Greetings!
So, for all known reasons, you have to spend more time at home in front of the monitor.
In this state of affairs, one has to remember the affairs of bygone days.
As is clear from the title of this article, we will talk about setting up a Synology NAS as a game server.
Attention - there are a lot of screenshots in the article (screenshots are clickable)!
Before we get started, here is a list of the tools we will need:
At the moment (April 2020) there are 105 game servers available on LinuxGSM.
The entire list can be viewed here
The LinuxGSM game server has integration with
Installing Docker on Synology NAS
At this stage, everything is simple, go to the Synology admin panel, then to the “Package centre”, find and install Docker.
package center
We launch and see something like this (I already have this container installed)
Container management
Next, go to the “Registry” tab, type “gameservermanagers” into the search, select the “gameservermanagers/linuxgsm-docker” image and click on the “Download” button.
gameservermanagers/linuxgsm-docker
After that, go to the "Image" tab, wait for the image to finish loading and click on the "Launch" button.
Image download
In the window that opens, go to "Advanced Settings", then to the "Network" tab and check the box "Use the same network as Docker Host".
The rest of the settings, for example, such as "Container Name", we change at our discretion.
Container Name - as you might guess, this is the name of the container, it will come in handy later. I recommend calling it something succinctly, for example, let it be “test”.
Next, click the "Apply" or "Next" button several times until the settings are completed.
Advanced Settings
Go to the “Container” tab and see a new running (if not, start) container.
Here you can stop, start, delete and carry out other actions.
Configuring a LinuxGSM Docker Container
Before you can connect to your Synology NAS via SSH, you need to enable SSH access itself in the admin panel.
Connecting via SSH
Next, you need to use the internal IP address of the Synology NAS server to connect via SSH.
We go to the terminal (or any other analogue, for example, under Windows this
ssh user_name@IP
In my case it looks like this
ssh [email protected]
Synology NAS server IP address
After authorization, you need to execute the command to go to the "test" container itself (the "Container Name" field in the Docker settings) under the "root" user
sudo docker exec -u 0 -it test bash
Connecting to Docker
Before installing "LinuxGSM" you need to take some steps.
Set a password for the "root" user
passwd
Next, update all packages
apt update && apt upgrade && apt autoremove
Waiting for the end of the process...
Updating packages
Next, install the necessary utilities
apt-get install sudo iproute2 netcat nano mc p7zip-rar p7zip-full
Since it is not the best idea to perform different actions under "root", we will add a new user "test".
adduser test
And allow the new user to use "sudo"
usermod -aG sudo test
Switching to the new user "test"
su test
Installing and configuring LinuxGSM
Consider an example of setting up LinuxGSM using the example of "Counter-Strike" aka "CS 1.6"
We go to the page with the instruction "Counter-Strike"
In the "Dependencies" tab, copy the code under "Ubuntu 64-bit".
At the time of writing, this code looks like this:
sudo dpkg --add-architecture i386; sudo apt update; sudo apt install mailutils postfix curl wget file tar bzip2 gzip unzip bsdmainutils python util-linux ca-certificates binutils bc jq tmux lib32gcc1 libstdc++6 lib32stdc++6 steamcmd
Installing dependencies
During the installation process, you must agree to the "Steam License":
Steam License
Go to the "Install" tab, copy the code from the 2nd step (we skip the 1st step, the "test" user already exists):
wget -O linuxgsm.sh https://linuxgsm.sh && chmod +x linuxgsm.sh && bash linuxgsm.sh csserver
Waiting for download:
Download
And we start the installation:
./csserver install
If everything went in the normal mode, we will see the coveted “Install Complete!”
InstallComplete!
We start ... and we see the error "Multiple IP addresses found."
./csserver start
Multiple IP addresses found
Next, you must explicitly tell the server which IP to use.
In my case it is:
192.168.0.166
We go to the folder, the path to which was in the message as "location":
cd /home/test/lgsm/config-lgsm/csserver
And see what files are in this folder:
ls
List of files in csserver folder
Copy the contents of the "_default.cfg" file to the "csserver.cfg" file:
cat _default.cfg >> csserver.cfg
And go to the editing mode of the file "csserver.cfg":
nano csserver.cfg
Editing the csserver.cfg file
Find the string:
ip="0.0.0.0"
And we replace the IP address that was proposed, in my case it is "192.168.0.166".
It will turn out something like this:
ip="192.168.0.166"
We press the key combination:
Ctr + X
And after the offer to save, click:
Y
We return to the folder of the user "test":
cd ~
And try to start the server again. The server should now start without problems:
./csserver start
Server start
To view more detailed information, use the command:
./csserver details
Detailed information about the server
Of the important parameters worth noting:
- Server IP: 192.168.0.166: 27015
- Internet IP: xxx.xx.xxx.xx:27015
- Config file: /home/test/serverfiles/cstrike/csserver.cfg
At this stage, the game server is already available on the local network.
Configuring IP Address Forwarding
Playing on a local network is good, but playing with friends over the Internet is better!
To forward the IP address that the router received from the provider, we use the NAT mechanism.
It is also pertinent to note that most ISPs use dynamic IP addresses for their clients.
For convenience and stability of work, it is desirable to get a static IP address.
Since I have a TP-Link Archer C60 router, I give an example of setting up forwarding, as it is implemented in my router.
For other routers, I assume the forwarding setup is similar.
Everything is simple here - you need to specify forwarding from the external IP address to the internal IP address of the server for two ports:
- 27015
- 27005
In the admin panel of my router it looks like this
Router admin panel
That's all, after saving the router settings, the game server will be available on the network at the external IP address for the specified ports!
Additional settings on the example of CS 1.6
Using CS 1.6 as an example, I would like to give some useful tips.
There are two files for server configuration
The first one is here:
~/lgsm/config-lgsm/csserver/csserver.cfg
The second one is here:
~/serverfiles/cstrike/csserver.cfg
The first file contains general settings such as IP address, map for the first boot of the server, etc.
The second file contains command settings that can be executed through the Counter-Strike console, such as "rcon_password" or "sv_password".
In the second file, I recommend setting a password for connecting to the server via the CVar "sv_password" and setting a password for managing from the server's console via the CVar "rcon_password".
A list of all CVar variables can be found here
Also, most likely there will be a need to install additional cards, for example "fy_pool_day".
All maps for CS 1.6 are here:
~/serverfiles/cstrike/maps
We find the necessary map, upload it directly to the server (if it is in the archive, unzip it), move the file with the ".bsp" extension to the folder with the files "~/serverfiles/cstrike/maps" and reboot the server.
~./csserver restart
By the way, all available server commands can be viewed like this
~./csserver
Сonclusion
I am pleased with the result. Everything works quickly and does not lag.
LinuxGSM has many advanced settings, such as integration with Telegram and Slack for notifications, but some functionality still needs to be improved.
In general, I recommend to use!
Sources of
UPD
As noticed
Source: habr.com