Gaming Ubuntu Server

Adding mods to your Don’t Starve Together server

Adding mods to your dedicated Don’t Starve Together server on Ubuntu Server can be a little fiddly – to get started you’ll need the mod IDs from the Steam Workshop. Once you have those they need to be added to a file in a specific format.

Open the file below:

vi ~/dontstarvetogether_dedicated_server/mods/dedicated_server_mods_setup.lua

The syntax is explained in the file – as per the files instructions, adding the mod Global Positions looks like this:


You can add as many mods as you need, just add them on a new line each time.

Once this is done you need to configure your mod – create a file called modoverrides.lua in your cluster:

vi ~/.klei/DoNotStarveTogether/Cluster_1/Master/modoverrides.lua

Now add your configuration: if you aren’t sure what needs to be added, try making a local game with the mod enabled and copy from your local game file.

A common mod called Global Positions has a set up similar to this:

return {
  ["workshop-378160973"] = {
    configuration_options = {
      ENABLEPINGS = true,
      FIREOPTIONS = 2,
      OVERRIDEMODE = false,
      SHOWFIREICONS = true,
    enabled = true 

Once you have configured these two files, simply restart your game and the mods should load.

If you want to remove these at any point simply remove the relevant configurations from the files above.

Gaming Ubuntu Server

Set up a Don’t Starve Together server on Ubuntu Server 18.04

In this post we’ll be setting up a dedicated Don’t Starve Together server with Caves on Ubuntu Server 18.04 for use with Windows, Mac and Linux clients. Sadly, neither Playstation nor Xbox players will be able to connect.

If you’re not sure what I’m talking about, maybe check out the Don’t Starve Together pages on the Klei web site.

Klei describes Don’t Starve Together as an uncompromising wilderness survival game, all I know is it’s alot of fun to play with friends.

Like playing the game, setting it up is a lot less stressful once you know what to do…


Before we can begin setting up our game server, we need to install some dependencies:

dpkg --add-architecture i386;

apt install libstdc++6:i386 libgcc1:i386 libcurl4-gnutls-dev:i386 wget screen

New user

Create a new user to install all the relevant game files into – this keeps file management easy and means you can easily remove the installation at a later date if you need to.

adduser dont-starve

Switch to the new user:

su - dont-starve

SteamCMD install

Don’t Starve is downloaded and updated from the Steam platform. To do this we need to install the SteamCMD package.

First let’s make a folder for it to live in:

mkdir -p ~/steamcmd/

cd ~/steamcmd/

Download and unpack the SteamCMD package:

wget ""

tar -xvzf steamcmd_linux.tar.gz

We’re done with SteamCMD for now, head back to the home root:

cd ~

Get cluster token and cluster config

To configure your Don’t Starve Together server you should now head over to the Klei accounts website:

At the bottom of the DST page, you can create a new server:

Creating the Anxiety Hour Don’t Starve together server, Warly’s Kitchen

Once the new server has been created you’ll need to configure it. You can do this manually but it saves you alot of headaches to just use the wizard – click the `Configure` link under your new server key:

For a quick setup, use Klei’s configure wizard initially

Choose some settings that make sense to you, you can always change these at a later date in your config files if you need to.

Once filled in you can download the Zip archive, extract the content, and place the folder `MyDediServer` inside ~/.klei/DoNotStarveTogether/

Startup script

To start your game server you’ll need a startup script – create a new file in your home root:

vi ~/

Drop the following into this file:



function fail()
	echo Error: "$@" >&2
	exit 1

function check_for_file()
	if [ ! -e "$1" ]; then
		fail "Missing file: $1"

cd "$steamcmd_dir" || fail "Missing $steamcmd_dir directory!"

check_for_file ""
check_for_file "$dontstarve_dir/$cluster_name/cluster.ini"
check_for_file "$dontstarve_dir/$cluster_name/cluster_token.txt"
check_for_file "$dontstarve_dir/$cluster_name/Master/server.ini"
check_for_file "$dontstarve_dir/$cluster_name/Caves/server.ini"

./ +force_install_dir "$install_dir" +login anonymous +app_update 343050 +quit

check_for_file "$install_dir/bin"

cd "$install_dir/bin" || fail

run_shared+=(-cluster "$cluster_name")
run_shared+=(-monitor_parent_process $$)

"${run_shared[@]}" -shard Caves  | sed 's/^/Caves:  /' &
"${run_shared[@]}" -shard Master | sed 's/^/Master: /'

Save the file and make it executable:

chmod u+x ~/

Starting your server

If you are staying in your terminal screen while you play, you can simply run the bash script directly:


This will update your server and start it up ready to connect. You’ll see lots of text on the screen as it starts, this is the game console. Be aware that if you close your terminal window or disconnect from SSH you will also close your running game server.

If you want to start your server without entering the console, so you can close your terminal or SSH connection, then use screen like below – where DST is just a easily remembered name for the screen session:

screen -S DST -d -m ~/

To view the game console later, use the following command:

screen -d -r DST

Shutting down your server

From the game console you can shutdown your server using ctrl + c if needed.

NGINX Ubuntu Server

Simple 301 redirect with NGINX

Just a quick post on 301 redirects in NGINX – for a single URL the syntax is pretty easy as it reflects most other location blocks you’ll be setting up anyway:

location /old/path/ {
    return 301;

This is a quick way to ensure old URLs still point to relevant content and you retain some of your PageRank too.

If you have other quick solutions to 301s post them below and I’ll add them to this post.

Apache Ubuntu Server

Enable Apache caching

To enable caching on Apache web server – simply type the following in on the CLI:

a2enmod expires

With this you can now add caching rules to your Virtual Host:

    <FilesMatch "\.(jpg|png|gif|mp4)$">
        ExpiresActive           On
        ExpiresDefault          "access plus 1 year"

    <FilesMatch "\.(css|js)$">
        ExpiresActive           On
        ExpiresDefault          "access plus 1 month"

Your application will need to manage expiring the cached files when things change.

PHP Ubuntu Server

Installing PHP on Ubuntu Server 18.04 for use in LAMP stack

Before doing any work on your Ubuntu Server, it’s a good idea to update your software repositories using:

apt update

Once that has completed, you can install PHP and some of the packages that integrate it into your stack:

apt install php libapache2-mod-php php-mysql

You may also want to just tidy up what files Apache looks for when someone requests a directory:

vi /etc/apache2/mods-enabled/dir.conf

<IfModule mod_dir.c>
    DirectoryIndex index.php index.html

As usual when making changes to apache, you’ll need to restart your service for changes to take affect:

systemctl restart apache2

Ubuntu Server

Quick set up for UFW or Ubuntu Firewall on Ubuntu Server 18.04

A quick and easy firewall is included with Ubuntu Server – it is easy to set up.

Before doing any work on your Ubuntu Server, it is good practice to update your software repositories using:

apt update

Before you start making changes to the firewall, it is a good idea to check its status:

ufw status

You can also list any running applications that have registered a profile with the firewall:

ufw app list

If you access your server via SSH then you need to allow that service before you enable the firewall:

ufw allow OpenSSH

If you are enbling a profile that has spaces in the name, simply wrap your service name in quotes:

ufw allow 'Apache Full'

Once you’re sure you’re happy with the firewall setup, enable your firewall:

ufw enable

You can now see what profiles are active by running:

ufw status

Apache Let's Encrypt Ubuntu Server

Installing Apache with Let’s Encrypt on Ubuntu Server 18.04

Before doing any work on your Ubuntu Server, it is good practice to update your software repositories using:

apt update

It’s also worth creating a document root for your new web sites – I generally create a dedicated folder in the root, with web sites and logs folders within:

mkdir /sites
mkdir /sites/logs
mkdir /sites/

To make life easier, make your web site folder reflect your domain name.

Installing Apache

To install Apache we simply use the apt command:

apt install apache2

Once installed you’ll need to do some configuration.

First of all let’s go to our apache hosts folder & create a .conf file specific to your new web site.

To keep things simple use the same naming convention you have used for the document root – ensure your config file is named with .conf at the end:

cd /etc/apache2/sites-available


Add the following to your file, you may find it easier to edit this beforehand:

<VirtualHost *:80>


    DocumentRoot    /sites/

    ErrorLog        /sites/logs/
    CustomLog       /sites/logs/ combined

    <Directory /sites/>
        Require all granted
        AllowOverride All


The only changes you really need to make at this stage is references to to reflect your web sites name.

Installing Let’s Encrypt

Because the version of Certbot in the Ubuntu repositories can be a little out of date, install directly from the PPA:

add-apt-repository ppa:certbot/certbot

apt install python-certbot-apache

Once installed you can run certbot to get a new certificate – on your first run you will need to enter your email address and opt in/out of some options.


Once you’ve run certbot and got your certificates you can simply check your web site and carry on with your day.

I prefer to tidy up my host files.

Firstly your HTTP config:


<VirtualHost *:80>


    DocumentRoot    /sites/

    RewriteEngine on
    RewriteRule ^{REQUEST_URI} [END,NE,R=permanent]


Secondly your HTTPS config:


<IfModule mod_ssl.c>
    <VirtualHost *:443>


        DocumentRoot            /sites/

        ErrorLog                /sites/logs/
        CustomLog               /sites/logs/ combined

        <Directory /sites/>
            Require all granted
            AllowOverride All

        SSLCertificateFile      /etc/letsencrypt/live/
        SSLCertificateKeyFile   /etc/letsencrypt/live/
        Include                 /etc/letsencrypt/options-ssl-apache.conf


Lastly, just to be sure all is still working, restart Apache:

systemctl reload apache2

Cert renewal

It’s a good idea to test your configuration using the following:

certbot renew --dry-run

When certbot is installed it adds a service to the cron.d so any certificates approaching its end-of-life will get renewed. Let’s Encrypt certificates are valid for 90 days, but the client will automatically renew after 60.

Ubuntu Server

Set up unattended-upgrades on Ubuntu Server 20.04

Setting up your Ubuntu Server to auto upgrade itself is pretty easy and will save you some piece of mind once set up.

As always when you are making changes to your server, make sure to update your software repositories using:

apt update

Once this has completed you can either upgrade any out of date packages or continue with setting up auto-update.

To get started, install the package:

apt install unattended-upgrades

Once complete you will need to configure your system – we’re using VI here but feel free to use your text editor of choice:

vi /etc/apt/apt.conf.d/50unattended-upgrades

By standard unattended-upgrades only installs security updates – I generally leave this so a daily update does affect my system setup.

Find these lines in the file below – in my version they were commented out, uncomment them and set your own preferences:

Unattended-Upgrade::Mail "my@email.address";
Unattended-Upgrade::MailReport "only-on-error";
Unattended-Upgrade::Remove-Unused-Kernel-Packages "true";
Unattended-Upgrade::Remove-New-Unused-Dependencies "true";
Unattended-Upgrade::Remove-Unused-Dependencies "true";

To activate the unattended-upgrades you’ll need to edit a separate file – this one was empty by default for me:

vi /etc/apt/apt.conf.d/20auto-upgrades

Add your own preferences, or simply use the ones I used below – the values equate to days:

APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Download-Upgradeable-Packages "1";
APT::Periodic::AutocleanInterval "7";
APT::Periodic::Unattended-Upgrade "1";

You can test your unattended-upgrades by running the following:

unattended-upgrades --dry-run --debug