Linux

How to set up a self-hosted speed test server on Ubuntu Linux

This is a self-hosted lightweight speed test implemented in JavaScript and it is based on Web Workers and XMLHttpRequest. The goal of the speed​​test is to measure download speed, upload speed, and ping value. In this article, you will learn How to set up a self-hosted speed test server on Ubuntu Linux. This will be useful for an organization that wants to set up a speed test server in its corporate network and measure its employees’ internet connection speed. A fast internet connection is absolutely essential for our day-to-day work online. It is worth noting that the achievable speed of an internet connection is often slower than stated by the provider. Please see the following guides on how to install and configure Ubuntu Linux, how to install the Windows Subsystem for Linux (WSL) on Windows Server via Server Manager and PowerShell, and how to set up SELinux on a Linux server

Due to the slow internet connection, I experienced repeatedly the Covid19 lockdown. I found myself performing multiple speed tests and I thought to myself and needed to set one up for myself 🙂 Here is a list of the top 20 Speedtest Open Source Projects.

Set up a self-hosted speed test server on Ubuntu

You can set up a speed test server to check how fast your Internet connection is (measure download speed, upload speed, and ping value) and to determine the latency of your users working from the home. To have the Speed Test installed on your server, please head over to this URL and click on download ZIP. If you have GIT installed on your device, you could just clone the repository.

Kindly extract the downloaded speed test to your desired location. I extracted mine into the downloads folder as this is a test VM.

Install the NPM Package:

This is a package manager for the Node JavaScript platform. It puts modules in place so that nodes can find them, and manages dependency conflicts intelligently. It is extremely configurable to support a wide variety of use cases. is a subsidiary of GitHub, which provides hosting for software development and version control with the usage of Git.

NPM is the default package manager for the JavaScript runtime environment Node.js. If you do not have NPM installed on your server, you will not be able to continue with the installation steps below. To have NPM installed on your server, please run the command below.

apt install npm

Having cloned or downloaded this repository, please change into the directory and issue the following command below. For more information on the NPM CLI commands, please see the following link.

npm run setup

NPM run build

This will run the build field from the package.json scripts. This is the plumbing command called by npm link and npm install.

npm run build

NPM run start: This will run a predefined command specified in the “start” property of a package’s “scripts” object.

npm run start

Access the Speed Test Server URL

As you can see, (despite not providing you with the entire logging output), the speed test has started. Now, we can now access this user interface from the browser with the following URL below.

https://localhost:5080

All you need do now is to do from here is to click on “Start” as shown above. This will begin the Speed test as shown below.

Now, you can share this link with your customers and employees in order to determine the speed of their internet connection to your server.

You may additionally have to create firewall rules to permit connection (access) to this server (LAN) etc. Kindly see this article on how to disable automatic screen lock on Ubuntu Desktop with the GUI and dconf Editor.

Explanation of SpeedTest Values

The following values ​​are automatically checked by some speed test servers.

  • Latency: In simple terms, latency is the reaction speed of your internet connection. It is used to outline the amount of time it takes for a packet to transfer to its destination (Delays can be predicted).
  • Jitter: This is the delay that varies over time when the signal wanes or jitters (Can not be predicted because of its inconsistency).
  • Download Speed: The download speed or bandwidth of an Internet connection is most important. It shows how quickly data is being downloaded from the Internet. The higher the speed or bandwidth of a connection (in megabits or gigabits per second), the better. Activities such as listening to music on Spotify, downloading large files, or streaming videos on Netflix all require you to download data.
  • Upload Speed: The upload speed has also become an important parameter for internet connections. In contrast to the download speed, it says how quickly data can be uploaded from a computer to the Internet. While downloading information is more common, some online activities need data to travel in the opposite direction. Sending emails, playing live tournament-style video games, and video calling a friend to require fast upload speeds for you to send data to someone else’s server.
  • Ping Value: The ping value indicates the time that a data packet needs to travel between the sender and receiver (for example from an employee device to your company server (self-hosted speed test)). The lower this value, the better. Most speed test displays this value in milliseconds. The ping value is particularly important for video chats or online games.
Latency and ping are often used interchangeably, they are a little bit different. Ping refers to the signal sent from the device to the server, latency is the time it takes for the ping to return to the device.

How to achieve the optimal speed test

The Internet speed on the computer with which you are performing the speed test can be influenced by numerous factors. Applications that are open during the Internet speed test, such as e-mail or security programs (firewall, anti-virus program), play an important role. Such programs can negatively influence the measurement result, especially if they run unnoticed in the background.

The configuration of the computer used and other hardware used such as a modem or WLAN router can also influence the measurement result. In order to obtain the most accurate result possible, your own computer should be connected directly to the modem or WLAN router for the speed test using a LAN cable.

With a wireless connection via WLAN, in addition to the performance of the devices used, the distance or apartment walls between the computer and the WLAN router can lead to a loss of speed. You should take these factors into account when installing WLAN at home.

I hope you found this blog post helpful on how to set up a self-hosted speed test server on Ubuntu Linux. If you have any questions, please let me know in the comment session.

Subscribe
Notify of
guest

7 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Steve Evans
Steve Evans
1 year ago

Excellent stuff! I’m trying to implement a speed test in a Linux Shell script that will be installed on multiple MACOS computers. However, I cannot install additional packages on those endpoints and would like a way to do a speed test via CLI that can be included in my script. Does your platform support anything like this?

Steve Evans
Steve Evans
1 year ago
Reply to  Christian

Yes I have, but as a I said “….I cannot install additional packages”.

Using speedtest-cli is easy but my company will not allow additional packages to be installed.

Steve Evans
Steve Evans
1 year ago
Reply to  Christian

Thank you sir! I will certainly do both! 👍

Rudy
Rudy
1 year ago

Great job.!! congrats. Exist any update ?

7
0
Would love your thoughts, please comment.x
()
x