Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

User:Webb/New linux server: Difference between revisions

From TF2 Classified Wiki
Webb (talk | contribs)
No edit summary
Webb (talk | contribs)
No edit summary
Line 16: Line 16:
* At least 20GB of free storage
* At least 20GB of free storage
* A minimum of a 10Mbps upload speed if you intend on hosting a server over the Internet, more will be needed if you host custom content
* A minimum of a 10Mbps upload speed if you intend on hosting a server over the Internet, more will be needed if you host custom content
* An opened port on your firewall for the server
* ''Optional'': An SSH/SFTP client if doing remote access/file management
* ''Optional'': An SSH/SFTP client if doing remote access/file management
* ''Optional'': A port that's been forwarded for the server if you wish to have it accessible over the internet


<sup>*</sup> This guide was written for and tested on Ubuntu Server 24.04 LTS Minimal. Other distros may use different package names and conventions.
<sup>*</sup> This guide was written for and tested on Ubuntu Server 24.04 LTS Minimal. Other distros may use different package names and conventions.
Line 148: Line 150:
Make sure the server type is set to “Internet and LAN” if you want players outside your LAN to be able to join (you may need to port forward if you’re on consumer broadband or open ports on your firewall).
Make sure the server type is set to “Internet and LAN” if you want players outside your LAN to be able to join (you may need to port forward if you’re on consumer broadband or open ports on your firewall).


Upload the generated ZIP file to your server using SFTP, unzip the folder using:
Upload the generated ZIP file to your server, perhaps using SFTP, and unzip the folder.


<pre>
<pre>
Line 226: Line 228:
# systemctl enable tf2c.service
# systemctl enable tf2c.service
</pre>
</pre>
You may create as many services as you have TF2C servers but remember to name the service files uniquely. When modifying service files, remember to run <code>systemctl daemon-reload</code> before restarting the service.


=== Automatic restarts using crontab ===
=== Automatic restarts using crontab ===


As root, execute <code>crontab -e</code>. This will open a special file in your editor where you can set cronjobs. For example, adding the following line will restart your game server every day at 04:00:
Cron is a program built into most Linux distros that runs scheduled commands.
 
As root, execute <code>crontab -e</code>. This will open a special file in your editor where you can declare what jobs you want to run and when. Let's add a job to run at 04:00 that will restart our server.


<pre>
<pre>
0 4 * * * systemctl restart tf2c.service
0 4 * * * systemctl restart tf2c.service
</pre>
</pre>
You may create as many services as you have TF2C servers but remember to name the service files uniquely, enable them in <code>systemctl</code>, and add them to the <code>crontab</code>. When updating service files, remember to run <code>systemctl daemon-reload</code> before restarting the service.


=== Manually managing services ===
=== Manually managing services ===