标签:加载 community iter lte release syslog car ide main
1 dnf update
1 dnf install aspnetcore-runtime-3.1
1 dotnet --info
出现如上图所示就说明安装成功
dnf -y install nginx
nginx -v
1 systemctl enable nginx
service nginx start
# 卸载
dnf remove nginx
# 停止 服务
service nginx stop
# 重启
service nginx restart
# 加载配置文件
service nginx reload
wget https://repo.mysql.com//mysql80-community-release-el8-1.noarch.rpm
rpm -ivh mysql80-community-release-el8-1.noarch.rpm
dnf -y install mysql-server
systemctl enable mysqld.service
systemctl start mysqld.service
因我是在某云上,所以需要设置我本地连接,如果是在自己虚拟器可跳过此步骤
update mysql.user set host="%" where user="root";
-- 切换数据库
use mysql;
-- 执行语句
ALTER USER ‘root‘@‘%‘ IDENTIFIED WITH mysql_native_password BY ‘123‘;
-- 刷新修改后的权限
flush privileges;
-- 退出
exit;
mkdir -p /var/www/web
如果项目中没有用到 Redis 可以跳过此步骤
wget http://download.redis.io/releases/redis-6.0.6.tar.gz
tar xzf redis-6.0.6.tar.gz
cd redis-6.0.6
dnf install tcl
make
make test
mkdir -p /usr/local/soft/redis
cd /usr/local/soft/redis/
mkdir bin
mkdir conf
cd bin/
cp /redis-6.0.6/src/redis-cli ./
cp /redis-6.0.6/src/redis-server ./
cd ../conf/
cp /redis-6.0.6/redis.conf ./
# 配置 redis-server 的 配置文件为 /usr/local/soft/conf/redis.conf
/usr/local/soft/redis/bin/redis-server /usr/local/soft/redis/conf/redis.conf
# 检查端口是否在使用
netstat -anp | grep 6379
vim /lib/systemd/system/redis.service
[Unit]Description=RedisAfter=network.target
[Service]Type=forkingPIDFile=/var/run/redis_6379.pidExecStart=/usr/local/soft/redis/bin/redis-server /usr/local/soft/redis/conf/redis.confExecReload=/bin/kill -s HUP $MAINPIDExecStop=/bin/kill -s QUIT $MAINPIDPrivateTmp=true
[Install]WantedBy=multi-user.target
systemctl daemon-reload
# 开机自启
systemctl enable redis
# 启动
systemctl start redis
# 查看状态
systemctl status redis
# 停止
systemctl stop redis
文件名 自定义,这里我起名为 aspnetCore.service
vim /lib/systemd/system/aspnetCore.service
[Unit]
Description=AspnetCoreDemo running on Centos8
[Service]# 应用程序所在的文件目录
WorkingDirectory=/var/www/web/
ExecStart=/usr/bin/dotnet /var/www/web/Carefree.AspNetCoreDemo.dll
Restart=always
# 如果dotnet服务崩溃,10秒后重新启动服务
RestartSec=10
KillSignal=SIGINT
SyslogIdentifier=AspNetCoreDemo
User=root
#Production:生产环境 Development:开发环境
Environment=ASPNETCORE_ENVIRONMENT=Development
Environment=DOTNET_PRINT_TELEMETRY_MESSAGE=false
[Install]
WantedBy=multi-user.target
# 重载系统
systemctl daemon-reload
# 开机自启动
systemctl enable aspnetCore.service
vim /etc/nginx/conf.d/web.conf
server
{
listen 80;
location /
{
proxy_pass http://localhost:5000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection keep-alive;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Forwarded-For
proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
# 验证配置文件
nginx -t
# 加载配置文件
nginx -s reload
至此我们的应用程序可正常访问了。
标签:加载 community iter lte release syslog car ide main
原文地址:https://www.cnblogs.com/IT-Evan/p/14204795.html