1、centos7 上安装.net core sdk 3.1
参考官方所给的教程 官方建议直接安装运行时 我安装了sdk 发现也安装了依赖项运行时
https://docs.microsoft.com/zh-cn/dotnet/core/install/linux-package-manager-centos7#install-the-aspnet-core-runtime
dotnet --version
2、centos7安装MySQL 8
官方教程:https://dev.mysql.com/doc/refman/8.0/en/linux-installation-yum-repo.html#yum-repo-installing-mysql
1.下载mysql源安装包 https://dev.mysql.com/downloads/repo/yum/
MySQL Yum Repository
我这里用的:mysql80-community-release-el7-3.noarch.rpm
shell> wget http://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm
2.安装mysql源
shell> sudo yum localinstall mysql80-community-release-el7-3.noarch.rpm
3.安装MySQL
shell> yum install mysql-community-server
4.启动MySQL服务
shell> systemctl start mysqld
5.开机启动
systemctl enable mysqld.service 或者 systemctl enable mysqld
systemctl start mysqld
systemctl stop mysqld
systemctl status mysqld
6.获取默认密码
shell> sudo grep ‘temporary password‘ /var/log/mysqld.log
7.通过使用生成的临时密码登录并尽快为超级用户帐户设置自定义密码,以更改root密码:
shell> mysql -uroot -p ///usr/local/mysql/bin/mysql -utz -p -h127.0.0.1
mysql> ALTER USER ‘root‘@‘localhost‘ IDENTIFIED BY ‘MyNewPass4!‘;
8.关闭防火墙
systemctl disable firewalld.service
9.创建新用户
CREATE USER ‘lylong‘@‘%‘ IDENTIFIED BY ‘901109‘;
10.修改加密方式,这一步可以不改
mysql8.0默认的加密方式是“caching_sha2_password”,而navicat只支持以前的"mysql_native_password",所以接下来修改密码加密方式
ALTER USER ‘lylong‘@‘%‘ IDENTIFIED WITH mysql_native_password BY ‘901109‘;
修改后可以执行select host,user,plugin from user;语句,查看新增用户的plugin是否是"mysql_native_password"
11.设置该账户可以远程登陆
GRANT ALL PRIVILEGES ON . TO ‘lylong‘@‘%‘;
12.刷新权限
flush privileges;
3、centos7 安装Nodejs
下载nodejs最新的tar包
可以在下载页面https://nodejs.org/en/download/中找到下载地址。然后执行指令
wget https://nodejs.org/dist/v12.14.0/node-v12.14.0-linux-x64.tar.xz
解压
tar -xvf node-v12.14.0-linux-x64.tar.xz
部署bin文件 关联
ln -s /www/node-v12.4.0-linux-x64/bin/node /usr/local/bin/node
ln -s /node-v12.4.0-linux-x64/bin/npm /usr/local/bin/npm
4、安装PM2
npm install pm2@latest -g
如果 -bash: pm2: 未找到命令 需要关联
ln -s /home/data/nodejs/node-v12.14.0-linux-x64/bin/pm2 /usr/local/bin/pm2
5、网关服务 开箱即用
pm2中运行网关服务
pm2 start "dotnet Bumblebee.ConsoleServer.dll" --name gateway
admin:tzadmin@2019
6、启动gameapi 服务科启动两个
pm2 start "dotnet TZY.GameApi.dll" --name gameapi_8086
pm2 start "dotnet TZY.GameApi.dll" --name gameapi_8087
7、设置开机启动
pm2 startup
pm2 save
8、Mysql上的操作
连接:/usr/local/mysql/bin/mysql -utz -p -h127.0.0.1 tz
创建数据库:create database 数据库名字 charset=‘utf8‘;
创建表:
use database名;
CREATE TABLE fileuploadhistory
(Id
bigint(20) NOT NULL AUTO_INCREMENT,FileExtention
varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT ‘文件后缀 .jpg‘,
PRIMARY KEY (Id
)
) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci ROW_FORMAT=DYNAMIC;
插入数据:
insert into fileuploadhistory(Id,FileExtention) values(10000,‘.jpg‘);
__EOF__