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?

Installing MyBB 1.8.12 on Ubuntu Server

In the following tutorial I will explain how to install MyBB 1.8.12 on Ubuntu Server. I will be doing this from the command line so no GUI needed.

  1. Download the MyBB package. You will want to get the latest version of MyBB.
  2. wget --content-disposition https://www.mybb.com/download/latest -O mybb.zip
  3. By default Ubuntu does not come with unzip. Install that now.
  4. sudo apt install unzip
  5. Unzip the MyBB zip file
  6. unzip mybb.zip

    2 folders should now be in your present working directory. Unload and Documentation.

  7. Install LAMP (Linux, Apache2, PHP and MySQL) Restart Apache after
  8. sudo apt install apache2 mysql-server php-mysql php libapache2-mod-php php-mcrypt
    sudo systemctl restart apache2

    This install will ask to create a root password for the MySQL database.

  9. Move MyBB files to the server folder
  10. cd /var/www/
    sudo mkdir mybb/
    mv ~/Upload/* /var/www/html/mybb/

    You should now see all the files in the www/mybb directory.

  11. Rename the inc/config.default.php
  12. sudo mv inc/config.default.php inc/config.php
  13. Now change permissions on the following files and directories
  14. sudo chmod 666 inc/config.php inc/settings.php inc/languages/english/*.php inc/languages/english/admin/*.php
    sudo chmod 777 cache/ cache/themes/ uploads/ uploads/avatars/ admin/backups/
  15. Login to MySQL and create Database.
  16. mysql -u root -p

    Enter the password that was create for MySQL.
    Now create the database and a user to have access to this database only.

    create database MyBB;
    grant all privileges on MyBB.* to 'MyBB'@'localhost' identified by "S0mePassw0rd";
    flush privileges;
  17. Browse to the install page.
  18. You can now follow the step by step installer. Be sure to specify the database credentials you create above. Do not use the root account.

Go to your main web URL and you should see your new forum ready to go! If you have any questions please leave them below.

Installing VirtualBox Guest Addition Ubuntu Server 14.04.3

Because my office is currently under construction I didn’t have access to my primary desktop machine that runs VMware Workstation. I needed to spin up a Ubuntu Server box to do some testing. It has been a few years since running VirtualBox but I decided to give it a go on my Mac Book Pro.

Installing VirtualBox is straight forward. Follow the on screen steps and you should be up and running. I setup a new VM with the minimum requirements for Ubuntu Server 14.04.3 LTS. All of my Digital Ocean servers run Ubuntu Server 14.04 LTS so I figured I would stick with that.

After installing and updating the new machine, I need to install the guest additions.

  1. Install the required build tools and dependancies.
  2. sudo apt install -y dkms build-essential linux-headers-generic linux-headers-$(uname -r)
  3. Restart VM.
  4. sudo shutdown -r now
  5. Mount the Guest Additions CD from the VirtualBox Menu.
  6. Devices -> Insert Guest Additions CD image

  7. Mount the CD in Ubuntu Server
  8. sudo mount /dev/cdrom /media/cdrom
  9. Change directory to CD
  10. cd /media/cdrom
  11. Guest Additions can now be installed
  12. sudo ./VBoxLinuxAdditions.run

    Ubuntu Server will give you an error about not finding X.org. Don’t worry about it. Guest additions get install anyways.

Restart the VM and that is it! VirtualBox Guest Additions have now been installed.

If you have any questions please let me know below!

Sprinkler Project

Final received my first Raspberry Pi. I have had an idea for years about what I wanted to do with one. Automated sprinkler system. 2 summers in a row my lawn has burnt to a frazzle. I have dealt with automated sprinklers before so why not build my own system!

What is needed:

  1. RaspberryPi
  2. Relay Board
  3. Water Valve
  4. 24 V AC transformer
  5. 1 LED (Yellow)
  6. 1 Locking switch

In this project, I started off with a Cana-Kit Raspberry Pi Ultimate Starter Kit. My dad had a 4 channel relay board he purchased for an Arduino project he was going to build but never started. So I borrowed that from him. You can find one here.

I also purchased an Orbit water valve for an in-ground sprinkler system. I used this one right here. I also found some adapters to connect this valve to a regular garden hose as I will not be burring the water line.

For power, these water valves normally run on 24V AC. To get this project going, I purchased a simple doorbell transform although I would recommend getting the correct 24V AC sprinkler transformer. (I will explain why later)


Because this was my first Raspberry Pi project, I started by wiring the breakout board to 4 LEDs instead of going directly to the relays. This posed a problem later on so I would suggest wiring directly to your relay board.

The relay board uses a positive voltage coming from the GPIO pins to keep the relay open. When the voltage is removed the relay will then close. This is backwards to what is required for the LEDs but because I was an n00b with this, I scratched my head for a while.

I added an LED for a status indicator. This flashes differently based on different triggers. For example: if the cancel button is pressed then flash the LED or if the rain sensor is tripped leave the LED on until the sensor is no longer wet. This also halts the main loop until these trips are cleared.

Here is how the GPIO is wired to the Raspberry Pi:

Description GPIO IN/OUT
Zone 1 (Relay) 17 Out
Zone 2 (Relay) 27 Out
Zone 3 (Relay) 22 Out
Zone 4 (Relay) 23 Out
Water Sensor 18 In
Cancel Button 4 In
Status LED 12 Out

I had a 2″ x 4″ lying around so I used that to screw all the components to for now. I added a 120V wall switch and outlet. The 24V transformer and the outlet are both wired to the switch. The Raspberry Pi is plugged into the outlet. I have a 3 conductor power cord so I used that to feed power to the switch. Be careful with 120V wiring. You can cause yourself and your project serious damage. Consult a professional if you are unsure.

The output of the transformer is wired to one side of the relay. I added a heavy gauge wire between the relays. I highly suggest you test the posts on the relays before connecting the 24V AC. The other side of the transformer can be connected to the Orbit valve. The second wire from the valve can be connected to the first zone. Please see the photo below.

The great part about this relay bank is the LED indicators. We can create the program without having all the water valves. I would also suggest leaving the 24v transformer off while developing the code.


I decided to write the code in Python. I had some experience writing Python code before but it was a few years back. The basics of this program are straightforward. We want to water each zone individually for a set amount of time. In my area, I have low water pressure so I only want to water one zone at a time. There is also a bylaw only allowing homeowners to water on an odd or even day of the week.

I also wanted the ability to log when each zone is triggered, when the water sensor has tripped and when the cancel but has been pressed. For this, I decided to use a MySQL database. The reason I chose this is that I already have MySQL running on my server in the basement. It handles my home Kodi environment. Setting up the database was simple. Create a new database and then create the one table we need right now. We could always add more later. See the SQL commands below to create the table.

logID int NOT NULL auto_increment,
zone varchar(25),
logTime datetime DEFAULT NOW(),
description varchar(200) NOT null,

I am currently not doing anything with the logged data but maybe someday we will have reports.

Here is the main Python code. The script runs when the Raspberry Pi boots. You can accomplish this with Cron.

GitHub Page

You will need to make changes to your setup. The database function may not be required for you. You can find that in the dbLog function. I would suggest if this is your first project build your code from scratch. It’s the only way to learn.


I haven’t added “water” to this project yet. I am hoping to find some cheap hose I can cut up and make a few short runs. Next year I may add another 3 watering zones.

One problem I did notice, using the doorbell transformer, is the amount of heat it generates. I do suggest getting the proper transformer for these Orbit valves. If you’re running multiple valves at the same time I would look at the Orbit transformer.

I will continue to create more Blog posts when I update this project. I am already starting to think about Christmas lights!

If you have any questions, please leave them below.