삼국지 모바일 게임 서버 구축 가이드

자동 배포 설정

다음은 삼국지 모바일 게임의 서버를 자동으로 배포하는 방법입니다.

서버 IP: 192.168.1.225 (네트워크 환경에 따라 조정 가능)

게임 접속 주소: http://192.168.1.225:82

관리자 페이지: http://192.168.1.225:88

CentOS에서 루트 비밀번호를 재설정하는 과정은 다음과 같습니다:

  1. 시스템 재부팅
  2. 부팅 메뉴에서 'e' 키 입력
  3. init=/bin/sh 추가 후 Ctrl+x로 부팅
  4. mount -o remount, rw / 실행
  5. 새로운 비밀번호 설정
  6. touch /.autorelabelexec /sbin/init 실행

수동 배포 방법 1

아래는 수동 배포 과정을 단계별로 설명합니다.

1.宝塔 설치


yum install -y wget && wget -O install.sh http://download.bt.cn/install/install_6.0.sh && sh install.sh

2. 환경 구성

  • Nginx: 1.18
  • MySQL: 5.7
  • PHP: 7.2
  • MongoDB: 4.0 (인증 비활성화)
  • Redis: 5.0

방화벽 비활성화:


systemctl stop firewalld
systemctl disable firewalld

3. openresty 설치


cd /home/proj
wget https://openresty.org/download/openresty-1.19.3.1.tar.gz
tar -zxvf openresty-1.19.3.1.tar.gz
mv openresty-1.19.3.1 openresty
cd openresty

sudo apt-get install libpcre3-dev \
libssl-dev perl make build-essential curl unzip -y

sudo yum install -y pcre-devel openssl-devel

./configure
make
make install

echo "PATH=/usr/local/openresty/bin:/usr/local/openresty/nginx/sbin:$PATH
export LC_ALL=en_US.UTF-8
export PATH" >> ~/.bash_profile
source ~/.bash_profile

4. 데이터베이스 설정


mysql -uroot -p123456
CREATE DATABASE sanguo DEFAULT CHARACTER SET utf8;
FLUSH PRIVILEGES;
USE sanguo;
SOURCE /home/sql/sanguo.sql;
EXIT;

5. 서비스 시작

API 서버 시작:


cd /home/proj/apiserver
nginx -p `pwd` -c conf/nginx.conf

게임 서버 시작:


cd /home/proj/skynet
sh getkey.sh
./skynet ../loginserver/prodconfig
./skynet ../gameserver/prodconfig

관리자 페이지 시작:


cd /home/proj/goserver
./mygo

수동 배포 방법 2

Ubuntu 20 기반의 배포 과정을 설명합니다.

1. openresty 설치


apt-get install libpcre3-dev libssl-dev perl make build-essential curl
wget https://openresty.org/download/openresty-1.19.3.1.tar.gz
./configure
make
make install

2. 환경 변수 설정


echo "PATH=/usr/local/openresty/bin:/usr/local/openresty/nginx/sbin:$PATH
export LC_ALL=en_US.UTF-8
export PATH" >> ~/.bash_profile
source ~/.bash_profile

3. skynet 설치


apt-get install git autoconf
git clone https://gitee.com/mirrors/skynet.git
cd skynet
make

4. 데이터베이스 설치

MySQL:


docker pull mysql:5.7.27
docker run --name mysql -e MYSQL_ROOT_PASSWORD=admin123456! -v /data/mysqldb_dir:/var/lib/mysql -p 3306:3306 -d mysql:5.7.27

Redis:


docker pull redis:5.0
docker run --name redis -v /data/redisdb_dir:/data -p 6379:6379 -d redis:5.0 --appendonly yes

MongoDB:


docker pull mongo:4.0.10
docker run --name mongo -v /data/mongodb_dir:/data/db -p 27017:27017 -d mongo:4.0.10

5. 코드 업로드 및 설정 수정

모든 프로젝트 파일을 /data/proj/ 디렉토리에 업로드하고 필요한 설정 값을 수정합니다.

6. 서버 시작


# API 서버
cd /data/proj/apiserver
nginx -p `pwd` -c conf/nginx.conf

# 게임 서버
cd /data/proj/skynet
./skynet ../loginserver/prodconfig
./skynet ../gameserver/prodconfig

# 관리자 페이지
cd /data/proj/goserver
./mygo

태그: linux ServerDeployment SkyNet

6월 26일 21:55에 게시됨