bookmark_borderEnabling BBR on Ubuntu 23.04

Hello,

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,

sysctl net.ipv4.tcp_available_congestion_control

Output:

root@ubuntu:~# sysctl net.ipv4.tcp_available_congestion_control
net.ipv4.tcp_available_congestion_control = reno cubic

Run the below command to check the current congestion control algorithm used in your system,

sysctl net.ipv4.tcp_congestion_control

Output:

root@ubuntu:~# sysctl net.ipv4.tcp_congestion_control
net.ipv4.tcp_congestion_control = cubic

Enabling TCP BBR in Ubuntu

Open the following configuration file /etc/sysctl.conf to enable enable TCP BBR.

nano /etc/sysctl.conf

At the end of the config file, add the following lines.

net.core.default_qdisc=fq
net.ipv4.tcp_congestion_control=bbr

Save the file, and refresh your configuration by using this command,

sysctl -p

Output:

root@ubuntu:~# sysctl -p
net.core.default_qdisc = fq
net.ipv4.tcp_congestion_control = bbr

Now, Verify if BBR is enabled in your system,

sysctl net.ipv4.tcp_congestion_control

Output:

root@ubuntu:~# sysctl net.ipv4.tcp_congestion_control
net.ipv4.tcp_congestion_control = bbr

bookmark_borderInstalling WordPress with LEMP Stack on Ubuntu 23.04

Hello,

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.

Prerequisites:

Creating Database

Log into MySQL with the following command.

mysql -u root -p

First, we’ll create a new database.

CREATE DATABASE wordpress_db;

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

Download and Install WordPress

Download the latest WordPress,

wget -O /tmp/wordpress.tar.gz https://wordpress.org/latest.tar.gz

Unzip the downloaded WordPress file.

tar -xzvf /tmp/wordpress.tar.gz -C /var/www/html

Change the permission of the site directory.

chown -R www-data:www-data /var/www/html/wordpress

Create a Server Block or vHost

We will create a server block (also called vHost) for the WordPress site and have it’s own configuration.

Create a new configuration file using your favourite editor,

vi /etc/nginx/sites-available/wp.domainhere.info

Replace wp.domainhere.info with actual domain name.

And insert the following content into the file.

server {
  listen 80;
  listen [::]:80;
  #server_name _;
  server_name wp.domainhere.info
  root /var/www/html/wordpress/;
  index index.php index.html index.htm index.nginx-debian.html;

  error_log /var/log/nginx/wp.domainhere.info_error.log;
  access_log /var/log/nginx/wp.domainhere.info_access.log;

  location / {
    try_files $uri $uri/ /index.php;
  }

  location ~ \.php$ {
    fastcgi_pass unix:/run/php/php8.1-fpm.sock;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
    include snippets/fastcgi-php.conf;
  }

 # A long browser cache lifetime can speed up repeat visits to your page
  location ~* \.(jpg|jpeg|gif|png|webp|svg|woff|woff2|ttf|css|js|ico|xml)$ {
       access_log        off;
       log_not_found     off;
       expires           360d;
  }

  # disable access to hidden files
  location ~ /\.ht {
      access_log off;
      log_not_found off;
      deny all;
  }
}

Save and exit the file.

Next create a symbolic link of the configuration in the sites-enabled directory with the following command:

ln -s /etc/nginx/sites-available/wp.domainhere.info /etc/nginx/sites-enabled/

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.

certbot --nginx -d wp.domainhere.info -d wp.domainhere.info

You will have to accept the terms of service.

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.

To check that you have top-of-the-line installation, navigate to https://www.ssllabs.com/ssltest/.

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:

systemctl restart nginx

Navigate to your browser.

http://wp.domainhere.info OR http://IP_ADDRESS/wordpress

Note: Replace wp.domainhere.info or IP_ADDRESS with the actual domain name or IP address of your website/server.

images

Start a WordPress installation by clicking on the Run the installation button.

images

Provide the requested information.

images

Once WordPress has been installed log in with your new user credentials.

images
images
images

Done!

bookmark_borderInstalling Docker On Ubuntu 23.04

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.

Install Docker

Install the docker using the apt package manager.

apt install docker.io

Start and enable docker

systemctl enable --now docker

Check Docker service status

systemctl status docker

Output:

root@ubuntu:~# systemctl status docker
● docker.service - Docker Application Container Engine
     Loaded: loaded (/lib/systemd/system/docker.service; enabled; preset: enabl>
     Active: active (running) since Fri 2023-04-21 20:31:43 UTC; 23s ago
TriggeredBy: ● docker.socket
       Docs: https://docs.docker.com
   Main PID: 3809 (dockerd)
      Tasks: 9
     Memory: 22.8M
        CPU: 1.359s
     CGroup: /system.slice/docker.service
             └─3809 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/cont>

Apr 21 20:31:42 ubuntu dockerd[3809]: time="2023-04-21T20:31:42.322853594Z" lev>
Apr 21 20:31:42 ubuntu dockerd[3809]: time="2023-04-21T20:31:42.323411858Z" lev>
Apr 21 20:31:42 ubuntu dockerd[3809]: time="2023-04-21T20:31:42.323809254Z" lev>
Apr 21 20:31:42 ubuntu dockerd[3809]: time="2023-04-21T20:31:42.392873225Z" lev>
Apr 21 20:31:42 ubuntu dockerd[3809]: time="2023-04-21T20:31:42.741850321Z" lev>
Apr 21 20:31:42 ubuntu dockerd[3809]: time="2023-04-21T20:31:42.960585254Z" lev>
Apr 21 20:31:42 ubuntu dockerd[3809]: time="2023-04-21T20:31:42.996881239Z" lev>
Apr 21 20:31:42 ubuntu dockerd[3809]: time="2023-04-21T20:31:42.997602672Z" lev>
Apr 21 20:31:43 ubuntu systemd[1]: Started docker.service - Docker Application >
Apr 21 20:31:43 ubuntu dockerd[3809]: time="2023-04-21T20:31:43.091542255Z" lev>

Create a group called docker,

groupadd docker

To add an user into the docker user group

usermod -aG docker $USER

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/

bookmark_borderInstalling LAMP Stack with MariaDB on Ubuntu 23.04

Hello,

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.

images

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,

apt install php libapache2-mod-php php-mysql php-common php-cli php-common php-json php-opcache php-readline php-mbstring php-gd php-dom php-zip php-curl

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
images

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.

bookmark_borderInstalling PostgreSQL on Ubuntu 22.10

Hello,

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

apt update

apt install postgresql postgresql-contrib

Output:

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.

bookmark_borderInstalling PhpMyAdmin in Ubuntu 22.10

Hello,

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.

ln -s  /usr/share/phpmyadmin /var/www/html/phpmyadmin

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.

image

Done!

bookmark_borderInstalling Linux kernel 6.0 on Ubuntu 22.10

Hello,

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:

Test amd64/build succeeded (rc=0, on=amd64, time=0:12:37, log=amd64/log)
amd64/linux-headers-6.0.9-060009-generic_6.0.9-060009.202211161102_amd64.deb
amd64/linux-headers-6.0.9-060009_6.0.9-060009.202211161102_all.deb
amd64/linux-image-unsigned-6.0.9-060009-generic_6.0.9-060009.202211161102_amd64.deb
amd64/linux-modules-6.0.9-060009-generic_6.0.9-060009.202211161102_amd64.deb

For upgrading to the latest kernel on Ubuntu, follow the given instructions:

wget https//:kernel.ubuntu.com/~kernel-ppa/mainline/v6.0.9/amd64/linux-headers-6.0.9-060009_6.0.9060009.202211161102_all.deb

wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v6.0.9/amd64/linux-headers-6.0.9-060009-generic-6.0.9060009.202211161102_amd64.deb

wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v6.0.9/amd64/linux-image-unsigned-6.0.9-060009-generic_6.0.9060009.202211161102_amd64.deb

wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v6.0.9/amd64/linux-modules-6.0.9-060009-generic_6.0.9060009.202211161102_amd64.deb

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.

bookmark_borderInstalling Docker On Ubuntu 22.10

Hello,

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/

bookmark_borderInstalling Webmin on Ubuntu 22.10

Hello,

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.

Installing Webmin on Ubuntu

First, check for any pending system updates.

apt update
apt upgrade

Install the required packages.

apt install apt-transport-https

Import and Add Webmin Repository Key.

wget https://download.webmin.com/jcameron-key.asc

cat jcameron-key.asc | gpg --dearmor >/etc/apt/trusted.gpg.d/jcameron-key.gpg

Install Webmin by running the following command.

apt update
apt install webmin

Start the Webmin by running the below command.

/etc/webmin/start

Output:

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.

To Configure the Firewall.

ufw allow 10000/tcp

Output:

root@crown:~# ufw allow 1000/tcp
Rules updated
Rules updated (v6)

To access Webmin, open the URL from your web browser: https://IP_address:10000

Note:

  1. When logging in for the first time, you will see an ‘invalid SSL’ warning.
  2. Simply click on the ‘Advanced’ tab and then ‘Accept the risk and Continue’.

Login to the Webmin web interface using your root user and password.

First

Once you log in, you will be redirected to the Webmin dashboard.

First

bookmark_borderInstalling Gitea on Ubuntu 22.10

Hello,

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.

To Install SQLite use the following command,

apt install sqlite3

To check the version,

sqlite3 --version

Output:

root@crown:~# sqlite3 --version
3.39.3 2022-09-05 11:02:23 4635f4a69c8c2a8df242b384a992aea71224e39a2ccab42d8c0b0  

Install Git

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,

git --version

Output:

root@crown:~# git --version
git version 2.37.2

Create a Git user,

  sudo adduser \
  --system \
  --shell /bin/bash \
  --gecos 'Git Version Control' \
  --group \
  --disabled-password \
  --home /home/git \
  git

Download the Gitea binary

Download the Gitea binary from download page and make it executable.

 apt install wget

 wget -O /tmp/gitea https://dl.gitea.io/gitea/1.17.3/gitea-1.17.3-linux-amd64

Output:

root@crown:~#  wget -O /tmp/gitea https://dl.gitea.io/gitea/1.17.3/gitea-1.17.3-linux-amd64
--2022-10-20 18:22:43--  https://dl.gitea.io/gitea/1.17.3/gitea-1.17.3-linux-amd64
Resolving dl.gitea.io (dl.gitea.io)... 84.17.46.53, 2400:52e0:1e01::883:1
Connecting to dl.gitea.io (dl.gitea.io)|84.17.46.53|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 112413616 (107M) [application/octet-stream]
Saving to: ‘/tmp/gitea’

Move the Gitea binary file to ‘/usr/local/bin’.

mv /tmp/gitea /usr/local/bin

Make the binary executable.

chmod +x /usr/local/bin/gitea   

Create the directory structure and set the required permissions and ownership.

 mkdir -p /var/lib/gitea/{custom,data,indexers,public,log}
 chown git: /var/lib/gitea/{data,indexers,log}
 chmod 750 /var/lib/gitea/{data,indexers,log}
 mkdir /etc/gitea
 chown root:git /etc/gitea
 chmod 770 /etc/gitea

To create a Systemd Unit File.

Download the file to the “/etc/systemd/system/” directory using the following command.

wget https://raw.githubusercontent.com/go-gitea/gitea/main/contrib/systemd/gitea.service -P /etc/systemd/system/  

To reload and enable the Gitea service,

systemctl daemon-reload

systemctl enable --now gitea

Output:

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

ufw allow 3000/tcp

Navigate to your browser. http://yourserver-ip-address:3000 to access the Gitea dashboard.

Follow the on-screen instructions to complete the Gitea setup. Click on Register to start the database initialization.

Database Settings:

  • Database Type: SQLite3
  • Path: Use an absolute path, /var/lib/gitea/data/gitea.db
image

Application General Settings:

  • Site Title: Enter username.
  • Repository Root Path: keep the default /home/git/gitea-repositories.
  • Git LFS Root Path: keep the default /var/lib/gitea/data/lfs.
  • Run As Username: git
  • SSH Server Domain: Enter your domain name or your IP address.
  • SSH Port: 22, change it if SSH is listening on other Port
  • Gitea HTTP Listen Port: 3000
  • Gitea Base URL: Use http with your domain name or server IP address.
  • Log Path: Leave the default /var/lib/gitea/log

Click on Install to Install Gitea.

image

Once the installation is completed then create the first user. Open http://yourip:3000/user/sign_up in a web browser and fill in the required details.

image

Once the form has been submitted, you are logged into your Gitea account.

image

Upgrading Gitea

To upgrade to a new version first stop the Gitea service.

To stop the Gitea service.

systemctl stop gitea

Download the Gitea binary from download page.

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.

VERSION=<THE_LATEST_GITEA_VERSION>

wget -O /tmp/gitea https://dl.gitea.io/gitea/${VERSION}/gitea-${VERSION}-linux-amd64

Move the Gitea binary file to /usr/local/bin and make the binary executable.

mv /tmp/gitea /usr/local/bin

chmod +x /usr/local/bin/gitea

To restart the Gitea service,

systemctl restart gitea

Done.