Mail server

How to Install WordPress on Ubuntu 22.04 LTS Server

Learn the steps to install WordPress CMS on Ubuntu 22.04 LTS Jammy JellyFish using LAMP Server – Apache, MariaDB and PHP.

If you want to animate your blog, you will quickly come across the WordPress software. What WordPress is and what possibilities it offers, we will tell you in this handy tip.

WordPress is the most popular software in the world that allows you to create a website. The particularity of this one is that you have an innovative interface.

Its plugin system is an additional feature for WordPress. There are thousands of free and paid plugins. With a plugin you extend the functions of your website. We can install, configure and of course remove plugins through the dashboard. A theme is an outfit, i.e. the design of your website. There are thousands of free and paid themes here. We can change a theme with just a few mouse clicks and change the look of your website. Plugins and themes help you build your WordPress website.

WordPress is suitable for almost all websites such as Private websites, blogs, corporate websites, corporate websites, online stores and member pages.

Steps to Install WordPress on Ubuntu 22.04 LTS Linux

The steps given here in this tutorial can be used for other Ubuntu server versions such as 20.04/18.04. Whereas to follow this guide the user must have Ubuntu 22.04 LTS, non-root user access with sudo rights and a LAMP stack (will install here).

1. Update Ubuntu 22.04

First, run the system update command to ensure that all packages in our system are up-to-date and the APT package index cache is in its latest state.

sudo apt update && sudo apt upgrade

2. Install Apache and PHP for WordPress

We need Apache web server and PHP programming language to configure WordPress CMS, let’s install both in this step.

sudo apt install apache2

After the Apache installation is complete, enable and start its service.

sudo systemctl enable apache2

Check Status:

systemctl status apache2

We can also check the functioning of the Apache web server by accessing its default page. For this, open your local system browser which can access the Ubuntu 22.04 server IP where you have Apache installed.

To note: Server IP address with your real address

http://server-ip-address

Install PHP version 8

The default version of PHP can be installed using the standard Ubuntu 22.04 LTS repository. Therefore, just run the given command to install the required PHP and extensions on your system.

sudo apt install -y php php-{common,mysql,xml,xmlrpc,curl,gd,imagick,cli,dev,imap,mbstring,opcache,soap,zip,intl}

To check the version after completing the above command, use:

php -v

3. Install MariaDB or MySQL

We can use MariaDB or MySQL Database Server on Ubuntu 22.04 to store data generated by WordPress CMS. Here we are using MariaDB Server.

sudo apt install mariadb-server mariadb-client

Enable, start and check service status:

sudo systemctl enable --now mariadb

To verify:

systemctl status mariadb

CTRL+C to leave.

Secure your database installation:

To secure our DB instance, run the given command:

sudo mysql_secure_installation

Production

The questions asked will be asked by the system, the sample answers are also given below:

Enter current password for root (enter for none): Press ENTER
Set root password? [Y/n]: Y
New password: Set-your-new-password
Re-enter new password: Set-your-new-password
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] Y
Remove test database and access to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y

4. Create a database for WordPress

Connect to your database server using the password you set for the root user of it.

sudo mysql -u root -p

Follow the command to create a new database. However, remember to replace New user whatever name you want to give your database user and similarly- new_db with a name for Database and Your password for the password.

CREATE USER 'new_user'@'localhost' IDENTIFIED BY 'your_password';
CREATE DATABASE new_db;
GRANT ALL PRIVILEGES ON new_db.* TO 'new_user'@'localhost';
FLUSH PRIVILEGES;
Exit;

5. Install WordPress on Ubuntu 22.04

The files to configure WordPress must be downloaded manually and we can do it using the command terminal. Here are the commands to follow:

sudo apt install wget unzip

Download WordPress:

wget https://wordpress.org/latest.zip

Extract the file:

sudo unzip latest.zip

Move it to the web folder:

sudo mv wordpress/ /var/www/html/

Delete downloaded files to free up space:

sudo rm latest.zip

Change file permission

sudo chown www-data:www-data -R /var/www/html/wordpress/

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

6. Configure Apache on Ubuntu 22.04

Next, enable your Apache web server’s Vhost modules and configuration file to ensure that it serves the PorcessWire CMS files without any errors.

Create a configuration file for WordPress

sudo nano /etc/apache2/sites-available/wordpress.conf

Copy-Paste the following lines:



ServerAdmin [email protected]

DocumentRoot /var/www/html/wordrpess
ServerName example.com
ServerAlias www.example.com



Options FollowSymLinks
AllowOverride All
Require all granted



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


Save the file by pressing Ctlr+O, hitting the Enter key, and then exiting using Ctrl+X.

 

Enable virtual host

sudo a2ensite wordpress.conf

Activate the rewrite module

sudo a2enmod rewrite

Disable default Apache test page

sudo a2dissite 000-default.conf

Restart the Apache web server to apply the changes:

sudo systemctl restart apache2

7. Configuring the WordPress CMS Web Interface

After following the above steps, open your system browser which can access the server IP address of the system where you have installed WordPress.

And point it like this:

http://your-server-ip-address

Start configuring:

Select the WordPress language you want to use, then click the Continue button.

Select WordPress language

8. Add database information

Then click on the let’s go button that will create a wp-config file to store database details.

Set Wo configuration file database

The database, its user and its password that we created in this tutorial to store the data generated by WordPress; add its details in the WordPress installation wizard when it asks, after that click on the “Tp submit” button.

Add MariaDB database to WordPress

Finally, click on the “Run the installation” button.

Run WordPress installation on Ubuntu 22.04 server

9. Create an admin user and password

Add the site title you want to give to your website, then add the username and a password to use. After that, add the email address and then tap “Install WordPress“.

Create an administrator user and password

10. Login to backend

Finally, the administrator login page will appear; add the user and password you created.

Access to the WordPress CMS admin dashboard

Other Items:

How To Install Backdrop CMS On Ubuntu 22.04 Jammy
How to Install Umbraco CMS on Ubuntu 20.04 LTS
Check internet speed using a command in Ubuntu…
How To Configure DNS Nameserver On Ubuntu
How to Install WordPress on Lighttpd Web Server – Ubuntu