bookmark_borderInstalling Netdata on Ubuntu 22.04

Hello,

In this week’s feature highlight, we look at How To Install Netdata on Ubuntu 22.04

Netdata is an Open Source real time server monitoring tool. It collects real time data like CPU usage, RAM usage, Load, SWAP usage, Bandwidth usage, Disk usage etc.

Update the Server

Let us update the server using the following command,

apt update -y

apt upgrade -y

Download Netdata Package

Install Netdata on the server using below command.

apt install netdata -y

The -y option is used for the confirmation which will be prompted by the installer.

Netdata Configuration

We need a small change in the configuration file, so that the dashboard is available on a public IP.

If you intend to use this locally, then you do not need to make this change.

nano /etc/netdata/netdata.conf 

Configuration file will look like this.

[global]
        run as user = netdata
        web files owner = root
        web files group = root
        # Netdata is not designed to be exposed to potentially hostile
        # networks. See https://github.com/netdata/netdata/issues/164
        bind socket to IP = 127.0.0.1

By default, the bind socket to IP it set to 127.0.0.1. To access the dashboard using the IP address, you need to replace 127.0.0.1 with your actual server IP Address.

[global]
        run as user = netdata
        web files owner = root
        web files group = root
        # Netdata is not designed to be exposed to potentially hostile
        # networks. See https://github.com/netdata/netdata/issues/164
        bind socket to IP = <Enter your IP address here>

Save the file and restart the netdata service using the below command.

systemctl restart netdata 

Firewall

Netdata listens on port 19999 by default, enable ports in firewall to use Netdata from browser.

ufw allow 19999

Netdata Dashboard

Enter the following URL on the browser to access the Netdata dashboard. By default netdata works on 19999 port.

http://<Enter Your IP Here>:19999/

The dashboard will look like this,

images

bookmark_borderUbuntu 22.04 Template now available for KVM Based VPS

Hey There!
We’re happy to announce that Ubuntu 22.04 is now available as an operating system choice on our KVM-based plans in our control panel.

Please refer to the following guide to install the operating system on KVM based VPSes using our Control Panel, Click Here.

Stay tuned for further updates!

Follow us on CrownCloud BlogTwitter, and Facebook for updates regarding current offers and other updates.

bookmark_borderInstalling PostgreSQL on Ubuntu 22.04

Hello,
In this week’s feature highlight, we look at How To Install PostgreSQL on Ubuntu 22.04

PostgreSQL is a powerful, open-source object-relational database system with over 30 years of active development that has earned it a strong reputation for reliability, feature robustness, and performance.

Install PostgreSQL on Ubuntu

Install PostgreSQL on Ubuntu by using the following command

apt update

apt install postgresql postgresql-contrib

Output:

root@crown:~# apt install postgresql postgresql-contrib
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
postgresql-contrib is already the newest version (13+225ubuntu1).
The following packages were automatically installed and are no longer required:
  libfile-find-rule-perl libnumber-compare-perl libtext-glob-perl
Use 'apt autoremove' to remove them.
Suggested packages:
  postgresql-doc
The following NEW packages will be installed:
  postgresql 

PostgreSQL Roles and Databases

We’ll switch to Postgres account for the next steps, to switch to the postgres account, use the following command,

sudo -i -u postgres

You can access a PostgreSQL prompt using the psql utility

psql

Output:

postgres@crown:~$ psql
psql (14.2 (Ubuntu 14.2-1))
Type "help" for help.

postgres=#

Exit out of the PostgreSQL shell type

\q

Create PostgreSQL Role,

sudo -u postgres createuser --interactive

Output:

Enter name of role to add: john
Shall the new role be a superuser? (y/n) y

Create a PostgreSQL database,

sudo -u postgres createdb john

Open a Postgres Prompt with the New Role.

sudo adduser john

Switch over and connect to the database.

sudo -u john psql

Output:

root@crown:~# sudo -u john psql
could not change directory to "/root": Permission denied
psql (14.2 (Ubuntu 14.2-1))
Type "help" for help.

john=#

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

\conninfo

Output:

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

bookmark_borderInstalling LEMP Stack (Nginx, MariaDB, PHP8.1) on Ubuntu 22.04

Hello,
In this week’s feature highlight, we look at How to Install LEMP Stack (Nginx, MariaDB, PHP8.1) on Ubuntu 22.04

LEMP Stack is a combination of free, open source software. The acronym LEMP refers to the first letters of Linux (Operating system), Nginx Server, MySQL (database software), and PHP, PERL or Python, principal components to build a viable general purpose web server.

Updating the system

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

apt update

apt upgrade

Install Nginx

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

apt install nginx

Output:

root@crown:~# apt install nginx
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  fontconfig-config fonts-dejavu-core libdeflate0 libfontconfig1 libgd3
  libjbig0 libjpeg-turbo8 libjpeg8 libnginx-mod-http-geoip2
  libnginx-mod-http-image-filter libnginx-mod-http-xslt-filter
  libnginx-mod-mail libnginx-mod-stream libnginx-mod-stream-geoip2 libtiff5
  libwebp7 libxpm4 nginx-common nginx-core
Suggested packages:
  libgd-tools fcgiwrap nginx-doc ssl-cert

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

systemctl start nginx

systemctl enable nginx

systemctl status nginx

Output:

 root@crown:~#     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 Thu 2022-03-17 14:43:23 UTC; 36min ago
       Docs: man:nginx(8)
    Process: 42595 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=ex>
    Process: 42596 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, sta>
   Main PID: 42597 (nginx)
      Tasks: 2 (limit: 1074)
     Memory: 2.8M
        CPU: 34ms
     CGroup: /system.slice/nginx.service
             ├─42597 "nginx: master process /usr/sbin/nginx -g daemon on; master_process on;"
             └─42598 "nginx: worker process" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "">

Check the Nginx version,

nginx -v

Output:

root@crown:~#     nginx -v
nginx version: nginx/1.18.0 (Ubuntu)

Verify that the webserver is running and accessible by accessing your server’s IP address.

From your browser,

http://IP_address
image

we need to make the user Nginx the owner of the web directory. By default, it’s owned by the root user.

chown www-data:www-data /usr/share/nginx/html -R

Install MariaDB Server

MariaDB is a popular database server. The installation is simple and requires just a few steps as shown.

apt install mariadb-server mariadb-client

Output:

root@crown:~# apt install mariadb-server mariadb-client
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  galera-4 libcgi-fast-perl libcgi-pm-perl libclone-perl
  libconfig-inifiles-perl libdaxctl1 libdbd-mysql-perl libdbi-perl
  libencode-locale-perl libfcgi-bin libfcgi-perl libfcgi0ldbl
  libhtml-parser-perl libhtml-tagset-perl libhtml-template-perl
  libhttp-date-perl libhttp-message-perl libio-html-perl
  liblwp-mediatypes-perl libmariadb3 libmysqlclient21 libndctl6 libpmem1
  libsnappy1v5 libtimedate-perl liburi-perl liburing2 mariadb-client-10.6
  mariadb-client-core-10.6 mariadb-common mariadb-server-10.6
  mariadb-server-core-10.6 mysql-common socat

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@crown:~# systemctl status mariadb
● mariadb.service - MariaDB 10.6.7 database server
     Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
     Active: active (running) since Thu 2022-03-17 13:37:36 UTC; 1h 37min ago
       Docs: man:mariadbd(8)
             https://mariadb.com/kb/en/library/systemd/
   Main PID: 26174 (mariadbd)
     Status: "Taking your SQL requests now..."
      Tasks: 7 (limit: 1074)
     Memory: 57.2M
        CPU: 1.671s
     CGroup: /system.slice/mariadb.service
             └─26174 /usr/sbin/mariadbd

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

mysql_secure_installation

Output:

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
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

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!

Once secured, you can connect to MySQL and review the existing databases on your database server by using the following command.

mysql -e "SHOW DATABASES;" -p

Output:

root@vps:~# mysql -e "SHOW DATABASES;" -p
Enter password:
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
+--------------------+

Install PHP 8.1

To Install PHP 8.1, use the command.

apt install php php-fpm php-mysql php-common php-cli php-common php-json php-opcache php-readline php-mbstring php-xml php-gd php-curl

To start php8.1-fpm.

systemctl start php8.1-fpm

To auto-start on boot php8.1-fpm.

systemctl enable php8.1-fpm

To Check status.

systemctl status php8.1-fpm

Output:

 root@crown:~# systemctl status php8.1-fpm
● php8.1-fpm.service - The PHP 8.1 FastCGI Process Manager
     Loaded: loaded (/lib/systemd/system/php8.1-fpm.service; enabled; vendor pr>
     Active: active (running) since Thu 2022-03-17 14:12:02 UTC; 57min ago
       Docs: man:php-fpm8.1(8)
   Main PID: 41457 (php-fpm8.1)
     Status: "Processes active: 0, idle: 2, Requests: 1, slow: 0, Traffic: 0req>
      Tasks: 3 (limit: 1074)
     Memory: 11.6M
        CPU: 359ms
     CGroup: /system.slice/php8.1-fpm.service
             ├─41457 "php-fpm: master process (/etc/php/8.1/fpm/php-fpm.conf)" >
             ├─41458 "php-fpm: pool www" "" "" "" "" "" "" "" "" "" "" "" "" "">
             └─41459 "php-fpm: pool www" "" "" "" "" "" "" "" "" "" "" "" "" "">

Setting Up Server Blocks

You need to remove the file default, located in /etc/nginx/sites-enabled.

rm /etc/nginx/sites-enabled/default

Create new server block file under /etc/nginx/conf.d/ directory.

nano /etc/nginx/conf.d/default.conf

Add the following text to the file.

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

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

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

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

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

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

Test PHP

To test PHP-FPM with the Nginx Web server, we need to create an info.php file in the webroot directory.

nano /var/www/html/info.php

Add the following PHP code to the file.

<?php phpinfo(); ?>

Now again, access http://localhost/info.php or http://yourserver-ip-address/info.php. You should see a page similar to the below one.

image

This concludes the installation of LEMP Stack on Ubuntu 22.04 server.

bookmark_borderInstalling LAMP Stack with MariaDB on Ubuntu 22.04

Hello,

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

A LAMP stack is a group of open-source software that is typically installed together to enable a server to host dynamic websites and web apps. This term is actually an acronym which represents the Linux operating system, with the Apache web server. The site data is stored in a MySQL or MariaDB database, and dynamic content is processed by PHP.

First, check for any pending system upgrades.

apt update
apt upgrade

Install Apache

Command to install Apache along with its utilities.

apt install -y apache2 apache2-utils

Next, check the Status of Apache.

systemctl status apache2

Output:

root@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 Mon 2022-03-14 21:07:34 UTC; 45min ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 22154 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
   Main PID: 22158 (apache2)
      Tasks: 7 (limit: 1074)
     Memory: 13.7M
        CPU: 294ms
     CGroup: /system.slice/apache2.service
             ├─22158 /usr/sbin/apache2 -k start
             ├─22159 /usr/sbin/apache2 -k start
             ├─22160 /usr/sbin/apache2 -k start
             ├─22161 /usr/sbin/apache2 -k start
             ├─22162 /usr/sbin/apache2 -k start
             ├─22163 /usr/sbin/apache2 -k start
             └─22195 /usr/sbin/apache2 -k start

If Apache is not active can start using the following command.

systemctl start apache2

Use the following command to auto start Apache at boot time.

systemctl enable apache2

You can confirm the Apache2 version with the below command,

apache2 -v

Output:

Server version: Apache/2.4.52 (Ubuntu)
Server built:   2022-02-03T18:25:47

Enable and Configure Firewall

To enable HTTP TCP port,

ufw allow http

Output:

Rules updated Rules updated (v6) Now you can verify whether the apache is installed correctly or not by opening it in a web browser.

http://ip-address

NOTE: Replace with your Server IP address.

images

Install MariaDB Server

To install MariaDB server, run the below command:

apt install mariadb-server mariadb-client

To check the status of MariaDB.

systemctl status mariadb

Output:

root@server:~# systemctl status mariadb

● mariadb.service - MariaDB 10.6.7 database server
     Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
     Active: active (running) since Mon 2022-03-14 20:55:55 UTC; 57min ago
       Docs: man:mariadbd(8)
             https://mariadb.com/kb/en/library/systemd/
   Main PID: 14311 (mariadbd)
     Status: "Taking your SQL requests now..."
      Tasks: 7 (limit: 1074)
     Memory: 57.2M
        CPU: 1.266s
     CGroup: /system.slice/mariadb.service
             └─14311 /usr/sbin/mariadbd

To start MariaDB if it is not active.

systemctl start mariadb

Use the following command to auto start MariaDB at boot time.

systemctl enable mariadb

Next, MariaDB database security.

NOTE: In this step, you will be prompted with several questions.

mysql_secure_installation

Output:

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!

To login to MariaDB.

 mariadb -u root -p

To exit from MariaDB.

exit

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

Install PHP

PHP 8.1 is the default version of PHP that would be installed on Ubuntu 22.04.

To install PHP.

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

To Enable the Apache PHP module and restart the Apache Web server.

a2enmod php
systemctl restart apache2

To check PHP Version.

php --version

Output:

root@crown:~# php --version
PHP 8.1.0 (cli) (built: Nov 25 2021 19:57:29) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.0, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.0, Copyright (c), by Zend Technologies

To test PHP scripts we need to add the info.php file in the document.

nano /var/www/html/info.php

Add the following to the file.

<?php phpinfo(); ?>

To verify enter the following link in a web browser.

NOTE: Replace with your server IP address below.

http://ip-address/info.php
images

Run PHP-FPM with Apache [Optional]

FPM (FastCGI Process Manager) is an alternative PHP FastCGI implementation with some additional features useful for heavy-loaded sites.

NOTE: This is an optional step, PHP 8.1 is used to run the PHP code but if you want to run PHP code with PHP-FPM follow the below steps.

First, Let us disable PHP,

a2dismod php

Next, Install PHP-FPM.

apt install php8.1-fpm

Enable 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

To enable php8.1-fpm file.

a2enconf php8.1-fpm

Restart the Apache.

systemctl restart apache2

To enable php-fpm.

systemctl enable php8.1-fpm

To start php-fpm.

systemctl start php8.1-fpm

To check the status of php-fpm.

systemctl status php8.1-fpm

Output:

root@crown:~# systemctl status php8.1-fpm
● php8.1-fpm.service - The PHP 8.1 FastCGI Process Manager
     Loaded: loaded (/lib/systemd/system/php8.1-fpm.service; enabled; vendor preset: enabled)
     Active: active (running) since Mon 2022-03-14 22:16:17 UTC; 29s ago
       Docs: man:php-fpm8.1(8)
   Main PID: 24942 (php-fpm8.1)
     Status: "Processes active: 0, idle: 2, Requests: 0, slow: 0, Traffic: 0req/sec"
      Tasks: 3 (limit: 1074)
     Memory: 7.3M
        CPU: 48ms
     CGroup: /system.slice/php8.1-fpm.service

Now you have successfully installed the LAMP stack (Apache, MariaDB, and PHP8.1) on Ubuntu 22.04.

bookmark_borderHow to Install WordPress on Ubuntu 22.04

Hello,

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

WordPress is one of the most popular website-building tools available out there. It is a simple way to get your online presence and perfect for those who do not know how to code and want a simple and effective way to share and build your story on the internet.

Prerequisites:

Creating Database

Log into MySQL with the following command.

mysql -u root -p

First, we’ll create a new database.

CREATE DATABASE wordpress_db;

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

CREATE USER 'wordpress_user'@'localhost' IDENTIFIED BY 'password';

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

GRANT ALL PRIVILEGES ON wordpress_db.* to wordpress_user@'localhost';

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

FLUSH PRIVILEGES;

Exit out of the MySQL command prompt by typing.

exit

Output:

root@crown:~# mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 81
Server version: 10.6.7-MariaDB-2ubuntu1 Ubuntu 22.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 WordPress is installed log in with your new user credentials.

images
images

bookmark_borderUbuntu 22.04 ISO is now available for KVM

Hello,

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

Refer the following Wiki. article to know how to Mount and Install the new Operating System from our CrownPanel, https://wiki.crowncloud.net/?How_to_install_Ubuntu_22_04

bookmark_borderInstalling Magento with LAMP Stack on Ubuntu 21.10

Hello,

In this week’s feature highlight, we look at How to Install Magento with LAMP Stack on Ubuntu 21.10

Magento is an e-commerce platform built on open source technology that provides online merchants with a flexible shopping cart system, as well as control over the look, content, and functionality of their online store. Magento offers powerful marketing, search engine optimization, and catalog-management tools.

Check Magento Latest Versions Here.

Pre-requisites :

  • A system with Ubuntu 21.10 installed and running.
  • root access to the system.
  • Adobe Magento account. For creating an account Click here.
  • MySQL 8 installed and running, for this, you can refer to one of our guides for installing MySQL 8 on Ubuntu 21.10.

Once you’re all set, we’ll proceed with Magento installation and configuration.

Install Apache & PHP

Now , install Apache and PHP using below commads:

apt install -y apache2 apache2-utils 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

Reload apache

a2enmod php7.4

systemctl reload apache2

systemctl enable apache2

Update firewall

ufw allow 80/tcp

ufw allow 443/tcp

Create Database

Let us begin with creating a Database and a user. We will then grant the required privileges to the user so it can interact with the Database.

You should create a database with the name magento2 for all.

mysql -u root

CREATE DATABASE magento2;

CREATE USER 'magento2'@'localhost' IDENTIFIED BY 'password_crowncloud';

GRANT ALL PRIVILEGES ON magento2.* TO 'magento2'@'localhost';

FLUSH PRIVILEGES;

EXIT

The above commands will give complete access to the user magento2. We would suggest using a strong and long password.

Configure PHP Settings for Magento

Configure PHP Memory Limit, Post max size, and Upload max filesize. You can change the limit as per your need.

sed -i 's/memory_limit = .*/memory_limit = 512M/' /etc/php/7.4/apache2/php.ini

sed -i 's/post_max_size = .*/post_max_size = 256M/' /etc/php/7.4/apache2/php.ini

sed -i 's/upload_max_filesize = .*/upload_max_filesize = 512M/' /etc/php/7.4/apache2/php.ini

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

a2enmod php7.4

systemctl restart apache2

Configuring Apache vHost

Now, create a new Apache configuration file dev.domainhere.info.conf for Magento with the following command.

Replace dev.domainhere.info with the domain name of your own for all the below code examples:

vi /etc/apache2/sites-available/dev.domainhere.info.conf

Now, press i to go to INSERT mode and type in the following lines of codes in the dev.domainhere.info.conf file.

<VirtualHost *:80>

ServerName dev.domainhere.info
ServerAlias dev.domainhere.info
ServerAdmin admin@dev.domainhere.info
DocumentRoot /var/www/magento

ErrorLog ${APACHE_LOG_DIR}/dev.domainhere.info_error.log
CustomLog ${APACHE_LOG_DIR}/dev.domainhere.info_access.log combined

<Directory /var/www/magento>
Options FollowSymlinks
AllowOverride All
Require all granted
</Directory>

</VirtualHost>

Enable SSL and Rewrite:

a2ensite dev.domainhere.info

a2enmod rewrite ssl

Restart Apache:

systemctl restart apache2

Download Magento

Let’s install composer first:

cd /var/www

apt install curl git

curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

Now go to Adobe website and create access keys. For creating access keys : Click here.

The below commands will create a new folder Magento with the required files.

When prompted, enter your authentication keys. Your public key is your username & your private key is your password.

composer create-project --repository=https://repo.magento.com/ magento/project-community-edition magento

Let’s make the folder readable.

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

cd /var/www/html/magento

find var generated vendor pub/static pub/media app/etc -type f -exec chmod g+w {} +

find var generated vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} +

chown -R :www-data . 

chmod u+x bin/magento

Disable Elasticsearch module.

php bin/magento module:disable {Magento_Elasticsearch,Magento_InventoryElasticsearch,Magento_Elasticsearch6,Magento_Elasticsearch7}

Install Magento

Let’s install Magento using the below command.

bin/magento setup:install

Yo can access the admin dashboard using the URL displayed after installation with username and password shown.

Next, disable the Magento2 two-factor authentication, clear the cache and install the Cron with the following commands:

-u www-data bin/magento module:disable Magento_TwoFactorAuth

-u www-data bin/magento cache:flush

-u www-data bin/magento cron:install

Restart apache:

systemctl restart apache2

Accessing the website

Now open the Domain name from your browser, this will load the Magento installed website.

https://dev.domainhere.info

Replace the dev.domainhere.info with the actual IP or domain configured on the server.

Now you have successfully installed Magento with LAMP Stack on Ubuntu 21.10.

In this guide,
CrownCloud
Get started at $5/month!
Use Code:
WELCOME for 10% off!

bookmark_borderInstalling PrestaShop with LAMP Stack and Let’s Encrypt SSL on Ubuntu 21.10

Hello,

In this week’s feature highlight, we look at How to Install PrestaShop with LAMP Stack and Let’s Encrypt SSL on Ubuntu 21.10

PrestaShop is a commonly used PHP-based CMS (Content Management System). For small & large businesses PrestaShop can be a good fit.  In this article, we are going to learn how to install PrestaShop on Ubuntu 21.10. So, let’s get started.

Pre-requisites :

  • A system with Ubuntu 21.10 installed and running.
  • root access to the system.
  • LAMP Stack installed and running, for this, you can refer to one of our guides on installing the LAMP Stack (Apache, MariaDB, and PHP).

Once you’re all set, we’ll proceed with PrestaShop installation and configuration.

Create Database

Let us begin with creating a Database and a user. We will then grant the required privileges to the user so it can interact with the Database.

mysql -u root

CREATE DATABASE ccpresta;

CREATE USER 'ccpresta'@'localhost' IDENTIFIED BY 'UYGVc%$#Erfgt*&^%4';

GRANT ALL PRIVILEGES ON ccpresta.* TO 'ccpresta'@'localhost';

FLUSH PRIVILEGES;

quit

The above commands will give complete access to ccpresta Database to the user ccpresta.We would suggest using a strong and long password.

Configure PHP Settings for PrestaShop

Configure PHP Memory Limit, Post max size, and Upload max filesize. You can change the limit as per your need.

sed -i 's/memory_limit = .*/memory_limit = 256M/' /etc/php/7.4/apache2/php.ini

sed -i 's/post_max_size = .*/post_max_size = 64M/' /etc/php/7.4/apache2/php.ini

sed -i 's/upload_max_filesize = .*/upload_max_filesize = 64M/' /etc/php/7.4/apache2/php.ini

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

a2enmod php7.4

systemctl restart apache2

Configuring Apache vHost

Now, create a new Apache configuration file dev.domainhere.info.conf for PrestaShop with the following command. Replace dev.domainhere.info with the domain name of your own for all the below code examples:

vi /etc/apache2/sites-available/dev.domainhere.info.conf

Now, press i to go to INSERT mode and type in the following lines of codes in the dev.domainhere.info.conf file.

<VirtualHost *:80>

ServerName dev.domainhere.info
ServerAlias dev.domainhere.info
ServerAdmin admin@dev.domainhere.info
DocumentRoot /var/www/html/dev.domainhere.info

ErrorLog ${APACHE_LOG_DIR}/dev.domainhere.info_error.log
CustomLog ${APACHE_LOG_DIR}/dev.domainhere.info_access.log combined

<Directory /var/www/html/dev.domainhere.info>
Options FollowSymlinks
AllowOverride All
Require all granted
</Directory>

</VirtualHost>

Now make directory for PrestaShop files:

mkdir -p /var/www/html/dev.domainhere.info/

Enable SSL and Rewrite:

a2ensite dev.domainhere.info

a2enmod rewrite ssl

Restart Apache:

systemctl restart apache2

Install Let’s Encrypt SSL Certificate

Let’s issue an SSL certificate for the domain for this we will need a snap package for Debian operating system.

We will update and install the snap package on the system:

apt update

apt install -y snapd

snap install core && sudo snap refresh core

Next, with the help of snap, we will install the certbot client which is used to create Let’s Encrypt certificates:

snap install --classic certbot

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

Install SSL Certificate

Use the certbot command to issue a Let’s Encrypt certificate. The command will auto-detect the domains available or configured in the vHost configuration:

certbot --apache

SSL certificates are valid for 90 days. The renewal process is now automated, you do not have to renew this manually.

Enable http and https ( 80/443 ):

To enable http and https connection through the firewall, follow the commands:

sudo ufw allow 80/tcp

sudo ufw allow 443/tcp

Download PrestaShop

Let’s download PrestaShop:

cd /etc/www/html/dev.domainhere.info

Check PrestaShop Latest Versions Here.

wget https://www.prestashop.com/en/system/files/ps_releases/prestashop_1.7.8.2.zip

unzip prestashop_1.7.8.2.zip

unzip prestashop.zip

rm prestashop_1.7.8.2.zip

rm prestashop.zip

chown -R www-data:www-data /var/www/html/dev.domainhere.info/

Configuring PrestaShop

Now open the IP address from your browser, this will redirect you to configuring the final parts of PrestaShop installation.

https://dev.domainhere.info

Replace the dev.domainhere.info with the actual IP or domain configured on the server.

Now we should remove the installtion directory using below commad:

sudo rm -rf /var/www/html/dev.domainhere.info/{install,docs,README.md}

Input the Database details which was configured earlier. Follow the below steps:

Now you have successfully installed PrestaShop with LAMP Stack and Let’s Encrypt SSL on Ubuntu 21.10.

bookmark_borderInstalling Winter CMS with LAMP Stack on Ubuntu 21.10

Hello,

In this week’s feature highlight, we look at How to Install Winter CMS with LAMP Stack on Ubuntu 21.10

Winter is a free, open-source content management system based on the Laravel PHP framework. Developers and agencies all around the world rely upon Winter for its quick prototyping and development, safe and secure codebase, and dedication to simplicity. In this article, we are going to learn how to install Winter CMS on Ubuntu 21.10. So, let’s get started.

Checkout the Winter CMS Project Here .

Get started with $5 VPS from CrownCloud. Check our latest offers : CrownCloud VPS [ 24×7 In-House Customer Support ].

Pre-requisites :

  • A system with Ubuntu 21.10 installed and running.
  • root access to the system.
  • LAMP Stack installed and running, for this, you can refer to one of our guides on installing the LAMP Stack (Apache, MariaDB, and PHP).

Once you’re all set, we’ll proceed with Winter CMS installation and configuration.

Create Database

Let us begin with creating a Database and a user. We will then grant the required privileges to the user so it can interact with the Database.

mysql -u root

CREATE DATABASE ccwintercms;

CREATE USER 'ccwintercms'@'localhost' IDENTIFIED BY 'UYGVc%$#Erfgt*&^%4';

GRANT ALL PRIVILEGES ON ccwintercms.* TO 'ccwintercms'@'localhost';

FLUSH PRIVILEGES;

QUIT

The above commands will give complete access to the user ccwintercms. We would suggest using a strong and long password.

Configuring Apache vHost

Now, create a new Apache configuration file dev.domainhere.info.conf for Winter CMS with the following command.

Replace dev.domainhere.info with the domain name of your own for all the below code examples:

vi /etc/apache2/sites-available/dev.domainhere.info.conf

Now, press i to go to INSERT mode and type in the following lines of codes in the dev.domainhere.info.conf file.

<VirtualHost *:80>

ServerName dev.domainhere.info
ServerAlias dev.domainhere.info
ServerAdmin admin@dev.domainhere.info
DocumentRoot /var/www/html/wintercms

ErrorLog ${APACHE_LOG_DIR}/dev.domainhere.info_error.log
CustomLog ${APACHE_LOG_DIR}/dev.domainhere.info_access.log combined

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

</VirtualHost>

Now make directory for Winter CMS files:

mkdir -p /var/www/html/wintercms/

Enable SSL and Rewrite:

a2ensite dev.domainhere.info

a2enmod rewrite ssl

Restart Apache:

systemctl restart apache2

Enable http and https ( 80/443 )

To enable http and https connection through the firewall, follow the commands:

ufw allow 80/tcp

ufw allow 443/tcp

Download Winter CMS

Let’s download Winter CMS:

cd /etc/www/html/wintercms

wget https://github.com/wintercms/web-installer/releases/latest/download/install.zip

unzip install.zip

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

chmod -R 775 /var/www/html/wintercms/

Configuring Winter CMS

Now open the domain name with a /install.html from your browser, this will redirect you to configuring the final parts of the Winter CMS installation.

https://dev.domainhere.info/install.html

Replace the dev.domainhere.info with the actual IP or domain configured on the server.

Input the Database details which was configured earlier. Follow the below steps:

Now you have successfully installed Winter CMS with LAMP Stack on Ubuntu 21.10.