Files
mir-godot/wiki/course/0001.md
makeryangcom a4712b8c84 1.0.0
2024-03-04 16:14:05 +08:00

143 lines
2.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

## 第一课
> 第一课时操作引导文档。
### 一、游戏资源下载
> 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
# 将SELINUX=设置为`disabled`关闭selinux
vim /etc/selinux/config
```
```shell
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
```