分享

如何在CentOS 6或7服务器上安装Cuberite

 炒浇面馆 2018-09-03
介绍

Cuberite是什么?

Cuberite是一个可扩展的开源Minecraft服务器实现,使用c++编写。它有一个易于使用的插件系统,允许用户用Lua编写自定义插件,最初是用MCServer的名字创建的。

支持平台:

Cuberite是多平台的,可以用于大多数Linux操作系统和Windows。本教程将只介绍在CentOS 67安装上安装服务器软件的情况。和大多数Minecraft服务器一样,插件和其他因素将导致更大的内存占用。首先,建议您至少有:

1 g的内存

一个CPU核心

 

安装

先决条件

在开始之前,我们必须确保系统是最新的,并且有一个适当的文本编辑器。这对于配置服务器是必要的。我们还需要适当的工具来构建和编译软件。

在我们安装任何东西之前,执行以下命令更新您的系统:

yum update -y

现在,我们将安装nano (您可以使用vim或任何其他编辑器):

yum install nano -y

完成后,运行以下命令安装cmake(编译器):

yum install cmake -y

现在,安装screen (允许应用程序在后台运行):

yum install screen -y

screen安装之后,您可以继续进入下一个部分

运行安装脚本

现在我们已经完成了安装所需的所有依赖项,我们必须检索脚本。下面的命令将在/root~中创建一个新目录。

cd ~ && mkdir server
cd server
wget -O install.sh https://www./

现在,您可以运行安装脚本:

sh install.sh

您将在终端上看到以下信息:

[root@demo server]# sh install sh
Hello, this script will download and compile Cuberite.
On subsequent runs, it will update Cuberite.
The compilation and download will occur in the current directory.
If you're updating, you should run: <Path to Cuberite>/compile.sh
Compiling from srouce takes time, but it usually generates faster
executables. If you prefer ready-to-use binaries or if you want
more info, please visit: https://
   Choose compile mode:
   *  (R)Release: Compiles normally.
                  Generates the fastest build.
   *  (D)Debug:   Compiles in debug mode.
                  Makes your console and crashes more verbose.
                  A bit slower than Release mode. If you plan to help
                  development by reporting bugs, this is preferred.
Choose compile mode: (r/d) (Default: "Release"):

当你看到上面的内容时,只需按下键盘上的回车键。

现在您将看到以下内容:

Choose the number of compilation threads.
You have 2 CPU threads.
If you have enough RAM, it is wise to choose your CPU's thread count.
Otherwise choose lower. Old Raspberry Pis should choose 1. If in doubt, choose 1
.
Please enter the number of compilation threads to use (Default: 1):

您可以选择为编译使用更多的线程(取决于您拥有的实例)。除此之外,你要做的就是按回车键。

一旦你这样做了,你将被提示如下信息:

#### Settings Summary ####
Build Type:                    Release
Branch:                        master (Currently the only choice)
Compilation threads:           1
CPU Threads:                   2
Previous Compilation:          Not detected. We are assuming this is the first compile.sh run.
Upstream Link:                 https://github.com/cuberite/cuberite.git
Upstream Repo:                 origin
 
After pressing ENTER, the script will connect to https://github.com/cuberite/cuberite.git
to check for updates and/or fetch code. It will then compile your program.
If you compiled before, make sure you're in the proper directory and that "Previous
compilation" is detected.
Press ENTER to continue...

这是编译开始前的最后一步。您将被告知按回车键开始编译。根据您的系统,大约需要15分钟。

注意:如果你看到一堆文本在你的终端上滚动,不要惊慌。系统将软件完全编译成可执行包需要一些时间。

一旦完成,你会收到以下信息:

-----------------
Compilation done!
 
Cuberite awaits you at:
/root/server/cuberite/Server/Cuberite
 
You can always update Cuberite by executing:
/root/server/cuberite/compile.sh
 
Enjoy :)

这标志着安装的结束。您可以进入下一节了解服务器的配置。

配置

为了配置您的服务器,我们必须首先从我们的临时目录中找到并复制已编译的服务器:

cd cuberite
cp -r Server ~/server/cuberiteServer
cd ./cuberiteServer

您的服务器目录将位于/root/server/cuberiteServer ,配置文件将位于/root/server/cuberiteServer/settings.ini.

我们现在可以使用任何文本编辑器编辑配置:

nano settings.ini

您将看到如下内容:

[Server]
Description=Cuberite - in C++!
ShutdownMessage=Server shutdown
MaxPlayers=100
HardcoreEnabled=0
AllowMultiLogin=0
Ports=25565

为了编辑在任何给定时间可以在线的最大玩家数量,只需将MaxPlayers=100行修改为任何您想要的数字。

例如,如果您想要最多25个玩家,您所要做的就是将行改为MaxPlayers=25

你也可以改变这个端口,但是不建议这样做,因为用户连接到你的服务器的难度增加了(Minecraft服务器的默认端口是25565)

如果你使用的是nano,你可以退出并通过CTRL + X保存,然后回车。

启动、停止并连接到新服务器

启动服务器

要启动服务器,只需转到服务器目录(/root/server/cuberiteServer)并启动一个屏幕:

cd ~/server/cuberiteServer
screen -S MinecraftServer && screen -r MinecraftServer

您可以在任何时候使用screen -r 命令重新连接到屏幕。我们将屏幕命名为MinecraftServer,因此重新连接可以通过执行screen -r MinecraftServer来完成。

现在,执行服务器二进制文件:

./Cuberite

在使用服务器之前,地形可能需要几秒钟才能生成。同样,使用以下组合退出屏幕:CTRL + A + D

停止服务器

为了执行硬关机,你只需要使用CTRL + c来执行一个优雅的关机,在控制台输入以下命令:

stop

 连接到您的服务器

假设您已经配置了防火墙,那么您可以在Minecraft客户机中输入服务器地址。

您的地址应该如下所示:192.0.2.5:25565(192.0.2.5是实际的服务器地址)

最后的评论

此时,您可以将服务器地址和一些朋友一起传递,然后开始构建。

卸载Cuberite

删除软件很简单。您所要做的就是确保服务器离线并运行rm -rf ~/server

 

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多