Skip to content

Instantly share code, notes, and snippets.

@niksudan
Last active December 12, 2023 20:15
Show Gist options
  • Star 54 You must be signed in to star a gist
  • Fork 8 You must be signed in to fork a gist
  • Save niksudan/a3f90651f35203815f245d5d09ac6646 to your computer and use it in GitHub Desktop.
Save niksudan/a3f90651f35203815f245d5d09ac6646 to your computer and use it in GitHub Desktop.
How to create a new Minecraft Server with DigitalOcean

Creating a new Minecraft Server

This is a short and simple guide on how to set up a multiplayer server running the latest version of Minecraft.

This guide has been tested on Ubuntu 16.04 and 18.04.

Setup

Create a new Ubuntu droplet on DigitalOcean. Make sure it has at least 2GB of RAM, and you provide it with your SSH key.

SSH into the server and install Java, which is required for Minecraft to run.

apt-get update && apt-get install default-jdk
java -version

Additionally, install Screen, which will allow us to run the server in the background.

apt-get install screen

Running the Server

Copy the download link of the latest Minecraft version here.

Create a directory to install the server files and download the server.

mkdir minecraft
wget -O minecraft_server.jar <paste-download-link-here>

Start a new screen session.

screen -S Server

Run the server.

java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui

Exit the screen session.

CTRL + A, D

You might need to update your firewall configuration so that the correct ports are open if you are getting the message "Unable to connect to world".

ufw allow 25565/tcp

Editing Properties

A server.properties file is automatically created when you run the server for the first time. A list of properties can be found here.

vi server.properties

Please note that after you edit the properties, you'll need to restart your server.

@flex-luthor
Copy link

Thanks a lot. Simple af.

@mamyaw
Copy link

mamyaw commented Dec 11, 2021

Hi! I know this is already a year old, but I'm having an issue with the java version. It basically says that ubuntu 18.04's version of java is not compatible with the latest minecraft server edition. should I upgrade my ubuntu server?

@Subhangmokkarala
Copy link

hey how can i push my world to the server on digital ocean

@paoloose
Copy link

hey how can i push my world to the server on digital ocean

You can upload your world to the internet (that is, some hosting server). This is HTTP, which is suitable for file downloading, so you will need to first zip the directory where you have your Minecraft world, and then wget the url where you have stored it. As an example, if you hosted it in Google Drive, see this. You can also git clone a Github repository where your world is uploaded, which under the hood is basically the same idea.

However, there is a more specialized protocol to share files and filesystem resources in general: FTP (File Transfer Protocol). There are plenty of FTP GUI clients to get started. FileZilla is a nice choice to begin with. Of course, you can use FTP within a console. In linux, there is the ftp command, but I encourage you to use instead sftp, which is essentially a secure version of ftp that uses ssh for authtentication. DigitalOcean has an specialized guide here.

@Subhangmokkarala
Copy link

Subhangmokkarala commented Jul 19, 2023

hey how can i push my world to the server on digital ocean

You can upload your world to the internet (that is, some hosting server). This is HTTP, which is suitable for file downloading, so you will need to first zip the directory where you have your Minecraft world, and then wget the url where you have stored it. As an example, if you hosted it in Google Drive, see this. You can also git clone a Github repository where your world is uploaded, which under the hood is basically the same idea.

However, there is a more specialized protocol to share files and filesystem resources in general: FTP (File Transfer Protocol). There are plenty of FTP GUI clients to get started. FileZilla is a nice choice to begin with. Of course, you can use FTP within a console. In linux, there is the ftp command, but I encourage you to use instead sftp, which is essentially a secure version of ftp that uses ssh for authtentication. DigitalOcean has an specialized guide here.

Thanks for the reply
I'll probably push to git and clone it whenever I need a server maybe I'll do some automation

Like say
When I start server clone the world and when I stop the server then push to git

*edit

@paoloose
Copy link

paoloose commented Jul 19, 2023

Like say
When I start server clone the world and when I stop the server then push to git

If you need some sort of synchronization or bidirectional communication between your local and the server world, then FTP is the best tool for the job, I mean you can setup a push/pull git workflow but eventually you may want to share a whole filesystem with syncronization and other features that only FTP can give you. On the other hand, git branches and backups seems promissing, not mentioning that it will manage to transfer only the necessary changes to the server. Go for whatever you like more.

Yeah ftp and http does work but for 200mb it takes so long time

Well, that depends on many factors such as your droplet bandwith, your connection speed, server geographical distance, network traffic, etc., so 200mb can be uploaded/downloaded in seconds, minutes, hours, days, just can't say a number; probably no more than a minute or so, I don't know. Remember that since files are streamed over the internet there is not theoretical limit of how large your files can be for both protocols, so 200mb is not a big deal, just watch out for your storage limit.

Edit: remember that git clone http(s)://... uses HTTP under the hood, so the same applies. Worth to mention that git can be used with other procols than HTTP for file transferring.

@Subhangmokkarala
Copy link

Like say
When I start server clone the world and when I stop the server then push to git

If you need some sort of synchronization or bidirectional communication between your local and the server world, then FTP is the best tool for the job, I mean you can setup a push/pull git workflow but eventually you may want to share a whole filesystem with syncronization and other features that only FTP can give you. On the other hand, git branches and backups seems promissing, not mentioning that it will manage to transfer only the necessary changes to the server. Go for whatever you like more.

Yeah ftp and http does work but for 200mb it takes so long time

Well, that depends on many factors such as your droplet bandwith, your connection speed, server geographical distance, network traffic, etc., so 200mb can be uploaded/downloaded in seconds, minutes, hours, days, just can't say a number; probably no more than a minute or so, I don't know. Remember that since files are streamed over the internet there is not theoretical limit of how large your files can be for both protocols, so 200mb is not a big deal, just watch out for your storage limit.

Edit: remember that git clone http(s)://... uses HTTP under the hood, so the same applies. Worth to mention that git can be used with other procols than HTTP for file transferring.

yeah about that i fixed it and it does work as expected
yeah everytime i play im cloning the repository and old one just stays as a backup incase anything goes wrong
and after ive stopped playing i just push it to repository and delete droplet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment