In this week’s feature highlight, we look at How to Enable BBR on Ubuntu 23.04
BBR stands for Bottleneck Bandwidth and RTT is a congestion control system. You can enable TCP BBR on your Linux desktop to improve the overall web surfing experience. By default, Linux uses the Reno and CUBIC congestion control algorithm.
Enabling BBR in Linux can help improve network performance by optimizing bandwidth utilization, reducing latency, and mitigating packet loss. We’ll show you how this is enabled:
Run the following command to check available congestion control algorithms,
In this week’s feature highlight, we look at How to Install WordPress with LEMP Stack on Ubuntu 23.04
WordPress is one of the most popular website-building tools available out there. It is a simple way to get your online presence and perfect for those who do not know how to code and want a simple and effective way to share and build your story on the internet.
Next, create a new MySQL user account that we will use to operate on WordPress’s new database, with the username “wordpress_user”.
CREATE USER 'wordpress_user'@'localhost' IDENTIFIED BY 'password';
Note: Replace “password” with a safe and secure password when creating the wordpress_user
Link the user and DB together by granting our user access to the database.
GRANT ALL PRIVILEGES ON wordpress_db.* to wordpress_user@'localhost';
Flush the privileges so that MySQL knows about the user permissions we just added.
FLUSH PRIVILEGES;
Exit out of the MySQL command prompt by typing.
exit
Output:
root@crown:~# mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 81
Server version: 10.6.7-MariaDB-2ubuntu1 Ubuntu 23.04
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> CREATE DATABASE wordpress_db;
Query OK, 1 row affected (0.003 sec)
MariaDB [(none)]> CREATE USER 'wordpress_user'@'localhost' IDENTIFIED BY 'password';
Query OK, 0 rows affected (0.005 sec)
MariaDB [(none)]> GRANT ALL PRIVILEGES ON wordpress_db.* to wordpress_user@'localhost';
Query OK, 0 rows affected (0.003 sec)
MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.003 sec)
MariaDB [(none)]> exit
Bye
Remove default Nginx server blocks to prevent Nginx automatic requests routing.
rm /etc/nginx/sites-available/default
Set up SSL Certificate
Run the command to install certbot specific to Nginx
snap install --classic certbot
Run this command to get a certificate and have Certbot edit your Nginx configuration automatically to serve it, turning on HTTPS access in a single step.
IMPORTANT NOTES:
- Congratulations! Your certificate and chain have been saved at:
/etc/letsencrypt/live/wp.domainhere.info/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/wp.domainhere.info/privkey.pem
Your cert will expire on 2020-09-05. To obtain a new or tweaked
version of this certificate in the future, simply run certbot again
with the "certonly" option. To non-interactively renew *all* of
your certificates, run "certbot renew"
- Your account credentials have been saved in your Certbot
configuration directory at /etc/letsencrypt. You should make a
secure backup of this folder now. This configuration directory will
also contain certificates and private keys obtained by Certbot so
making regular backups of this folder is ideal.
- If you like Certbot, please consider supporting our work by:
Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate
Donating to EFF: https://eff.org/donate-le
You will receive this acknowledgement that the SSL certificate for wp.domainhere.info and www.wp.domainhere.info are successfull.
You can now verify your website using https:// that the connection is secure with the lock icon in the usrl bar.
Confirm that the configuration is all OK and there are no errors.
nginx -t
you would see an output like below:
root@vps:~# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
Now that the configuration has no errors, restart the web server:
Hello, In this week’s feature highlight, we look at How to Install Docker On Ubuntu 23.04
What is docker?
Docker is basically a container engine which uses the Linux Kernel in order to create the containers on top of an operating system. Which is used to create, deploy and run the applications.
If you want to add a different user, replace $USER with existing username.
Check docker version,
docker --version
Ouput:
root@ubuntu:~# docker --version
Docker version 20.10.21, build 20.10.21-0ubuntu3
Test docker using the hello-world container.
docker run hello-world
Output:
root@ubuntu:~# docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
2db29710123e: Pull complete
Digest: sha256:4e83453afed1b4fa1a3500525091dbfca6ce1e66903fd4c01ff015dbcb1ba33e
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/
In this week’s feature highlight, we look at How to Install LAMP Stack with MariaDB on Ubuntu 23.04
A LAMP stack is a group of open-source software that is typically installed together to enable a server to host dynamic websites and web apps. This term is actually an acronym which represents the Linux operating system, with the Apache web server. The site data is stored in a MySQL or MariaDB database, and dynamic content is processed by PHP.
First, check for any pending system upgrades.
apt update
apt upgrade
Install Apache
Command to install Apache along with its utilities.
apt install -y apache2 apache2-utils
Next, check the Status of Apache.
systemctl status apache2
Output:
root@ubuntu:~# systemctl status apache2
● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; preset: enab>
Active: active (running) since Fri 2023-04-14 15:36:54 UTC; 3min 6s ago
Docs: https://httpd.apache.org/docs/2.4/
Main PID: 2067 (apache2)
Tasks: 55 (limit: 3386)
Memory: 5.1M
CPU: 191ms
CGroup: /system.slice/apache2.service
├─2067 /usr/sbin/apache2 -k start
├─2068 /usr/sbin/apache2 -k start
└─2070 /usr/sbin/apache2 -k start
If Apache is not active can start using the following command.
systemctl start apache2
Use the following command to auto start Apache at boot time.
systemctl enable apache2
You can confirm the Apache2 version with the below command,
apache2 -v
Output:
root@ubuntu:~# apache2 -v
Server version: Apache/2.4.55 (Ubuntu)
Server built: 2023-03-08T16:32:34
Enable Firewall
We will open the HTTP port in the firewall, so we can access the page served by the Apache web server.
Allow the HTTP port by running the below command,
ufw allow http
Output:
Rules updated
Rules updated (v6)
And to verify if it’s working, open the server’s IP address in your browser. You should be able to view the Apache default page.
http://ip-address
NOTE: Replace with your Server IP address.
Install MariaDB Server
Install MariaDB server, run the below command:
apt install mariadb-server mariadb-client
Once the installation complete, check the status of MariaDB.
systemctl status mariadb
Output:
root@ubuntu:~# systemctl status mariadb
● mariadb.service - MariaDB 10.11.2 database server
Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; preset: enab>
Active: active (running) since Fri 2023-04-14 18:11:18 UTC; 22s ago
Docs: man:mariadbd(8)
https://mariadb.com/kb/en/library/systemd/
Main PID: 4880 (mariadbd)
Status: "Taking your SQL requests now..."
Tasks: 17 (limit: 3386)
Memory: 79.2M
CPU: 1.439s
CGroup: /system.slice/mariadb.service
└─4880 /usr/sbin/mariadbd
Start MariaDB if it is not active using below command,
systemctl start mariadb
Use the following command to auto start MariaDB at boot time.
systemctl enable mariadb
Next, MariaDB database security.
NOTE: In this step, you will be prompted with several questions.
mysql_secure_installation
Output:
root@ubuntu:~# mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
haven't set the root password yet, you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password or using the unix_socket ensures that nobody
can log into the MariaDB root user without the proper authorisation.
You already have your root account protected, so you can safely answer 'n'.
Switch to unix_socket authentication [Y/n] y
Enabled successfully!
Reloading privilege tables..
... Success!
You already have your root account protected, so you can safely answer 'n'.
Change the root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] y
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] y
... Success!
By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] y
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!
Login to the MariaDB using below command,
mariadb -u root -p
To exit from MariaDB.
exit
Check MariaDB Version,
mariadb --version
Output:
root@ubuntu:~# mariadb --version
mariadb Ver 15.1 Distrib 10.11.2-MariaDB, for debian-linux-gnu (x86_64) using EditLine wrapper
Install PHP
PHP 8.1 is the default version of PHP that would be installed on Ubuntu 22.04.
Install PHP and Required Extensions using below command,
Enable the Apache PHP module and restart the Apache Web server.
systemctl restart apache2
To check PHP Version.
php --version
Output:
root@ubuntu:~# php --version
PHP 8.1.12-1ubuntu4 (cli) (built: Feb 22 2023 19:48:21) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.12, Copyright (c) Zend Technologies
with Zend OPcache v8.1.12-1ubuntu4, Copyright (c), by Zend Technologies
Test PHP scripts we need to add the info.php file in the document.
nano /var/www/html/info.php
Add the following to the file.
<?php phpinfo(); ?>
To verify enter the following link in a web browser.
NOTE: Replace with your server IP address below.
http://ip-address/info.php
Run PHP-FPM with Apache [Optional]
FPM (FastCGI Process Manager) is an alternative PHP FastCGI implementation with some additional features useful for heavy-loaded sites.
NOTE: This is an optional step, PHP 8.1 is used to run the PHP code but if you want to run PHP code with PHP-FPM follow the below steps.
Next, Install PHP-FPM.
apt install php8.1-fpm
Enable proxy_fcgi and setenvif module.
a2enmod proxy_fcgi setenvif
Output:
root@ubuntu:~# a2enmod proxy_fcgi setenvif
Considering dependency proxy for proxy_fcgi:
Enabling module proxy.
Enabling module proxy_fcgi.
Module setenvif already enabled
To activate the new configuration, you need to run:
systemctl restart apache2
Now enable php8.1-fpm file.
a2enconf php8.1-fpm
Restart the Apache.
systemctl restart apache2
Enable php-fpm.
systemctl enable php8.1-fpm
Follow below command to start php-fpm.
systemctl start php8.1-fpm
To check the status of php-fpm.
systemctl status php8.1-fpm
Output:
root@ubuntu:~# systemctl status php8.1-fpm
● php8.1-fpm.service - The PHP 8.1 FastCGI Process Manager
Loaded: loaded (/lib/systemd/system/php8.1-fpm.service; enabled; preset: e>
Active: active (running) since Fri 2023-04-14 18:30:47 UTC; 1min 32s ago
Docs: man:php-fpm8.1(8)
Main PID: 17796 (php-fpm8.1)
Status: "Processes active: 0, idle: 2, Requests: 0, slow: 0, Traffic: 0req>
Tasks: 3 (limit: 3386)
Memory: 9.5M
CPU: 133ms
CGroup: /system.slice/php8.1-fpm.service
├─17796 "php-fpm: master process (/etc/php/8.1/fpm/php-fpm.conf)"
├─17797 "php-fpm: pool www"
└─17798 "php-fpm: pool www"
Now you have successfully installed the LAMP stack (Apache, MariaDB, and PHP8.1) on Ubuntu 23.04.
In this week’s feature highlight, we look at How to Install PostgreSQL on Ubuntu 22.10
PostgreSQL is a powerful, open-source object-relational database system with over 30 years of active development that has earned it a strong reputation for reliability, feature robustness, and performance.
Install PostgreSQL
Install PostgreSQL on Ubuntu by using the following command
root@crown:~# apt install postgresql postgresql-contrib
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
galera-4 libconfig-inifiles-perl libdaxctl1 libdbd-mysql-perl libdbi-perl
libmariadb3 libmysqlclient21 libndctl6 libpmem1 libsnappy1v5 liburing2
mariadb-common socat
Use 'apt autoremove' to remove them.
The following additional packages will be installed:
libcommon-sense-perl libjson-perl libjson-xs-perl libllvm14 libpq5
libsensors-config libsensors5 libtypes-serialiser-perl postgresql-14
postgresql-client-14 postgresql-client-common postgresql-common sysstat
PostgreSQL Roles and Databases
We’ll switch to the Postgres user account for the next steps, to switch to the Postgres account, use the following command,
sudo -i -u postgres
You can access a PostgreSQL prompt using the psql utility
psql
Output:
postgres@crown:~$ psql
psql (14.5 (Ubuntu 14.5-1ubuntu1))
Type "help" for help.
postgres=#
To exit the postgres shell, use the below command,
\q
Create PostgreSQL Role
Now let us see how we can create additional users that can interact with the Databases.
For this, you have to be a postgres user and then run the command as shown below,
createuser --interactive
Output:
postgres@vps:~$ createuser --interactive
Enter name of role to add: adam
Shall the new role be a superuser? (y/n) y
Create a PostgreSQL Database
Creating a database is as simple as it gets. Run the below command as a postgres user account.
createdb database_name
Example:
postgres@vps:~$ createdb my_db
Open a Postgres Prompt with the New Role
For this, we will create a new Linux system user by using adduser.
For simplicity purpose, we will be using the same name as which we created the postgres role with, adam.
You will need to switch back to root user or a sudo user with required privileges .
adduser username
Example:
root@vps:~# adduser adam
Adding user `adam' ...
Adding new group `adam' (1000) ...
Adding new user `adam' (1000) with group `adam' ...
Creating home directory `/home/adam' ...
Copying files from `/etc/skel' ...
New password:
Retype new password:
passwd: password updated successfully
...
Switch over to the newly added user and connect to the database.
sudo -u username
Open the postgres shell and connect to the new Database,
psql -d database_name
Example:
root@vps:~# sudo -i -u adam
adam@vps:~$ psql -d my_db
psql (14.5 (Ubuntu 14.5-1ubuntu1))
Type "help" for help.
my_db=#
Once you’re logged in as adam, check your current connection information:
\conninfo
Output:
my_db=# \conninfo
You are connected to database "my_db" as user "adam" via socket in "/var/run/postgresql" at port "5432".
This concludes the topic on installing PostgreSQL on Ubuntu.
In this week’s feature highlight, we look at How to Install PhpMyAdmin in Ubuntu 22.10
In this guide, we will demonstrate how PhpMyAdmin is installed on a Ubuntu 22.10 system. PhpMyAdmin requires a standalone Database or as part of the LEMP stack, installed and running on the system beforehand.
Prerequisites:
Server with Apache, PHP, and MariaDB. You can find our LAMP Installation guide here.
Installing PhpMyAdmin
apt install phpmyadmin
Output:
root@crown:~# apt install phpmyadmin
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
dbconfig-common dbconfig-mysql icc-profiles-free javascript-common
libjs-jquery libjs-openlayers libjs-sphinxdoc libjs-underscore libzip5
php-bz2 php-google-recaptcha php-mysql php-phpmyadmin-motranslator
php-phpmyadmin-shapefile php-phpmyadmin-sql-parser php-phpseclib
php-psr-cache php-psr-container php-psr-log php-symfony-cache
php-symfony-cache-contracts php-symfony-expression-language
Create Symbolic Link
Create a symbolic link from the installation files to Nginx’s document root directory.
Enter it into your browser’s address bar to check that phpmyadmin is installed. http://yourserver-ip-address/phpmyadmin/. You should see a page similar to the below one.
In this week’s feature highlight, we look at How to Install Linux kernel 6.0 on Ubuntu 22.10
Kernel is central component of an operating system that manages operations of computer and hardware. It basically manages operations of memory and CPU time. It is core component of an operating system. Kernel acts as a bridge between applications and data processing performed at hardware level using inter-process communication and system calls.
Step 1 – Update your system
First, Update the system packages to the latest versions using the below apt commands,
apt update
apt upgrade
Install some of the packages required for the Kernel upgrade,
apt install gcc make perl wget
Step 2 – Installing Linux Kernel 6.0
By default on Ubuntu 22.10, The kernel version it ships with is version 5.19
Linux Kernel 6.0 is not available on Ubuntu 22.10 base repository. So we will manually download the required Linux Kernel packages from the official site and install.
You can check their official site for a list of available kernel versions that can be installed, kernel.ubuntu.com.
At the time of writing this article, version 6.0.9 was the only latest kernel we could install with.
Some points to note, for selecting a different version of kernel. Open the site kernel.ubuntu.com and scroll to the bottom of the page. Find a version whose builds are successful, under that, navigate to “amd64” folder. You will find the required four files to download on the ubuntu system, Linux Headers, Linux Image and Linux Modules. A successful build looks like below:
Now, install the downloaded files using the dpkg command as shown below,
Ensure that there are no other .deb files apart from the ones that were downloaded. If there are any other .deb files, recommended to remove them before proceeding.
dpkg -i *.deb
After installing the Linux Kernel 6.0, reboot the system to run the new Kernel
reboot
Step 3 – Verify the Kernel version
To verify the kernel installed and running after the reboot, use the uname command as shown below,
uname -r
Output:
root@vps:~# uname -r
6.0.9-060009-generic
This concludes the topic of installing the latest version of Kernel on a Ubuntu System.
In this week’s feature highlight, we look at How to Install Docker On Ubuntu 22.10
What is docker?
Docker is basically a container engine that uses the Linux Kernel in order to create containers on top of an operating system. Which is used to create, deploy and run the applications.
Install Docker
Install the docker using the apt package manager.
apt install docker.io docker-compose
Start and enable the docker
systemctl enable --now docker
Check Docker service
systemctl status docker
Output:
root@crown:~# systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; preset: enabl>
Active: active (running) since Mon 2022-10-17 13:59:05 UTC; 52s ago
TriggeredBy: ● docker.socket
Docs: https://docs.docker.com
Main PID: 5778 (dockerd)
Tasks: 8
Memory: 22.6M
CPU: 358ms
CGroup: /system.slice/docker.service
Create a group called docker,
groupadd docker
To add a user to the docker user group
usermod -aG docker $USER
If you want to add a different user, replace $USER with an existing username.
Check the docker version,
docker --version
Output:
root@crown:~# docker --version
Docker version 20.10.16, build 20.10.16-0ubuntu1
Test docker using the hello-world container.
docker run hello-world
Output:
root@crown:~# docker run hello-world
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/
In this week’s feature highlight, we look at How to Install Webmin on Ubuntu 22.10
Webmin is a web-based dashboard that allows sysadmins to manage Linux and Unix-like systems (especially servers). Webmin allows system administrators to manage user accounts, update packages, system log files, configure firewalls, email, database, postfix, etc.
Webmin install complete. You can now login to https://vps.server.com:10000/
as root with your root password, or as any user who can use sudo
to run commands as root.
In this week’s feature highlight, we look at How to Install Gitea on Ubuntu 22.10
Gitea is an open-source forge software package for hosting software development version control using Git as well as other collaborative features like bug tracking, wikis, and code review. It supports self-hosting but also provides a free public first-party instance hosted in China on DiDi’s cloud.
Prerequisites
Full SSH root access or a user with Sudo privileges is required.
Gitea supports the following databases.
SQLite
PostgreSQL
MySQL
MariaDB
In our guide below, we’ll use SQLite as the database for Gitea. You can pick any of the supported databases in your installation as needed.
Gitea is a painless self-hosted Git service. With features similar to ones in GitHub, Bitbucket, or GitLab. Git is the standard for distributed version control systems and can be installed on Ubuntu systems using apt.
Check for system updates and install them.
apt update
apt upgrade
Install the Git package using the following command,
apt install git
You can check the version of Git installed with the following command,
root@crown:~# systemctl enable --now gitea
Created symlink /etc/systemd/system/multi-user.target.wants/gitea.service → /etc/systemd/system/gitea.service.
To check the status of the Gitea service,
systemctl status gitea
Output:
root@crown:~# systemctl status gitea
● gitea.service - Gitea (Git with a cup of tea)
Loaded: loaded (/etc/systemd/system/gitea.service; enabled; preset: enabled)
Active: active (running) since Thu 2022-10-20 18:23:42 UTC; 15s ago
Main PID: 14144 (gitea)
Tasks: 8 (limit: 2227)
Memory: 129.4M
CPU: 1.190s
CGroup: /system.slice/gitea.service
└─14144 /usr/local/bin/gitea web --config /etc/gitea/app.ini
Configure Gitea
If you’re running ufw firewall on your server, allow the port 3000
At the time of writing this article, the latest Gitea version is 1.17.3 If there is a newer version available on the link above, change the VERSION variable before using the following command.