In this article, we are going to install a Minecraft server on Ubuntu. Make sure that you are logged in under a user who isn’t the root user, as running this server as root can be unsafe.
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-jdkNow, we are going to download the Minecraft server via wget. If you don’t have it 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.jarThe Minecraft install is complete. Accept the license agreement.
echo "eula=true" > eula.txtYou can now start your Minecraft server via the following command:
java -Xmx1024M -Xms1024M -jar minecraft_server.jar noguiThis command starts the Minecraft server with 1024MB RAM allocated. Allocating more RAM to the Minecraft server is easy. Simply change the -Xmx and -Xms attributes in the command.
In case you want the server to run in the background, you can install the screen:
apt-get install screenTo start the Minecraft server on screen, open a screen instance, then run the Java command again.
screen
java -Xmx1024M -Xms1024M -jar minecraft_server.jar noguiTo exit out of the screen window, press CTRL + A, then d. If you want to open the window again, use the command screen -r.