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?

IIS7: What a change

In the next few weeks, I am required to use one of my most scariest server products I have used. IIS. I use to manage a small network that used IIS for hosting internal mail interface and other web based products our company used. Back then, we were running IIS6 on Server 2003 R2, and what a scary machine that was. IIS6 wasn’t very intuitive compared to other Microsoft server products at that time. When you needed to add a site or add a CGI extension, it always felt you had to hack it to get something to work and you never went back to it after it was working.

I was required to install it for a programming class and what a change. For someone that never had proper training on IIS, the new interface has defiantly been improved and is now very intuitive.

To install IIS7 was open Control Panel -> Programs and Features -> “Turn Windows feature on or off”. I checked the “Internet Information Service” in the list and that was it. Windows installed the service without needing the disks.

It was that easy to get the new web server up and running on my local development machine.

IIS7 Main screen
Browsed to http://localhost to make sure my new IIS server was running.

I remember spending hours in the server room trying to get PHP installed on the old IIS6 machine we were running. I thought, I wonder how easy it will be on IIS7? Turns out very easy! Microsoft now has an installation you can download that installs PHP 5.3.13 into your IIS.

A few things need to be done first. Make sure you have installed CGI. Windows does not do this by default.

CGI Installation
Be sure “CGI” is checked.

IIS is now ready for the PHP installation. Go to php.iis.net to download the executable. Once you have it download, run it and follow the on screen instruction.

That is it! You have now installed PHP on your IIS server. Create a phpinfo() file on the root of your web-server to make sure everything is working.

My phpinfo().

If you run into the error “Handler “PHP53_via_FastCGI” has a bad module “FastCgiModule” in its module list” it means CGI is not installed. Go back into Windows Features and check “CGI”.

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/