X

How To Install WordPress 6.0 On Ubuntu 22.04

In this tutorial how to install WordPress 6.0 on Ubuntu 22.04 server. WordPress is an open source content management system written by php and mysql.

#############################
My server info :
Server IP : 10.66.10.5
Disk : 25 GB
RAM: 1GB
vCPU : 2
Service : WordPress
Web : Apache
Database : Mariadb
Php : 7.4
#############################

Step #01: Check Server version and ip address.

root@wordpress:~# lsb_release -a && ip r
root@wordpress:~#  apt-get update && apt-get upgrade -y
root@wordpress:~# apt-get install apache2 apache2-utils -y
root@wordpress:~# systemctl enable apache2
root@wordpress:~# systemctl start apache2
root@wordpress:~# apt install mariadb-server -y
root@wordpress:~# systemctl enable mariadb
root@wordpress:~# systemctl start mariadb

Reset mysql root password using below command.

root@wordpress:~# mysql_secure_installation

Step #02: Install php7.4.

root@wordpress:~# add-apt-repository -y ppa:ondrej/php
root@wordpress:~# apt update

Then run all required php extension as like below.

root@wordpress:~# apt install libapache2-mod-php7.4 php7.4-mbstring php7.4-cli php7.4-mysql php7.4-cgi php7.4-fpm php7.4-gd php7.4-imap php7.4-xml php7.4-intl php-dev libmcrypt-dev php-pear php-apcu unzip -y

Check your server php is working. Create one php file or open

root@wordpress:~# vi /var/www/html/tech.php

Insert below line into tech.php file.

<?php phpinfo(); ?> //PHP code goes here

Then browse your server ip address as like below.

http://10.66.10.5/tech.php

Step #03: Download latest WordPress using wget command.

root@wordpress:~# wget -c http://wordpress.org/latest.tar.gz
root@wordpress:~# tar -xzvf latest.tar.gz

Then move all file into html default root directory.

root@wordpress:~# rsync -av wordpress/* /var/www/html/
root@wordpress:~# chmod -R 755 /var/www/html/
root@wordpress:~# chown -R www-data:www-data /var/www/html/
root@wordpress:~# rm -rf /var/www/html/index.html

Step #04: Create WordPress Database and user permission.

root@wordpress:~# mysql -u root -p

Then type your mysql root user password.

create database wp_db;
grant all privileges on wp_db.* to 'wp_db_user'@'localhost' identified by 'wp_db_passw0rd';
flush privileges;
\q

Copy wp-config.php file from default name.

root@wordpress:~# mv /var/www/html/wp-config-sample.php /var/www/html/wp-config.php

Open this file and insert database name, user name and password.

root@wordpress:~# vi /var/www/html/wp-config.php

Inset into this file.

define('DB_NAME', 'wp_db');
define('DB_USER', 'wp_db_user');
define('DB_PASSWORD', 'wp_db_passw0rd');
define('DB_HOST', 'localhost');
define('DB_CHARSET', 'utf8');
define('DB_COLLATE', '');

Restart apache and mysql service.

root@wordpress:~# systemctl restart apache2.service
root@wordpress:~# systemctl restart mariadb.service

Step #05: Configure web config file.

Open default config file using any editor.

root@wordpress:~# vi /etc/apache2/sites-available/000-default.conf

Insert below all line and replace as your server ip address.

       ServerAdmin webmaster@localhost
       DocumentRoot /var/www/html
       ServerName server_domain_name_or_IP

       AllowOverride All

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

Step #06: Setup permission and enable rewrite rule.

root@wordpress:~# a2enmod rewrite
root@wordpress:~# systemctl restart apache2
root@wordpress:~# touch /var/www/html/.htaccess
root@wordpress:~# chown :www-data /var/www/html/.htaccess
root@wordpress:~# chmod 664 /var/www/html/.htaccess
root@wordpress:~# service apache2 restart

Then browse your server ip address for web installation process.

http://10.66.10.5/

If you see any error so please see my YouTube video for more help.

5 1 vote
Article Rating
Admin: I am system administrator as Windows and Linux platform. I have 4 years skilled from the professional period. I have to configure Linux based system such as an Asterisk VOIP system, Network monitoring tools (ZABBIX), Virtualization (XEN Server), Cloud computing (Apache CloudStack) etc. Now share my professional skill each interested person. Thanks to all.
Leave a Comment