Everything You Need to Build a Game Server on Linux

Affiliate Disclosure: By buying the products we recommend, you help keep the site alive. Read more.


Since its inception, gaming has almost always been more fun with multiple players. Dating back to the Atari 2600 and arcade cabinets, multiplayer gameplay thrived. Once the internet age struck, remote multiplayer became possible with the advent of game servers.

Unlock the "Essential Linux Commands Cheat Sheet" now!

This will sign you up to our newsletter

Enter your Email

With current games, it’s not only possible to connect to servers but even to run one. Whether it’s a Minecraft server, a bout of Counter-Strike, or any of a slew of titles, there’s usually a way to start up a game server. While gaming on Linux might seem like opposites, there’s a nice variety of games available natively on Linux 10+ Windows Games You Could Be Playing on Linux with Steam 10+ Windows Games You Could Be Playing on Linux with Steam If you've been holding onto Windows simply to play your favorite games, let go. Installing SteamOS is now a viable option and the following collection of titles illustrate just what the situation is in 2016. Read More .

Learn about everything you need to build a game server on Linux.

Requirements for Building a Game Server

There’s a misconception that building a game server requires beefy hardware. On the contrary, the you don’t need high-end hardware. However, low spec computers likely won’t yield optimum performance. So that old netbook you have lying around probably isn’t the best choice.

While building a game server on Linux is not terribly difficult, it does mandate some networking and computer familiarity. What you don’t know, you may be able to look up.

Building a Game Server on Linux

Creating a Minecraft Server

Setting up a Minecraft server requires server software from Mojang. Luckily, it’s free to download. A Linux-hosted Minecraft server should function properly on both 32- and 64-bit versions of Linux. However, the Minecraft Gamepedia does suggest that 64-bit iterations may offer increased performance.

We’ll need Java installed to run a Minecraft server. Linux is more compatible 4 Ways to Make Linux Compatible With Even More Software 4 Ways to Make Linux Compatible With Even More Software Read More with Java installed. To check your Java version run the command

java -version

If running this command returns a message similar to “Java not found” then you’ll need to install it. You can install Java on Linux with a number of methods. The easiest on Ubuntu is using using apt-get.

Before installing Java, update the package index:

sudo apt-get update

Next, install Java with the following command. It installs the default Java Development Kit (JDK):

minecraft jdk

sudo apt-get install default-jdk

You may try OpenJDK, but users report more success with the official Oracle Java install.


If you’re running Ubuntu, you may need to run the following package installers to that you can use the



minecraft common prop

apt-get install software-properties-common
apt-get install python-software-properties

Next, add the update the source list, add the PPA, and finally install Java:

sudo apt-add-repository ppa:webupd8team/java

After adding the PPA, perform an update:

sudo apt-get update

Once this update is complete, install Java via the command line:

sudo apt-get install oracle-java8-installer

java 8 minecraft config

You should now have Java installed.


On Debian-based distros, installing Java is a bit different. You need to scan non-free repositories. To accomplish this, add non-free to the /ect/apt/sources.list file.

The actual URL you add this to will vary. For instance, it may read

deb http://http.us.debian.org/debian stable main contrib

Therefore the new URL would be:

deb http://http.us.debian.org/debian stable main contrib non-free

Once you’ve added non-free, update your sources list:

sudo apt-get update

To install Java, run:

sudo apt-get install sun-java7-jre

Arch Linux

Execute the command:

pacman -S jre7-openjdk

Arch Linux ARMv7

On Arch Linux ARMv7, the best means is installing Java from the Oracle download here. Extract this file to /usr/lib/jvm and switch the Java default to:

archlinux-java set jdk1.7.o_60


If you’re using Gentoo, simply run:

emerge virtual/jre

Other Distros

There’s always the download method. Oracle provides download packages for Java that are compatible with most distros. Both 32- and 64-bit packages are available.

Download the Minecraft Server Software

Make a directory for your Minecraft server and change directory into it. Give it a name (“minecraft” is a good choice), then navigate into this directory.

mkdir minecraft
cd minecraft

cd minecraft

Next, fetch the latest iteration of the Minecraft server software:

dl minecraft

wget -O minecraft_server.jar https://s3.amazonaws.com/Minecraft.Download/versions/1.11/minecraft_server.1.11.jar

Alternately, download the latest version of the Minecraft server software from this link. Move the JAR to your desired Minecraft folder. Change directory into it if you haven’t already.

Finally, run the following:

java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui

However, install will fail. We need to first agree to the Eula license. Enter:

nano eula.txt

This opens the eula.txt file. Simply change:

minecraft eula true




Enter the command again:

java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui

Connecting to the Minecraft Server

You can now connect to your freshly installed Minecraft server by running Minecraft. Select Multiplayer. Next give your server a name. Finally, add the address of the machine or your local PC. This will be the IP and the port. By default, the port Minecraft uses is 25565. Thus, the server address would be [IP address]:25565. After that, just click Done.

Now that you’ve installed your Minecraft server, learn how to optimize Minecraft for Linux.

Creating a Steam Game Server

For Counter-Strike and other Steam games, you’ll need a Steam game server. However, creating a Steam game server is a bit different. I used a machine with Ubuntu 16.04 LTS. While a Steam Community post suggests creating a different user account to use as a Steam Server, I simply used my default Ubuntu user account.


The SteamCMD utility allows you to run a Steam server. This tool downloads and installs dedicated servers for Steam games. To download the SteamCMD installer, paste this into the command line:

cd ~
mkdir steamcmd
cd ~/steamcmd
wget http://media.steampowered.com/installer/steamcmd_linux.tar.gz
tar -xvzf steamcmd_linux.tar.gz


Ensure you are in your steamcmd directory. Once you changed into that directory, run:


An installer script and update execute. After that, try logging in. You can simply enter:

login anonymous

You should see a message that you are logged into Steam Public anonymously.

steamcmd terminal

Connecting to Servers

Although SteamCMD is installed, we still need to add dedicated servers. However there are a few intricacies. Namely, if Steam provides a dedicated server and it’s free, then an anonymous login is fine. But certain servers require you to login with a Steam account.

For instance, Team Fortress 2 can be played this way. Haven’t played Team Fortress or it’s been a while? Well, maybe you need to revisit TF2. Yet if Steam offers a dedicated server and it’s not a free provision, you must login with a Steam account. This is like you’re using a Steam client. Counter-Strike servers must be set up this way.

Steam assigns AppIDs for both clients and servers.

Counter-Strike Source

  • Client AppID: 240
  • Server AppID: 232330

Team Fortress 2

  • Client AppID: 440
  • Server AppID: 232250

But what do we actually do with this information? It needs to go in the dedicated folders. Therefore, for a Team Fortress 2 server, the default path will be


To create an installation folder, run:

mkdir tf2-1

There are two methods for installing a game. It you are using an anonymous login, simply enter:

cd ~/steamcmd;~/steamcmd/steamcmd.sh +login anonymous +force_install_dir {install-folder} +app_update {appid} validate +quit;

However, if you’re required to use a Steam ID, instead use:

cd ~/steamcmd;~/steamcmd/steamcmd.sh +login {real-steam-id-here} {steam-id's-password-here} +force_install_dir {install-folder-here} +app_update {appid-here} validate +quit;

Therefore, to install a Team Fortress 2 server, enter this into the command line:

cd ~/steamcmd;~/steamcmd/steamcmd.sh +login anonymous +force_install_dir /home/game-server/tf2-1 +app_update 232250 validate +quit;

Some configuration might be required depending on your set up. You can read more about that here. To start up a game server, navigate into the proper folder and execute it. We’ll look at a Team Fortress 2 example:

cd /home/game-server/tf2-1/;./srcds_run -secure -game tf -nohltv +port 6005 -steamport 6105 +clientport 6205

Other Methods

While the previous examples cover Steam games and Minecraft, those aren’t the only titles you may want to run a server for. Nor are those the only methods of creating a game server on Linux. GameServers.com offers a solid solution. There are paid versions, but I tried a free Counter-Strike: Source server. Check out the free servers available here.

As soon as you claim a server, you’ll receive an email with information on your server. Click the link and follow the instructions (see below). It’s a neat service. Notably, it’s especially useful if you’ve got dated hardware or simply want a separate server.

free game server

Finally, Linux Game Server Managers provides a nifty solution. It’s a fantastic tool that’s compatible with loads of distros. LGSM boasts more than 50 dedicated servers. Plus, it’s open source. The command line tool allows quick deployment of dedicated game servers on Linux. Check out the demo below:

While these are excellent choices, there are loads of Linux game server set up options. Which are you using? Let us know in the comments section below!

Image Credit: Aperture75 via Shutterstock.com

Whatsapp Pinterest

Enjoyed this article? Stay informed by joining our newsletter!

Enter your Email

Leave a Reply

Your email address will not be published. Required fields are marked *

  1. ZentixZaneic
    December 28, 2016 at 4:15 pm

    This works on Bash on Ubuntu on Windows. I tried it, and it worked just like it would on Ubuntu. So if you wanted to let your friends connect, you would still have to port forward, correct?

    • Anthony ojei
      August 29, 2017 at 3:25 pm

      i want to develop game like monopoly game,can can i use only java,pls help