This guide is for who wants to create a server to play with friends for a few hours or so.
The intent of this guide is to create a droplet, set it up, play, turn it off, create a snapshot and destroy the droplet.
First of all, you need to create an SSH Key and add it to your account, click the following link on how to -> https://cloud.digitalocean.com/account/security
Then, create a new droplet (I choose a Standard $20 Droplet and it should be fine to play with a few friends).
In the meantime, create a new Firewall (https://cloud.digitalocean.com/networking/firewalls/new) and name it Minecraft. Add a custom Inbound Rule setting the protocol to TCP and the port to 25565.
When the droplet has been created, attach the firewall that we have just created to the droplet.
Connect to the droplet via SSH -> ssh root@THE_DROPLET_IP
Run the following command and type Y when asked to proceed with the installation fo Java
apt-get update && apt-get install default-jdk
Create a new directory with the following command
mkdir minecraft && cd minecraft
Then go to this page to get the download link of the Minecraft server https://www.minecraft.net/en-us/download/server/
Then run the following command to download the minecraft server
wget -O minecraft-server.jar THE_DOWNLOAD_LINK_HERE
Then run the server
java -Xmx3G -Xms3G -jar minecraft_server.jar nogui
The 3G above is the GB of RAM that Minecraft will use, since I use a 4GB droplet, I dedicate a 3GB of RAM. DO NOT enter the whole droplet RAM, leave 1GB to the instance.
You will need to accept the EULA to do so you need to modify the eula.txt file
nano eula.txt
and modify the accept=false
to accept=true
then press Control + X
, then Y
and then Enter
.
To give you superpowers you need to modify the file ops.json with nano ops.json
and modify it based on the below template (you can just have one player if you want to, just the delete the second bracket {}
block. You need to add a new brackets {}
block for each user.
[
{
"uuid": "UUID_goes_here",
"name": "the_player_username_here",
"level": 4
},
{
"uuid": "UUID_goes_here",
"name": "the_player_username_here",
"level": 4
},
]
To get the UUID, just search minecraft UUID
and click on any Nickname/UUID converter.
Save it with Control + X
, then Y
and then Enter
.
You now can ran the server
java -Xmx3G -Xms3G -jar minecraft_server.jar nogui
You need to leave the terminal open in order to keep the server running.
Now login to the server using the IP of the Droplet that DigitalOcean is giving you on their dashboard.
Once you finished playing, turn the Minecraft server off going back to the terminal and press Control + C
.
Turn the Droplet Off. Go to Snapshots and create one. Once that's done, you can now destroy the Droplet.
When you want to play again, you need to create a new Droplet using the snapshot that we have previously created. Once that's created, reattach the previously created Firewall, login and start the server as we previously done and repeat this process every time you start a new droplet.
- Create Droplet
- Create Firewall + Attach it
- Stop Droplet
- Save Snapshot
- Destroy Droplet
- Create Droplet Using the Previous Snapshot
- Attach the Firewall
- Delete Snapshot
- Stop Droplet
- Save Snapshot
- Destroy Droplet
- Etc..
This will cost about 0.06c per hour of use + 0.15c per month to keep your progress saved.