七日杀linux学生机搭建教程
//安装steamcmd
//进入根目录以及安装对应的环境包
cd /
yum install glibc.i686 libstdc++.i686
//如果安装环境包报错则分开写
yum install glibc.i686
yum install libstdc++.i686
//进入到/usr/local目录下
cd /usr/local/
//创建steamcmd文件夹并进入
mkdir steamcmd
cd steamcmd/
//下载steamcmd 安装包
wget https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz
tar -zxvf steamcmd_linux.tar.gz
//启动steamcmd
cd /usr/local/steamcmd
./steamcmd.sh
//启动之后登陆(account 换成你的steam账号,password换成你对应的密码)
login account password
//登陆完成之后设置你的游戏下载路径(我这里设置的是/usr/local/games目录下)
force_install_dir /usr/local/games
//设置完成之后下载七日杀(我这里设置的是最后一个版本)
app_update 294420 -beta latest_experimental validate
//下载完成之后退出
quit
//安装gcc编译器
cd /
yum install gcc
//安装对应的环境glibc 2.15
cd /usr/local/
//下载glibc 2.15安装包并解压
wget http://ftp.gnu.org/gnu/libc/glibc-2.15.tar.xz
tar -xvf glibc-2.15.tar.xz
//开始安装(以下每行代码依次执行)
mkdir -p /var/VMdisks
mv glibc-2.15 /var/VMdisks/
cd /var/VMdisks/glibc-2.15/
mkdir build
cd build/
../configure --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin
//以下两行代码执行时间较长请耐心等待
make -j4
make install
//设置swap分区(避免学生机内存不足直接把七日杀进程杀掉)
//查看是否有swap分区
free -m
//如果显示出来的swap 后面是0 0 0 则需要设置swap分区(我这里设置的是8g 即8192)
dd if=/dev/zero of=/var/swap bs=1M count=8192
//设置权限
chmod 600 /var/swap
//创建swap分区
mkswap /var/swap
//启用swap
swapon /var/swap
//设置开机自动设置swap
echo '/var/swap swap swap default 0 0' >> /etc/fstab
//最后再用free -m 查看swap分区是否有值,如果有值则设置成功
free -m
//如果你的是阿里云服务器则需要打开ipv6地址请求(使用vim的时候一定要慎重,至于vim怎么修改保存自行百度)
vim /etc/modprobe.d/disable_ipv6.conf
//这是修改以前的文件
alias net-pf-10 off
alias ipv6 off
options ipv6 disable=1
//修改成这样
alias net-pf-10 off
#alias ipv6 off
options ipv6 disable=0
//然后修改network,将ipv6打开(依旧是vim修改)
vim /etc/sysconfig/network
//修改前
NETWORKING=yes
HOSTNAME=coolnull
NETWORKING_IPV6=no
PEERNTP=no
GATEWAY=*.*.*.*
//修改后
NETWORKING=yes
HOSTNAME=coolnull
NETWORKING_IPV6=yes
PEERNTP=no
GATEWAY=*.*.*.*
//再修改sysctl.conf,将这几项修改成0(如果没有这几项则自己添加上就行)
//修改前
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
//修改后
net.ipv6.conf.all.disable_ipv6 = 0
net.ipv6.conf.default.disable_ipv6 = 0
net.ipv6.conf.lo.disable_ipv6 = 0
//设置好以后重启服务器测试看是否支持ipv6(输入后能看到有输出则设置成功)
ifconfig|grep -i inet6
//以上工作完成以后则可以启动你的七日杀服务了
cd /usr/local/games/
nohup sh startserver.sh -configfile=serverconfig.xml &
//查看七日杀进程是否存在
top
//查看七日杀日志(output_log在7DaysToDieServer_Data目录下)
tail -500f output_log__2019-12-15__16-36-15.txt
//更新七日杀服务端版本shell
echo '#!/bin/bash' > /usr/local/games/bin/update.sh
echo 'APP_ID=$1' >> /usr/local/games/bin/update.sh
echo 'APP_DIR=$2' >> /usr/local/games/bin/update.sh
//set your username and your password or use anonymous account
echo 'STEAM_USER="username"' >> /usr/local/games/bin/update.sh
echo 'STEAM_PASS="userpassword"' >> /usr/local/games/bin/update.sh
//not set force_install
echo '/usr/local/steamcmd/steamcmd.sh +login ${STEAM_USER} ${STEAM_PASS} +app_update ${APP_ID} +exit' >> /usr/local/games/bin/update.sh
//set force_install script
echo '/usr/local/steamcmd/steamcmd.sh +login ${STEAM_USER} ${STEAM_PASS} +force_install_dir ${APP_DIR} +app_update ${APP_ID} +exit' >> /usr/local/games/bin/update.sh
//if you want to use the script you must input like this
./update.sh 294420 /usr/local/games
//all most you can set script like this
#!/bin/bash
APP_ID="294420"
APP_DIR="/usr/local/games"
STEAM_USER="anonymous"
/usr/local/steamcmd/steamcmd.sh +login ${STEAM_USER} +force_install_dir ${APP_DIR} +app_update ${APP_ID} +exit
//If you follow the above settings,you should start like this
./update.sh
//tencent server uninstall monitor
/usr/local/qcloud/stargate/admin/uninstall.sh
/usr/local/qcloud/YunJing/uninst.sh
/usr/local/qcloud/monitor/barad/admin/uninstall.sh
//check uninstall is successful
ps -A | grep agent