In this article, we are going to install a Minecraft server on an Ubuntu. Make sure that you are logged in under a user that isn’t the root user, as running this server as root can be unsafe.
In order to run a Minecraft server, we need Java 1.7 to be installed on the server. To install Java 1.7, run the following commands:
sudo apt-get update sudo apt-get install openjdk-7-jdk
Now, we are going to download the Minecraft server via
wget. If you don’t have
wget installed, then you can install it via
sudo apt-get install wget. Replace
1.10.2 with the current release of Minecraft.
wget https://s3.amazonaws.com/Minecraft.Download/versions/1.10.2/minecraft_server.1.10.2.jar chmod +x minecraft_server.jar
The Minecraft install is complete. Accept the license agreement.
echo "eula=true" > eula.txt
You can now start your Minecraft server via the following command:
java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui
This command starts the Minecraft server with 1024MB RAM allocated. How to allocate more RAM to Minecraft server is easy. Simply change the
-Xms attributes in the command.
In case you want the server to run in the background, you can install screen:
apt-get install screen
To start the Minecraft server in screen, open a screen instance, then run the Java command again.
screen java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui
To exit out of the screen window, press CTRL + A, then d. If you want to open the window again, use the command