安装java17

1
2
3
4
5
6
7
8
9
10
11
12
13
14
cd /usr/local
wget https://download.oracle.com/java/17/latest/jdk-17_linux-x64_bin.tar.gz
tar -zxvf jdk-17_linux-x64_bin.tar.gz
mv jdk-17.0.3.1 java
rm -f jdk-17_linux-x64_bin.tar.gz
vim /etc/profile

export JAVA_HOME=/usr/local/java
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH

source /etc/profile
java -version

安装核心

核心可以在minecraftwiki中下载
核心上传到/data/minecraft/目录,然后把核心重命名为server.jar

创建脚本start.sh

1
vi start.sh
1
2
cd /data/minecraft
java -Xms1G -Xmx12G -jar /data/minecraft/server.jar nogui

把eula.txt中的false改成true
#可以用这个包创建虚拟连接

1
yum intall -y screen

server.properties示例

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
view-distance=10
max-build-height=256
server-ip=
level-seed=
allow-nether=true
enable-command-block=true#是否开启命令方块
server-port=25565#端口
gamemode=0#模式
enable-rcon=false
op-permission-level=4#op等级
enable-query=false
prevent-proxy-connections=false
generator-settings=
resource-pack=
player-idle-timeout=0
level-name=world
motd=A Minecraft Server#显示
force-gamemode=false
hardcore=false
white-list=false#白名单
broadcast-console-to-ops=true
pvp=true#是否开启pvp
spawn-npcs=true
generate-structures=true
spawn-animals=true
snooper-enabled=true
difficulty=1
network-compression-threshold=256
level-type=DEFAULT
spawn-monsters=true
max-tick-time=60000
enforce-whitelist=false
use-native-transport=true
max-players=20#最多人数
resource-pack-sha1=
spawn-protection=16
online-mode=false#正版验证
allow-flight=false
max-world-size=29999984