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_borderAlmaLinux ISO is now available for KVM

Hello,

We’re happy to announce that AlmaLinux ISO is now available as an operating system choice for our KVM based plans in our control panel.

You can refer to the following guide to install the operating system on KVM based VPS’s,

https://wiki.crowncloud.net/?how_to_install_almalinux8_4stable

Or, choose our 1-click install template and have it online in minutes.

https://wiki.crowncloud.net/?Reinstalling_your_kvm_vm_on_crownpanel

bookmark_borderRocky Linux ISO is now available for KVM

Hello,

We’re happy to announce that Rocky Linux ISO is now available as an operating system choice for our KVM based plans in our control panel.

You can refer to the following guide to install the operating system on KVM based VPS’s,

https://wiki.crowncloud.net/?How_to_Install_Rocky_Linux

Or, choose our 1-click install template and have it online in minutes.

https://wiki.crowncloud.net/?Reinstalling_your_kvm_vm_on_crownpanel

bookmark_borderDebian 11 ISO is now available for KVM

Hello,

We’re happy to announce that Debian 11 Bullseye ISO is now available as an operating system choice for our KVM based plans in our control panel.

You can refer to the following guide to install the operating system on KVM based VPS’s,

https://wiki.crowncloud.net/?How_to_install_debian11

We’re also working on a 1-click install template which will be available soon for all users!

Stay tuned for further updates!

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.