bookmark_borderInstalling Drupal on Ubuntu 23.10

Hello,

In this week’s feature highlight, we look at How to Install Drupal on Ubuntu 23.10

Drupal is a Content Management System (CMS) to maintain and publish an internet website. It’s an open-source content management system (CMS) with a large, supportive community. It’s used by millions of people and organizations around the globe to build and maintain their websites.

Update the System

Let us update the system packages to the latest by running the below commands,

apt update -y 

apt upgrade -y

Install MariaDB Server

Next is to install MariaDB or MySQL. I will be using MariaDB for this process. So let’s install MariaDB with the following command.

apt install -y mariadb-server mariadb-client

Secure your database server by setting a root password, disabling root remote logins, and removing test databases.

mysql_secure_installation

Output:

root@server:~# 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!

Check that you can log in to the database as a root user with a password set.

mysql -u root -p

Now that we are able to log in as regular users, we can now create a Drupal database that Drupal can use once we installed it into our system. To create one using the following command.

Create Database for Drupal

mysql -u root -p
CREATE DATABASE drupal;
CREATE USER 'drupal_user'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON drupal.* to drupal_user@'localhost';
FLUSH PRIVILEGES;
\q

Output:

root@server:~# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 41
Server version: 10.11.2-MariaDB-1 Ubuntu 23.10

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 drupal;
Query OK, 1 row affected (0.001 sec)

MariaDB [(none)]> CREATE USER 'drupal_user'@'localhost' IDENTIFIED BY 'Strong_Password';
Query OK, 0 rows affected (0.006 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES ON drupal.* to drupal_user@'localhost';
Query OK, 0 rows affected (0.005 sec)

MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.002 sec)

MariaDB [(none)]> \q
Bye

Note: Replace the Strong_Password with actual strong password

Install PHP

By default, Ubuntu 23.10 comes with PHP version 8.2. We will install PHP and other necessary modules required to run Drupal.

apt install php php-{cli,fpm,json,common,mysql,zip,gd,intl,mbstring,curl,xml,pear,tidy,soap,bcmath,xmlrpc}

Output:

root@server:~# apt install php php-{cli,fpm,json,common,mysql,zip,gd,intl,mbstring,curl,xml,pear,tidy,soap,bcmath,xmlrpc}
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  apache2 apache2-bin apache2-data apache2-utils fontconfig-config fonts-dejavu-core libapache2-mod-php8.2 libapr1
  libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libdeflate0 libfontconfig1 libgd3 libjbig0 libjpeg-turbo8 libjpeg8
  liblerc4 liblua5.3-0 libtidy5deb1 libtiff6 libwebp7 libxmlrpc-epi0 libxpm4 libzip4 php8.2 php8.2-bcmath php8.2-cli
  php8.2-common php8.2-curl php8.2-fpm php8.2-gd php8.2-intl php8.2-mbstring php8.2-mysql php8.2-opcache php8.2-readline
  php8.2-soap php8.2-tidy php8.2-xml php8.2-xmlrpc php8.2-zip ssl-cert
Suggested packages:
  apache2-doc apache2-suexec-pristine | apache2-suexec-custom www-browser libgd-tools
The following NEW packages will be installed:
  apache2 apache2-bin apache2-data apache2-utils fontconfig-config fonts-dejavu-core libapache2-mod-php8.2 libapr1
  libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libdeflate0 libfontconfig1 libgd3 libjbig0 libjpeg-turbo8 libjpeg8
  liblerc4 liblua5.3-0 libtidy5deb1 libtiff6 libwebp7 libxmlrpc-epi0 libxpm4 libzip4 php php-bcmath php-cli php-common
  php-curl php-fpm php-gd php-intl php-json php-mbstring php-mysql php-pear php-soap php-tidy php-xml php-xmlrpc php-zip
  php8.2 php8.2-bcmath php8.2-cli php8.2-common php8.2-curl php8.2-fpm php8.2-gd php8.2-intl php8.2-mbstring php8.2-mysql
  php8.2-opcache php8.2-readline php8.2-soap php8.2-tidy php8.2-xml php8.2-xmlrpc php8.2-zip ssl-cert

Install Apache Web Server

As for the Web Server, we will use Apache as it is easy to configure and use.

To install, run the below commands

apt install apache2 libapache2-mod-php

Output:


root@server:~# apt install apache2 libapache2-mod-php
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
apache2 is already the newest version (2.4.55-1ubuntu2).
apache2 set to manually installed.
The following NEW packages will be installed:
  libapache2-mod-php
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.

Update PHP Timezone and Memory Limit.

Enter the TimeZone you want Drupal to use as default.

nano /etc/php/*/apache2/php.ini
memory_limit = 256
date.timezone = UTC

Download the Latest Version of Drupal and extract it on Ubuntu 23.10.

wget https://www.drupal.org/download-latest/tar.gz -O drupal.tar.gz
tar xvf drupal.tar.gz
mv drupal-*/  /var/www/html/drupal

Update ownership for a drupal directory to Apache user and group.

chown -R www-data:www-data /var/www/html/
chmod -R 755 /var/www/html/

Configure Apache Web Server for Drupal

Create a configuration file for Drupal.

nano /etc/apache2/sites-available/drupal.conf

Add the following content,

Replace drupal.domainhere.info with your actual domain name.

<VirtualHost *:80>
     ServerName drupal.domainhere.info
     ServerAdmin admin@drupal.domainhere.info
     DocumentRoot /var/www/html/drupal/

     CustomLog ${APACHE_LOG_DIR}/access.log combined
     ErrorLog ${APACHE_LOG_DIR}/error.log

      <Directory /var/www/html/drupal>
            Options Indexes FollowSymLinks
            AllowOverride All
            Require all granted
            RewriteEngine on
            RewriteBase /
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteCond %{REQUEST_FILENAME} !-d
            RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
   </Directory>
</VirtualHost>

Configure and Enable the Website using the below commands,

apachectl -t
a2dismod mpm_event
a2enmod mpm_prefork
a2enmod php8.2
a2enmod rewrite
a2ensite drupal.conf
systemctl restart apache2

Install Certbot

Certbot is a tool that simplifies the process of obtaining and renewing Let’s Encrypt SSL certificates,

apt install certbot python3-certbot-apache

Generate SSL Certificate,

certbot --apache -d drupal.domainhere.info

Note: Replace drupal.domainhere.info with actual domain name

Output:

Successfully received certificate.
Certificate is saved at: /etc/letsencrypt/live/drupal.domainhere.info/fullchain.pem
Key is saved at:         /etc/letsencrypt/live/drupal.domainhere.info/privkey.pem
This certificate expires on 2024-01-16.
These files will be updated when the certificate renews.
Certbot has set up a scheduled task to automatically renew this certificate in the background.

Deploying certificate
Successfully deployed certificate for drupal.domainhere.info to /etc/apache2/sites-enabled/drupal.domainhere.info-le-ssl.conf
Your existing certificate has been successfully renewed, and the new certificate has been installed.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Access Drupal

Access the Drupal configuration page by using http://drupal.domainhere.info

Replace drupal.domainhere.info with your actual domain.

images

Select an installation profile.

images

Set Database Configure for Drupal.

images

Wait for the installation to complete,

images

Configure your site,

images

You’ll get to the Drupal dashboard in a few,

images
images

Done.

bookmark_borderInstalling PhpMyAdmin in Ubuntu 23.10

Hello,

In this week’s feature highlight, we look at How to Install PhpMyAdmin in Ubuntu 23.10

In this guide, we will demonstrate how PhpMyAdmin is installed on a Ubuntu 23.04 system. PhpMyAdmin requires a standalone Database or as part of the LEMP stack, installed and running on the system beforehand.

Prerequisites:

Server with Nginx, PHP, and MariaDB. You can find our LEMP Installation guide here.

Installing PhpMyAdmin

apt install phpmyadmin

Output:

root@ubuntu23:~# apt install phpmyadmin
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
   apache2 apache2-bin apache2-data apache2-utils dbconfig-common
   dbconfig-mysql default-mysql-client fontconfig-config fonts-noto-core
   fonts-noto-mono icc-profiles-free javascript-common libapache2-mod-php
   libapache2-mod-php8.2 libapr1 libaprutil1 libaprutil1-dbd-sqlite3
   libaprutil1-ldap libdeflate0 libfontconfig1 libgd3 libjbig0 libjpeg-turbo8
   libjpeg8 libjs-codemirror libjs-jquery libjs-jquery-metadata
   libjs-jquery-mousewheel libjs-jquery-tablesorter libjs-jquery-timepicker
   libjs-jquery-ui libjs-sphinxdoc libjs-underscore liblerc4 liblua5.4-0
   libmcrypt4 libtiff6 libwebp7 libxpm4 libzip4 mysql-client-8.0
   mysql-client-core-8.0 mysql-common php-bz2 php-cli php-common
   php-composer-ca-bundle php-curl php-fig-http-message-util php-gd
   php-getallheaders php-google-recaptcha php-mariadb-mysql-kbs php-mbstring
   php-mcrypt php-mysql php-nikic-fast-route php-phpmyadmin-motranslator
   php-phpmyadmin-shapefile php-phpmyadmin-sql-parser php-psr-cache
   php-psr-container php-psr-http-factory php-psr-http-message php-psr-log
   php-slim-psr7 php-symfony-cache php-symfony-cache-contracts
   php-symfony-config php-symfony-dependency-injection
   php-symfony-deprecation-contracts php-symfony-expression-language
   php-symfony-filesystem php-symfony-polyfill-php80
   php-symfony-service-contracts php-symfony-var-exporter php-tcpdf php-twig
   php-twig-i18n-extension php-webmozart-assert php-xml php-zip php8.2-bz2
   php8.2-cli php8.2-common php8.2-curl php8.2-gd php8.2-mbstring php8.2-mcrypt
   php8.2-mysql php8.2-opcache php8.2-readline php8.2-xml php8.2-zip ssl-cert

Create Symbolic Link

Create a symbolic link from the installation files to Nginx’s document root directory.

sudo 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.

images

Done!

bookmark_borderInstalling Joomla on Ubuntu 23.10

Hello,

In this week’s feature highlight, we look at How to Install Joomla on Ubuntu 23.10

Joomla is a free and open-source content management system for publishing web content on websites. Web content applications include discussion forums, photo galleries, e-Commerce, and user communities, and numerous other web-based applications.

Update the System,

apt update

apt upgrade

LAMP Stack Configuration

Joomla like any other CMS application, will require a web server with Database running on the system to support it. And since Joomla is built on PHP, we will need to install PHP as well.

Install Apache and PHP

We will now install Apache and PHP and other supporting packages by running the below command,

apt install apache2 libapache2-mod-php openssl php-imagick php-gd php-imap php-intl php-json php-ldap php-mbstring php-mysql php-pgsql php-smbclient php-ssh2 php-sqlite3 php-xml php-zip

Verify apache version using below command,

apache2 -version

Output:

root@ubuntu23:~# apache2 -version
Server version: Apache/2.4.57 (Ubuntu)
Server built:   2023-07-21T21:17:42

Now start and enable the Apache Web server,

systemctl start apache2 
systemctl enable apache2

Verify Apache is up and running using below command,

systemctl status apache2

Output:

root@ubuntu23:~# 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-10-20 08:14:53 UTC; 6min ago
       Docs: https://httpd.apache.org/docs/2.4/
   Main PID: 15570 (apache2)
      Tasks: 6 (limit: 2226)
     Memory: 20.0M
        CPU: 347ms
     CGroup: /system.slice/apache2.service
             ├─15570 /usr/sbin/apache2 -k start
             ├─15573 /usr/sbin/apache2 -k start
             ├─15574 /usr/sbin/apache2 -k start
             ├─15575 /usr/sbin/apache2 -k start
             ├─15576 /usr/sbin/apache2 -k start
             └─15577 /usr/sbin/apache2 -k start

Oct 20 08:14:53 ubuntu23 systemd[1]: Starting apache2.service - The Apache HTTP>
Oct 20 08:14:53 ubuntu23 apachectl[15569]: AH00558: apache2: Could not reliably>
Oct 20 08:14:53 ubuntu23 systemd[1]: Started apache2.service - The Apache HTTP >

Open server IP address on your browser(http://Server_Ip) to see default Apache page.

Note: Replace “Server_Ip” with actual Ip address of the server.

images

Verify PHP using below command

php -v  

Output:

  root@ubuntu23:~# php -v
  PHP 8.2.10-2ubuntu1 (cli) (built: Sep  5 2023 14:37:47) (NTS)
  Copyright (c) The PHP Group
  Zend Engine v4.2.10, Copyright (c) Zend Technologies
      with Zend OPcache v8.2.10-2ubuntu1, Copyright (c), by Zend Technologies

Install MariaDB

Let us install MariaDB on the server now with the following command,

apt install mariadb-server

MariaDB is not secured by default, As a precaution, we are secure the database engine using below command.

mysql_secure_installation

Create a Joomla Database

Login to MariaDB using the command

mysql -u root -p

Let us configure the Database so Joomla can connect to it and store the data.

For this, we will create a Database, create a User and grant certain Privileges to the User. Refer the below commands for the usecase.

CREATE DATABASE joomla;

GRANT ALL PRIVILEGES ON joomla.* TO 'joomla_user'@'localhost' IDENTIFIED BY  'StrongPassword';

FLUSH PRIVILEGES;

EXIT;

Download and Extract Joomla

Note: At the time of writing this article, Joomla 5 had just been released.

We will now download the latest version of Joomla from the Official site.

Download Joomla in Ubuntu using below command,

wget https://github.com/joomla/joomla-cms/releases/download/5.0.0/Joomla_5.0.0-Stable-Full_Package.zip

Once the download is complete. We need to unzip this to the /var/www/html/ directory. Make the directory called Joomla.

apt install unzip 

mkdir /var/www/html/joomla

Unzip the zipped Joomla file to ‘Joomla’ directory created above.

unzip Joomla_5.0.0-Stable-Full_Package.zip -d /var/www/html/joomla

After unzip, Set the directory ownership of the directory to Apache user and change the permissions using below command,

chown -R www-data:www-data /var/www/html/joomla
chmod -R 755 /var/www/html/joomla

Restart Apache Web server using following command,

systemctl restart apache2 

Configuring Apache for Joomla

Configure the Apache webserver to serve Joomla webpages. For this create a virtual host’s file for Joomla and name it joomla.conf,

nano /etc/apache2/sites-available/joomla.conf

Add the following content into the file

<VirtualHost *:80>
 ServerAdmin admin@dev.domainhere.info
 DocumentRoot /var/www/html/joomla/
 ServerName dev.domainhere.info
 ServerAlias www.dev.domainhere.info

 ErrorLog ${APACHE_LOG_DIR}/error.log
 CustomLog ${APACHE_LOG_DIR}/access.log combined

 <Directory /var/www/html/joomla/>
        Options FollowSymlinks
        AllowOverride All
        Require all granted
 </Directory>
</VirtualHost>

Save and exit the file,

Replace dev.domainhere.info with your actual domain name.

Enable the virtual host file,

a2ensite joomla.conf
a2enmod rewrite

After this Restart Apache Webserver using below command,

systemctl restart apache2

Open your browser to load the site, http://dev.domainhere.info.

Install SSL Certificate

Let us install the SSL Certificate from Let’s Encrypt. For this, you will need to install certbot via snapd.

Installing snapd,

apt install snapd

Check the snapd for updates,

snap install core; sudo snap refresh core

Install Certbot

snap install --classic certbot

ln -s /snap/bin/certbot /usr/bin/certbot

Since we’re using Apache web server, run the below command to get the certificate,

certbot --apache

The Certbot will take care of your renewal automatically before they expire, you would have to run the certbot again only if you make changes to your configuration. You can perform a test run with below command,

certbot renew --dry-run

Next, reload the page on the browser and it should then redirect and load the HTTPS site https://dev.domainhere.info.

Joomla Configuration

On the browser, we will configure the remaining aspects of getting our Joomla CMS up and running

Upon loading the domain, you will be prompted with setting up Language and Site Name

images

Enter the required details such as Username, User Account, Super User Password, and Email Address, and click on Setup Database Connection button

images

Enter the Database information that was configured earlier,

images

Enter the username and password which was set earlier,

images

View of the Dashboard after loggin in,

images

Done! This concludes the topic of installing latest version of Joomla on Ubuntu 23.10.

bookmark_borderDiscontinuation of Free IP Announce/BYOIP Services via AS205320

Hello,
This is a notice to inform that we have discontinued our free to use IP Announce/BYOIP Services via AS205320.

This service was provided to our end-customers as a means to facilitate BYOIP (bring-your-own-IP) allowing for easier, cheaper and long term expansion of services on our platform. For example: Customers could rent a dedicated server from our platform and IP addresses externally and use them together for use as VPS host-nodes.

Over the past months, this free to use service has been targeted by various groups who have used it for everything but long term expansion of services and ultimately created a lot of abuse which is not something we expected given the amount of “work”, “documentation” and “technical effort” required to rent IPv4 addresses from the open market.

We implemented various allow/deny checks on customer enquiries for this product on our end and as of October 2023 were left with just a few customers who were allowed to access this feature, but ultimately the abuse didn’t stop due to the nature of webhosting services which can be resold across multiple levels.

At this point of time, we have no option but to retire this free to use service which was used by a few customers but ultimately generated more than multiple years worth of abuse in a few months.

The impact of this given the active pool of customers we had using this service in October 2023, should be NIL across our userbase, but we feel it’s fair to add this announcement so that anyone who is referred to us from word-of-mouth can find this blog post as a reference too.


Frequently Asked Questions


Q: Does this impact my VPS Hosting with you?
A: No, none of our VPS hosting customers had a BYOIP/IP Announcement, hence this does not impact you.

Q: Does this impact my shared hosting / reseller hosting with you?
A: No, none of our shared hosting / reseller hosting had a BYOIP/IP Announcement, hence this does not impact you.

Q: Does this impact my dedicated server with you?
A: Apart from a single digit number of customers across 2023, and a even smaller single digit number in October 2023, none of our dedicated server customers had a BYOIP/IP Announcement, hence this does not impact you.

Thus, the impact of this feature being discontinued is, simply: NIL/non-existent to our customer base, apart from the customers who used this service and no longer can. So, If you didn’t use it, you aren’t affected 🙂


Thanks,
-Team CrownCloud.


bookmark_borderEnabling BBR on Ubuntu 23.10

Hello,
In this week’s feature highlight, we look at How to Enable BBR on Ubuntu 23.10

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@ubuntu23:~# 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@ubuntu23:~# 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@ubuntu23:~# 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@ubuntu23:~# sysctl net.ipv4.tcp_congestion_control
net.ipv4.tcp_congestion_control = bbr

bookmark_borderInstalling Node.js on Ubuntu 23.10

Hello,
In this week’s feature highlight, we look at How to Install Node.js on Ubuntu 23.10

Node.js is an open-source, server-side runtime environment that allows you to run JavaScript on the server. It is designed to be efficient and lightweight and is commonly used to build scalable network applications and web services.

To install Node.js on an Ubuntu 23.10 server, you can follow these steps:

Login to the Ubuntu 23.10 server and update the package repository information.

apt update

Install NVM manager

NVM, which stands for Node Version Manager, is a popular tool for managing multiple versions of Node.js on a single machine. It allows you to switch between different Node.js versions and manage global and project-specific versions with ease.

To install nvm, you can use the following command in your terminal:

wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.39.3/install.sh | bash

Output:

root@vps:~# wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.39.3/install.sh | bash
=> Downloading nvm from git to '/root/.nvm'
=> Cloning into '/root/.nvm'...
remote: Enumerating objects: 360, done.
remote: Counting objects: 100% (360/360), done.
remote: Compressing objects: 100% (306/306), done.
remote: Total 360 (delta 41), reused 167 (delta 28), pack-reused 0
Receiving objects: 100% (360/360), 220.29 KiB | 2.16 MiB/s, done.
Resolving deltas: 100% (41/41), done.
* (HEAD detached at FETCH_HEAD)
  master
=> Compressing and cleaning up git repository

=> Appending nvm source string to /root/.bashrc
=> Appending bash_completion source string to /root/.bashrc
=> Close and reopen your terminal to start using nvm or run the following to use it now:

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion
root@vps:~#

Update your shell ~/.profile by running following command

source ~/.profile

Next, Check the if NVM installed or not by checking for its version.

nvm --version

Output:

root@vps:~# nvm --version
0.39.3
root@vps:~#

List out the all available Node.js versions. you can see all Node.js versions from the first version to the latest version.

nvm ls-remote

Output:

root@vps:~# nvm ls-remote
        v0.1.14
        v0.1.15
        v0.1.16
        v0.1.17
        v0.1.18
        .......
        ......
        .....
        ....
        ...
        ..
        v20.6.1
        v20.7.0
        v20.8.0
        v20.8.1
        v21.0.0
root@vps:~#

To install a specific Node.js version, use the following command. Here, we are installing v21.0.0. If you want to install another version, replacing v21.0.0 with the version number you want:

nvm install 21.0.0

Output:

root@vps:~# nvm install 21.0.0
Downloading and installing node v21.0.0...
Downloading https://nodejs.org/dist/v21.0.0/node-v21.0.0-linux-x64.tar.xz...
############################################################################################################## 100.0%
Computing checksum with sha256sum
Checksums matched!
Now using node v21.0.0 (npm v10.2.0)
Creating default alias: default -> 21.0.0 (-> v21.0.0)
root@vps:~#

And check the version of the Node.js once the installation is done.

node -v

Output:

root@vps:~# node -v
v21.0.0
root@vps:~#

Done!

bookmark_borderInstalling GCC on Debian 12

Hello,

In this week’s feature highlight, we look at How to Install GCC on Debian 12

GCC, the GNU Compiler Collection is a compiler system developed to support various programming languages. GCC is the standard compiler for most projects related to GNU and Linux, including the Linux kernel.

Installing GCC on Debian

Debian repositories contain build-essential package which contains the GCC compiler, g++ and make

Debian an existing system by running following command

apt upgrade 

apt install build-essential

If you want to install the manual page for GCC, run the below command,

apt-get install manpages-dev

After installing, to verify that GCC is successfully installed by checking gcc version,

gcc --version

Output:

 root@server:~# gcc --version
 gcc (Debian 12.2.0-14) 12.2.0
 Copyright (C) 2022 Free Software Foundation, Inc.
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

root@server:~#

Compiling a Hello World Example

Create a basic C code source, eg: let’s create a hello world C program and open hello.c text file,

nano hello.c

Add the following code to hello.c file

// hello.c
#include <stdio.h>

int main() {
    printf("Hello, world!\n");
    return 0;
}

Compile it into an executable and execute the hello program by running the following commands,

gcc hello.c -o hello

./hello

Output:

root@server:~# ./hello 
Hello, world!

bookmark_borderInstalling and use PHP Composer on Debian 12

Hello,

In this week’s feature highlight, we look at How to Install and use PHP Composer on Debian 12

Composer is a dependency manager for the programming language, PHP. It functions as some sort of project manager that helps the programmer manage dependencies that will be used on a project-to-project basis.

Installing Composer on Debian 12

First, need to check for any pending system updates,

apt update

apt upgrade

Install the required packages.

apt install wget php-cli php-zip unzip

Download the composer installer file.

wget -O composer-setup.php https://getcomposer.org/installer

Output:

root@vps:~# wget -O composer-setup.php https://getcomposer.org/installer
--2023-06-13 20:51:32--  https://getcomposer.org/installer
Resolving getcomposer.org (getcomposer.org)... 142.44.245.229, 2607:5300:201:2100::4:d105
Connecting to getcomposer.org (getcomposer.org)|142.44.245.229|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 58140 (57K) [application/octet-stream]
Saving to: ‘composer-setup.php’

composer-setup.php                100%[=============================================================>]  56.78K  --.-KB/s    in 0.08s   

2023-06-13 20:51:32 (738 KB/s) - ‘composer-setup.php’ saved [58140/58140]

root@vps:~# 

To install Composer globally inside the /usr/local/bin directory by running the following command.

php composer-setup.php --install-dir=/usr/local/bin --filename=composer

Output:

root@vps:~# php composer-setup.php --install-dir=/usr/local/bin --filename=composer
All settings correct for using Composer
Downloading...

Composer (version 2.5.8) successfully installed to: /usr/local/bin/composer
Use it: php /usr/local/bin/composer

root@vps:~# 

If a new Composer version is available, update the package by running the following command.

composer self-update 

Use Composer in PHP Project

mkdir ~/my-first-composer-project

cd ~/my-first-composer-project

Initialize a new composer.json and install the carbon package by running the following command.

composer require nesbot/carbon

Output:

root@vps:~/my-first-composer-project# composer require nesbot/carbon
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Continue as root/super user [yes]? yes
Info from https://repo.packagist.org: #StandWithUkraine
./composer.json has been created
Running composer update nesbot/carbon
Loading composer repositories with package information
Updating dependencies
Lock file operations: 5 installs, 0 updates, 0 removals
  - Locking nesbot/carbon (2.67.0)
  - Locking symfony/polyfill-mbstring (v1.27.0)
  - Locking symfony/polyfill-php80 (v1.27.0)
  - Locking symfony/translation (v6.3.0)
  - Locking symfony/translation-contracts (v3.3.0)
....

After the installation is complete, you can see that Composer created two files composer.json and composer.lock along with a vendor directory.

ls -l

Output:

root@vps:~/my-first-composer-project# ls -l
total 28
-rw-r--r-- 1 root root    60 Jun 13 20:55 composer.json
-rw-r--r-- 1 root root 16387 Jun 13 20:55 composer.lock
drwxr-xr-x 6 root root  4096 Jun 13 20:55 vendor
root@vps:~/my-first-composer-project# 

Create a new file named testing.php and paste the following content.

<?php

require __DIR__ . '/vendor/autoload.php';

use Carbon\Carbon;

printf("Now: %s", Carbon::now());

Run the script by running the following command.

php testing.php

Output:

root@vps:~/my-first-composer-project# php testing.php 
Now: 2023-06-13 20:58:35root@vps:~/my-first-composer-project# 

Next, if you want to update the package then you can use the following command.

composer update

Output:

root@vps:~/my-first-composer-project# composer update
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Continue as root/super user [yes]? yes
Composer is operating significantly slower than normal because you do not have the PHP curl extension enabled.
Loading composer repositories with package information
Updating dependencies
Nothing to modify in lock file
Installing dependencies from lock file (including require-dev)
Nothing to install, update or remove
Generating autoload files
5 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
No security vulnerability advisories found
root@vps:~/my-first-composer-project# 

Done!

bookmark_borderInstalling Elasticsearch on Debian 12

Hello,

In this week’s feature highlight, we look at How to Install Elasticsearch on Debian 12

Elasticsearch is a highly scalable open-source full-text search and analytics engine. It allows you to store, search, and analyze big volumes of data quickly and in near real-time. Elasticsearch is an open-source developed in Java and used by many big organizations around the world.

Install OpenJDK-11

First, update the packages index and install the OpenJDK-11 with the following commands.

apt update

OpenJDK packages are available under native apt repositories. You can simply use apt-cache search command to search the available java version for your Debian system.

apt-cache search openjdk

Output:

root@vps:~# apt-cache search openjdk
openjdk-17-dbg - Java runtime based on OpenJDK (debugging symbols)
openjdk-17-demo - Java runtime based on OpenJDK (demos and examples)
openjdk-17-doc - OpenJDK Development Kit (JDK) documentation
openjdk-17-jdk - OpenJDK Development Kit (JDK)
openjdk-17-jdk-headless - OpenJDK Development Kit (JDK) (headless)
openjdk-17-jre - OpenJDK Java runtime, using Hotspot JIT

Now install openjdk latest version,

apt-get install openjdk-17-jre

Output:

root@vps:~# apt-get install openjdk-17-jre
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  adwaita-icon-theme alsa-topology-conf alsa-ucm-conf at-spi2-common at-spi2-core ca-certificates-java dconf-gsettings-backend
  dconf-service fontconfig

After installation, check the version of JAVA.

java -version

Output:

root@vps:~# java -version
openjdk version "17.0.6" 2023-01-17
OpenJDK Runtime Environment (build 17.0.6+10-Debian-1)
OpenJDK 64-Bit Server VM (build 17.0.6+10-Debian-1, mixed mode, sharing)
root@vps:~#

Install Elasticsearch

Install GnuPG2 Package by running the following command.

apt-get install gnupg2 -y 

Import GPG key for Elasticsearch packages.

wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -

Output:

root@vps:~# wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | apt-key add -
Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
OK
root@vps:~# 

Next, add the Elasticsearch repository to the system by the following command.

sh -c 'echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" > /etc/apt/sources.list.d/elastic-7.x.list'

After adding the repository to your system. Update cache and then install Elasticsearch packages on your system.

apt update 

apt install elasticsearch

Output:

root@vps:~# apt install elasticsearch
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
  elasticsearch

After installing the Elasticsearch package, Start and enable the elasticsearch service with the following command.

systemctl start elasticsearch.service

systemctl enable elasticsearch.service

Output:

root@vps:~# systemctl enable elasticsearch.service
Synchronizing state of elasticsearch.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable elasticsearch
Created symlink /etc/systemd/system/multi-user.target.wants/elasticsearch.service → /lib/systemd/system/elasticsearch.service.
root@vps:~# 

Configure Elasticsearch

Once the elasticsearch has been installed on your system, open the elasticsearch.yml configuration file.

nano /etc/elasticsearch/elasticsearch.yml 

Search for the line that contains network.host, uncomment it, and change the value to 0.0.0.0.

Set the network host to 0.0.0.0 to listen on all interfaces and make it available publicly,

network.host: 0.0.0.0

In case you want to configure this to be private/local to your machine. You will have to set the network.host to 127.0.0.1, so the content is not public.

Add discovery.type: single-node under the discovery section,

discovery.type: single-node

Save and exit the file once modified and restart the Elasticsearch service for the changes to take effect.

systemctl restart elasticsearch

Install and enable firewall using below command,

apt install ufw -y

ufw enable 

Output:

Command may disrupt existing ssh connections. Proceed with operation (y|n)? y
Firewall is active and enabled on system startup
root@vps:~# 

Now, allow the port and reload the firewall using the following command.

ufw allow 9200

ufw reload  

Output:

root@vps:~# ufw allow 9200
Rules updated
Rules updated (v6)
root@vps:~# ufw enable
Command may disrupt existing ssh connections. Proceed with operation (y|n)? y
Firewall is active and enabled on system startup
root@vps:~# 

Enter it into your browser’s to the server hostname or IP address followed by port #9200

http://<your_server_IP>:9200

Output:

{
  "name" : "vps.server.com",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "Njc30wnCRsOXSECsvnlmdA",
  "version" : {
    "number" : "7.17.10",
    "build_flavor" : "default",
    "build_type" : "deb",
    "build_hash" : "fecd68e3150eda0c307ab9a9d7557f5d5fd71349",
    "build_date" : "2023-04-23T05:33:18.138275597Z",
    "build_snapshot" : false,
    "lucene_version" : "8.11.1",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

Done!

bookmark_borderInstalling Duf on Debian 12

Hello,

In this week’s feature highlight, we look at How to Install Duf on Debian 12

Duf also called “Disk Usage Free utility” is a free and open-source tool written in Golang. It is used to display disk usage of the system in a tabular format. It is an alternative to the df command and it can be installed on Linux, BSD, Windows, and macOS. It also displays the disk usage details in the JSON output.

In this post, we will show you how to monitor disk usage with the Duf utility on Debian 12.

Prerequisites:

  • A system with Debian 12 installed and running.
  • root access to the system.

Check for System Updates

First, we will update the system to the latest with the following commands,

apt update
apt upgrade

Install Duf

At the time of writing this article, version 0.8.1 was the latest. You can check and download the latest version of .deb source file from their official repository.

We will download using wget command as shown below,

wget https://github.com/muesli/duf/releases/download/v0.8.1/duf_0.8.1_linux_amd64.deb

Output:

Resolving objects.githubusercontent.com (objects.githubusercontent.com)... 185.199.108.133, 185.199.109.133, 185.199.110.133, ...
Connecting to objects.githubusercontent.com (objects.githubusercontent.com)|185.199.108.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 917644 (896K) [application/octet-stream]
Saving to: ‘duf_0.8.1_linux_amd64.deb’

duf_0.8.1_linux_amd64.deb         100%[=============================================================>] 896.14K  --.-KB/s    in 0.02s   

2023-06-15 22:28:46 (51.3 MB/s) - ‘duf_0.8.1_linux_amd64.deb’ saved [917644/917644]

root@vps:~# 

Install the downloaded .deb source file using the dpkg command,

apt install dpkg
dpkg -i duf_0.8.1_linux_amd64.deb

Output:

root@vps:~# dpkg -i duf_0.8.1_linux_amd64.deb 
Selecting previously unselected package duf.
(Reading database ... 33235 files and directories currently installed.)
Preparing to unpack duf_0.8.1_linux_amd64.deb ...
Unpacking duf (0.8.1) ...
Setting up duf (0.8.1) ...
root@vps:~#

Using the Duf Command Utility

We will now try using the duf command on the terminal to get disk-related information.

duf

Output:

root@vps:~# duf
╭───────────────────────────────────────────────────────────────────────────────────────╮
│ 1 local device                                                                        │
├────────────┬───────┬──────┬───────┬───────────────────────────────┬──────┬────────────┤
│ MOUNTED ON │  SIZE │ USED │ AVAIL │              USE%             │ TYPE │ FILESYSTEM │
├────────────┼───────┼──────┼───────┼───────────────────────────────┼──────┼────────────┤
│ /          │ 97.9G │ 1.7G │ 91.2G │ [....................]   1.8% │ ext4 │ /dev/vda2  │
╰────────────┴───────┴──────┴───────┴───────────────────────────────┴──────┴────────────╯
╭────────────────────────────────────────────────────────────────────────────────────────────────╮
│ 5 special devices                                                                              │
├─────────────┬────────┬────────┬────────┬───────────────────────────────┬──────────┬────────────┤
│ MOUNTED ON  │   SIZE │   USED │  AVAIL │              USE%             │ TYPE     │ FILESYSTEM │
├─────────────┼────────┼────────┼────────┼───────────────────────────────┼──────────┼────────────┤
│ /dev        │   1.9G │     0B │   1.9G │                               │ devtmpfs │ udev       │
│ /dev/shm    │   1.9G │     0B │   1.9G │                               │ tmpfs    │ tmpfs      │
│ /run        │ 391.5M │ 512.0K │ 391.0M │ [....................]   0.1% │ tmpfs    │ tmpfs      │
│ /run/lock   │   5.0M │     0B │   5.0M │                               │ tmpfs    │ tmpfs      │
│ /run/user/0 │ 391.5M │     0B │ 391.5M │                               │ tmpfs    │ tmpfs      │
╰─────────────┴────────┴────────┴────────┴───────────────────────────────┴──────────┴────────────╯

Next, Find out more duf usages and available options that you can use to get started,

duf --help

To display the information about Pseudo, inaccessible, and duplicate file systems, run the following command:

duf -all

Output:

root@vps:~# duf -all
╭────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ 5 local devices                                                                                        │
├────────────────────────────┬───────┬──────┬───────┬───────────────────────────────┬───────┬────────────┤
│ MOUNTED ON                 │  SIZE │ USED │ AVAIL │              USE%             │ TYPE  │ FILESYSTEM │
├────────────────────────────┼───────┼──────┼───────┼───────────────────────────────┼───────┼────────────┤
│ /                          │ 97.9G │ 1.7G │ 91.2G │ [....................]   1.8% │ ext4  │ /dev/vda2  │
│ /run/credentials/systemd-s │    0B │   0B │    0B │                               │ ramfs │ ramfs      │
│ ysctl.service              │       │      │       │                               │       │            │
│ /run/credentials/systemd-s │    0B │   0B │    0B │                               │ ramfs │ ramfs      │
│ ysusers.service            │       │      │       │                               │       │            │
│ /run/credentials/systemd-t │    0B │   0B │    0B │                               │ ramfs │ ramfs      │
│ mpfiles-setup-dev.service  │       │      │       │                               │       │            │
│ /run/credentials/systemd-t │    0B │   0B │    0B │                               │ ramfs │ ramfs      │
│ mpfiles-setup.service      │       │      │       │                               │       │            │
╰────────────────────────────┴───────┴──────┴───────┴───────────────────────────────┴───────┴────────────╯
╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ 20 special devices                                                                                              │
├──────────────────────────┬────────┬────────┬────────┬───────────────────────────────┬─────────────┬─────────────┤
│ MOUNTED ON               │   SIZE │   USED │  AVAIL │              USE%             │ TYPE        │ FILESYSTEM  │
├──────────────────────────┼────────┼────────┼────────┼───────────────────────────────┼─────────────┼─────────────┤
│ /dev                     │   1.9G │     0B │   1.9G │                               │ devtmpfs    │ udev        │
│ /dev/hugepages           │     0B │     0B │     0B │                               │ hugetlbfs   │ hugetlbfs   │
│ /dev/mqueue              │     0B │     0B │     0B │                               │ mqueue      │ mqueue      │
│ /dev/pts                 │     0B │     0B │     0B │                               │ devpts      │ devpts      │
│ /dev/shm                 │   1.9G │     0B │   1.9G │                               │ tmpfs       │ tmpfs       │
│ /proc                    │     0B │     0B │     0B │                               │ proc        │ proc        │
│ /proc/sys/fs/binfmt_misc │     0B │     0B │     0B │                               │ binfmt_misc │ binfmt_misc │
│ /proc/sys/fs/binfmt_misc │     0B │     0B │     0B │                               │ autofs      │ systemd-1   │
│ /run                     │ 391.5M │ 512.0K │ 391.0M │ [....................]   0.1% │ tmpfs       │ tmpfs       │
│ /run/lock                │   5.0M │     0B │   5.0M │                               │ tmpfs       │ tmpfs       │
│ /run/user/0              │ 391.5M │     0B │ 391.5M │                               │ tmpfs       │ tmpfs       │
│ /sys                     │     0B │     0B │     0B │                               │ sysfs       │ sysfs       │
│ /sys/fs/bpf              │     0B │     0B │     0B │                               │ bpf         │ bpf         │
│ /sys/fs/cgroup           │     0B │     0B │     0B │                               │ cgroup2     │ cgroup2     │
│ /sys/fs/fuse/connections │     0B │     0B │     0B │                               │ fusectl     │ fusectl     │
│ /sys/fs/pstore           │     0B │     0B │     0B │                               │ pstore      │ pstore      │
│ /sys/kernel/config       │     0B │     0B │     0B │                               │ configfs    │ configfs    │
│ /sys/kernel/debug        │     0B │     0B │     0B │                               │ debugfs     │ debugfs     │
│ /sys/kernel/security     │     0B │     0B │     0B │                               │ securityfs  │ securityfs  │
│ /sys/kernel/tracing      │     0B │     0B │     0B │                               │ tracefs     │ tracefs     │
╰──────────────────────────┴────────┴────────┴────────┴───────────────────────────────┴─────────────┴─────────────╯

Done!