. NETCORE project Linux deployment summary

Time:2021-12-8

Linux deployment documentation

1. Common instructions

Find [/ root directory. Current directory] - name [file name] - find file path
PS aux | grep [program name] - query startup status
PS - EF | grep [program name] - query startup status
Ls -- view all files in the directory
Kill - 9 PID -- delete process
View network status
netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}'

2. Install the web environment

#Installing NETCORE
sudo rpm -Uvh https://packages.microsoft.com/config/centos/7/packages-microsoft-prod.rpm
sudo yum install dotnet-sdk-3.1
​
#Installing nginx
#Installation dependency
yum -y install gcc zlib zlib-devel pcre-devel openssl openssl-devel
#Decompress
tar -zxvf linux-nginx-1.12.2.tar.gz
cd nginx-1.12.2/
#Execute configuration
./configure
#Compile and install (installed in / usr / local / nginx by default)
make
make install
​
#Install process hosting
yum install supervisor
Command supervisorctl
#Start Supervisor
supervisord -c /etc/supervisord.conf
#Restart Supervisor
supervisorctl -c /etc/supervisord.conf
#Stop service
supervisorctl shutdown
​
#Install NPM
yum install -y nodejs
    
#Install Git
yum install git -y
​
#Common instructions
$ supervisorctl status
$ supervisorctl stop usercenter
$ supervisorctl start usercenter
$ supervisorctl restart usercenter
$ supervisorctl reread
$ supervisorctl update

 

3. Install database environment

#Install Maria database
1. Installation command
yum -y install mariadb mariadb-server
2. Start MariaDB
systemctl start mariadb

#Install redis
yum install redis -y 
    --Move file
    mv redis.conf /usr/local/redis/etc/
    mv mkreleasehdr.sh redis-benchmark redis-check-aof redis-check-rdb redis-cli redis-server /usr/local/redis/bin/
    --Modify redis.conf 
    Change the daemon attribute to Yes (indicating that it needs to run in the background)
    redis-server /usr/local/redis/etc/redis.conf

4. Firewall

1. Turn on the firewall 
    systemctl start firewalld
​
2. Open specified port
      firewall-cmd --zone=public --add-port=1935/tcp --permanent
 Command meaning:
--Zone # scope
--Add port = 1935 / TCP # add port, format: port / communication protocol
--Permanent # permanently takes effect. It will become invalid after restarting without this parameter
​
3. Restart firewall
      firewall-cmd --reload
​
4. View port number
Netstat - ntlp // view all current TCP ports·
Netstat - ntulp | grep 1935 // view the usage of all 1935 ports·
Fuser - K 443 / TCP // close port 443