安装Linux用的是腾讯云的centos7.5,需要安装有环境有mysql5.7 .netcore2.1 nginx1.14
1.首先是mysql的安装
我用的链接工具是putty,首先root登入系统
采用yum的方式安装mysql
1.安装mysql的yum源
wget http://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpm
2.安装mysql-community.repo
mysql-community-source.repo依赖包
rpm -ivh mysql57-community-release-el7-8.noarch.rpm
3.安装mysql
yum install -y mysql-server
安装完成
4.运行mysql,并查看运行状态
service mysqld start
service mysqld status
运行成功
5.由于mysql5.7 会生成一个随机密码,所有先查看密码 (mysql5.6 也有随机密码,5.5不知道)
grep "password" /var/log/mysqld.log
箭头值得就是随机密码,我们记录下来
6.登录 MySQL并更新用户 root 的密码,这里我们设置了passwordA1.作为新密码
mysql -u root -p
SET PASSWORD = PASSWORD('passwordA1.'); ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER; flush privileges;
7.设置mysql可以被任意ip访问和root 本地访问
grant all privileges on *.* to root@"%" identified by "passwordA1.";
grant all privileges on *.* to root@"localhost" identified by "passwordA1.";
flush privileges;
8.MySQL控制命令:启动、停止、重启、查看状态
service mysqld start
service mysqld stop
service mysqld restart
service mysqld status
systemctl start mysqld
service mysqld stop
service mysqld restart
systemctl status mysqld
9.测试远程连接
连接成功!
2. .net core2.1的安装
参照官方文档,地址:https://www.microsoft.com/net/learn/dotnet/hello-world-tutorial#install
1.添加yum源
sudo rpm -Uvh https://packages.microsoft.com/config/rhel/7/packages-microsoft-prod.rpm
2.升级所有包同时也升级软件和系统内核
sudo yum update
3.安装.net core
sudo yum install dotnet-sdk-2.1.4
3. nginx的安装
1.添加nginx源
sudo rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
2.安装nginx
sudo yum install nginx
3.启动nginx并设置开机启动
sudo systemctl start nginx.service
sudo systemctl enable nginx.service
访问web服务成功