bookmark_borderInstalling Focalboard on Ubuntu 20.04

Hello,
In this week’s feature highlight, we look at How to Install Focalboard on Ubuntu 20.04

Focalboard is an open source, self-hosted alternative to Trello, Notion, and Asana. It’s a project management tool that helps define, organize, track and manage work across teams, using a familiar kanban board view

Update the System.

apt update

apt upgrade

Install Focalboard

Download the focalboard packages and then move it into /opt/focalboard directory.

wget https://github.com/mattermost/focalboard/releases/download/v0.9.2/focalboard-server-linux-amd64.tar.gz
tar -xvzf focalboard-server-linux-amd64.tar.gz
sudo mv focalboard /opt

Install NGINX

Now install NGINX using the following command. By default, the Focalboard server runs on port 8000.

sudo apt install nginx

Adjust firewall setting as per your need. You can open port 8000 in the firewall or you can disable the firewall in your server.

Configure NGINX

Create new config site.

sudo nano /etc/nginx/sites-available/focalboard

Copy and paste this configuration.

upstream focalboard {
server localhost:8000;
keepalive 32;
}

server {
listen 80 default_server;

server_name focalboard.example.com;

location ~ /ws/* {
     proxy_set_header Upgrade $http_upgrade;
     proxy_set_header Connection "upgrade";
     client_max_body_size 50M;
     proxy_set_header Host $http_host;
     proxy_set_header X-Real-IP $remote_addr;
     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
     proxy_set_header X-Forwarded-Proto $scheme;
     proxy_set_header X-Frame-Options SAMEORIGIN;
     proxy_buffers 256 16k;
     proxy_buffer_size 16k;
     client_body_timeout 60;
     send_timeout 300;
     lingering_timeout 5;
     proxy_connect_timeout 1d;
     proxy_send_timeout 1d;
     proxy_read_timeout 1d;
     proxy_pass http://focalboard;
 }

 location / {
     client_max_body_size 50M;
     proxy_set_header Connection "";
     proxy_set_header Host $http_host;
     proxy_set_header X-Real-IP $remote_addr;
     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
     proxy_set_header X-Forwarded-Proto $scheme;
     proxy_set_header X-Frame-Options SAMEORIGIN;
     proxy_buffers 256 16k;
     proxy_buffer_size 16k;
     proxy_read_timeout 600s;
     proxy_cache_revalidate on;
     proxy_cache_min_uses 2;
     proxy_cache_use_stale timeout;
     proxy_cache_lock on;
     proxy_http_version 1.1;
     proxy_pass http://focalboard;
   }
}

If there is a default site, then delete it.

sudo rm /etc/nginx/sites-enabled/default

Test the config and reload NGINX using the following commands:

sudo ln -s /etc/nginx/sites-available/focalboard /etc/nginx/sites-enabled/focalboard
sudo nginx -t
sudo /etc/init.d/nginx reload

Install Postgresql

To install Postgresql, run the following commands on the server.

sudo apt install postgresql postgresql-contrib

Now login as a postgres user to create new database,

sudo --login --user postgres

psql

Currently you are in psql prompt, run the following commands,

CREATE DATABASE focal;
CREATE USER focaluser WITH PASSWORD 'focaluser-password';
\q

Exit the session.

exit

Edit the Focalboard /opt/focalboard/config.json,

nano /opt/focalboard/config.json

Modify the dbconfig in the file with the postgres database that was created.

"dbtype": "postgres",
"dbconfig": "postgres://boardsuser:boardsuser-password@localhost/boards?sslmode=disable&connect_timeout=10",

Move focalboard-server file in /opt/focalboard/ directory,

 mv /opt/focalboard/bin/focalboard-server /opt/focalboard/

Configure Focalboard Service

Create a new service config file,

sudo nano /lib/systemd/system/focalboard.service

And paste following lines in file.

[Unit]
Description=Focalboard server

[Service]
Type=simple
Restart=always
RestartSec=5s
ExecStart=/opt/focalboard/focalboard-server
WorkingDirectory=/opt/focalboard

[Install]
WantedBy=multi-user.target

Make systemd reload the new unit, and enable it.

sudo systemctl daemon-reload
sudo systemctl start focalboard.service
sudo systemctl enable focalboard.service

Enter the IP Address:8000 in browser to open the focalboar. You will see following screen.

image

You will see the Focalboard dashboard,

image

Done.

bookmark_borderInstalling and use Docker Compose on Ubuntu 21.04

Hello,
In this week’s feature highlight, we look at How to Install and use Docker Compose on Ubuntu 21.04

Installing Docker on Ubuntu

Check for system updates and install it.

apt update

apt upgrade

Install basic dependencies.

apt install apt-transport-https ca-certificates curl gnupg-agent software-properties-common

Output:

root@vps:~# apt install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
ca-certificates is already the newest version (20210119build1).
ca-certificates set to manually installed.
curl is already the newest version (7.74.0-1ubuntu2).
curl set to manually installed.
software-properties-common is already the newest version (0.99.10).
software-properties-common set to manually installed.
The following packages were automatically installed and are no longer required:
  eatmydata libeatmydata1 python3-certifi python3-importlib-metadata python3-jinja2 python3-json-pointer
  python3-jsonpatch python3-jsonschema python3-markupsafe python3-more-itertools python3-pyrsistent
  python3-requests python3-urllib3 python3-zipp
Use 'apt autoremove' to remove them.
The following NEW packages will be installed:
  apt-transport-https gnupg-agent
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 6,940 B of archives.
After this operation, 212 kB of additional disk space will be used.
Do you want to continue? [Y/n]

Import docker repository GPG key.

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

Output:

root@vps:~# curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
OK

Add Docker CE repository.

add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

Output:

root@vps:~# add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
Repository: 'deb [arch=amd64] https://download.docker.com/linux/ubuntu hirsute stable'
Description:
Archive for codename: hirsute components: stable
More info: https://download.docker.com/linux/ubuntu
Adding repository.
Press [ENTER] to continue or Ctrl-c to cancel.
Adding deb entry to /etc/apt/sources.list.d/archive_uri-https_download_docker_com_linux_ubuntu-hirsute.list
Adding disabled deb-src entry to /etc/apt/sources.list.d/archive_uri-https_download_docker_com_linux_ubuntu-hirsute.list
Hit:1 http://de.archive.ubuntu.com/ubuntu hirsute InRelease
Get:2 http://de.archive.ubuntu.com/ubuntu hirsute-updates InRelease [109 kB]
Get:3 https://download.docker.com/linux/ubuntu hirsute InRelease [28.3 kB]
Hit:4 http://de.archive.ubuntu.com/ubuntu hirsute-backports InRelease
Get:5 http://de.archive.ubuntu.com/ubuntu hirsute-security InRelease [101 kB]
Get:6 https://download.docker.com/linux/ubuntu hirsute/stable amd64 Packages [2,406 B]
Fetched 240 kB in 1s (364 kB/s)
Reading package lists... Done

Installing Docker CE.

apt install docker-ce

Output:

root@vps:~# apt install docker-ce
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  eatmydata libeatmydata1 python3-certifi python3-importlib-metadata python3-jinja2 python3-json-pointer
  python3-jsonpatch python3-jsonschema python3-markupsafe python3-more-itertools python3-pyrsistent
  python3-requests python3-urllib3 python3-zipp
Use 'apt autoremove' to remove them.
The following additional packages will be installed:
  containerd.io docker-ce-cli docker-ce-rootless-extras docker-scan-plugin libslirp0 pigz slirp4netns
Suggested packages:
  aufs-tools cgroupfs-mount | cgroup-lite
The following NEW packages will be installed:
  containerd.io docker-ce docker-ce-cli docker-ce-rootless-extras docker-scan-plugin libslirp0 pigz
  slirp4netns
0 upgraded, 8 newly installed, 0 to remove and 0 not upgraded.
Need to get 108 MB of archives.
After this operation, 465 MB of additional disk space will be used.
Do you want to continue? [Y/n] y

To check status.

systemctl status docker

Output:

root@vps:~# systemctl status docker
● docker.service - Docker Application Container Engine
     Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2021-05-01 03:45:52 UTC; 1min 6s ago
TriggeredBy: ● docker.socket
       Docs: https://docs.docker.com
   Main PID: 632611 (dockerd)
      Tasks: 8
     Memory: 41.1M
     CGroup: /system.slice/docker.service
             └─632611 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
root@vps:~#

Installing Docker Compose on Ubuntu

Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a Compose file to configure your application’s services. Then, using a single command, you create and start all the services from your configuration.

Use curl to download the Compose file into the /usr/local/bin directory.

curl -L "https://github.com/docker/compose/releases/download/1.29.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

Output:

root@vps:~# curl -L "https://github.com/docker/compose/releases/download/1.29.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   633  100   633    0     0    561      0  0:00:01  0:00:01 --:--:--   561
100 12.1M  100 12.1M    0     0  7465k      0  0:00:01  0:00:01 --:--:-- 32.2M

Next, set the correct permissions so that the docker-compose command is executable.

chmod +x /usr/local/bin/docker-compose

To verify that the installation was successful, you can run following command.

docker-compose --version

Output:

root@vps:~# docker-compose --version
docker-compose version 1.29.1, build c34c88b2

Setting Up a docker-compose.yml File

In this section, we’ll use Docker Compose to construct a multi-container WordPress utility.

creating a new directory in your home folder, and then moving into it.

mkdir my_app

cd my_app

Next, create the docker-compose.yml file.

nano docker-compose.yml

Paste the following content on your docker-compose.yml file.

version: '3'

services:
  db:
    image: mysql:5.7
    restart: always
    volumes:
      - db_data:/var/lib/mysql
    environment:
      MYSQL_ROOT_PASSWORD: password
      MYSQL_DATABASE: wordpress

  wordpress:
    image: wordpress
    restart: always
    volumes:
      - ./wp_data:/var/www/html
    ports:
      - "8080:80"
    environment:
      WORDPRESS_DB_HOST: db:3306
      WORDPRESS_DB_NAME: wordpress
      WORDPRESS_DB_USER: root
      WORDPRESS_DB_PASSWORD: password
    depends_on:
       - db

volumes:
    db_data:
    wp_data:

In this example, we have services, db, and wordpress. Each service runs one image, and creates a separate container when docker-compose is run.

Start up the WordPress application by running the following command.

docker-compose up

Output:

root@vps:~# docker-compose up
Creating network "root_default" with the default driver
Creating volume "root_db_data" with default driver
Creating volume "root_wp_data" with default driver
Pulling db (mysql:5.7)...
5.7: Pulling from library/mysql
f7ec5a41d630: Pull complete
9444bb562699: Pull complete
6a4207b96940: Pull complete
181cefd361ce: Pull complete

Navigate to your browser. http://yourserver-ip-address:8080 and you will see the WordPress installation screen.

images

Start the Compose in a detached mode by following command.

docker-compose up -d

Output:

root@vps:~# docker-compose up -d
Starting root_db_1 ... done
Starting root_wordpress_1 ... done

To check the running services.

docker-compose ps

Output:

root@vps:~# docker-compose ps
  Name                    Command               State          Ports
--------------------------------------------------------------------------------
root_db_1          docker-entrypoint.sh mysqld      Up      3306/tcp, 33060/tcp
root_wordpress_1   docker-entrypoint.sh apach ...   Up      0.0.0.0:8080->80/tcp

To stop the services only.

docker-compose stop

To stop and remove containers and networks.

docker-compose down    


bookmark_borderHow to Install Python 3.9 on Ubuntu 21.04

Hello,
In this week’s feature highlight, we look at How to Install Python 3.9 on Ubuntu 21.04

Ubuntu has had Python installed by default since at least version 8.04 and since 18.04 LTS the python included in the base system is Python 3.

Use python command to run commands for any older Python 2.x version, to run a command using the newer version, use python3.

You can check the python version by executing the following command.

python3 --version

If python is not installed by default, you can install it by using the following command.

apt install python3

Output:

root@vps:~# apt install python3
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  libpython3-stdlib python3-minimal python3.9 python3.9-minimal
Suggested packages:
  python3-doc python3-tk python3-venv python3.9-venv python3.9-doc binutils
  binfmt-support
The following NEW packages will be installed:
  libpython3-stdlib python3 python3-minimal python3.9 python3.9-minimal
0 upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
Need to get 2,387 kB of archives.
After this operation, 6,460 kB of additional disk space will be used.
Do you want to continue? [Y/n] y

Next, check the python version.

root@vps:~# python3 -V
Python 3.9.4

bookmark_borderInstalling LAMP Stack with MariaDB on Ubuntu 21.04

Hello,
In this week’s feature highlight, we look at How to Install LAMP Stack with MariaDB on Ubuntu 21.04

Update the system

First, lets check for any pending system package updates,

apt update
apt upgrade

Install Apache

A command to install apache2 and with its utilities.

apt install -y apache2 apache2-utils

Next, check the Status of Apache.

systemctl status apache2

Output:

root@server:~# systemctl status apache2
● apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor prese>
     Active: active (running) since Thu 2021-04-29 16:37:46 UTC; 16s ago
       Docs: https://httpd.apache.org/docs/2.4/
   Main PID: 31366 (apache2)
      Tasks: 55 (limit: 2280)
     Memory: 5.5M
     CGroup: /system.slice/apache2.service
             ├─31366 /usr/sbin/apache2 -k start
             ├─31367 /usr/sbin/apache2 -k start
             └─31368 /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 starts apache at boot time.

systemctl enable apache2

To check Apache Version.

apache2 -v

Output:

Server version: Apache/2.4.41 (Ubuntu)
Server built:   2020-08-12T19:46:17

Enabling the Firewall

Allow the port/service http via UFW

ufw allow http

Output:

Rules updated
Rules updated (v6)

You can now verify whether the Apache webserver is installed correctly and functioning via your web browser.

NOTE: Replace “ip-address” with your actual server IP-Address below.

http://ip-address
LAMP

Install MariaDB Server

Installing MariaDB

apt install mariadb-server mariadb-client

Checking MariaDB status

systemctl status mariadb

Output

root@server:~# systemctl status mariadb
● mariadb.service - MariaDB 10.3.25 database server
     Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor prese>
     Active: active (running) since Thu 2021-04-29 16:41:06 UTC; 15s ago
       Docs: man:mysqld(8)
             https://mariadb.com/kb/en/library/systemd/
   Main PID: 33004 (mysqld)
     Status: "Taking your SQL requests now..."
      Tasks: 31 (limit: 2280)
     Memory: 64.7M
     CGroup: /system.slice/mariadb.service
             └─33004 /usr/sbin/mysqld

To start MariaDB if it is not active.

systemctl start mariadb

Use the following command to auto starts 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:

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!

Login to MariaDB

 mariadb -u root

Exit from MariaDB

exit;

Checking the MariaDB Version

mariadb --version

Output:

root@server:~# mariadb --version
mariadb  Ver 15.1 Distrib 10.3.25-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

Installing PHP 7.4

Run the following commands to install PHP 7.4

apt install php7.4 libapache2-mod-php7.4 php7.4-mysql php-common php7.4-cli php7.4-common php7.4-json php7.4-opcache php7.4-readline

Enable the php7.4 module for Apache and restart the Apache Web server.

a2enmod php7.4

systemctl restart apache2

Checking the PHP Version.

php --version

Output:

root@server:~# php --version
PHP 7.4.3 (cli) (built: Oct  6 2020 15:47:56) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.3, Copyright (c), by Zend Technologies

To ensure PHP is functioning correctly, lets create a test PHP script, for this we create a new file called info.php,

nano /var/www/html/info.php

Add the following into the file, info.php,

<?php phpinfo(); ?>

Visit the the following link in a web browser to verify that PHP is working fine,

NOTE: Replace “ip-address” with your actual server IP-Address below.

http://server-ip-address/info.php
LAMP

To Run Apache with PHP-FPM (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 if you wish to run your WordPress website with PHP-FPM.

First, disable normal/plain PHP 7.4,

a2dismod php7.4

Next, Install the php7.4-fpm package,

apt install php7.4-fpm

Enable the proxy_fcgi and setenvif module.

a2enmod proxy_fcgi setenvif

Output:

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

Enable the php7.4-fpm module in Apache,

a2enconf php7.4-fpm

Restart Apache,

systemctl restart apache2

Enable php7.4-fpm to start on boot, so anytime your system reboots, php7.4-fpm will start with it,

systemctl enable php7.4-fpm

Start the php7.4-fpm service,

systemctl start php7.4-fpm

If you wish to check the status of php7.4-fpm,

systemctl status php7.4-fpm

Output:

root@server:~# systemctl status php7.4-fpm
● php7.4-fpm.service - The PHP 7.4 FastCGI Process Manager
     Loaded: loaded (/lib/systemd/system/php7.4-fpm.service; enabled; vendor preset: >
     Active: active (running) since Thu 2021-04-29 17:13:08 UTC; 15min ago
       Docs: man:php-fpm7.4(8)
    Process: 42271 ExecStartPost=/usr/lib/php/php-fpm-socket-helper install /run/php/>
   Main PID: 42263 (php-fpm7.4)
     Status: "Processes active: 0, idle: 2, Requests: 1, slow: 0, Traffic: 0req/sec"
      Tasks: 3 (limit: 2280)
     Memory: 8.1M
     CGroup: /system.slice/php7.4-fpm.service

To verify enter the following link in a web browser.

NOTE: Replace “ip-address” with your actual server IP-Address below.

http://server-ip-address/info.php
LAMP

Now you have successfully installed LAMP stack (Apache, MariaDB, and PHP7.4) on Ubuntu 21.04.

bookmark_borderInstalling WordPress on Ubuntu 21.04

Hello,

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

Prerequisites:

Creating database

Log into MySQL with the following command.

mysql

First, we’ll create a new database.

MariaDB [(none)]> CREATE DATABASE wordpress_db;

Next, create a new MySQL user account that we will use to operate on WordPress’s new database, with username “wordpress_user”.

MariaDB [(none)]> CREATE USER 'wordpress_user'@'localhost' IDENTIFIED BY 'password';

Link the user and DB together by granting our user access to the database.

MariaDB [(none)]> GRANT ALL PRIVILEGES ON wordpress_db.* to wordpress_user@'localhost';

Flush the privileges so that MySQL knows about the user permissions we just added.

MariaDB [(none)]> FLUSH PRIVILEGES;

Exit out of the MySQL command prompt by typing.

MariaDB [(none)]> exit

Output:

root@vps:~# mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 61
Server version: 10.5.9-MariaDB-1 Ubuntu 21.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 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

Navigate to your browser.

http://IP_ADDRESS/wordpress

images

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

images

Provide the requested information.

images

Once the WordPress is installed login with your new user credentials.

images
images

bookmark_borderInstalling LAMP Stack on Debian 11 bullseye

Hello,

In this week’s feature highlight, we look at How to Install LAMP Stack on Debian 11 bullseye

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 MariaDB database, and dynamic content is processed by PHP.

Update Debian 11 Bullseye

apt update && apt -y upgrade

Install MaridaDB database server

To get started with MariaDB installation, follow the below steps:

apt install -y mariadb-server mariadb-client

Check the status of mariaDB database server.

systemctl status mariadb

Output:

root@server:~# systemctl status mariadb
● mariadb.service - MariaDB 10.5.11 database server
Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2021-08-03 19:42:28 IST; 36min ago
Docs: man:mariadbd(8)

Run the command below to secure your database server,

mysql_secure_installation

Using the above command, you can do the following,

  • Set root password.
  • Remove anonymous users.
  • Disable remote login for root user.
  • Remove test database and access to it.

You can log in as your root user and set up a regular user and a database.

mysql -u root -p

Output:

root@server:~# mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 52
Server version: 10.5.11-MariaDB-1 Debian 11
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)]> 

Install Apache Web Server

Apache is one of the most commonly used web server. You can install by running the below command,

apt install -y apache2 apache2-utils

Output:

root@server:~# apt install -y apache2 apache2-utils
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
apache2-utils is already the newest version (2.4.48-3.1).
Suggested packages: apache2-doc apache2-suexec-pristine | apache2-suexec-custom www-browser

Check apache build and version.

apache2 -v

Output:

root@server:~# apache2 -v
Server version: Apache/2.4.41 (Debian)
Server built:   2021-07-05T07:16:56
root@server:~#

Check service status.

systemctl status apache2

Output:

root@server:~# systemctl status apache2
● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2021-08-03 20:22:39 IST; 8min ago
Docs: https://httpd.apache.org/docs/2.4/
Main PID: 20302 (apache2)

Restart service when a change is made & enable the service to start at boot.

systemctl reload apache2
systemctl enable apache2

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

Example

Install PHP

Follow the below steps to install PHP on the server,

apt install php libapache2-mod-php php-cli php-fpm php-json php-pdo php-mysql php-zip php-gd  php-mbstring php-curl php-xml php-pear php-bcmath

Output:

root@server:~# apt install php libapache2-mod-php php-cli php-fpm php-json php-pdo php-mysql php-zip php-   gd  php-mbstring php-curl php-xml php-pear           php-cmath
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'php7.4-common' instead of 'php-pdo'
The following additional packages will be installed:libapache2-mod-php7.4 php-common php7.4 php7.4-bcmath php7.4-cli php7.4-curl php7.4-fpm php7.4-gd             7.4-json php7.4-mbstring php7.4-mysql php7.4-opcache php7.4-readline php7.4-xml php7.4-zip

Enable Apache module if not already enabled then restart the Web Server.

a2enmod php7.4

Confirm the PHP version

php -v

Output:

root@server:~# php -v
PHP 7.4.21 (cli) (built: Jul  2 2021 03:59:48) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.21, Copyright (c), by Zend Technologies

In order to test the PHP is working on the server, we will create a small file that will list out all the PHP information available.

Run the below command which will create a file,

echo "<?php phpinfo(); ?>" > /var/www/html/info.php

To view the PHP info on your browser, http://IP_address/phpinfo.php

Example.

PHP info

Once you confirmed that the PHP has been installed and working, remove the info.php for security reasons.

rm /var/www/html/info.php

bookmark_borderInstalling Joomla 4 on Ubuntu 21.04

Hello,

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

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.

Let us first check for any pending updates in the Ubuntu server and install if any are available.

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,

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

user1@server:~$ apache2 -version
Server version: Apache/2.4.46 (Ubuntu)
Server built:   2021-06-17T17:09:41

Now start and enable the Apache Webserver

systemctl start apache2 
systemctl enable apache2

Verify Apache is up and running using below command

systemctl status apache2

Output:

root@server:~# systemctl enable apache2
Synchronizing state of apache2.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable apache2
root@server:~# systemctl status apache2
● apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor pre>
     Active: active (running) since Tue 2021-08-17 13:34:31 UTC; 7min ago
       Docs: https://httpd.apache.org/docs/2.4/
   Main PID: 31226 (apache2)
      Tasks: 6 (limit: 1039)
     Memory: 17.5M
     CGroup: /system.slice/apache2.service
             ├─31226 /usr/sbin/apache2 -k start

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@server:~# php -v
PHP 7.4.16 (cli) (built: Jul  5 2021 13:04:38) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.16, Copyright (c), by Zend Technologies

Install MariaDB

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

sudo apt install mariadb-server

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

sudo mysql_secure_installation

Create a Joomla Database

Login to MariaDB using the command

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

MariaDB [(none)]> CREATE USER 'crowncloud'@'localhost' IDENTIFIED BY 'password';
MariaDB [(none)]> CREATE DATABASE joomla_database;
MariaDB [(none)]> GRANT ALL ON joomla_database.* TO 'crowncloud'@'localhost' IDENTIFIED BY 'strongpassword';
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;

Download and Extract Joomla

Note: At the time of writing this article, Joomla 4 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/4.0.0/Joomla_4.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.

mkdir /var/www/html/joomla

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

unzip Joomla_4.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 Webserver using following command

systemctl restart apache2 

Configuring Apache for Joomla

Configure the Apache webserver to server Joomla webpages. For this create a virtual host’s files for Joomla and rename it Joomla.conf

Add the following content into the file

<VirtualHost *:80>
 ServerAdmin admin@example.com
 DocumentRoot /var/www/html/joomla/
 ServerName example.com
 ServerAlias www.example.com

 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>

Enable the virtual hosts’ file.

a2ensite joomla.conf
a2enmod rewrite

After this Restart Apache Webserver using below command

systemctl restart apache2

Open server IP address on your browser(http://Server_IP/joomla) to see Joomla dashboard page.

Setup Site Name below

images

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

images

Setup Database Configuration Details, Then click on Install Joomla

images

After Setting up configuration, Press Complete and Open Admin enter in Joomla

images

Put login details Username and Password to get dashboard

images

Dashboard will look like this

images

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

bookmark_borderInstalling WordPress on Debian 11

Hello,

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

Updating the system

We first update the system to make sure that all our installed packages are upto date. Your Debian system can be updated easily with the following command.

apt update

apt upgrade

Installing Nginx

We will start by installing the Nginx web server. To complete the installation, use the following command.

apt-get install nginx

Once the installation is complete, enable Nginx (to start automatically upon system boot), start the web server and verify the status using the commands below.

systemctl start nginx

systemctl enable nginx

systemctl status nginx

Output:

root@server:~# systemctl status nginx
● nginx.service - A high performance web server and a reverse proxy server
 Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
 Active: active (running) since Tue 2021-08-03 22:10:03 GMT; 14h ago
   Docs: man:nginx(8)
Process: 59970 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Process: 59971 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Main PID: 59972 (nginx)
  Tasks: 9 (limit: 4677)
 Memory: 6.0M
    CPU: 150ms
 CGroup: /system.slice/nginx.service
         ├─59972 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
         ├─59973 nginx: worker process
         ├─59974 nginx: worker process

Installing PHP and MariaDB Server

Install PHP, PHP-FPM, and MariaDB packages by running the following command.

apt-get install php php-mysql php-fpm php-curl php-gd php-intl php-mbstring php-soap php-xml php-xmlrpc php-zip mariadb-server mariadb-client

Once the installation is complete, enable MariaDB (to start automatically upon system boot), start the mariaDB and verify the status using the commands below.

systemctl start mariadb

systemctl enable mariadb

systemctl status mariadb

Output:

root@server:~# systemctl status mariadb
● mariadb.service - MariaDB 10.5.11 database server
 Loaded: loaded (/lib/systemd/system/mariadb.service; >
 Active: active (running) since Tue 2021-08-03 14:12:2>
   Docs: man:mariadbd(8)
         https://mariadb.com/kb/en/library/systemd/
Main PID: 1818 (mariadbd)
 Status: "Taking your SQL requests now..."
  Tasks: 8 (limit: 4677)
 Memory: 84.2M
    CPU: 20.827s
 CGroup: /system.slice/mariadb.service
         └─1818 /usr/sbin/mariadbd

Enable PHP-FPM service, start the PHP-FPM service and verify the status using the commands below.

systemctl start php7.4-fpm

systemctl enable php7.4-fpm

systemctl status php7.4-fpm

Output:

● php7.4-fpm.service - The PHP 7.4 FastCGI Process Manager
 Loaded: loaded (/lib/systemd/system/php7.4-fpm.service; enabled; vendor preset: enabled)
 Active: active (running) since Tue 2021-08-03 21:57:30 GMT; 14h ago
   Docs: man:php-fpm7.4(8)
Main PID: 58325 (php-fpm7.4)
 Status: "Processes active: 0, idle: 2, Requests: 0, slow: 0, Traffic: 0req/sec"
  Tasks: 3 (limit: 4677)
 Memory: 10.9M
    CPU: 4.828s
 CGroup: /system.slice/php7.4-fpm.service
         ├─58325 php-fpm: master process (/etc/php/7.4/fpm/php-fpm.conf)
         ├─58327 php-fpm: pool www
         └─58328 php-fpm: pool www

Finally, you will want to secure your MariaDB installation by issuing the following command.

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

Creating Database

Log into MySQL with the following command.

mysql

First, we’ll create a new database.

MariaDB [(none)]> CREATE DATABASE wordpress_db;

Next, create a new MySQL user account that we will use to operate on WordPress’s new database, with username “wordpress_user”.

MariaDB [(none)]> CREATE USER 'wordpress_user'@'localhost' IDENTIFIED BY 'password';

Link the user and DB together by granting our user access to the database.

MariaDB [(none)]> GRANT ALL PRIVILEGES ON wordpress_db.* to wordpress_user@'localhost';

Flush the privileges so that MySQL knows about the user permissions we just added.

MariaDB [(none)]> FLUSH PRIVILEGES;

Exit out of the MySQL command prompt by typing.

MariaDB [(none)]> exit   

Output:

root@server:~# mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 62
Server version: 10.5.11-MariaDB-1 Debian 11

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.001 sec)

MariaDB [(none)]> 
MariaDB [(none)]> CREATE USER 'wordpress_user'@'localhost' IDENTIFIED BY 'password';
Query OK, 0 rows affected (0.004 sec)

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

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

MariaDB [(none)]> exit   
Bye

Download and Install WordPress

Download 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 and revert changes after installing WordPress.

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

chmod -R 755 /var/www/html/wordpress

Creating an NGINX Virtual Host

Create a Virtual Host for WordPress website on the Nginx server by running the following command.

nano /etc/nginx/conf.d/wordpress.conf

Add the content to file.

server {
        listen 80;
        listen [::]:80;
        root /var/www/html/wordpress;
        index index.php index.html index.htm;
        error_log /var/log/nginx/wordpress_error.log;
        access_log /var/log/nginx/wordpres_access.log;
        client_max_body_size 100M;
        location / {
                try_files $uri $uri/ /index.php?$args;
        }
        location ~ \.php$ {
                include snippets/fastcgi-php.conf;
                fastcgi_pass unix:/run/php/php7.3-fpm.sock;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        }
}

Remove the default server block to enable your WordPress website.

rm /etc/nginx/sites-enabled/default

rm /etc/nginx/sites-available/default

Next, test to make sure that there are no syntax errors in any of your Nginx files.

nginx -t

If there aren’t any problems, restart Nginx to enable your changes.

systemctl reload nginx

Navigate to your browser.

http://IP_ADDRESS

images

Provide the requested information.

images

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

images

Once the WordPress is installed login with your new user credentials.

images
images

Done!!

bookmark_borderHow to Install Debian 11

Hello,

In this week’s feature highlight, we look at How to Install Debian 11

  • Login to CrownPanel for managing the server.
  • To start the installation, you will have to mount the Debian 11 ISO. To mount the ISO click on CD-ROM and then select the required ISO from the drop-down menu and click on Mount button(It will take 2-3 minutes) Deb11installer
  • Once it is mounted, click on Power Control and then Click on the Reboot button to reboot the server. You can also perform a soft reboot from the VNC, by clicking on the Send Ctrl+Alt+Del button.
  • Now Launch VNC to start the installation. Deb11installer
  • Select your preferred language and click on continue. Deb11installer
  • Select your preferred country and click on continue. Deb11installer
  • Choose your preferred keyboard layout. Deb11installer
  • Enter the Hostname, In this example we will use “vps.server.com”. You can also add a different Hostname that will better suit your operation. Deb11installer
  • Next, provide root password for the server. We generally recommend a strong password to begin with which helps in keeping the server safer. Check out Password Generator to generate a strong password for you. Deb11installer
  • We will create a new user for the system. For this, you will have to start with adding a Real name for the user. Deb11installer
  • Next, Create the new user. Enter a Username that will be used for non-administrative purposes. Deb11installer
  • Enter the password for the new user. Again, we recommend a strong password, from Password Generator. Deb11installer
  • Select the time-zone. Deb11installer
  • Now you have to partition your disk, Select your partitioning method. In this example, we will go with Manual partitioning. But if you go with guided, system will auto-generate all the standard partitioning that is required for the OS to run. Deb11installer
  • If you select manual, you will get the following window. Deb11installer
  • Select Yes to proceed further, this will overwrite the changes made on the partitioning to the disk. Deb11installer
  • You can select No here, we do not have any other ISO medium to scan. Deb11installer
  • Depending on the location of your server or system, you can select the nearest country for the mirror. Deb11installer
  • Select the Debian archive mirror. Deb11installer
  • You can leave it blank and click on continue. Deb11installer
  • As per your choice, you can select either to opt for sending anonimous data or not here. Deb11installer
  • Choose the additional softwares to install. Generally, you will need “SSH Server”, “standard system utilities” as part of a minimal install. But if you’re looking for a GUI install, you can choose “Debian desktop environment” along with your choice of user interface – GNOME, Xfce etc. Deb11installer
  • Select Yes to install GRUB. Deb11installer
  • Select the partition to install the GRUB boot loader, this will make your newly installed system bootable. For example — In our case, it is partition /dev/vda. Deb11installer Important: After the installation has completed unmount the ISO and reboot the server.
  • After the umount and reboot — Wait for a few minutes and then you will get login access.

bookmark_borderInstalling PostgreSQL in Rocky Linux 8

Hello,

In this week’s feature highlight, we look at How to Install PostgreSQL in Rocky Linux 8

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.

List the PostgreSQL Module

List the PostgreSQL module by using the following command:

dnf module list postgresql

Output:

[root@server ~]# dnf module list postgresql
Last metadata expiration check: 2:22:31 ago on Fri 14 May 2021 01:53:51 PM EDT.
Rocky Linux 8 - AppStream
Name         Stream   Profiles             Summary
postgresql   9.6      client, server [d]   PostgreSQL server and client module
postgresql   10 [d]   client, server [d]   PostgreSQL server and client module
postgresql   12       client, server [d]   PostgreSQL server and client module

Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled

Enable the PostgreSQL Module

Enable the latest version of PostgreSQL module i.e. version 12 by using the following command,

dnf module enable postgresql:12

Output:

[root@server ~]# dnf module enable postgresql:12
Last metadata expiration check: 2:22:51 ago on Fri 14 May 2021 01:53:51 PM EDT.
Dependencies resolved.
================================================================================
 Package           Architecture     Version             Repository         Size
================================================================================
Enabling module streams:
 postgresql                         12

Transaction Summary
================================================================================

Is this ok [y/N]: y
Complete!

Install the PostgreSQL Server

After the version 12 module has been enabled, install the postgresql-server by using the following command:

dnf install postgresql-server

Output:

[root@server ~]# dnf install postgresql-server
Last metadata expiration check: 2:23:17 ago on Fri 14 May 2021 01:53:51 PM EDT.
Dependencies resolved.
================================================================================
 Package           Arch   Version                               Repo       Size
================================================================================
Installing:
 postgresql-server x86_64 12.5-1.module+el8.3.0+109+eaf75cf7    appstream 5.6 M
Installing dependencies:
 libpq             x86_64 12.5-1.el8_2                          appstream 194 k
 postgresql        x86_64 12.5-1.module+el8.3.0+109+eaf75cf7    appstream 1.5 M

Creating a New PostgreSQL Database Cluster

Initialize a database storage area on disk by using the following command:

postgresql-setup --initdb

Output:

[root@server ~]# postgresql-setup --initdb
 * Initializing database in '/var/lib/pgsql/data'
 * Initialized, logs are in /var/lib/pgsql/initdb_postgresql.log

Start the PostgreSQL service:

systemctl start postgresql

Enable the PostgreSQL service:

systemctl enable postgresql

Output:

[root@server ~]# systemctl enable postgresql
Created symlink /etc/systemd/system/multi-user.target.wants/postgresql.service → /usr/lib/systemd/system/postgresql.service.

Verify the PostgreSQL service:

systemctl status postgresql

Output:

[root@server ~]# systemctl status postgresql
● postgresql.service - PostgreSQL database server
   Loaded: loaded (/usr/lib/systemd/system/postgresql.service; enabled; vendor >
   Active: active (running) since Fri 2021-05-14 16:18:20 EDT; 19s ago
 Main PID: 11270 (postmaster)
    Tasks: 8 (limit: 4835)
   Memory: 19.7M
   CGroup: /system.slice/postgresql.service
           ├─11270 /usr/bin/postmaster -D /var/lib/pgsql/data
           ├─11272 postgres: logger
           ├─11274 postgres: checkpointer
           ├─11275 postgres: background writer
           ├─11276 postgres: walwriter

PostgreSQL Roles

We’ll switch to postgres account for this.

sudo -i -u postgres

you can access a postgresql prompt using the psql utility.

psql

Output:

[postgres@server ~]$ psql
psql (12.5)
Type "help" for help.

postgres=#

To exit out of the postgresql shell type.

\q

Change to your original account by using the following command:

exit

To create postgresql Role:

createuser --interactive

Output:

[postgres@vps ~]$ createuser --interactive
Enter name of role to add: jones
Shall the new role be a superuser? (y/n) y

PostgreSQL Database

Create a Database by using the following command:

createdb db_name

Enter the Database name something like:

[postgres@vps ~]$ createdb jones

Opening a PostgreSQL Prompt with the New Role

Add new user by using the following command:

sudo adduser jones

To switch over and connect to the database:

sudo -i -u jones

psql

Output:

[jones@vps ~]$ psql
psql (12.5)
Type "help" for help.

Once you logged in as jones and check your current connection information.

\conninfo

Output:

jones=# \conninfo
You are connected to database "jones" as user "jones" via socket in "/var/run/postgresql" at port "5432".
jones=#