Centos7.6 安装 .NET6.0
2022/4/13 7:12:36
本文主要是介绍Centos7.6 安装 .NET6.0,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
开始安装
安装MySQL
https://blog.csdn.net/qq_37525851/article/details/122332850
1.使用wget指令下载YUM Repositry并安装以找到合适的YUM Server
wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
yum -y install mysql57-community-release-el7-10.noarch.rpm
2.用yum指令下载并安装mysql
yum -y install mysql-community-server
Mysql安装失败-GPG验证不通过
在yum install 版本后面加上 --nogpgcheck,即可绕过GPG验证成功安装。比如yum install mysql-community-server --nogpgcheck
3.启动服务
systemctl start mysqld.service
4.查看root的临时密码
grep "password" /var/log/mysqld.log
5.用root的临时密码登陆mysql
mysql -u root -p
6.修改root密码
//修改密码策略
set global validate_password_policy = 0 //0-低强度,1-中强度,2-高强度
set global validate_password_length=4 //修改最小密码长度
set password for 'root'@'localhost'=password('root') //更新密码
ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
7.开启远程登陆
use mysql
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '密码' WITH GRANT OPTION;
flush privileges;
//另一台主机通过mysql连接远程数据库
mysql -h 1.1.1. -p3306 -u root -p
8.0开机启动
systemctl enable mysqld
systemctl daemon-reload
9.0
配置默认编码为utf8:
配置默认编码为utf8
修改/etc/my.cnf配置文件,在[mysqld]下添加编码配置,如下所示:
[mysqld]
character_set_server=utf8
init_connect='SET NAMES utf8'
安装.NET6.0
CentOS 7 ✔️
安装 .NET 之前,请运行以下命令,将 Microsoft 包签名密钥添加到受信任密钥列表,并添加 Microsoft 包存储库。 打开终端并运行以下命令:
sudo rpm -Uvh https://packages.microsoft.com/config/centos/7/packages-microsoft-prod.rpm
安装运行时 sudo yum install aspnetcore-runtime-6.0
运行测试 加上星号和端口才支持外网连接 dotnet xxxx.dll --urls http://*:5000 //以下操作二选一
systemctl status firewalld // 查看防火墙状态 systemctl stop firewalld //关闭防火墙 firewall-cmd --zone=public --add-port=5000/tcp --permanent // permanent参数是永远存在,不然的话,重启后就没有了 firewall-cmd --reload // 重启防火墙 ,添加端口后记得执行此命令
安装.NGINX
rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm yum install -y nginx //这句才是真正的安装nginx systemctl start nginx //启动nginx,就是这么简单 systemctl enable nginx //将nginx设为开机启动
配置Nginx
位置/etc/nginx/conf.d/default.conf
server { listen 80 default_server; 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
nginx -s reload //重启nginx
监视应用
配置web应用为后台服务
vi /usr/lib/systemd/system/webname.service
[Unit] Description=Webname Web App [Service] WorkingDirectory=/home/ftpuser/var/www Environment=ASPNETCORE_ENVIRONMENT=Production ExecStart=/usr/bin/dotnet NetCore.fw.web.dll Restart=always RestartSec=10 [Install] WantedBy=multi-user.target
#开机自启
systemctl enable webname.service
systemctl start webname.service
参考 https://www.cnblogs.com/caijt/p/10978324.html https://docs.microsoft.com/zh-cn/dotnet/core/install/linux?WT.mc_id=dotnet-35129-website https://blog.csdn.net/u013120365/article/details/86064315 https://www.cnblogs.com/hicuiyang/p/10407748.html
这篇关于Centos7.6 安装 .NET6.0的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2022-03-01沐雪多租宝商城源码从.NetCore3.1升级到.Net6的步骤
- 2024-05-08首个适配Visual Studio平台的国产智能编程助手CodeGeeX正式上线!C#程序员必备效率神器!
- 2024-03-30C#设计模式之十六迭代器模式(Iterator Pattern)【行为型】
- 2024-03-29c# datetime tryparse
- 2024-02-21list find index c#
- 2024-01-24convert toint32 c#
- 2024-01-24Advanced .Net Debugging 1:你必须知道的调试工具
- 2024-01-24.NET集成IdGenerator生成分布式全局唯一ID
- 2024-01-23用CI/CD工具Vela部署Elasticsearch + C# 如何使用
- 2024-01-23.NET开源的简单、快速、强大的前后端分离后台权限管理系统