Take me back to the full version
Minecraft Server Version: 1.12.2
Minecraft Forge 1.12.2-220.127.116.1147
Oracle Java Version: 8u241
Get a $100 60 day credit towards a dedicated server with DigitalOcean by using this link.
Step 1 - Download Java
Step 2 - Configure Java
Step 3 - Setup Your Environment
Step 4 - Download the Forge Installer file
Step 5 - Configure your new Modded Minecraft Server
Step 6 - Optional-- Configure Minecraft to start on bootup
Step 7 - Connect to Your Server
Step 8 - Hardening Your Minecraft Server if Visible on the Internet
Step 9 - Backup Your Server Frequently
Step 10 - Recovering a Corrupted World
Step 11 - Creating Automatic Backups
Donate Your donations keep this site ad free -- Thank You
Report errors in this guide. Your feedback is appreciated.
Latest Version of Java
Once downloaded copy it to your /opt folder and then unpack it;
tar -zxvf jdk-8u241-linux-x64.tar.gz
update-alternatives --install /usr/bin/java java /opt/jdk1.8.0_241/bin/java 1 update-alternatives --install /usr/bin/javac javac /opt/jdk1.8.0_241/bin/javac 1
update-alternatives --config java update-alternatives --config javac
i) java -version You should see the following; java version "1.8.0_241" Java(TM) SE Runtime Environment (build 1.8.0_241-b07) Java HotSpot(TM) 64-Bit Server VM (build 25.241-b07, mixed mode) ii) javac -version You should see the following; javac 1.8.0_241
apt update && apt -y upgradeb) Install screen (This will be needed to run your minecraft server console while logged out of your Linux server).
apt install screen
cd /opt mkdir minecraft cd minecraft
Now download the version 1.12.2 Forge Installer. Pick the Latest Installer file (not the Universal file) and copy it to your /opt/minecraft folder.
You should now have only one jar file in your /opt/minecraft folder.
java -jar forge-1.12.2-18.104.22.16847-installer.jar --installServerNow run the newly created universal file as follows;
assuming a server with 2048MB (2GB RAM) cd /opt/minecraft && java -Xms1024M -Xmx2000M -jar /opt/minecraft/forge-1.12.2-22.214.171.12447-universal.jar nogui
b) accept the EULA. The first time you try to run your minecraft server you will be required to accept the EULA.
nano eula.txtc) Change the following line to true and save the file
eula=trued) copy your mods to the newly created mods folder.
e) Run the server again to generate your world. World generation will take a little longer the first time. Subsequent server starts
will be much quicker.
Before doing this, you can download the following server.properties file and replace the one that was created automatically. (or copy/paste directly to your existing server.properties file from the console).
This server.properties file will give you a standard survival world on normal difficulty.
Edit the file with your preferred seed if you have one and it will generate the world that you specify.
nano server.properties change the following line with your preferred seed directly after the = sign level-seed= If you leave it blank Minecraft will generate a random world on first launch
f) make things a little easier on yourself by using a script to start minecraft
cd /opt && mkdir scripts cd scripts nano minecraft.shg) Copy and paste the following in your minecraft.sh file
#!/bin/bash cd /opt/minecraft/ && java -Xms1024M -Xmx2000M -jar /opt/minecraft/forge-1.12.2-126.96.36.19947-universal.jar noguih) Save the file and make it executable
chmod +x minecraft.shi) Start your server
screen <---hit enter at the informational message /opt/scripts/minecraft.sh To exit the screen session hit 'CTRL AD'
nano /etc/rc.localRight before the last line 'exit 0' add the following command, save and exit the file. This will allow the minecraft server to start in a detached screen session when the server boots up.
screen -dm -S minecraft /opt/scripts/minecraft.sh
cd /etc nano rc.localin the rc.local file copy and paste the following
#!/bin/sh screen -dm -S minecraft /opt/scripts/minecraft.sh exit 0Save the file and make it executable
chmod +x rc.local
If that doesn't work you may have to re-enable the rc.local service. Use the following set of instructions. However this should not be necessary.
b) To access your console after bootup use the following command;
screen -r minecraft To exit the screen session use the following command CTRL AD
d) Enter your world for the first time and have fun!!!
b) Activate whitelisting. It is extremely important to activate whitelisting if your server is visible on the internet.
In your server.properties set the following value to true;
white-list=true Restart your minecraft server and run the following command at the console for each user you would like to allow. whitelist add minecraft_user1 whitelist add minecraft_user2 To remove a user whitelist remove minecraft_user2
login to your server cd /opt tar -zcvf minecraft_backup.tar.gz minecraft
Delete your existing minecraft folder cd /opt rm -r -f minecraft copy your previously saved minecraft.tar.gz file to your /opt folder. restore your world tar -zxvf minecraft.tar.gzThat's it, restart your server and you have successfully restored from your last good backup. Any changes you made since that backup are gone, so it is important to do your backups regularly.
This will create a 7 day rotation of backups with the oldest being overwritten with a new one.
a) Create your script.
cd /opt/scripts nano mcbackup.shb) copy and paste this script into your mcbackup.sh file you have open in the nano editor. Change the dest= line to point to the folder you want your backups to reside in.
#!/bin/sh #################################### # # Backup minecraft world to a # specified folder. # #################################### # What to backup. Name of minecraft folder in /opt backup_files="minecraft" # Specify which directory to backup to. # Make sure you have enough space to hold 7 days of backups. This # can be on the server itself, to an external hard drive or mounted network share. # Warning: minecraft worlds can get fairly large so choose your backup destination accordingly. dest="/home/username/minecraftbackups" # Create backup archive filename. day=$(date +%A) archive_file="$day-$backup_files-.tar.gz" # Backup the files using tar. cd /opt && tar zcvf $dest/$archive_file $backup_files
c) Save the file by pressing CTRL-X and entering Y
d) Make the file executable
chmod +x mcbackup.she) Test your script. Before creating the scheduled task ensure your script works
f) Create a scheduled task with the cron scheduler
Make sure you are logged in as root so that it writes to your root user crontab.
crontab -eEnter this line at the end of your root crontab and then save it.
02 2 * * * /opt/scripts/mcbackup.sh &> /dev/nullThis will create your backup every day at 2:02 am.
Monday-mcbackup-.tar.gz Tuesday-mcbackup-.tar.gz Wednesday-mcbackup-.tar.gz Thursday-mcbackup-.tar.gz Friday-mcbackup-.tar.gz Saturday-mcbackup-.tar.gz Sunday-mcbackup-.tar.gzEvery day your oldest file will be replaced with the new backup giving you a seven day rotation of backups.