Requirements
1.Java
2. A non-root sudo user
3. At least 1GB of RAM. While Minecraft can operate on less, you may run into memory issues
4. Screen (optional)
Begin
Create a new non-root user with sudo access:
Code:
adduser yourname
Add User to the sudo group
Code:
usermod -aG sudo yourname
Switch to the new sudo user:
Code:
su - yourname
Update system:
Code:
sudo apt update && sudo apt upgrade -y
Installation
- We will need Java on the server. Install the latest version
Code:
sudo apt install openjdk-8-jdk -y
- Confirm the Java installation:
Code:
sudo java -version
- You can also install Screen,
if you want the Minecraft server to be able to run in the background
Code:
sudo apt install screen -y
4.Create a new directory, and move to that directory
Code:
sudo mkdir minecraft && cd minecraft
- Now we can install Minecraft. Be sure to replace 1.11.2 with the current release of Minecraft
Code:
sudo wget -O minecraft_server.jar https://s3.amazonaws.com/Minecraft.Download/versions/1.11.2/minecraft_server.1.11.2.jarsudo chmod +x minecraft_server.jar
- The Minecraft installation is now complete, but you must accept the license agreement before you can use it
Code:
sudo vim eula.txt
-
Find the line eula=false and change it to eula=true. Save and exit.
-
Start MC Server
Code:
sudo java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui
-
This command starts the Minecraft server with 1024MB RAM allocated. To allocate more RAM, simply change the -Xmx and -Xms arguments to your desired size. For example, -Xmx2048M -Xms2048M will start the server with 2048MB RAM.
-
If you want to run the server in the background, first stop the server that is currently running with the command stop. Now create a new Screen instance.
Code:
sudo screen -S "My Minecraft Server"
- Run the Java command again
Code:
sudo java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui