1.0.0
This commit is contained in:
		
							
								
								
									
										158
									
								
								wiki/course/0002.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										158
									
								
								wiki/course/0002.md
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,158 @@ | ||||
| ## 第一课 | ||||
|  | ||||
| > 第一课时操作引导文档。 | ||||
|  | ||||
| ### 一、游戏资源下载 | ||||
|  | ||||
| > 1、访问:[GitHub](https://www.github.com) | ||||
|  | ||||
| > 2、下载安装Git:[Git](https://git-scm.com) | ||||
|  | ||||
| ````shell | ||||
| # 生成GitHub SSH KEY | ||||
| ssh-keygen -t rsa -C "你的GitHub登录账号" | ||||
| ```` | ||||
|  | ||||
| ```shell | ||||
| git config -global user.name "你的GitHub用户名" | ||||
| git config -global user.email "你的GitHub登录账号" | ||||
| ``` | ||||
|  | ||||
| ````shell | ||||
| # 获取生成的GitHub SSH KEY | ||||
| C:\Users\admin/.ssh/id_rsa.pub | ||||
| ```` | ||||
|  | ||||
| ```shell | ||||
| # 下载游戏源码 | ||||
| git clone --depth=1 git@github.com:makeryangcom/Engine2D.git | ||||
| ``` | ||||
|  | ||||
| ### 二、虚拟机的安装和配置 | ||||
|  | ||||
| > 1、CentOS系统镜像下载地址:[CentOS-8.5.2111-x86_64-dvd1.iso](https://mirrors.aliyun.com/centos/8/isos/x86_64/CentOS-8.5.2111-x86_64-dvd1.iso) | ||||
|  | ||||
| > 2、切换到root用户,密码为`root` | ||||
|  | ||||
| ```shell | ||||
| su | ||||
| ``` | ||||
|  | ||||
| > 3、修改SSH配置,防止后续SSH远程登录时因连接超时自动断开 | ||||
|  | ||||
| ```shell | ||||
| vim /etc/ssh/sshd_config | ||||
| ``` | ||||
|  | ||||
| > 4、获取虚拟机服务器内网IP地址 | ||||
|  | ||||
| ```shell | ||||
| ifconfig | ||||
| ``` | ||||
|  | ||||
| > 5、在本地电脑的命令行工具中通过SSH远程登录到虚拟机服务器 | ||||
|  | ||||
| ```shell | ||||
| ssh root@服务器内网IP地址 | ||||
| ``` | ||||
|  | ||||
| > 6、更新软件源 | ||||
|  | ||||
| ```shell | ||||
| sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* | ||||
| sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-* | ||||
| # 设置阿里云软件源 | ||||
| wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-8.repo | ||||
| # 清理缓存 | ||||
| yum clean all | ||||
| yum makecache | ||||
| ``` | ||||
|  | ||||
| > 7、游戏资源下载 | ||||
|  | ||||
| ````shell | ||||
| # 安装git | ||||
| yum install -y git | ||||
| ```` | ||||
|  | ||||
| ````shell | ||||
| # 生成GitHub SSH KEY | ||||
| ssh-keygen -t rsa -C "你的GitHub登录账号" | ||||
| ```` | ||||
|  | ||||
| ````shell | ||||
| # 获取生成的GitHub SSH KEY | ||||
| cat /root/.ssh/id_rsa.pub | ||||
| ```` | ||||
|  | ||||
| ```shell | ||||
| git config --global user.name "你的GitHub用户名" | ||||
| git config --global user.email "你的GitHub登录账号" | ||||
| ``` | ||||
|  | ||||
| ```shell | ||||
| cd /opt | ||||
| # 下载游戏源码 | ||||
| git clone --depth=1 git@github.com:makeryangcom/Engine2D.git | ||||
| ``` | ||||
|  | ||||
| > 8、自动化部署 | ||||
|  | ||||
| ```shell | ||||
| cd /opt/Engine2D | ||||
| sudo ./tools/init.sh | ||||
| ``` | ||||
|  | ||||
| ```shell | ||||
| # 取消CRYPTO_POLICY=的注释 | ||||
| vim /etc/sysconfig/sshd | ||||
| # MySQL数据库远程连接配置 | ||||
| vim /etc/ssh/sshd_config | ||||
| # 在最后添加下面的配置 | ||||
| Ciphers aes128-ctr,aes192-ctr,aes256-ctr,3des-cbc | ||||
| KexAlgorithms diffie-hellman-group1-sha1 | ||||
| # 重启服务 | ||||
| sudo systemctl restart sshd | ||||
| ``` | ||||
|  | ||||
| ```shell | ||||
| cd /opt/Engine2D | ||||
| sudo ./tools/update.sh | ||||
| ``` | ||||
|  | ||||
| > 9、本地解析服务器域名 | ||||
|  | ||||
| ```shell | ||||
| C:\Windows\System32\drivers\etc | ||||
| ``` | ||||
|  | ||||
| > 10、日常维护使用的命令 | ||||
|  | ||||
| ``` bash | ||||
| # 监听后端服务日志 | ||||
| sudo journalctl -fu server.service | ||||
| # 监听游戏服务器日志 | ||||
| sudo journalctl -fu game.service | ||||
|  | ||||
| # 常用维护命令-重启Nginx服务 | ||||
| sudo systemctl restart nginx.service | ||||
| # 常用维护命令-停止Nginx服务 | ||||
| sudo systemctl stop nginx.service | ||||
| # 常用维护命令-启动Nginx服务 | ||||
| sudo systemctl start nginx.service | ||||
|  | ||||
| # 查看后端服务、游戏服务器状态 | ||||
| sudo systemctl status server.service game.service | ||||
|  | ||||
| # 停止、重启后端服务 | ||||
| sudo systemctl stop|restart server.service | ||||
| # 停止、重启游戏服务器 | ||||
| sudo systemctl stop|restart game.service | ||||
| ``` | ||||
|  | ||||
| > 11、其他配置 | ||||
|  | ||||
| ```shell | ||||
| Host 0.0.0.0 | ||||
| KexAlgorithms +diffie-hellman-group1-sha1 | ||||
| ``` | ||||
		Reference in New Issue
	
	Block a user