Steam Game Server

Jarret B

Well-Known Member
Staff member
Joined
May 22, 2017
Messages
339
Reaction score
369
Credits
11,689
Quite a few people use Steam to play games. Sometimes, some people may want to play a multi-player game with only immediate family. This article can help you create your own server to use.

By having your own server, you can use all the resources for yourself and not share them with other players (other than those in your house). The better hardware you use, the better the game can be. Also, there is no sharing of the server bandwidth by other players that aren’t in the game (playing other games).

There are two ways to manage setting up a server. Let’s look at the easier one first.

Linux Game Server Manager (Linux-GSM)

The Game Server Manager is a script that controls all the aspects of installing, starting and stopping the Steam game server.

NOTE: We can consider that each game you install its own server. We can run multiple games on one server at the same time. With more games running, we share the hardware resources among the games. If you want multiple games on the system, you just follow the steps for installing each game, one at a time.

Once we start a game, players can connect to the server and play together. If only one player connects, then they are alone in the game world.

Setting up the Game Server

A game server should have a fairly decent hardware specs, especially if you expect a lot of players or multiple games running at once.

For the system I used, I started with a Dell OptiPlex 7010 SFF. The basic specs are:
  • Quad core Intel i5-3475S
  • RAM: 8 GB
  • Storage: 500 GB
  • GPU: GeForce GTX 1650 Low Profile
  • Ethernet: 1Gb/s (no Wi-Fi)
I have this system hard-wired to my network router to allow access from all systems on my network, whether hard-wired or Wi-Fi, but I find better performance with a physical connection.

Install Linux

I downloaded Lubuntu 20.04.4 ISO from here. After downloading it, I burned it to a USB to use to boot my system from it.

Once the system loads on the Game Server, make sure the ‘Try It’ Operating System (OS) has the network connection enabled. Internet access is necessary for upgrading the system as well as downloading the Game Manager.

Go through installing Lubuntu to the local hard disk. Settings should be fine as defaults.

NOTE: I chose Lubuntu since it uses fewer resources than other distros. The reason is that there are more resources available for the Game Server to provide to players.

Once you have installed Lubuntu, open a terminal and execute the following commands:

Code:
sudo apt update
sudo apt upgrade -y
sudo apt install curl -y
sudo apt autoremove

Reboot to verify that all updates are have taken effect and are running.

Everything should be ready to set up the actual game services.

Install Linux-GSM

The first thing to do is to download the Linux-GSM script files, which are found at linuxgsm.com. The direct download is here.

Once you have downloaded the compressed file, you need to extract it within your Home Folder. It will create a folder named ‘LinuxGSM-master’. All the files and folders will be within the main folder.

In a terminal, make sure it’s maximized, go to the ‘LinuxGSM-master’ folder and perform the following commands:

Code:
sudo chmod +x ~/LinuxGSM-master/lgsm/functions/*.sh
./linuxgsm.sh install

NOTE: It is important to maximize the terminal whenever you are executing the ‘linuxgsm.sh’ script. It creates a menu of the games and some are not visible in a smaller window.

Choose the game you want to install for the server. For example, it lists ‘cod4server’ as the ‘Call of Duty 4’ game. Realize that this is not the playable game you are downloading. What you are downloading is a server version that allows steam systems to connect to it and play a multi-player game together.

The installation process will continue and create a script called ‘cod4server’. The name is based on the game you select from the list.

If you run the file within the ‘LinuxGSM-master’ folder, the script installs the games in that folder. Let’s assume I want to place the game in a folder called ‘cod4’ in my Home Folder. Here’s how that is done:

Code:
cd ~
mkdir cod4
cd cod4
~/LinuxGSM-master/cod4server install

Your chosen game installation should now start. The first thing it will ask is if the present folder is where you want to install the game. It should list the present folder in this case as ‘~/cod4’. Just press enter to set the specified folder as the installation folder. If you answer ‘N’, then the script quits.

The script will check for dependencies. If any dependencies need installed, the script prompts for the password for elevated privileges.

Every game requires the same basic set of dependencies and there are a few that require an extra special package or two to be installed. The script will check that the dependencies are present. After the system has met all dependencies, the system will connect to a Steam Server and download the files for your specified game. Once downloaded and setup, it should notify you that the installation was successful. The final question posed to you will be if the install was successful. Answer accordingly to the messages you received.

The final question is whether you want to allow for anonymous statistics to be sent for the game. Just answer ‘Y’ or ‘N’ and press enter.

The final message is to run the script with the parameter ‘start’ to start the game server. If I use the command ‘cod4server’ with no parameters, I get a message similar to Figure 1.

Figure 1.jpg

FIGURE 1

Notice that there is a parameter for updating (ul). If the players cannot connect to the server and the game is running, then you may need to update the game files on the server (cod4server ul). The versions must match between the server and clients.

The server is not running, so to start it, type in ‘cod4server start’.

If you want to see the connected users and messages between the players, use the command ‘cod4server c’ to see the console.

Most of these parameters should be self-explanatory.

For my kids, I installed ‘Unturned’ to test. It required them to select ‘Play’, then ‘Servers’ and finally ‘LAN’ when the game started. After they chose the LAN, the local server appeared for them to select. After selecting ‘OK’, the game started, and they were playing together in the same world.

This is the basics for setting up a Steam Game Server. If you check the documentation for the game, you can find specific configurations you can make to change the game a bit. You can set the number of MaxPlayers, etc.

SteamCMD

The second method of installing games is a little more complicated. I will use the game ‘7 Days to Die’ as the example installation.

NOTE: The install may not be as difficult, but has less ease than using the GSM scripts.

To start, you need to check for the ID of the app (AppID) of the game you want to install. Two sites that allow this are https://developer.valvesoftware.com/wiki/Dedicated_Servers_List and https://steamdb.info/apps/.

Either of these sites can provide an AppID for the game server you want to make. Once you have found the game you want, make a note of the AppID. The current AppID for ‘7 Days to Die’ is 294420. The AppIDs can change if they release a newer version, or the game is no longer an alpha or beta release.

After you install your OS and updated the software, you need to install the program ‘SteamCMD’ and ‘lib32gcc1’ with the command:

Code:
sudo apt install steamcmd lib32gcc1 -y

During the installation, the system prompts you to accept the License Agreement. Use the TAB key to highlight ‘OK’, then press Enter. Arrow down to ‘I Agree’ and press Enter. Installation should continue and finish.

You will need to find the IP Address for your game server. While in the terminal, use the command ‘ip a’ to get the address of the LAN Connection you will be using. Make note of this address.

When the terminal gets back to the prompt, type ‘steamcmd’ and press Enter.

The program should connect to the Internet and download any necessary updates it requires. When it completes, it leaves you at a ‘steam’ prompt. You are now in the SteamCMD Application Programming Interface (API).

The first thing you need to do at the ‘steam’ prompt when installing a new game server is to set the folder that will contain the game server files. To set the folder, the folder needs to exist and be accessible by the current user. The folder needs to be specified with an absolute path, no shortcuts such as the tilde (~). For my example, I use the folder path ‘/home/jarret/7days/’.

The command at the ‘steam’ prompt is ‘force_install_dir <folder>’. The command I would execute is ‘force_install_dir /home/jarret/7days/’.

After we set the installation folder, you need to login to the Steam Server from the API. In most cases, you can login anonymously with the command ‘login anonymous’. If a game requires you to login, you need to create an account and login with the command ‘login <username> <password>’.

The next step is to perform the install/update. If we have not installed the game, the command will install it, but if the game exists, then the program updates it if needed. The command is ‘app_update <AppID>’. So, my command is ‘app_update 294420’ to install ‘7 Days to Die’. If, during the initial install, an update exists, then the program downloads it as well.

You can type ‘exit’ and press Enter to leave the SteamCMD API.

We can issue SteamCMD commands from the regular terminal prompt by chaining them with a plus sign (+). for instance, to check the games installed, you can use the command ‘apps_installed. My chained command would be ‘steamcmd +apps_installed +quit’. The command would start steamcmd, issue the ‘apps_installed’ command and exit the API. To install the above game with a chained command would be ‘steamcmd +app_update 294420 +quit’.

If you go into the specified folder that was set as the installation folder, there should be a file with the name ‘serverconfig.xml’. This folder contains any settings for the game. If you change the file, set them in the ‘value=’ section at the end of the line. The following are the first three lines as an example:

<property name="ServerName" value="7Days Server"/> <!-- Whatever you want the name of the server to be. -->
<property name="ServerDescription" value="Jarret’s 7 Days to Die Server"/> <!-- Whatever you want the server description to be, will be shown in the server browser. →
<property name="ServerWebsiteURL" value=""/> <!-- Website URL for the server, will be shown in the serverbrowser as a clickable link -->


There are pages of settings for modifying game play. Each game will provide a different xml file. It may be a best practice to make a backup of the ‘generic’ file with its basic settings if it’s needed to restore the file and start over. We can make multiple settings files since each time you start the server, you specify which file to load.

When you choose a game to create a Steam Server, there is usually a link for the game when you find the AppID. For my example, I found the link ‘https://developer.valvesoftware.com/wiki/7_Days_to_Die_Dedicated_Server’. Opening this link shows basic settings for the xml file. Here, you may notice that it specifies a Port for the XML to access the game server. The default Port is ‘26900’. To open the Port on the Game Server, use the command in a terminal:

Code:
sudo ufw allow 26900
sudo systemctl restart ufw

To start the server, go in a terminal and change to the game installation folder. In my case. It would be ‘/home/jarret/7days/’. From here, I would then start the server using the ‘serverconfig.xml’ file with the command:

Code:
./startserver.sh -configfile=serverconfig.xml

The server should start, but the program is holding the terminal open and you will not see a prompt. To stop the server and get back to a prompt, press ‘CTRL+A’ then ‘CTRL+D’.

On a client system within the Steam App, start ‘7 Days to Die’. Select the Option to ‘Join a Game’. Click on ‘Search’ and select ‘Connect to IP’. Enter the IP Address of your game server that you noted earlier. The Port should be the default of ‘26900’ unless you changed it in the XML file. Select the game server it lists and click on ‘Join’. You can now play the world created by your game server.

Internet Usage

You can open a port on your router and set up Port Forwarding to your Game Server to allow people outside your personal Local Area Network (LAN) or Wi-Fi to access your server.

I will not go into setting up Port Forwarding here, but there are many instructions on the Internet to set it up.

Conclusion

I hope this method of making a Steam Server comes in handy for some of you. It is an easy way to set up a server for you and any players you have locally or otherwise. You can then have a private game for only your friends.

Not only can you set up your own world, but set your settings as you like. Change any game settings as you see fit to customize your gaming experience.

Happy gaming!
 

Members online


Top