Minecraft Linux

Posted on  by 



The script should run on any Debian based flavor of Linux but since the Minecraft Bedrock server is compiled natively for Ubuntu I recommend sticking with it. If you have a GUI flavor of Ubuntu and a decent PC (= 2 GB of RAM) the server will work just fine on it. You can find the results here:Info:Resolution 1920x1080Linux Driver: Mesa 20.0.0, 10.0.0 LLVMWind. To enjoy Minecraft on Linux, you need working 3D acceleration. You can test 3D acceleration using a popular OpenGL test called glxgears, which is part of the mesa-utils package. First, install the mesa-utils package (it should be in your distribution’s repositories) and then enter “glxgears” in the terminal.

WARNING: Only 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 4? See the Raspberry Pi 4 install documentation.

Minecraft Server Version: 1.12.2
Minecraft Forge 1.12.2-14.23.5.2854
Java Version: OpenJDK version '1.8.0_282'

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

Youtube Channel - UnEssenced
Please support this youtube channel highlighting Hypixel Skywars play.
The speed at which he plays boggles my mind. Take a peek and leave some feedback.


Step 1 - Install Java
Step 2 - Setup Your Environment
Step 3 - Download the Forge Installer file
Step 4 - Configure your new Modded Minecraft Server
Step 5 - Optional-- Configure Minecraft to start on bootup
Step 6 - Connect to Your Server
Step 7 - Hardening Your Minecraft Server if Visible on the Internet
Step 8 - Backup Your Server Frequently
Step 9 - Recovering a Corrupted World
Step 10 - Creating Automatic Backups

Donate Your donations keep this site ad free -- Thank You

Things to consider...

These instructions are for building 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 work for PE or the Better Together version. The modding scene is almost entirely on the Java edition and you will need to be running Minecraft Java on PC (Windows, Linux or Mac) to connect to this server.You will not be able to connect to this with your Xbox or your Ipad or the Microsoft Windows 10 Edition.

Be careful when downloading mods. There are so 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 lead to malware sites. It's a minefield, and for this reason, I highly recommend that you get your mods from CurseForge which uses the Twitch launcher. While Curse have a tonne of mods, they don't have everything. Minecraftforum.net seems fine too to get individual mods. I am sure there a other reputable places, but you are taking your chances.

You will also need the Forge Minecraft launcher to play mods. If you are new to mods, getting an account 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. You need to install Forge (or the Twitch Launcher) for the version you want to play.

Finally, these instructions are for version 1.12.2 of Minecraft. When it comes to mods version matters. There are many great mods at version 1.7.10 for example. No worries though, these instructions should work the same for any version you need. You just need to download the right version of Forge which I will get into later.

Why Linux and Not a Fully Managed Solution?

This is a valid question. A fully managed solution like one offered by the many dedicated Minecraft hosting companies out there can make sense. There is no need to secure the underlying Linux OS, this is all done for you.You get a nice graphical front end to manage your server, automated backups, DNS management to access your server, FTP access. They provide a GUI for managing your mods.

Minecraft

However, if you decide to go with a dedicated setup you can get 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 you may want to build your own;

1 - Maximum control right down to the OS level.
2 - Prefer 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 dedicated server is cheaper than a higher end fully hosted solution.
4 - Have a server available which isn't costing you anything and a good internet link.
5 - Want to learn how to do it yourself from start to finish.
6 - Finally, the most important reason of all.....Because You Can!

Which Linux Distribution?

Recommending a specific Linuxdistribution as 'the best option' is like recommending a religion as the 'bestone to follow'. You will either be preaching to the converted or alienatingthe person you are having the discussion with.

For my purposes I like using Debian and its derivitaves. Specifically I likeUbuntu Server and XUbuntu Desktop LTS versions. However I have used otherdistributions and have liked them as well. This guide uses Ubuntu Server 16.04 LTS using the apt package manager. When a package manager is called for, just substitute the relevant commands for your favorite distro. They are all good.

Root Access to Your Server

The instructions assume that you have root (Administrator) access to your server. For simplicity I assume you are logging in as the root user. All of these commands will also work with sudo. If running sudo from your user account then make sure to add it when necessary. I will not be using sudo in front of these command line arguments throughout the document.

Step 1 - Install Java

Minecraft Server version 1.12.2 requires Java 8 to run. You can install it on Ubuntu as follows;

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

b) Run the following commandc) Finally check your version to make sure all went well during install.If after installing you still see a different verison of java, run the following command and select java-8-openjdk-amd64/jre/bin/java

Step 2 - Setup Your Environment

a) This is a good time to do a full upgrade of your system. If using a Debianbased system you can use apt, otherwise use your distributions packagemanager.b) Install screen (This will be needed to run your minecraft server console while logged out of your Linux server).

Step 3 - Download The Forge Installer

a) create the folder

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.

Linux

You should now have only one 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

Step 4 - Configure your new Modded Minecraft Server

a) run the forge installer file with the --installServer flag.This will take a bit of time and will create a second file called forge-1.12.2-14.23.5.2854.jar.

Now run the newly created forge jar file as follows;

*Note: -Xms1024M and -Xmx2000M are parameters telling java to start with 1GB of ram as a minimum for the server jar file and let it grow to just under 2GB max as needed.If your server has more ram to dedicate then you can adjust these numbers. More players and more mods mean you need more. These are not constructs unique to Minecraft. Do a google search on (xms xmx jvm) and you will get some good information on how to manage a JVM's heap. From there you can make a better determination on what you should set this to for your servers resources and how you will be using your server.

For example, on a VPS with 1GB of ram I have set xms and xmx to 512M and 1008M respectively. So start the JVM with 512MB of ram and let it grow to just under 1GB max.

b) accept the EULA. The first time you try to run your minecraft server you will be required to accept the EULA.c) Change the following line to true and save the filed) 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.
Minecraft Atlas is great site to find new interesting seeds. Although the site says Minecraft 1.8, the seeds are compatible with 1.12.2
View the Wiki for all server.properties configuration options.On a low power system you can lower the view distance. Start with 10 for your modded server,and adjust it downward if you get some lag. If you have plenty of CPU and RAM you can increase it as well.

f) make things a little easier on yourself by using a script to start minecraft g) Copy and paste the following in your minecraft.sh file h) Save the file and make it executablei) Start your server

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.Right 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.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 can simply re-create /etc/rc.local file as follows;in the rc.local file copy and paste the followingSave the file and make it executable

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.

Also note that I have not tested this on Ubuntu 20.04LTS but you should be able to re-enable rc.local there as well.

b) To access your console after bootup use the following command;

Note: 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 wanta full screen session accessible to view and interact with the minecraft server console. If I want to stop the server I want to issue a stop command there, not from a script in init.d. Also rc.local is one lineand is super easy. It just works well for this situation. I use init scripts for other things and they are great, but this is just a preference I have for a minecraft server. Do whatworks for you.

Step 6 - Connect to Your Server

If you have made it this far then I assume you have already been playing mods on local single player worlds. You already know how to install mods locally. If not then just make sure that you have the same mods running on your PCthat you have installed on your server. Your server and local mods folders should have the same files in them.

If you have friends that want to join your server they will also need to have the same mods and mod 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 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 world for the first time and have fun!!!

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

If you want friends to access the server from outside your home network you will have to forward external requests to port 25565 on your router to your server. Check the documentation for your router.

a) If you are installing this on a VPS or dedicated server you will most likely want to enable the firewall with netfilter/iptables. You should be blocking ports that are not used orthat you do not want to expose to the internet. An example rule for a minecraft server would be as follows;This rule says to accept all new tcp packet requests to the minecraft server listening on port 25565.

To help you get started please refer to my article on setting up The Linux Five Minute Firewall.

Note:If you are not comfortable doing this then a VPS or dedicated server solution may not be a good one for you. If you manage a full Linux server connected directly to the internet with a public IP address, it is your responsibility to ensure you are hardening and securing it properly. If this is not something you want to do then a fully managed solution with a Minecraft server hosting company may be a better option for you. They take care of all the dirty work like this.

b) Activate whitelisting. It 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 can login and cause havoc on your world. Whitelisting will stop unauthorized users from joining your world.
In your server.properties set the following value to true;When an unauthorized user tries to connect to your server they will simply get a message that they are not whitelisted and will be turned away.

Step 8 - Backup Your Server Frequently

To backup your server do the following; Copy the minecraft_backup.tar.gz to a safe location, preferably another computer. This file can be used to restore your world if needed. Get into the habit of doing this regularly. You can even use 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. It happens, you try to log into your awesome minecraft world and you see exception errors only. Or you enter the world and all kindsof things have disappeared, your sweet enchanted sword is gone, your diamonds chest is empty. Hours of work and play are now destroyed. Your world may have corrupted for any number of issues such as software problems or disk errors.

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

That'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.

Minecraft Linux Server

Step 10 - Creating Automatic Backups

These instructions will help you create automatic backups of your minecraftworld, so that you don't have to worry about remembering. These instructionswill do the following;

1) Provide a ready 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 day rotation of backups with the oldest being overwrittenwith a new one.

a) Create your script.b) copy and paste this script into your mcbackup.sh file you have open in thenano editor. Change the dest= line to point to the folder you want your backups to reside in.

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

d) Make the file executableStep 12e) Test your script. Before creating the scheduled task ensure your scriptworksYou should see the backup happening. Once completed open the file it createdwhich should be in the location that you specified. Once you have confirmedthat your backup works, create a scheduled task to automate the backups.

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.Enter this line at the end of your root crontab and then save it. This will create your backup every day at 2:02 am. That's it, in your folderwhere you specified your backups to be created you will have the followingafter one week;Every day your oldest file will be replaced with the new backup giving you a sevenday rotation of backups.

That's it! Now have fun! I hope these instructions were helpful and that you learned a bit of how a Minecraft server functions.

Donate

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

PayPal

Copyright © 2021 Al Audet

We’ll install Minecraft on Linux, the most popular indie-game of all time. It immerses the player in a world made of blocks where the player can build, destroy, and mine things! The best part is that it is available on Linux too. You can install it on your desktop PC or if you have a powerful machine, you can set it up on your server as well. This article will cover both the desktop and server installs of Minecraft.

Install Minecraft on Linux

Currently, the official Minecraft Download page has three options for Desktop Linux

  1. .deb file – For installation on Debian/Ubuntu and their derivatives.
  2. AUR Repository – For installation on Arch based distros.
  3. .tar.gz file – For installation on almost any Linux distribution. This archive needs to be extracted. It contains the Minecraft binary itself which can be run directly.

In this article I’ll show you installation only through the 1st option i.e. for Debian/Ubuntu systems.

1. Obtain the .deb file from Minecraft’s official website

The .deb file can be downloaded using the wget command as follows:

This will download a .deb file in your home directory.

Minecraft Linux Edition

2. Install the downloaded .deb file

You can install the .deb file using your distro’s .deb opener by double clicking on the Minecraft.deb or you can use the dpkg command.

3. Run Minecraft

You will find Minecraft now listed as one of the applications. You can launch it as you may launch any other application. You can also run it using the command line by typing minecraft-launcher on the command line.

Install and setup Minecraft on a Debian/Ubuntu server

You might have installed Minecraft on your local PC but you can have a private server for you and your friends exclusively! To play Minecraft as multiplayer you have to purchase a license. But the server edition is free to run and you don’t need to purchase a license for that. Let’s now get going with installing Minecraft on our server.

1. Install Java

Minecraft Server is only compatible with Minecraft: Java Edition. So, to be able to run Minecraft, you need to have JRE (Java Runtime Environment) on which Minecraft can run. Visit here for complete instructions on installing Java on Debian Linux.

Java ( specifically JRE) is provided by the OpenJDK package(Any version of JDK >=8 will do) . You can install it using the apt command

We used headless Java as we do not require GUI, or mouse/keyboard support(which is usually the case for a server). You could also install the normal openjdk-14-jre package.

You can verify the java installation by typing

It should print information like in the above screenshot.

Linux

2. Create a Minecraft user

It’s better to create a separate user for Minecraft from a security perspective. This account cannot be accessed through SSH as it has no password. It can only be accessed by a user with sudo privileges. To add a Minecraft user, use the useradd command as follows

For further steps you need to change into the newly created Minecraft user using the su command.

3. Download Minecraft Server edition

Creating a separate directory for a server is a good idea. That can be done using themkdir command.

As of this writing, the latest version of Minecraft server is 1.16.4. To download the server edition you can go to Minecraft’s official download page.

For Minecraft Server v1.16.4, you can download it using this wget command

5. Configure Minecraft server

Now that the server is downloaded, we need to run the server as it generates configuration files when run for the first time.

Since the server is a .jar file, it has to be run using the java command from the server directory

As can be seen in the screenshot, the server generates some configuration files. The 1st file to change is eula.txt. To accept the EULA, you need to change eula=false to eula=true

You can either use your favorite text editor or get away with a one-liner using the sed command

4. Create systemd unit file for Minecraft

It is convenient to run Minecraft as a service as then systemd manages the headache of starting/restarting the service for us.

You need to create a systemd unit file with your favorite text editor. I’ll be using the nano text editor

Switch back to the sudo user by typing exit. From now on, all commands are to be executed by the user with sudo privileges. Next, create the unit file.

Then, paste the following configuration

Modify the Xmx and Xms flags according to your server resources. The Xmx flag defines the maximum memory allocation pool for a Java Virtual Machine (JVM), while Xms defines the initial memory allocation pool.

Save and exit. And now reload the systemd-daemon

5. Start the Minecraft service

This can be done using the systemctl command

Minecraft

To check the status of the Minecraft service, type

Lastly, enable this service so that Minecraft automatically starts on a reboot.

6. Configure Firewall for Minecraft

Chances are that the Minecraft server will be behind a firewall. To access it from the internet, port 25565 has to be opened.

To allow traffic from port 25565, we use the ufw firewall:

7. Additional Configuration for Minecraft (Optional)

You might have noticed that the server also produces a server.properties file. (You can use the ls command to check). This file provides additional control over your Minecraft world in the form of key-value pairs. Some of the options are:

As you can see, you can change almost every parameter of the game to suit your needs.

Conclusion

Minecraft Linux Crack

Minecraft, being the most popular indie-game, has a very large user base. Installing Minecraft on Linux is a breeze. Though the steps for installing on the server might seem difficult, following the steps in this article will get your server set up in very little time. Further, you can look for utilities such as mcron that allow for easy backups of Minecraft worlds. You can also choose non-vanilla modded Minecraft servers with some bells and whistles like Spigot.





Coments are closed