CentOS 7 install .Net Core operating environment-redis-supervisord

1. Install .net core

1. Check the system version

#cat /etc/redhat-release
CentOS Linux release 7.7.1908 (Core)

2. Install .net core dependencies
#rpm -ivh libgdiplus-2.10-10.el7.x86_64.rpm

#rpm -ivh libgdiplus-devel-2.10-10.el7.x86_64.rpm

#rpm -ivh packages-microsoft-prod.rpm

#yum -y install libXrender libexif libjpeg libtiff fontconfig-devel cairo-devel giflib-devel

3. Install dotnet-sdk-3.1

#yum install dotnet-sdk-3.1

4. View the installation

#dotnet -version
Unknown option: -version
.NET Core SDK (3.1.403)

Successful installation!

Two, install redis

1. Install gcc

#yum install -y gcc

2. Install redis

#wget http://download.redis.io/releases/redis-5.0.8.tar.gz

#tar zxvf redis-5.0.8.tar.gz

#cd redis-5.0.8

#make

#make install PREFIX=/usr/local/redis

#cd /usr/local/redis/bin/

#./redis-server

#cp /usr/local/src/redis-5.0.8/redis.conf /usr/local/redis/bin/

Modify the redis.conf file and change daemonize no to daemonize yes

#sed -i 's/daemonize no/daemonize yes/g' redis.conf

Set boot up

#vi /etc/systemd/system/redis.service

Add the following content

[Unit]
Description=redis-server
After=network.target

[Service]
Type=forking
ExecStart=/usr/local/redis/bin/redis-server /usr/local/redis/bin/redis.conf
PrivateTmp=true

[Install]
WantedBy=multi-user.target

Set boot up

#systemctl daemon-reload

#systemctl start redis.service

#systemctl enable redis.service

#ln -s /usr/local/redis/bin/redis-cli /usr/bin/redis

Service Operation Command

systemctl start redis.service #Start redis service

systemctl stop redis.service #Stop the redis service

systemctl restart redis.service #Restart the service

systemctl status redis.service #View the current status of the service

systemctl enable redis.service #Set the boot to start automatically

systemctl disable redis.service #Stop boot from start

Three, install supervisord

#yum install epel-release

#yum install -y supervisor

Set boot up

#systemctl enable supervisord

Command usage:

#systemctl stop supervisord #stop#
systemctl start supervisord #start#
systemctl status supervisord #view status#
systemctl reload supervisord
#load configuration file #systemctl restart supervisord #restart service

#cat /etc/supervisord.conf

[include]
files = supervisord.d/*.ini

#cat /etc/supervisord.d/new.ini

[program:web.new]
command=dotnet HualuTrain.Web.dll --urls "http://*:9000"
directory=/data0/app/new.Web
environment=ASPNETCORE__ENVIRONMENT=Production
user=www
stopsignal=INT
autostart=true
autorestart=true
startsecs=3
stderr_logfile=/var/log/ossoffical.err.log
stdout_logfile=/var/log/ossoffical.out.log

Start supervisord

#systemctl start supervisord

Check whether to start
#systemctl status supervisord

Successful installation!

Guess you like

Origin blog.51cto.com/bristol/2544620