运维开发网

CentOS 7 安装 .Net Core 运行环境-redis-supervisord

运维开发网 https://www.qedev.com 2020-10-29 12:02 出处:51CTO 作者:bristol
CentOS 7 安装 .Net Core 运行环境-redis-supervisord

一、安装.net core

1、查看系统版本

#cat /etc/redhat-release

CentOS Linux release 7.7.1908 (Core)

2、安装.net core依赖

#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、安装dotnet-sdk-3.1

#yum install dotnet-sdk-3.1

4、查看安装

#dotnet -version

Unknown option: -version

.NET Core SDK (3.1.403)

安装成功!

二、安装redis

1、安装gcc

#yum install -y gcc

2、安装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/

修改 redis.conf 文件,把 daemonize no 改为 daemonize yes

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

设置开机启动

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

添加如下内容

[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

设置开机启动

#systemctl daemon-reload

#systemctl start redis.service

#systemctl enable redis.service

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

服务操作命令

systemctl start redis.service #启动redis服务

systemctl stop redis.service #停止redis服务

systemctl restart redis.service #重新启动服务

systemctl status redis.service #查看服务当前状态

systemctl enable redis.service #设置开机自启动

systemctl disable redis.service #停止开机自启动

三、安装supervisord

#yum install epel-release

#yum install -y supervisor

设置开机启动

#systemctl enable supervisord

命令使用:

#systemctl stop supervisord #停止

#systemctl start supervisord #启动

#systemctl status supervisord #查看状态

#systemctl reload supervisord #加载配置文件

#systemctl restart supervisord #重启服务

#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

启动supervisord

#systemctl start supervisord

查看是否启动

#systemctl status supervisord

安装成功!

扫码领视频副本.gif

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号