If you want to play Minecraft with friends or set up an uninterrupted server for a community as stably as possible, you can use Clouding for your Minecraft server.
In this article, you will see how to configure your server as securely as possible and specifically configure the necessary ports.
Create the server and configure its ports
Note: For the server to work as well as possible, it is important to use Strict Anti-DDoS Filtering, as this will prevent potential attacks and their consequences.
To do this, you will need to enable the filtering option when creating the server:
Once the server has been created with Strict DDoS, you will need to configure the server ports: allow SSH access (later you will see how to keep the server running with this port closed), allow port 25565 (if you change it in the service configuration, you will need to change it in the panel), and finally, to perform pings, you can leave ICMP enabled, although it can be disabled without any problems:
For the Minecraft Pocket Edition version, you will also need to enable port 19132 UDP.
Server preparation
The first thing we need to do is add the repositories and download java so we can run the server:
# add-apt-repository ppa:openjdk-r/ppa && apt update && apt install openjdk-18-jre-headless
Create the folder for the server and go into it:
# mkdir servidor && cd servidor
Now you will need to download the executable to configure the server. To do this, you can go to its website and download the latest version. In the section labeled minecraft_server.X.XX.X.jar (depending on the latest version), you can right-click to copy the link address.
Once you have the server link on the clipboard, you will need to use the wget command + paste. It would look something like this:
# wget https://piston-data.mojang.com/v1/objects/c9df48efed58511cdd0213c56b9013a7b5c9ac1f/server.jar
Now you will need to use the command to start the Minecraft server:
# java -Xmx1024M -Xms1024M -jar server.jar nogui
The first -Xmx1024M indicates the RAM with which the server starts running; the second -Xmx1024M sets the limit on the RAM the server can use. These parameters can be adjusted as needed.
server.jar is the name with which the server was created; it can be changed without any problems.
Minecraft server configuration
Server creation will be interrupted because you need to accept the EULA (End User License Agreement). To do this, you will need to run the command to edit the eula.txt file to accept the license:
# nano eula.txt
You will need to change the setting:
eula=false
To "true" to accept the license:
eula=true
Once this is done, you can save the changes and run the server again:
# java -Xmx1024M -Xms1024M -jar server.jar nogui
Now you will need to stop the server again; you can do this with the CTRL+C key combination. You also need to make the final adjustments to the server. Edit the server.properties configuration file:
# nano server.properties
And in the section:
server-ip=
server-port=25565
You will need to enter the IP in the first setting, and we do not recommend changing the default port.
Other parameters you can change are:
- To allow non-premium users to access it, you can change the online-mode=true parameter to online-mode=false
- To change the welcome message: motd=A Minecraft Server.
- You can also change whether you want PVP on the server, the game difficulty, and the gamemode (game type, survival, creative...)
Once this is done, the server will be configured.
Run the service
There are two different ways to run the server on Clouding. The first is more traditional and practical, while the second is somewhat more secure but restricts access much more.
The first option is to use the screen command, so that when you close the remote terminal, the server keeps running. That is, you would need to access the server via SSH and use the command:
# screen
Once the command has been run, use the command to run the server:
# java -Xmx1024M -Xms1024M -jar server.jar nogui
When using this command, we need to keep a few things in mind.
- To resume a previous session, use the command
screen -r. - To detach from a session, use the command
Ctrl+a d. - If you have several sessions open, when you use the command
screen -r, a list of sessions will appear:
There are several suitable screens on:
8651.pts-1.minecraft (12/08/2022 12:47:27 PM) (Detached)
7176.pts-1.minecraft (12/08/2022 12:19:20 PM) (Detached)
Type "screen [-d] -r [pid.]tty.host" to resume one of them.
- If we want to access a specific session, we will need to use the command screen -r + the numeric code shown above. In our case, it would look something like
screen -r 8651.
The second option is to access the server directly from the emergency console and run the command to start the service:
# java -Xmx1024M -Xms1024M -jar server.jar nogui
With this second option, you could close or filter port 22 for some additional security.
Remember, if you have questions about this or any other issue related to your servers on Clouding, feel free to write to soporte@clouding.ioWe are here for anything you need. Just ask us!