X

How To Install WordPress on Ubuntu 18.04

WordPress is an opensource CMS (Content Management System). At this time various CMS running but WordPress is an user friendly. So now I have to show how to install WordPress on your Ubuntu 18.04 machine local or cloud.

How To Install Zabbix 5.0 On Centos 7
How To Fix Jitsi Meet Video Conference Using Mobile Browser

Step #01: Server must be update & upgrade needed.

root@technologyrsslocal:~# apt-get update && apt-get upgrade -y

Install web server apache2

root@technologyrsslocal:~# apt-get install apache2 apache2-utils -y

Then enable and start this service

root@technologyrsslocal:~# systemctl enable apache2
root@technologyrsslocal:~# systemctl start apache2

Step #02: Install database server mysql for install WordPress.

root@technologyrsslocal:~# apt-get install mysql-client mysql-server -y

If you set mysql password then run below command and setup mysql root password otherwise not.

root@technologyrsslocal:~# mysql_secure_installation

Press y| Y    << Type Y press enter

Do you want to continue press y|Y   << Type Y press enter

Remove anonymous user press y|Y  << Remove anonymous user type Y press enter

Disallow root login remoetly y|Y  << Disallow root user login type Y press enter

Remove test database and access to it y|Y  << Remove test database type Y press enter

Reload privilege tables now? y|Y  << Reload all tables type Y press enter

Step #03: Install php code for install WordPress on Ubuntu 18.04.

root@technologyrsslocal:~# apt-get install php7.2 php7.2-mysql libapache2-mod-php7.2 php7.2-cli php7.2-cgi php7.2-gd

Create one php file for check properly run php on your server.

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

Insert below code into tech.php file so I check php run properly.

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

Save file Esc :wq then press Enter.

Step #04: Download latest WordPress file from below link.

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

After download then extract this file command below

root@technologyrsslocal:~# tar -xzvf latest.tar.gz

Now all files move to web directory

root@technologyrsslocal:~# rsync -av wordpress/* /var/www/html/

Setup permission for web directory

root@technologyrsslocal:~# chmod -R 755 /var/www/html/
root@technologyrsslocal:~# chown -R www-data:www-data /var/www/html/

Step #05: Create database for install WordPress on Ubuntu 18.04.

mysql> create database wp;
mysql> grant all privileges on wp.* TO 'tech'@'localhost' identified by 'passw0rd';
mysql> flush privileges;
mysql> \q

Now goto web directory for move or copy database information file wp-config-sample.php

root@technologyrsslocal:~# cd /var/www/html

File move command below

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

Open wp-config.php file for insert database information

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

Insert all information like as my database name wp, user tech and password is passw0rd.

define('DB_NAME', 'wp');
define('DB_USER', 'tech');
define('DB_PASSWORD', 'passw0rd');
define('DB_HOST', 'localhost');
define('DB_CHARSET', 'utf8');
define('DB_COLLATE', '');

Step #06: Now web server and database server restart and remove default index.html file.

root@technologyrsslocal:/var/www/html# systemctl restart apache2.service
root@technologyrsslocal:/var/www/html# systemctl restart mysql.service
root@technologyrsslocal:/var/www/html# rm -rf index.html
root@technologyrsslocal:/var/www/html# cd

Step #07: Open apache2 default config file and insert some information.

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

Insert or check your server config file as like below configuration.

<VirtualHost *:80>
       ServerAdmin webmaster@localhost
       DocumentRoot /var/www/html
       ServerName server_domain_name_or_IP
<Directory /var/www/html/>
       AllowOverride All
</Directory>
       ErrorLog ${APACHE_LOG_DIR}/error.log
       CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

Enable rewrite mode then restart web server.

root@technologyrsslocal:~# a2enmod rewrite
root@technologyrsslocal:~# systemctl restart apache2

Create htaccess file and setup permission then restart web server.

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

If any query please comment and for more information see my YouTube video. Please subscribe my channel for more update.

0 0 votes
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.

View Comments (6)

Leave a Comment