Setup Minecraft server on CentOS

Minecraft is a Computer indie game in the genre sandbox, developed by the Swedish programmer Markus Persson and released by his company Mojang AB. In this article we will create a server for the game Minecraft, we consider the solution of some typical errors, set up the launcher on the client and do emails to friends inviting them to play!

The principle of operation of Minecraft: has server with the world and locations, connects the client with the player. The Minecraft server will be created on the base of the original from the developers, no other modifications and extensions. At the time of this writing, the latest version of the game Minecraft was 1.14.4. This is the standard, he is clean official minecraft server for 1.14.4, there are no plugins or mods, this server need to play with your friends in classic minecraft like single player.


Game Minecraft server has port 25565, which can easily change it in the configuration files. To the server connect using TL-launcher for Minecraft.

Setup Minecraft server on CentOS

1. Preparing the server

To create a Minecraft server, just install the CentOS 7 server with Minimal configuration. Everything else doustanovit during server configuration. Install a text editor mc and net-tools package to determine the IP address of the server:

yum-y install mc net-tools

Update all CentOS 7 components and their dependencies to the latest versions in the repositories:

yum-y upgrade

Make sure our server received an IP address via DHCP from the source and has its own IP address:

ifconfig

Our server got IP address 192.168.10.132. Remember it. It will help us later to customize the configuration file of the game server of Minecraft.

3. Installing java on a server

Verify if we have installed java at all, or does it need to be reinstalled to a newer version?

java-version

In this case, in our CentOS 7 is already version 1.6.0, but it is outdated for the version of the game 1.14.4 and we will need to install a more recent version to work correctly on our Minecraft server.

View what versions of java are available in the available repositories:

The list will be a lot of everything that contains the word java, but we are interested in packages like this:

Put all packages:

yum-y install java-1.8.0*

Check the version of java:

java-version

Order! Next install screenin order to run a MineCraft server and it continued to work after leave console VPS:

yum-y install screen

Launches the Minecraft server is going to do in the screen window.

3. How to work in screen

Creating a window with a unique name:

screen-S "imaoka"

If you suddenly get confused and lost and screen Windows, you can always dial a special command and the view menu of the Windows that we open in General:

screen-r

Then enter the ID of the window or its name in quotes, this when you create the window and switch to window “imaoka“:

screen-r "imaoka"

You can still consider, that all our works are working in all created Windows in the background thanks to screen.

Press simultaneously the keys “Ctrl” + “a“, then just one key “d“. Screen our work will be curtailed in the memory, and we will go to the primary console CentOS 7. You can return to the menu window screen it again to open the window screenby typing in the terminal screen-r and the window name, which was given him when creating him.

Go back to screen workflow always easy with this team:

screen-r "imaoka"

4. The firewall

For correct operation of the Minecraft server you want to configure rules for the firewall on server CentOS 7. The guide uses the program iptables. It is likely that settings in other firewall products will be similar. We assume that the server already successfully functioning iptables and installed a text editor mc. Open the configuration file of iptables in a text editor:

mcedit /etc/sysconfig/iptables

And in the middle of a string array, under the permission work with port 22, insert the following lines exactly the same string, but with port gaming MInecraft server is on port 25565:

-A INPUT -p tcp -m state --state NEW-m tcp --dport 25565 -j ACCEPT

It should look like this:

So iptables is taken into account in the work, you need to restart it:

systemctl restart iptables

If after this command came the error:

Carefully check what you wrote there. Your line contains a typo!

6. Installing Minecraft server

For ease of launching Minecraft server create a folder to minecraft in the server root directory. Download though where a file with the Minecraft server. Any way put the Minecraft server file in that directory.

Work:

/minecraft/minecraft_server.1.14.4.jar

Now let’s activate the Minecraft server. Startup screen:

screen-S "Minecraft server"

Run the Minecraft server:

java -Xmx1024M-Xms1024M -jar /minecraft/minecraft_server.1.14.4.jar nogui

It take too long and will be to unpack its contents to the root folder of the system is CentOS 7, PWD will issue a message stating that we have read and accept the license agreement on the game Minecraft.

You need to answer him in the affirmative in the file eula.txtthat Yes, we have read and agree with everything written!

Our labors are working in the background, thanks to the screen. Press simultaneously the keys “Ctrl” + “a“, then just one key “d“. Screen our work will be curtailed in the memory, and we will go to the primary console CentOS 7. You can return to the menu window screen it again to open the window screenby typing in the terminal screen-r and the window name, which was given him when creating him.

Go back to screen workflow for the Minecraft serveras needed:

screen-r "Minecraft server"

Come out and see:

Open the text file eula.txt in a text editor, it is extracted to the home folder of the user you are logged in CentOS 7.

mcedit ./имя_пользователя/eula.txt

or something like that

mcedit ./имя_пользователя/eula.txt

Change to false

on true

value meaning.

Save the file. Now you need to disable license verification on Minecraft clients Minecraft server and add the IP address of CentOS server 7. These parameters is the configuration file for the Minecraft server server.properties, that being always near eula.txt:

mcedit ./username/server.properties

Looking for the string ‘server-ip=‘ (empty parameter contains) and ‘online-mode=true‘ (enabled scan) that contain those settings and replace them with these values:

server-ip=192.168.10.132

online-mode=false

Save the configuration file. As this file contains many other parameters that directly affect the rules of the game, but their description can be easily found on the Internet and spend on them in the article makes no sense.

Will continue to run the Minecraft server:

screen-r "Minecraft server"

Then run the java file minecraft_server.1.14.4.jar:

java -Xmx1024M-Xms1024M -jar /minecraft/minecraft_server.1.14.4.jar nogui

Minecraft requires 1 GB RAM for boot server, this is enough. But still it is recommended to increase the amount of RAM to improve performance! To do this, replace the 1024 in the options -Xmx and -Xms to 2048 (2GB) and so on. Read more startup parameters as you can read on the Internet.

For 32-bit system prefix -d32for a 64-bit system prefix -d64. Option generous running the server on 64-bit with 4 Gb of RAM:

java -d64 -Xmx496M -Xms496M -jar /minecraft/minecraft_server.1.14.4.jar nogui

The file for a long time think, pozavane and sharply manifest here in this end of the process:

This means that in the server’s RAM CentOS 7 was created and earned Minecraft server!

Our labors are working in the background, thanks to the screen. Press simultaneously the keys “Ctrl” + “a“, then just one key “d“. Screen our work will be curtailed in the memory, and we will go to the primary console CentOS 7. You can return to the menu window screen it again to open the window screenby typing in the terminal screen-r and the window name, which was given him when creating him.

Go back to screen workflow for the Minecraft server if we need it again:

screen-r "Minecraft server"

Yet, out of this screen and check that your Minecraft server memory. Come out and see:

Scan memory for the presence of processes on open ports:

netstat-ntulp

As you can see our process 7828/java hangs in memory and has IP address 192.168.10.132 and regularly listens port 25565! The connection to the server will occur at 192.168.10.132:25565.

6. Setting up the Minecraft client

At the beginning of the download and install the freshest version of java under your operating system. Java on-line installer [Download 2 MB]. Install it in your system. If you offer to remove the old version, agree and install the new one.

As the launcher of Minecraft you will use TL–launcher. In the community you can always download the latest version of this program. To start the game, you can use any other launcher with the same client build Minecraft the gaming Minecraft server. Minecraft client (TL-launcher) [Download 2.2 MB]. Download TL–launcher in any folder in Windows and run it:

In the launcher you need to create an account name, choose in the window of the run the name of the account records and client Version of the game. Since we have a Minecraft server created in version 1.14.4 without modifications, then choose from the list. If the launcher prompts you to download some components to the game, agree. It will do it automatically. Click Install, then Start.

You may need to add a Minecraft server to allowed apps in the firewall. Put all the checkboxes on the permission and agree.

The game runs… Choose Network game.

Connect to the address.

Enter IP address 192.168.10.132:25565 games Minecraft server and press Connect.

If everything was done correctly, the player will be in the game world of Minecraft. Enjoy the game!

7. Forwarding a port to the Internet

For cooperative play with friends online, you need to do port forwarding in any way. The most convenient way to do this is through a router with white IP-address.

Server commands Minecraft

Appointment of an Administrator of the server

In order to give administrative privileges to an account in the game world, you need to go by the user on a Minecraft server, check there in the game, then try the command on server CentOS 7 console advanced control panel Minecraft server:

/op user_name

Example user Hamster:

Stop the server

Sometimes there is a need to shut down the server with CentOS 7, but we have a Minecraft server! So just can not be shut down. Before shutting down is very necessary to correctly complete the работуMinecraft that would save all game locations and will not damage your files with the game world. Write command:

/stop

What to do if a Minecraft server is hung?

Scan memory for the presence of processes on open ports:

netstat-ntulp

What do we see? Yeah, a string with the IP address 192.168.10.132 opened the port 25565 is our server Minecraft. We are interested in the number of the process in the last column. This will be the value 1386/java. Forcibly close a hung server process. To send the signal SIGKILL (it has 9) process 1386, run in command line:

kill -9 1386

In General, the team kill is designed to send a signal to a process. By default, if we don’t specify what signal to send the signal being sent is SIGTERM (from the word termination — completion). SIGTERM indicates the process that must be completed. Each signal has its own number. SIGTERM has the number 15. A list of all signals (and their numbers) that can send a team kill, you can display by running kill-l.

Apply team and again into the scan memory for the presence of processes on open ports:

netstat-ntulp

As you can see, the process with the Minecraft server in the server’s RAM CentOS 7 missing. Now you can restart the Minecraft server according to the instructions above.

If anything goes wrong at all, then erase all files which were created during the install and again follow the steps in this tutorial. The error should disappear.

Source: losst.ru

(Visited 6 times, 1 visits today)