- Установка сервера Team Fortress 2 на Linux с помощью steamCMD
- Доступы и начальные приготовления
- Создание пользователя в Linux
- Загрузка сервера Team Fortress 2 на Linux через steamCMD
- Создание токена для Team Fortress 2
- Запуск сервера Team Fortress 2
- Конфигурация сервера Team Fortress 2 через файл server.cfg
- Team fortress ��� linux
- Linux dedicated server
- Contents
- Reading this article
- Docker
- Step-By-Step
- Requirements
- Download and install the SteamCMD Tool
- Download the Server
- Creating/Updating server configuration files
- Create a shell script to run the server
- Ports
- IPTables
- Utils
- screen
- Other command line options
- Reboot Persistence
- Using systemd
- Using init
- Using Upstart
- Plugins
- Troubleshooting
Установка сервера Team Fortress 2 на Linux с помощью steamCMD
Доступы и начальные приготовления
Для начала необходимо заказать сервер с перечисленными параметрами. Рекомендуем сделать у нас: «Заказать VPS». В качестве операционной системы используем Debian (или Ubuntu). На дистрибутивах Linux игровые серверы будут работать быстрее, чем на Windows (в подавляющем большинстве случаев все серверы работают на Linux из за его стабильности и меньшем потреблении ресурсов, по сравнения с Windows).
После покупки сервера Вы получите доступы к серверу: логин (root) и пароль. Зайдите на сервер через ssh. Если работаете на windows, то используйте клиент PuTTY. Если вы работаете на дистрибутивах Linux, то откройте консоль и используйте команду «ssh root@ip_адрес_сервера«, чтобы подключиться к серверу с логином root.
После получения доступа к серверу необходимо первым делом выполнить команду для обновления уже установленного программного обеспечения от лица root пользователя и добавить стандартные пакеты: После чего можно приступить к установке 32 разрадной библиотеки, без которой steamcmd не будет работать.
Создание пользователя в Linux
Загрузка сервера Team Fortress 2 на Linux через steamCMD
Создание токена для Team Fortress 2
Запуск сервера Team Fortress 2
Сделаем предварительную небольшую настройку, которая поможет серверу загрузить steamclient.so. Для этого выполним следующие команды: Теперь перейдём в папку с сервером: Создадим скрипт для запуска классического сервера в фоновом режиме. Назовём файл скрипта для запуска сервера «start.sh». Создать этот скрипт можно следующей командой: После создания файла «start.sh» необходимо дать ему права для запуска, используя команду: Всё готово. Можно запускать сервер. Для этого выполним команду: В будущем можно будет использовать эту команду для запуска игрового сервера в фоновом режиме: Но не забудьте, что запускать сервер стоит из-под пользователя «steam», а не из-под «root» .
Чтобы остановить сервер, необходимо убить процесс «hlds_linux». В консоли введите команду «top», появится список запущенных на сервере процессов. В первой колонке, под название «PID» будет стоят уникальный номер процесса. Необходимо найти процесс с значением в последнем столбце «COMMAND» равным «srcds_linux» и убить процесс, используя команду: Где вместо 1234 подставьте PID процесса.
Конфигурация сервера Team Fortress 2 через файл server.cfg
Создадим файл конфигурации сервер с названием «server.cfg» в папке «/home/steam/steamcmd/tf2/tf/cfg/». Теперь откроем файл в текстовом редакторе Nano и вставим в него следующее содержание. Для этого выполним команду: Изменим в содержании файла строку «rcon_password». Зная пароль, указанный в rcon_password, вы сможете отправлять любую команду на сервер, чтобы управлять процессом игры. К примеру, изменять карту или банить пользователей. Также изменим в этом файле название сервера, которое находится напротив «hostname».
Можно запускать сервер и пытаться подключиться к нему из клиента игры по ip адресу, используя команду в консоли клиент «connect 256.256.256.256» (вместо 256.256.256.256 вставьте ip адрес своего сервера).
Источник
Team fortress ��� linux
2,865 | уникальных посетителей |
32 | добавили в избранное |
- Download the Ubuntu 12 iso 32bit [releases.ubuntu.com] or 64bit [releases.ubuntu.com] depending on your PC’s architecture.
- Run VirtualBox and create a new Ubuntu Linux partition (VDI Disk) with a size of 50GB or more (and still have space left for Windows to page with).
Mount the Ubuntu ISO file in the VirtualBox storage settings. To do this, click on Machine, Settings, Storage and then click on the CD icon as in this picture below.
- In Ubuntu, open Firefox and get Steam from the Steam Store page or click here: <ССЫЛКА УДАЛЕНА>http://bit.ly/Z5dRDs.
Open the » <ССЫЛКА УДАЛЕНА>http://bit.ly/Z5dRDs» file that was downloaded and install Steam fully.
Update Ubuntu fully once again: Gear icon -> ‘Updates Available’ -> ‘Check’ -> ‘Install Updates’.
Please note that for this method to work you need to have installed VirtualBoxGuestAdditions and enabled ‘host-to-guest’. a) clipboard sharing and b) drag’n’drop features.
1. After installing TF2 on your Ubuntu Steam, ‘Pause Updating’ and ‘Delete Local Content’.
2. In Windows, navigate to your «Steamapps» folder and copy these GCF files:
Source 2007 Binaries.gcf
Source 2007 Binaries 2.gcf
Source 2007 Shared Materials.gcf
Source 2007 Shared Models.gcf
Source 2007 Shared Sounds.gcf
Source Engine.gcf
Source Materials.gcf
Source Models.gcf
Source Sounds.gcf
Team Fortress 2 Content.gcf
Team Fortress 2 Materials.gcf
3. In Ubuntu, navigate to the «Home» folder in Ubuntu and press CTRL+H to view all hidden files and look for the folder called .steam/steam/SteamApps. Paste those files in there.
4. If you cannot find the files that you copied over, they may be stored in the Ubuntu ‘Home/Documents/VirtualBox Dropped Files’ folder. Make sure to move them to the ‘SteamApps’ folder.
5. You may then need to manually rename and Capitalize The First Letter Of Each Word in those Ubuntu GCF filenames.
6. Run Steam, click ‘Library’ and ‘Install’ TF2.
7. Voila!
Enjoy your shiny new free Tux when you start playing TF2 on Linux for the first time!
Check for the correct filesize (2.3MB) after downloading the file.
Fix: Install Guest Additions and use USB Transfer or Copy and paste from Windows to Ubuntu.
Copy this command line: sudo apt-get install libtxc-dxtn-s2tc0
In Ubuntu, press CTRL+ALT+T to open the terminal window, then right click and paste the command and hit ENTER. Input password to allow it to update the package. Close terminal when its done doing its thing.
Enter these commands in the Ubuntu Terminal, one line at a time.
Источник
Linux dedicated server
This article or section may need to be rewritten entirely to comply with Team Fortress Wiki’s quality standards. You can help. The discussion page may contain suggestions. |
This guide assumes that the reader has a basic understanding of using the Linux command line. |
This is a setup guide that walks you through the installation process of a basic Team Fortress 2 dedicated server on GNU/Linux (x86 or amd64) or a FreeBSD (x86 or amd64) system with Linux compatibility patches running in it’s kernel. In the example below, the server is installed into the user’s home directory in a directory called hlserver .
Basic installation and configuration of a dedicated server is almost the same on most Linux distributions, but small details, such as package names and directories may differ from distribution to distribution. It is recommended that you check your package manager’s repositories for the required packages before continuing.
NOTE: Information about running a server on Windows is often applicable on Linux, for example, files like server.cfg and motd_default.txt are identical between platforms. Check that page for additional details and suggestions. Information on that page and this one may also be useful on other Unix-like platforms.
Contents
Reading this article
This article has been written according to standard Linux terminal documentation syntax, meaning the following:
- A command prefixed by # (a hashtag) is meant to be run as root. Most distributions have a separate root account; for other distributions such as Ubuntu, Linux Mint and Crunchbang, prepending sudo to a command will ensure that the command is run as root. An alternative would be to use the su command to make all following commands run as root, although this is not recommended.
- A command prefixed by $ (a dollar sign) is meant to be run as a regular user without root permissions.
- ./ means current working directory, the directory in which commands entered into the terminal will be executed.
Docker
If your server is running Docker, you can simply use:
The container will automatically update the game on startup, so if there is a game update just restart the container.
The config is located here: /home/steam/tf2-dedicated/tf/cfg
If you want to launch another instance you can increment the environment variables, using -e (—env):
You can find the associated Docker Hub page here: https://hub.docker.com/r/cm2network/tf2/
Step-By-Step
Requirements
A number of requirements exist in order to run a Team Fortress 2 dedicated server on the GNU/Linux platform, namely:
- Write-access to the current working directory
- A version of glibc equal to or newer than 2.3.6.
- Approximately 8GB of free hard-drive space (for a barebones server with no custom maps, sounds, etc).
- If you are following this tutorial on a FreeBSD system, then most of the commands shown here are still applicable, but you must enable Linux compatibility in the kernel and install a base system via the ports collection. Instructions to get you started are located here. WARNING: This guide is outdated. Consider consulting the FreeBSD Handbook or other more recent sources of information.
- In the case of a 64-bit distribution, the package named lib32gcc1 or ia32-libs is required to be installed:
On 64-bit CentOS run: # yum install ncompress libgcc.x86_64 libgcc.i686 glibc.i686 zlib.i686 ncurses-libs.i686 On 64-bit Debian/Ubuntu/Linux Mint run: $ sudo dpkg —add-architecture i386 $ sudo apt-get update $ sudo apt-get install lib32z1 libncurses5:i386 libbz2-1.0:i386 lib32gcc1 lib32stdc++6 libtinfo5:i386 libcurl3-gnutls:i386 For x86_64 Arch Linux run: # pacman -Syy lib32-gcc-libs lib32-libcurl-gnutls (you need to have multilib repositories enabled)
You may also need to install other packages in their 32-bit forms (eg libcurl4-gnutls).
Download and install the SteamCMD Tool
It is recommended you create a separate user (such as «gameserver») to install and run game servers.
- Create an user named «gameserver»
- Create a directory in which SteamCMD will be installed, eg ‘./hlserver’:
- Change the current working directory to hlserver:
- Use the tar command to uncompress the archive into the working directory:
tar zxf steamcmd_linux.tar.gz
Download the Server
- Use this command to download the latest server:
- If you want to opt-in to the pre-release version of the TF2 dedicated server, add the following line:
- You can update the server in the future by executing this command again.
- If you receive the error «Error! App ‘232250’ state is 0x202 after update job.»
» You do not have enough available disk space.
- If you get the error saying /something/linux32/steamcmd — No such file or directory
» You did not install the requirements listed above.
Creating/Updating server configuration files
- Change the current working directory to
- Add the following content into your server.cfg (see Windows dedicated server for more information):
- Edit the files motd.txt, maplist.txt (?), and mapcycle.txt, all found in the ‘
Create a shell script to run the server
- Create a file in ‘./hlserver/tf2.sh’ with the following contents:
- +sv_setsteamaccount is required to be listed; https://steamcommunity.com/dev/managegameservers!
- Make the file named ./tf2.sh executable:
- Run ./tf2.sh to launch the server:
Ports
- Ports used by TF2 & those that need to be opened on your server to allow connection from users outside your local network. See below section on setting up port forwarding.
- UDP 27015 — Main connection port (MUST). This is the port and protocol used by the server browser, allows clients to connect.
- TCP 27015 — This port is used for RCON such as with SourceBans (if needed).
- UDP 27020 — SourceTV (if enabled). You can disable this port by adding «-nohltv» to the start up command.
- UDP 27005 (Optional) — This is an outgoing connection used by clients. Typically you would not need to open this port in your firewall because this is for OUTBOUND connections.
- if you are using AWS EC2, open at least the main inbound port UDP 27015 src 0.0.0.0/0, and add as other ports as needed.
- To see ports used by TF2 and user connecting: $ netstat -a |egrep 270
If UFW is installed you can use the following commands:
IPTables
Firstly, run sudo -i to get a root prompt. Then, enter this (all one line). To leave the root prompt and return to the standard user, just type exit like normal.
CentOS 6.4 (minimal install)
on CentOS 6.4 the default IPTables rules has a reject line as the last entry. This will cause all traffic to be rejected if you append (as the above commands recommend). To fix this I recommend first running the server to determine what ports it uses:
This should output something like this:
The ports listed with the ./srcds_linux name are being used by your server. In this instance port 27015 is using TCP, and ports 26901, 27005, 27015, and 27020 are using UDP. These ports need to be added to the iptables rules so that the firewall will not block access to incoming traffic.
To add them, first you should find out what is currently in your iptables config. You must do all these commands as root. The most secure method of doing this is prepending sudo to each command.
Which should output something like this:
Notice that line 5 says «REJECT all. » This means your server will reject everything. If you choose to append new rules to the iptables, you will still have no success with the server as the rules are followed in the order they appear in iptables. The commands you would like to run (again as root or sudo) are:
This will add the new rules above the reject line. If you look at the commands, they have a section that says «-I INPUT 5,6,7,8,9.» This is telling what to make the rule number for this entry. Each time you add a new rule, you move the reject line down one, so you increment the rule number. You can choose to just keep adding the commands all as «-I INPUT 5». and everything will still work, but I like to keep my iptables nice and orderly. call me OCD. If you wanted, you could delete the REJECT LINE (sudo iptables -D INPUT 5) and re-add it later, but you have to get the syntax correct so it is easier to insert them above. The save will keep your iptables for reboot, and you must restart the service so the new rules are recognized. Your iptables should now look like this:
This should fix your firewall issues.
Utils
screen
Many server operators choose to run the server under screen or similar packages (such as tmux ), as it allows you to switch between the console and the shell at will, as well as end your SSH session without killing the server. It can be installed via your distribution’s package manager. The server can then be run with:
$ screen -m -S tf2 ./srcds_run parameters
Command string example:
$ screen -m -S tf2.MapNameHere -t MapNameHere /home/Username/hlserver/srcds_run -game tf +map MapFileNameHere -maxplayers 32 -autoupdate -steam_dir /home/Username/hlserver/ -steamcmd_script /home/Username/hlserver/tf2_ds.txt +sv_shutdown_timeout_minutes 5 -port 27015 +exec server.cfg +mapcyclefile mapcycle.txt
where parameters is your normal srcds_run parameters. You can use Ctrl + A + D to minimize the console, and screen -r tf2 to bring it back up. Ctrl + D will terminate the session (make sure you use the killserver console command first) and Ctrl + A , followed by Esc will allow you to scroll through it using ↑ and ↓ . See the manual for more commands and parameters.
Other command line options
Some other common command-line options for TF2 are:
- +ip 0.0.0.0 — Bind to a specific IP. By default, listens on all network interfaces
- -port 27015 — Bind to a different port (27015 is the default)
- -secured — VAC secured
- -timeout 0 — Faster server restart on crash
- -strictportbind — If a server is already running on the specified port, stop the server from running
- +randommap — Use instead of +map to select a map at random
- +servercfgfile — Which tf/cfg/ file to execute on map change, defaults to server.cfg
- +mapcyclefile — Which tf/cfg/ file contains this server’s mapcycle, defaults to mapcycle.txt. Will also look in tf/
- -replay — Executes replay.cfg and adds an additional slot for the replay bot, but removes it from the player count.
- -autoupdate — Attempts to auto-update the server when an update comes out. You MUST use -steam_dir and -steamcmd_script
- -steam_dir
/hlserver/ — Location of steamcmd. Required by -autoupdate
-steamcmd_script/hlserver/tf2_ds.txt — SteamCMD script to update this server. Required by -autoupdate
- +sv_shutdown_timeout_minutes 360 — When autoupdating, automatically restart after this many minutes. Defaults to 360 (6 hours).
Reboot Persistence
In the event of unexpected power outages, it might be useful to automatically restart your server.
Using systemd
For systems that use systemd instead of init scripts you need to make a systemd service Make a file in the /etc/systemd/system/ directory, named tf2server.service and put the following text into it:
This should run the shell script at /home/tf2server/hlserver/tf2 at server boot. You can change /home/tf2server/hlserver/tf2.sh in the ExecStart=/bin/sh /home/tf2server/hlserver/tf2.sh line of the tf2server.service to the path your shell script for running the server is. Now only thing left to do is tell systemd to refresh the the *.service files and add the file to the startup:
# systemctl daemon-reload # systemctl enable tf2server.service
After this, the server should start automatically after the system starts.
Using init
NOTE: Most modern systems should be able to use systemd (see above) rather than a system init script. Use these instructions only if you are unable/unwilling to use systemd.
The following example Debian LSB init script can be used to automatically restart the server. Note that screen is used. This script should be named tf2-server and can be put in the folder /etc/init.d. After doing that, run:
$ update-rc.d tf2-server defaults
This should ensure a proper startup of the server after each reboot.
Using Upstart
As above, a systemd script is preferable. But if you’d rather use an upstart script, paste the following into /etc/init/tf2-server.conf
Plugins
Source mod can be installed for administration features like kick, ban, vote, map change. It is a requirement for most other plugins.
Troubleshooting
- [S_API FAIL] SteamAPI_Init() failed; SteamAPI_IsSteamRunning() failed.
» save to ignore. This is just the Steam code looking for, but not finding the Steam client.
- dlopen failed trying to load: /home/ubuntu/.steam/sdk32/steamclient.so
» TF2 server could not locate 32-bit binary. To fix this, run: $ ln -s
/.steam/sdk32 Doing just $ ln will give you an error on most distributions.
- Could not load: replay_srv.so
» Search your package manager for packages named libtinfo5:i386, libncurses5:i386, and libcurl3-gnutls:i386, and install them using sudo apt-get install
- Segmentation fault (core dumped)
» This means your dedicated server has crashed. To help resolve the issue, add -debug to the tf2/srcds_run file. Doing this will generate a file named debug.log, which contains detailed information about the crash.
- My server doesn’t show up in the LAN tab of my client’s server browser OR I cannot access my loadout when playing on this server.
» Are you still able to connect using connect in the Developer Console? » During startup, does your server report the following? » When you connect with your client, does the server say the following? » If so, then both of these problems have the same solution: Make sure you have a steam_appid.txt file containing the number 232250 in your directory. See Running the server, above.
- My server doesn’t auto-update on startup.
» When starting up, does your server say the following? » If so, then you need point srcds_run to the location of your SteamCMD binary, using the -steam_dir argument and to your steamcmd update script using the -steamcmd_script argument. See Other command line options, above.
- My server is stuck at 0/0 during updates
» When an update is running, does the console output the following? » If so, remove the «validate» instruction from the update command.
- My server doesn’t work with rcon and/or refuses to broadcast UDP logs
» Do you have IPv6 or multiple network interfaces? If so, the server will have an existential crisis when trying to perform these, and you’ll need to reassure it by giving it IPs to listen on: » To do this, include +ip 0.0.0.0 on the command-line arguments and add rcon_address 0.0.0.0 to your server.cfg » Note: rcon_address is not exclusively used by rcon, UDP logging will fail without it.
- steamclient.so error — 64bit
dlopen failed trying to load:
/.steam/sdk32/steamclient.so with error:
/.steam/sdk32/steamclient.so: cannot open shared object file: No such file or directory
» save to ignore. This is just the Steam code looking for, but not finding the Steam client. If you want to fix it use:
- Could not load replay_srv.so
» Install packages named mailutils , lib32gcc1 , libstdc++6 , libstdc++6:i386 , and libcurl4-gnutls-dev:i386 using apt, apititute or yum.
- Server fails to start with ./srcds_run line 324 18491 Segmentation fault $HL_CMD
» Run the following 2 commands: yum install libcurl.i686 ln -s /usr/lib/libcurl.so.4 /usr/lib/libcurl-gnutls.so.4
- Assertion error when logging in via SteamCMD or SteamCMD says to check the connection.
If this error occurs on Arch Linux, you may need to run the following command. This may work on other distributions of Linux.
sudo ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
After running the command, restart the machine to ensure that the changes are applied. This error occurs when the resolv.conf isn’t configured.
- SteamCMD still says to check the connection.
Another method of solving this issue is modfying the hosts file. Only do this method if the solution above doesn’t work. This solution may work on other distributions of Linux. However, this solution has only been tested on Arch Linux. For Arch system users may need to run the following:
Источник