Minecraft现在变得越来越火了,但是大多数人还在自己单机。想要进入服务器又苦于找不到好的亦或是厌烦各种可恶的规矩。那还在等什么?自己建一个吧!
以下将以Linux为例
1、使用ssh登陆购买linux服务器
选择合适的工具
- MAC OS 打开终端
- Windows 大家可以百度下有什么可以有的ssh工具
- Linux 你当然是知道的
输入以下命令登陆linux服务器
ssh [user]@[ip_address] -p [port]
2. 下载你中意的服务器版本
官方minecraft服务器版本下载地址:minecraft_server。
3、 编写启动脚本
具体步骤如下:
创建一个文件夹放置服务器文件
mkdir minecratr_server mv minecraft_server*.jar ./minecratr_server/minecraft_server.jar
使用文本编辑器创建脚本文件
cd minecratr_server vim minecraft_server.sh
添加以下内容
#!/bin/bash java -Xmx1024M -Xms512M -jar minecraft_server.jar
设置执行权限
chmod +x minecraft_server.sh
4. 第一次启动服务器
启动服务器
./minecraft_server.sh
等待服务器退出
[21:13:34] [Server thread/INFO]: Starting minecraft server version 1.11.2 [21:13:34] [Server thread/INFO]: Loading properties [21:13:34] [Server thread/WARN]: server.properties does not exist [21:13:34] [Server thread/INFO]: Generating new properties file [21:13:34] [Server thread/WARN]: Failed to load eula.txt [21:13:34] [Server thread/INFO]: You need to agree to the EULA in order to run the server. Go to eula.txt for more info. [21:13:34] [Server thread/INFO]: Stopping server
同意EULA
vim eula.txt
将eula=false改为eula=true
再次启动服务器
./minecraft_server.sh
等待加载完成后,关闭服务器。
[21:14:53] [Server thread/INFO]: Starting minecraft server version 1.11.2 [21:14:53] [Server thread/INFO]: Loading properties [21:14:53] [Server thread/INFO]: Default game type: SURVIVAL [21:14:53] [Server thread/INFO]: Generating keypair [21:14:53] [Server thread/INFO]: Starting Minecraft server on *:25565 [21:14:53] [Server thread/INFO]: Using epoll channel type [21:14:53] [Server thread/WARN]: Failed to load user banlist: java.io.FileNotFoundException: banned-players.json (没有那个文件或目录) at java.io.FileInputStream.open0(Native Method) ~[?:1.8.0_111] at java.io.FileInputStream.open(FileInputStream.java:195) ~[?:1.8.0_111] at java.io.FileInputStream.<init>(FileInputStream.java:138) ~[?:1.8.0_111] at com.google.common.io.Files.newReader(Files.java:86) ~[minecraft_server.jar:?] at mx.g(SourceFile:136) ~[minecraft_server.jar:?] at lg.z(SourceFile:99) [minecraft_server.jar:?] at lg.<init>(SourceFile:25) [minecraft_server.jar:?] at lh.j(SourceFile:186) [minecraft_server.jar:?] at net.minecraft.server.MinecraftServer.run(SourceFile:436) [minecraft_server.jar:?] at java.lang.Thread.run(Thread.java:745) [?:1.8.0_111] [21:14:53] [Server thread/WARN]: Failed to load ip banlist: java.io.FileNotFoundException: banned-ips.json (没有那个文件或目录) at java.io.FileInputStream.open0(Native Method) ~[?:1.8.0_111] at java.io.FileInputStream.open(FileInputStream.java:195) ~[?:1.8.0_111] at java.io.FileInputStream.<init>(FileInputStream.java:138) ~[?:1.8.0_111] at com.google.common.io.Files.newReader(Files.java:86) ~[minecraft_server.jar:?] at mx.g(SourceFile:136) ~[minecraft_server.jar:?] at lg.y(SourceFile:91) [minecraft_server.jar:?] at lg.<init>(SourceFile:27) [minecraft_server.jar:?] at lh.j(SourceFile:186) [minecraft_server.jar:?] at net.minecraft.server.MinecraftServer.run(SourceFile:436) [minecraft_server.jar:?] at java.lang.Thread.run(Thread.java:745) [?:1.8.0_111] [21:14:53] [Server thread/WARN]: Failed to load operators list: java.io.FileNotFoundException: ops.json (没有那个文件或目录) at java.io.FileInputStream.open0(Native Method) ~[?:1.8.0_111] at java.io.FileInputStream.open(FileInputStream.java:195) ~[?:1.8.0_111] at java.io.FileInputStream.<init>(FileInputStream.java:138) ~[?:1.8.0_111] at com.google.common.io.Files.newReader(Files.java:86) ~[minecraft_server.jar:?] at mx.g(SourceFile:136) ~[minecraft_server.jar:?] at lg.A(SourceFile:107) [minecraft_server.jar:?] at lg.<init>(SourceFile:29) [minecraft_server.jar:?] at lh.j(SourceFile:186) [minecraft_server.jar:?] at net.minecraft.server.MinecraftServer.run(SourceFile:436) [minecraft_server.jar:?] at java.lang.Thread.run(Thread.java:745) [?:1.8.0_111] [21:14:53] [Server thread/WARN]: Failed to load white-list: java.io.FileNotFoundException: whitelist.json (没有那个文件或目录) at java.io.FileInputStream.open0(Native Method) ~[?:1.8.0_111] at java.io.FileInputStream.open(FileInputStream.java:195) ~[?:1.8.0_111] at java.io.FileInputStream.<init>(FileInputStream.java:138) ~[?:1.8.0_111] at com.google.common.io.Files.newReader(Files.java:86) ~[minecraft_server.jar:?] at mx.g(SourceFile:136) ~[minecraft_server.jar:?] at lg.C(SourceFile:123) [minecraft_server.jar:?] at lg.<init>(SourceFile:30) [minecraft_server.jar:?] at lh.j(SourceFile:186) [minecraft_server.jar:?] at net.minecraft.server.MinecraftServer.run(SourceFile:436) [minecraft_server.jar:?] at java.lang.Thread.run(Thread.java:745) [?:1.8.0_111] [21:14:53] [Server thread/INFO]: Preparing level "world" [21:14:54] [Server thread/INFO]: Preparing start region for level 0 [21:14:55] [Server thread/INFO]: Preparing spawn area: 5% [21:14:56] [Server thread/INFO]: Preparing spawn area: 10% [21:14:57] [Server thread/INFO]: Preparing spawn area: 14% [21:14:58] [Server thread/INFO]: Preparing spawn area: 20% [21:14:59] [Server thread/INFO]: Preparing spawn area: 26% [21:15:00] [Server thread/INFO]: Preparing spawn area: 33% [21:15:01] [Server thread/INFO]: Preparing spawn area: 41% [21:15:02] [Server thread/INFO]: Preparing spawn area: 49% [21:15:03] [Server thread/INFO]: Preparing spawn area: 57% [21:15:04] [Server thread/INFO]: Preparing spawn area: 68% [21:15:05] [Server thread/INFO]: Preparing spawn area: 76% [21:15:06] [Server thread/INFO]: Preparing spawn area: 86% [21:15:07] [Server thread/INFO]: Preparing spawn area: 96% [21:15:08] [Server thread/INFO]: Done (14.531s)! For help, type "help" or "?"
更改服务器配置文件
vim server.properties
server.properties配置方法:server.properties
正式启动服务器
screen ./minecraft_server.sh
到此服务器建立完毕,开始享用吧!
参考:如何建立一个自己的Minecraft服务器 【原版】