How to build a game server on Linux

Current games can not only connect to the server but also run that server. Learn about everything you need to build a Linux server game through the following article.

Since its creation, gaming is almost always more interesting when there are many people playing. The multiplayer game flourished since the Atari 2600. When the Internet became popular, remote multiplayer gaming was possible with the advent of game servers.

Current games can not only connect to the server but also run that server. Whether it's a Minecraft server or any server, there is a way to start that game server. Although playing games on Linux seems to be the opposite, there are still many games available on Linux.

Learn about everything you need to build a Linux server game through the following article.

How to build a game server on Linux

  1. Required to build a game server
  2. Build a game server on Linux
    1. Create a Minecraft server
    2. Download the Minecraft server software
    3. Connect to Minecraft server
  3. Create a Steam Game Server
    1. SteamCMD
    2. Connect to servers
    3. Other methods

Required to build a game server

There is a misconception that building a server game requires strong hardware. In fact, you don't need advanced hardware to build the game server. However, low-spec computers will likely not yield optimal performance. So the old netbook is probably not the best option.

Although building a game server on Linux is not a difficult task, the process is still required to use familiar computers and networks. What you don't know, you can look up later.

Build a game server on Linux

Create a Minecraft server

Setting up Minecraft server requires server software from Mojang. Fortunately, this software can be downloaded for free. Minecraft servers hosted on Linux will work normally on both 32 and 64-bit versions of Linux. However, Gamepedia Minecraft does not suggest that 64-bit versions can bring higher performance.

You will need to install Java to run a Minecraft server. Linux is more compatible with Java installed. To check your Java version, run the command:

 java -version 

If you run this command returns a message similar to " Java not found ", then you will need to install Java. You can install Java on Linux using a number of methods. The easiest way on Ubuntu is to use apt-get.

Before installing Java, update the package index:

 sudo apt-get update 

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

How to build a game server on Linux Picture 1How to build a game server on Linux Picture 1

 sudo apt-get install default-jdk 

You can try OpenJDK, but many users have been more successful with the official Oracle Java installation.

Ubuntu

If you are running Ubuntu, you may need to run the following package installer to be able to use the apt-add-repository command :

How to build a game server on Linux Picture 2How to build a game server on Linux Picture 2

 apt-get install software-properties-common 

apt-get install python-software-properties

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

 sudo apt-add-repository ppa: webupd8team / java 

After adding PPA, please update:

 sudo apt-get update 

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

 sudo apt-get install oracle-java8-installer 

How to build a game server on Linux Picture 3How to build a game server on Linux Picture 3

Now you have successfully installed Java.

Debian

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

The actual URL you added will change. For example, the old URL is:

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

Therefore, the new URL will be:

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

When you have added non-free, update the source 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 way is to install Java from the Oracle download. Extract this file into / usr / lib / jvm and convert the default Java to:

 archlinux-java set jdk1.7.o_60 

Gentoo

If you are using Gentoo, just run:

 emerge virtual / jre 

Other distributions

There is always a download method. Oracle provides download packages for Java that are compatible with most Linux distributions. Available in both 32 and 64-bit packages.

Link download: https://www.java.com/en/download/manual.jsp

Download the Minecraft server software

Create a folder for your Minecraft server and change the directory to it. Name it ("Minecraft" is a good choice), then navigate to this directory.

 mkdir minecraft 

cd minecraft

How to build a game server on Linux Picture 4How to build a game server on Linux Picture 4

Next, find the latest version of Minecraft server software:

How to build a game server on Linux Picture 5How to build a game server on Linux Picture 5

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

If not, download the latest version of the Minecraft server software. Move JAR to your desired Minecraft folder. Switch to that folder, if you haven't done so already.

Finally, run the following command:

 java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui 

However, the installation will not succeed. First of all, you need to agree with the Eula license. Please enter:

 nano eula.txt 

This will open the eula.txt file . Just change:

How to build a game server on Linux Picture 6How to build a game server on Linux Picture 6

 eula = false 

city

 eula = true 

Re-enter the command:

 java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui 

Connect to Minecraft server

You can now connect to your newly installed Minecraft server by running Minecraft. Select Multiplayer. Next name the server. Finally, add the address of the machine or the local computer. This will be IP and port. By default, the Minecraft port is 25565. Therefore, the server address will be [IP address]: 25565 . Then just click Done .

Now that you have completed your Minecraft server installation, then learn how to optimize Minecraft for Linux.

Create a Steam Game Server

For Counter-Strike and other Steam games, you will need a Steam Game Server. However, creating a Steam Game Server is a bit different. The author used a computer with Ubuntu 16.04 LTS. While the Steam Community article suggests creating another user account to use as a Steam server, simply use the default Ubuntu user account.

SteamCMD

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

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

How to build a game server on Linux Picture 7How to build a game server on Linux Picture 7

Make sure you are in the steamcmd folder . Once you have switched to that folder, run:

 ./steamcmd.sh 

An installer and update script will be executed. Then try logging in. You just need to enter:

 login anonymous 

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

How to build a game server on Linux Picture 8How to build a game server on Linux Picture 8

Connect to servers

Although SteamCMD is already installed, you still need to add dedicated servers. However, this is a bit complicated. Specifically, if Steam provides a dedicated server and it's completely free, you can still use an anonymous login. But some servers require you to log in with a Steam account.

For example, Team Fortress 2 can play this way. However, if Steam provides a dedicated server and it is not free, you must log in with a Steam account. This is like you are using a Steam client. The Counter-Strike server must be set up this way.

Steam assigns AppID to both client and server.

Counter-Strike Source

  1. Client AppID: 240
  2. Server AppID: 232330

Team Fortress 2

  1. Client AppID: 440
  2. Server AppID: 232250

But what do you really do with this information? They need to be in specialized directories. Therefore, for Team Fortress 2 server, the default path will be:

 / home / usr / tf2-1 

To create the installation directory, run:

 mkdir tf2-1 

There are two methods to install a game. If you are using anonymous login information, just enter:

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

However, if you are required to use Steam ID, please 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 Team Fortress 2 server, enter the command line:

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

Some configurations may be required, depending on your setup. To start the game server, navigate to the appropriate directory and execute it. Consider Team Fortress 2 example:

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

Other methods

Although the previous examples only include Steam games and Minecraft, these are not the only things you want to run the server. That is not the only method to create a game server on Linux.GameServers.com provides a solid solution to this. There is a paid version, but you can try the free version. Check out the free servers at: https://www.gameservers.com/free/

As soon as you request a server, you will receive an email with information about your server. Click the link and follow the instructions (see picture below). Notably, it is especially useful if you have old hardware or simply want a separate server.

How to build a game server on Linux Picture 9How to build a game server on Linux Picture 9

Finally, Linux Game Server Managers (reference link: https://linuxgsm.com/) provides a convenient solution. It is a great tool compatible with countless Linux distributions. LGSM boasts more than 50 dedicated servers. In addition, it is open source. Command line tool allows fast deployment of dedicated server games on Linux. Please see the demo below:

Although these are great options, there are many other options for setting up game servers for Linux. If you are using such an option, please let us know in the comment section below!

See more:

  1. Build Internet access network using Linux server
  2. 6 best media server software for Linux
  3. Webmin - configure Linux server with a graphical interface
5 ★ | 1 Vote