Quick start script
“I’m lazy and I need a script to do this for me” is my mantra, and it should be yours, too! Therefore, I made some scripts that automate the process below.
Check out this README file to see what command to run, in order to perform a one-line install on your server. Good luck!
This guide will not set up
ufw, the default firewall of Linux servers. Consider turning it on if you’re going to deploy a public gaming server.
If you choose to use the script above, remember to verify the contents before letting it run on your server!
This guide (and script) will work best on Debian 10.
Initial server setup
Create a new administrator account:
Update the server:
sudo if your server doesn’t come with it:
Give your user admin privileges:
htop to make your server admin life easier:
Those will be used for running the server processes in the background and for monitoring the health of the server.
Almost done! You need to log in as the new user, BUT do NOT log out from your current session yet. You need to verify some things before you actually log in as the new user.
Execute the following command:
Press Ctrl-W, and then type in
PasswordAuthentication and then press Enter. You may need to retry this a couple of times to get to the correct line. If you see this:
This means you logged in using SSH keys. This is extremely common if you used a VPS provider such as DigitalOcean and supplied your own SSH key.
If you see this:
How did you log in? Did you log in by supplying a password, or a key file? If using a key file, try logging into the server in a separate session with a password this time. If it fails, then you have password authentication disabled, which is exactly what you want (it’s secure!)
If you see this:
This means you can log into your new user account using your password. This is not really secure so it’s not recommended. Generate an SSH key and disable password authentication.
We need to change the default SSH port. Change it to something random and high, like
30724. Obviously, choose a random port number that isn’t bigger than
65535 and isn’t smaller than
Press Ctrl-O, and then Enter to save, and then press Ctrl-X to exit
nano. Now, if you have SSH-key authentication, type the following commands:
Make sure to change the username if you have done so while creating the new admin acocunt.
You don’t have to do anything if you have password-based authentication, but I really recommend turning it off because passwords are easy to crack.
Now try logging in as the new user. If you are successful, it’s time to disable root logins. (You don’t have to do this either.) Edit the file and change
no. Reboot the server to reflect the changes (or just restart the SSH daemon service).
Log in as the new user. Congratulations! You have your server set up. Now it’s time to set up the game processes on the server.
We need to first install Java:
Let’s create a directory to contain all of our Minecraft files:
Now, we need to download the actual server binary. If you want to download vanilla, follow this link. For PaperMC, follow this link. To get the raw download URL, right-click on the URL or build number and click on “Copy Link Address.”
Paste it in the code block below:
So for example, I would run:
To start the server, we need a script. Make a file called
start.sh and paste in the contents below:
Experiment with the RAM values as needed. A good rule of thumb is about 1 GB for about 4 players,. 2 GB for about 6 players, and 4 GB for about 10 players.
Now, make the script executable:
When you first run the server, it may ask you to accept an EULA. Simply edit the
eula.txt file and change the value to yes. You’re done! Start the server like so:
You may need to adjust server properties in
server.properties. I recommend setting up proper whitelisting.
Download and extact the server binary:
(If the unextract command fails, run
sudo apt install xz-utils)
Go into the
factorio/ directory. Copy over game saves if you have any. You need to copy the following if you want to play with a previous save:
tmux and run;
This command should load the latest game save, referencing the configuration file.