一、选择服务器镜像
我使用的是Ubuntu 20.04
二、使用shell终端连接器连接服务器
三、安装必要的软件包来构建mcrcon
工具:
sudo apt update
sudo apt install git build-essential
安装 Java 运行环境
apt install openjdk-17-jre
注意:高版本jdk兼容低版本mc
注意:下载完使用java -version查看版本
为了断开shell后也可以让服务器正常运行,需要screen
安装screen
apt-get install screen
创建一个文件夹安装mc服务端:
mkdir minecraft
cd minecraft
使用vim编辑软件源文件: vim /etc/apt/sources.list
阿里云:
deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
清华大学:
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted
更新软件列表:apt update
去官网把服务端jar下载到我们的服务器上
wget https://launcher.mojang.com/v1/objects/c8f83c5655308435b3dcf03c06d9fe8740a77469/server.jar
注意:自己下载对应的服务端版本,后面要和客户端版本一致。
查看是否成功 ls -l
四、去服务器防火墙上开启25565端口
五、启动服务端
启动命令
java -jar server.jar nogui
ctrl+c停止
编辑vim eula.txt
将其中的eula = false 改为eula = true
vim server.properties文件,将online-mode一行改为false:online-mode=false
再次使用上次的启动命令或根据服务器内存添加对应参数,等出现下面的提示服务器启动成功
Done (217.736s)! For help, type "help"
六、启动游戏
再去下载一个我的世界启动器
HMCL-3.5.5.zip - [email protected] 的分享 (ctfile.com)
根据服务端的版本安装对应的客户端
添加上你的公网ip,就可以玩了。
标签:mirrors,restricted,阿里,ubuntu,服务器,deb,main,focal,搭建 From: https://www.cnblogs.com/15078480385zyc/p/17501863.html