How to Setup a Modded Minecraft Server (1.12.2)

Build a Modded Minecraft Server on Linux

WARNING: Merely download Forge from the official site at files.minecraftforge.net. Always beware of scam sites.

TL/DR – Modded Linux Condensed Version – For Returning Users

Building a full Linux vanilla server? See the Linux server install documentation.
Building on Raspberry Pi four? See the Raspberry Pi 4 install documentation.

Minecraft Server Version: ane.12.two
Minecraft Forge 1.12.ii-fourteen.23.5.2860
Java Version: OpenJDK version “1.8.0_312”

Judge time to complete: 30 minutes depending on your server. This besides depends on your comfort level working from the Linux command line. Give yourself plenty of fourth dimension.

Get a $100 60 day credit towards a dedicated server with DigitalOcean by using this link.

Step ane – Install Coffee
Footstep 2 – Setup Your Surround
Step three – Download the Forge Installer file
Step four – Configure your new Modded Minecraft Server
Footstep 5 – Optional– Configure Minecraft to kickoff on bootup
Stride half dozen – Connect to Your Server
Step vii – Hardening Your Minecraft Server if Visible on the Internet
Step 8 – Backup Your Server Frequently
Step ix – Recovering a Corrupted World
Step 10 – Creating Automatic Backups

Donate Your donations keep this site advertising free — Thank you

Study errors in this guide. Your feedback is appreciated.

Things to consider…

These instructions are for edifice a modded Minecraft Java Edition Server. All players using your server must install the same mods locally on their own PC. Configuring your PC to play mods is outside the scope of this article.

These instructions won’t piece of work for PE or the Meliorate Together version. The modding scene is near entirely on the Java edition and you volition need to be running Minecraft Java on PC (Windows, Linux or Mac) to connect to this server. You volition not be able to connect to this with your Xbox or your Ipad or the Microsoft Windows x Edition.

Exist conscientious when downloading mods. At that place are then many shady mod sites that use AdFly links that lead to porn ads, that rehost mods without permission from the authors and even host ads that pb to malware sites. It’s a minefield, and for this reason, I highly recommend that you go your mods from CurseForge which uses the Twitch launcher. While Curse have a tonne of mods, they don’t accept everything. Minecraftforum.net seems fine too to become private mods. I am sure there a other reputable places, but you lot are taking your chances.

You will also need the Forge Minecraft launcher to play mods. If you lot are new to mods, getting an business relationship with Twitch/Curse and using their launcher and managing your mods there is much easier. You can’t play on a modded server with the stock Mojang Launcher. Yous demand to install Forge (or the Twitch Launcher) for the version you desire to play.

Finally, these instructions are for version 1.12.2 of Minecraft. When it comes to mods version matters. At that place are many great mods at version 1.7.10 for example. No worries though, these instructions should work the same for whatsoever version you need. Y’all merely need to download the right version of Forge which I will get into later.

Why Linux and Non a Fully Managed Solution?

This is a valid question. A fully managed solution similar ane offered by the many dedicated Minecraft hosting companies out there can make sense. In that location is no need to secure the underlying Linux OS, this is all done for you. You lot become a nice graphical front end end to manage your server, automated backups, DNS direction to admission your server, FTP access. They provide a GUI for managing your mods.

However, if you decide to go with a dedicated setup you tin go a credit towards your server with DigitalOcean if you sign up through this referral link. Sizing of your server will depend on how many mods and users you intend to have.

Here are some of the reasons y’all may want to build your own;

1 – Maximum command right down to the OS level.
2 – Adopt working from the command line than from a Web browser to manage your server.
3 – High memory and cpu needs for your server and a VPS or defended server is cheaper than a higher end fully hosted solution.
4 – Have a server available which isn’t costing you annihilation and a good internet link.
5 – Want to learn how to do it yourself from starting time to terminate.
6 – Finally, the nearly of import reason of all…..Because You lot Tin can!

Which Linux Distribution?

Recommending a specific Linux distribution equally “the best option” is like recommending a religion as the “best one to follow”. Yous will either be preaching to the converted or alienating the person you are having the give-and-take with.

For my purposes I like using Debian and its derivitaves. However I take used other distributions and have liked them likewise. This guide uses Ubuntu Server 18.04 LTS using the apt package director. When a packet director is called for, simply substitute the relevant commands for your favorite distro. They are all good.

Popular:   DHCP, DNS and HTTP Server configuration over the network in Packet Tracer | CCNA | Cisco Networking|

Root Admission to Your Server

The instructions presume that yous take root (Administrator) access to your server. For simplicity I assume you are logging in equally the root user. All of these commands will as well work with sudo. If running sudo from your user business relationship and so make sure to add it when necessary. I will not be using sudo in front end of these command line arguments throughout the document.

Footstep 1 – Install Java

Minecraft Server version 1.12.ii requires Java viii to run. Yous tin can install information technology on Ubuntu every bit follows;

a) Login to your server via ssh or open a console window if this is a Linux Desktop system.

via Linux:   ssh username@your_domain via Windows: Connect using a SSH customer such every bit Putty
      

b) Run the following control

        apt install openjdk-8-jdk  *** Notation: If using these instructions to install later on versions of Minecraft similar 1.xvi and then you lot tin can install Coffee 11 equally follows;      apt install default-jre
      

c) Finally check your version to make sure all went well during install.

        i) java -version  You should run across the following;      openjdk version "i.eight.0_312"     OpenJDK Runtime Environment (build one.8.0_312-8u312-b07-0ubuntu1~18.04-b07)     OpenJDK 64-Scrap Server VM (build 25.312-b07, mixed mode)
      

If after installing you lot even so see a different verison of coffee, run the following command and select
java-8-openjdk-amd64/jre/bin/java

        update-alternatives --config java
      

Step 2 – Setup Your Surround

a) This is a good time to do a full upgrade of your system. If using a Debian based organisation you lot can use apt, otherwise use your distributions package manager.

        apt update && apt -y upgrade
      

b) Install screen (This will be needed to run your minecraft server console while logged out of your Linux server).

        apt install screen
      

Footstep 3 – Download The Forge Installer

a) create the binder

        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 binder.

Y’all should at present have only i jar file in your /opt/minecraft folder.


Tip: If connecting to your server from a Windows based pc, use Filezilla or WinSCP to transfer the files to your Linux server

Pace 4 – Configure your new Modded Minecraft Server

a) run the forge installer file with the –installServer flag.

        java -jar forge-ane.12.ii-fourteen.23.five.2860-installer.jar --installServer
      

This volition take a bit of fourth dimension and will create a 2d file called
forge-ane.12.2-14.23.5.2860.jar.

Now run the newly created forge jar file as follows;

        assuming a server with 2048MB (2GB RAM)         cd /opt/minecraft && java -Xms1024M -Xmx2000M -jar /opt/minecraft/forge-one.12.2-14.23.5.2860.jar nogui
      

*Note: -Xms1024M and -Xmx2000M are parameters telling java to first with 1GB of ram equally a minimum for the server jar file and permit it abound to only under 2GB max every bit needed. If your server has more than ram to dedicate then you tin adjust these numbers. More players and more than mods hateful you need more. These are not constructs unique to Minecraft. Practise a google search on (xms xmx jvm) and you volition get some practiced data on how to manage a JVM’due south heap. From there you tin can make a meliorate determination on what you should ready this to for your servers resources and how you will be using your server.

For instance, on a VPS with 1GB of ram I take prepare xms and xmx to 512M and 1008M respectively. So beginning the JVM with 512MB of ram and let it grow to just under 1GB max.

b) accept the EULA. The commencement time y’all endeavor to run your minecraft server you volition exist required to accept the EULA.

        nano eula.txt
      

c) Modify the following line to true and save the file

        eula=truthful
      

d) copy your mods to the newly created mods binder.

e) Run the server again to generate your world. World generation will take a little longer the showtime fourth dimension. Subsequent server starts will exist much quicker.

Earlier doing this, you lot can download the post-obit server.properties file and replace the one that was created automatically. (or copy/paste directly to your existing server.backdrop file from the console).
This server.properties file will requite you lot a standard survival earth on normal difficulty.

Edit the file with your preferred seed if you take 1 and it will generate the world that y’all specify.
Minecraft Atlas is great site to observe new interesting seeds. Although the site says Minecraft 1.8, the seeds are compatible with one.12.two
View the Wiki for all server.properties configuration options.

        nano server.properties          change the following line with your preferred seed straight after the = sign     level-seed=          If you leave information technology blank Minecraft will generate a random world on beginning launch
      

On a low power organisation you tin can lower the view distance. Start with 10 for your modded server, and suit it downward if you become some lag. If you have enough of CPU and RAM you can increase it likewise.

Popular:   Difference Between Broad Money and Narrow Money

f) brand things a little easier on yourself by using a script to start minecraft

        cd /opt && mkdir scripts     cd scripts     nano minecraft.sh
      

g) Copy and paste the post-obit in your minecraft.sh file

        #!/bin/fustigate     cd /opt/minecraft/ && java -Xms1024M -Xmx2000M -jar /opt/minecraft/forge-1.12.2-xiv.23.5.2860.jar nogui
      

h) Save the file and make information technology executable

        chmod +10 minecraft.sh
      

i) Start your server

        screen <---hit enter at the informational message     /opt/scripts/minecraft.sh          To get out the screen session striking 'CTRL Advertizing'
      

Step 5 – Optional– Configure Minecraft to start on bootup.

a) Add a command to /etc/rc.local to start your Minecraft server everytime the server boots up.

        nano /etc/rc.local
      

Right before the last line ‘exit 0’ add the following command, save and exit the file. This will allow the minecraft server to commencement in a detached screen session when the server boots upwards.

        screen -dm -South minecraft /opt/scripts/minecraft.sh
      


Note: rc.local still works on some Debian derivitaves such as Ubuntu 16.04LTS. On Debian proper and Ubuntu 18.04 LTS, rc.local has been deprecated. To re-enable rc.local you lot can simply re-create /etc/rc.local file as follows;

cd /etc nano rc.local
      

in the rc.local file copy and paste the following

#!/bin/sh screen -dm -Southward minecraft /opt/scripts/minecraft.sh exit 0
      

Save the file and make it executable

chmod +x rc.local
      

If that doesn’t work you may take to re-enable the rc.local service. Use the post-obit set of instructions. Withal this should not be necessary.

Too note that I take not tested this on Ubuntu twenty.04LTS but yous should be able to re-enable rc.local there as well.


b) To access your console subsequently bootup employ the post-obit command;

        screen -r minecraft          To exit the screen session use the post-obit command     CTRL Advertizement
      

Annotation: Some people may question why I am using rc.local instead of an init script to start the minecraft server. I don’t want to run the server in the background, I want a total screen session attainable to view and collaborate with the minecraft server console. If I desire to end the server I want to issue a end command there, not from a script in init.d. Also rc.local is one line and is super easy. It just works well for this situation. I use init scripts for other things and they are great, only this is just a preference I accept for a minecraft server. Practise what works for you lot.

Step half-dozen – Connect to Your Server

If you have made it this far and so I assume you lot take already been playing mods on local single player worlds. Y’all already know how to install mods locally. If non and then just make sure that you lot have the same mods running on your PC that you have installed on your server. Your server and local mods folders should have the same files in them.

If you have friends that desire to join your server they will also need to have the same mods and modernistic versions on their computers. If they need help setting things up you can direct them to the How to Install and Play Mods page.

a) In Minecraft select the Multiplayer push button

b) Click the Add Server button
c) Edit the Server Info as follows (insert the IP address of your Linux server)

d) Enter your earth for the first time and have fun!!!

New Server Image

Step 7 – Hardening Your Minecraft Server if Visible on the Internet

If you desire friends to access the server from outside your home network you will take to frontwards external requests to port 25565 on your router to your server. Check the documentation for your router.

a) If y’all are installing this on a VPS or defended server you will most likely want to enable the firewall with netfilter/iptables. You should be blocking ports that are not used or that you practise non desire to expose to the internet. An example rule for a minecraft server would be as follows;

        /sbin/iptables -A INPUT -p tcp --dport 25565 -m country --state NEW -j Accept
      

This rule says to accept all new tcp parcel requests to the minecraft server listening on port 25565.

To help yous get started delight refer to my article on setting upwards The Linux Five Minute Firewall.


Note:If you lot are not comfortable doing this then a VPS or dedicated server solution may not exist a expert one for you. If you manage a full Linux server continued direct to the internet with a public IP accost, information technology is your responsibility to ensure you are hardening and securing it properly. If this is not something y’all want to exercise then a fully managed solution with a Minecraft server hosting company may be a ameliorate selection for yous. They take care of all the dirty piece of work like this.

b) Activate whitelisting. Information technology is extremely important to activate whitelisting if your server is visible on the internet. Port 25565 is a popular port and is actively scanned by all kinds of people using automated scripts. They are looking for open servers so they tin can login and cause havoc on your world. Whitelisting will finish unauthorized users from joining your globe.
In your server.backdrop set the following value to true;

Popular:   Difference Between Sarcoidosis and Lymphoma

        white-listing=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
      

When an unauthorized user tries to connect to your server they will simply go a message that they are not whitelisted and will exist turned away.

Footstep viii – Fill-in Your Server Frequently

To backup your server do the post-obit;

        login to your server     cd /opt     tar -zcvf minecraft_backup.tar.gz minecraft
      

Copy the minecraft_backup.tar.gz to a condom location, preferably another computer. This file tin be used to restore your earth if needed. Go into the habit of doing this regularly. You lot tin can even employ the cron scheduler to automate the process at a specified time each day as explained in Step 10.

Step 9 – Recovering a Corrupted World

The importance of regular backups cannot be overstated. Information technology happens, you lot try to log into your awesome minecraft earth and you see exception errors only. Or y’all enter the earth and all kinds of things accept disappeared, your sugariness enchanted sword is gone, your diamonds breast is empty. Hours of work and play are at present destroyed. Your world may have corrupted for any number of bug such every bit software problems or disk errors.

If you lot did your backups like nosotros discussed in Step 8 and then you lot are laughing. To restore your previous backup do the following;

Delete your existing minecraft folder      cd /opt     rm -r -f minecraft        copy your previously saved minecraft.tar.gz file to your /opt binder.  restore your world      tar -zxvf minecraft.tar.gz
      

That’s it, restart your server and you take successfully restored from your terminal adept backup. Whatever changes you fabricated since that backup are gone, so it is important to practice your backups regularly.

Step ten – Creating Automatic Backups

These instructions will aid you create automatic backups of your minecraft earth, and so that you don’t have to worry almost remembering. These instructions volition exercise the following;

1) Provide a set up to use script to initiate the backup
2) Configure the cron scheduler to start the backup at 2:02am everyday
3) Name the backup day_of_week-minecraft-.tar.gz

This will create a 7 twenty-four hours rotation of backups with the oldest being overwritten with a new one.

a) Create your script.

        cd /opt/scripts     nano mcbackup.sh
      

b) re-create 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 desire your backups to reside in.


        #!/bin/sh #################################### # # Backup minecraft world to a # specified binder. # ####################################  # What to backup.  Proper noun of minecraft binder in /opt backup_files="minecraft"  # Specify which directory to backup to. # Brand sure yous have enough space to hold 7 days of backups. This # can exist on the server itself, to an external hard drive or mounted network share. # Warning: minecraft worlds can get fairly big so cull your fill-in destination accordingly. dest="/dwelling/username/minecraftbackups"  # Create fill-in archive filename. day=$(date +%A) archive_file="$twenty-four hour period-$backup_files-.tar.gz"  # Fill-in the files using tar. cd /opt && tar zcvf $dest/$archive_file $backup_files
      

c) Save the file by pressing CTRL-X and inbound Y

d) Make the file executable

        chmod +x mcbackup.sh
      

Step 12 e) Test your script. Before creating the scheduled job ensure your script works


        /opt/scripts/mcbackup.sh
      

You should see the backup happening. Once completed open the file information technology created which should exist in the location that you specified. Once you have confirmed that your backup works, create a scheduled task to automate the backups.

f) Create a scheduled chore with the cron scheduler

Make certain you are logged in as root and so that it writes to your root user crontab.

        crontab -e
      

Enter this line at the end of your root crontab and and then salve it.

        02 2 * * * /opt/scripts/mcbackup.sh &> /dev/null
      

This will create your backup every day at 2:02 am. That’s it, in your binder where you specified your backups to be created you volition have the following after i week;


        Monday-mcbackup-.tar.gz Tuesday-mcbackup-.tar.gz Wednesday-mcbackup-.tar.gz Thursday-mcbackup-.tar.gz Friday-mcbackup-.tar.gz Sat-mcbackup-.tar.gz Sunday-mcbackup-.tar.gz
      

Every mean solar day your oldest file will be replaced with the new fill-in giving you a vii mean solar day rotation of backups.

That’due south it! Now have fun! I hope these instructions were helpful and that y’all learned a chip of how a Minecraft server functions.

Donate

If you found these instructions helpful a small donation is appreciated. I volition be keeping these instructions up to date with the latest versions of Forge for 1.12.2.


PayPal


Copyright © 2022 Al Audet

How to Setup a Modded Minecraft Server (1.12.2)

Source: https://linuxnorth.org/minecraft/modded_linux.html