centos 安装minecraft服务端

首先安装需要的组件,screen和Java1.8

yum install screen;

建立一个专门访问mc的账户

adduser mcserver
#set a secure password.
passwd mcserver
#this allows you to run screen while su'd from root for the next step
chown mcserver `tty`

可以从官网或者第三方网站下载服务端jar包并安装

su - mcserver
mkdir minecraft
cd minecraft
wget -O minecraft_server.jar https://s3.amazonaws.com/Minecraft.Download/versions/1.11.2/minecraft_server.1.11.2.jar
chmod +x minecraft_server.jar
screen
echo "eula=true" > eula.txt
#start your Minecraft Server
java -Xmx1024M -Xms768M -jar minecraft_server.jar nogui

使用screen终端启动游戏

screen -S mc
java -Xmx1024M -Xms768M -jar minecraft_server.jar nogui
Ctrl+a+d #离开当前终端但不关闭会话

screen ls #查看列表
screen -r 会话id #进入会话

你可能感兴趣的:(Java)