All articles, Linux server, Web Hosting Tools and Techniques

Linux internet speed test

Linux internet speed test

This article will help you learn how to measure internet speed on a Linux server. In this case, we recommend using the speedtest-cli utility. You can directly install the Python speedtest package on your Linux distribution and then run the test using a command in the terminal.

We will guide you on how to do this step by step, following the instructions provided below.

What is speedtest-cli?

The utility speedtest-cli is a script written in Python. It measures internet traffic speed in two directions (Upload/Download) using the speedtest.net infrastructure for speed measurement. This program requires Python 2.4-3.4 or higher to be installed.

This service program allows you to find out the server’s speed (upload and download) from different parts of the world.

Installing EPEL

EPEL (Extra Packages for Enterprise Linux) is a community-based open-source and free project repository provided by the Fedora team, which contains high-quality additional software packages for Linux distributions.

Installing Python and python-pip

A module in Python refers to a file with the .py extension. Modules are designed to store frequently used functions, classes, constants, and so on. Modules and programs can be roughly divided: programs are intended for direct execution, and modules are intended for import into other programs. It is worth noting that modules can be written not only in the Python language but also in other languages.

Pip is a package management system used for installing and managing software packages written in Python. Most Python distributions already contain pip. If pip is missing, it can be installed using a package management system.

Examples of Linux Systems

Installing the utility on different operating systems

CentOS:

Installing EPEL release:

yum install epel-release -y

Linux internet speed test test skorosti interneta v linux1

Installing Python and python-pip:

yum install python python-pip -y

Linux internet speed test test skorosti interneta v linux 2 1024x458

Installing the Speedtest-cli package using pip:

pip install –upgrade pip

Linux internet speed test test skorosti interneta v linux 3 1024x115

Debian/Ubuntu:

First, update all packages:

apt-get update

Linux internet speed test test skorosti interneta v linux 4

Installing Python and python-pip:

apt install python python-pip -y

pip install –upgrade pip

Linux internet speed test test skorosti interneta v linux 5 1024x104

Installing the Speedtest-cli package using pip:

apt-get install speedtest-cli

FreeBSD:

Installing Python:

pkg install python

Linux internet speed test test skorosti interneta v linux 6

Download the speedtest-cli.py file:

wget –no-check-certificate -O speedtest-cli

https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py

Linux internet speed test test skorosti interneta v linux 7 1024x156

Assign the necessary permissions to the downloaded file:

chmod 777 speedtest-cli

Run the internet speed testing script:

./speedtest-cli

Linux internet speed test test skorosti interneta v linux 8

Installing and Using the Speedtest-cli Utility

To install, use the pip command:

pip install speedtest-cli

To choose a server location for testing, use the command:

speedtest-cli –list

For detailed instructions on using this utility, you can find by entering the following command:

speedtest-cli –help

Each testing server has its own unique ID, for example:

2113) Gatchina-Online (Gatchina, Russian Federation) [305.32 km]

To use this server for testing, use the command:

speedtest-cli –server 2113

Of course, you should execute these commands in the server console or using SSH.

Conclusion

Regardless of the type of server you use – Cloud KVM or Dedicated Server, testing internet speed can help determine how quickly the server can handle requests and what level of performance to expect. Choosing the right tools and technologies can help you achieve your business goals and increase your infrastructure’s performance.