Deploying TeamSpeak 3 on Ubuntu 22.04

Discord has pretty much replaced Teamspeak, but there are still some good use cases for the product. I decided to roll a server out to play Minecraft with my son. He’s young, so I didn’t want to have to create a Discord account. Plus, if some company has any of his info, it should be up to him when he is older.

This brought me to the idea of rolling out a TS3 server. I had done it many years ago during my World of Warcraft days. It turns out the installation continues to be simple.

You can rent a VPS from Digital Ocean or do what I did and roll my own in Proxmox. I started with a fresh Container on Ubuntu 22.04 LTS. I won’t go over the setup of Ubuntu Server, but I will have a tutorial on how I do it coming soon.

Start by SSHing into your server. The first thing is to create a new user for Teamspeak service to run on.

sudo adduser --disabled-login teamspeak

Be sure to specify the --disabled-login account so it cannot be logged into locally or remotely.

Using our current user, log in as the teamspeak user.

su - teamspeak

You will also want to download the Teamspeak 3 server software from here. Be sure to download the 64-bit version under the Linux header.

Once downloaded, upload the file to the Ubuntu server with scp or the FileZilla client. You can also use wget to download it directly onto the server.

wget https://files.teamspeak-services.com/releases/server/3.13.7/teamspeak3-server_linux_amd64-3.13.7.tar.bz2

Next, we need to extract the contents of the tar file.

tar -xvfj teamspeak3-server_linux_amd64-3.13.7.tar.bz2

Copy the new directory and move it to the users home directory.

cp teamspeak3-server_linux_amd64/* -R /home/teamspeak/

Now that the files are in place, accept the license agreement by creating this file.

touch .ts3server_license_accepted

Type exit to leave the teamspeak users prompt and return to our account.

We must tell our Ubuntu Server how to start and stop the Teamspeak service. We will create a config file so systemd knows how to do this.

We will use nano as our text editor, you can use anything you are comfortable with.

sudo nano /lib/systemd/system/ts3server.service

Paste in the code below. If you used a different account name, you may need to adjust the folder names.

[Unit]
Description=Teamspeak Service
Wants=network.target

[Service]
WorkingDirectory=/home/teamspeak
User=teamspeak
ExecStart=/home/teamspeak/ts3server_minimal_runscript.sh
ExecStop=/home/teamspeak/ts3server_startscript.sh stop
ExecReload=/home/teamspeak/ts3server_startscript.sh restart
Restart=always
RestartSec=15

[Install]
WantedBy=multi-user.target

Save and close the file. You can press Ctrl + x and follow the prompts.

Reload systemd so it picks up this new config.

sudo systemctl daemon-reload

Add the service and start it now.

sudo systemctl enable --now ts3server

Check the status of it and grab the token code, too. You will need this token code to administer the server from the Teamspeak client.

sudo systemctl status ts3server

Firewall

Add rules to the firewall to allow the traffic through.

sudo ufw allow 3033/tcp
sudo ufw allow 9987/udp
sudo ufw allow 1011/tcp

That is it! The Teamspeak 3 server is up and running. It really doesn’t take that long if you’re familiar with bash. If you have any issues or questions, please click here to join the Discord server.

NTP Client Setup – Ubuntu 22.04

The following tutorial will cover how to enable the NTP client on Ubuntu. When working with Linux servers, the system time must be accurate. The best way to do that is by using the Network Time Protocol.

The first step is to install the NTP client.

sudo apt install ntp

Before we begin configuration, let’s back up the default NTP client config. We will use today’s date in the command.

sudo cp --archive /etc/ntp.conf /etc/ntp.conf-COPY-$(date +"%Y%m%d%H%M%S")

Open the config file using your favourite text editor. In my case, I will be using nano.

sudo nano /etc/ntp.conf

The first thing we want to do is comment out the current servers that ships with Ubuntu. Add a # in front of all the “pool” lines.

Head to NTP Pool and find the closest pool address to your machine. In my case, I am in Canada, so I’m going to add the following to the bottom of my ntp.conf file.

You can do this all in one command if you would like.

sudo sed -i -r -e "s/^((server|pool).*)/# \1         # commented by $(whoami) on $(date +"%Y-%m-%d @ %H:%M:%S")/" /etc/ntp.conf
echo -e "\npool ca.pool.ntp.org iburst         # added by $(whoami) on $(date +"%Y-%m-%d @ %H:%M:%S")" | sudo tee -a /etc/ntp.conf

We will restart the NTP client service once you have saved and closed the config file.

sudo service ntp restart

Let’s check to see if the service is running.

sudo ntpq -p

The following output should show.

Output of the ntpq command. This is showing the list of server NTP is getting time from.

That’s it! Your box will always get its time from the ntp pool; no more out-of-sync log files.

This tutorial was found in the How-To-Secure-A-Linux-Server GitHub repository. If you have any questions, please drop a comment below.

Deploying a Discord bot in Docker

A few months back I did a video on Fusion Terror’s YouTube channel. Fusion has actually been a summer student at my current place of employment for the last year. I had mentioned a few times how easy it is to get Node working in a Docker container.

I asked him if his audience would be interested in this type of content and he said yes! Away I went to film my first YouTube video.

Took me an entire morning to get things right but here is the final product.

If you want to code from this video, you can subscribe to his Patreon here.

I keep reflecting back on this and thinking about all the other ideas I have for videos. Maybe it’s time to start my own thing?

Linux Mounting Partitions

Most Linux distribution include auto mounting for different file system types. Specific distributions, you need to mound some file systems your self. The following commands will allow you to mount different file system types.

To list all partitions attached to the system, use the following commands.

fdisk -l

First thing, create a mount point for this new file system.

mkdir /media/drive

You can create this folder anywhere on the system. Most distributions mount all drives to /media.

Mounting FAT or FAT32:

mount -t vfat /dev/sdb1 /media/drive/

Mounting NTFS:

mount -t ntfs-3g /dev/sdb1 /media/drive/

Un-mounting the drive:

umount /media/drive/

Synergy with Ubuntu & Windows

Synergy let you share a single mouse and keyboard across multiple computers. In the following example, thewall is going to have our server and laptopnew is going to be our second computer. thewall, is to the right of laptopnew. thewall is also our linux box running Linux Mint (gnome). laptopnew is running Windows 7 x64.

First thing we need to do is install Synergy on our two machines. On the linux box run:

sudo aptitude install synergy

Next we need to install Synergy on our second computer. The version of Synergy in the Ubuntu repos is version 1.3 so we need to install that version. Click here for the download list.

Once you have it installed on both machines we need to create our configuration file. The following is an example of my configuration file.

gedit ~/.synergy

Configuration file:

section: screens
thewall:
laptopnew:
end

section: aliases
laptopnew:
192.168.1.24
end

section: links
thewall:
left = laptopnew
laptopnew:
right = thewall
end

section: options
screenSaverSync = false

end

For this to work correctly you must use the hostnames of both machines. Now we can open a terminal and run:

synergys

This will start the server; next we want to hit the start button on the client. You should now be able to move your mouse between the two computers! Synergy also allows you to copy and paste (text only) between the machines.

To get the synergy server to run on startup we can just add it to the gnome startup. Menu -> Preferences -> Start Up Applications.

The next time you reboot Synergy should start automatically. That concludes this tutorial, if you have any questions or comments please leave them below.