Key steps we’ll cover in this guide:
- Installing Java
- Installing the Minecraft server
- Launching the server
Install Java
Install Java on AWS Linux
Install Java on Ubuntu
Update the repository to ensure you download the latest version of OpenJDK
Install the latest Java Development Kit
Install Java on CentOS
Start by updating the package repository
Install the Java Development Kit with
Verify Java is installed by running:
The output should respond with the version of OpenJDK installed on the system.
Installing the Minecraft server
The steps to install and launch the server are much the same as any other install — download the file, put it somewhere permanent and run it. We’ll do that through the command line.
We’ll also create a dedicated user for the server on the instance
After the user is created, we’ll make directories and download the latest version of the Minecraft server into them, then provide access to the “minecraft” user.
The URL for the latest version of the server can be found on the official Minecraft server page. Minecraft has now been downloaded on the machine and is almost ready to run.
Launching the Minecraft Server
A little trick with running the Minecraft server for the first time is that you have to run it once, edit a eula.txt file to agree with the license and then start it again before it will run. The next steps show how to do this using vi.
We’ll swap to the user and move to the server directory.
Run the following command to start the server. If you are using a different Minecraft server filename, update the command accordingly.
The command will error and say you need to agree to the eula. Do so by running the following command
Navigate to the “eula=false” statement, press i and edit it to say “eula=true”. Press escape and type :x to save and exit. Any Minecraft server specific settings can be modified in a similar way using vi in the server.properties file.
Start the server again using the same command as above. Minecraft server is running and will be available to log in after world generation is complete.
Install Screen
Screen is a console application that keeps your server running when you’re not connected.
Install Screen on Ubuntu with:
To install Screen on CentOS, run:
Run Screen
Start a Screen session using the screen command and add the -S option to name the session:
Run Your Minecraft Server
Start the Minecraft server by running the java command to execute the jar file
Wait for the system to finish executing. You should get a message when the process is done, at this point the Minecraft server is up and running.
You can now detach from the Minecraft screen by pressing Ctrl+a+d.
To reattach to the screen, press Ctrl+r.