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!