How To Install WordPress on Ubuntu 18.047 min read
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.
[email protected]:~# apt-get update && apt-get upgrade -y
Install web server apache2
[email protected]:~# apt-get install apache2 apache2-utils -y
Then enable and start this service
[email protected]:~# systemctl enable apache2 [email protected]:~# systemctl start apache2
Step #02: Install database server mysql for install WordPress.
[email protected]:~# apt-get install mysql-client mysql-server -y
If you set mysql password then run below command and setup mysql root password otherwise not.
[email protected]:~# 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.
[email protected]:~# 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.
[email protected]:~# 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.
[email protected]:~# wget -c http://wordpress.org/latest.tar.gz
After download then extract this file command below
[email protected]:~# tar -xzvf latest.tar.gz
Now all files move to web directory
[email protected]:~# rsync -av wordpress/* /var/www/html/
Setup permission for web directory
[email protected]:~# chmod -R 755 /var/www/html/ [email protected]:~# 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
[email protected]:~# cd /var/www/html
File move command below
[email protected]:/var/www/html# mv wp-config-sample.php wp-config.php
Open wp-config.php file for insert database information
[email protected]:/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.
[email protected]:/var/www/html# systemctl restart apache2.service [email protected]:/var/www/html# systemctl restart mysql.service [email protected]:/var/www/html# rm -rf index.html [email protected]:/var/www/html# cd
Step #07: Open apache2 default config file and insert some information.
[email protected]:~# vi /etc/apache2/sites-available/000-default.conf
Insert or check your server config file as like below configuration.
<VirtualHost *:80> ServerAdmin [email protected] 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.
[email protected]:~# a2enmod rewrite [email protected]:~# systemctl restart apache2
Create htaccess file and setup permission then restart web server.
[email protected]:~# touch /var/www/html/.htaccess [email protected]:~# chown :www-data /var/www/html/.htaccess [email protected]:~# chmod 664 /var/www/html/.htaccess [email protected]:~# service apache2 restart
If any query please comment and for more information see my YouTube video. Please subscribe my channel for more update.
- How To Install Odoo 16 on Ubuntu 22.04 - May 14, 2023
- 12 Steps to Organize Photos on Your Computer - March 20, 2023
- 9 Ways to Speed Up Your MacBook Yosemite - February 21, 2023
We really appreciate for your support for buying me a coffee.
It takes us a while to compose and upload new content, as they have to be checked to see if Properly works. We appreciate you if you help me for one cup of coffee to keep us awake and always deliver good quality content.
No contribution is small of an amount. We are grateful for any amount you support us with. Thank you!
This is the best tutorial. I just searched everywhere and finally this is the one which worked.
Thanks, mate. yo, ma life saver.
Welcome!
Without a doubt the best guide I have come across, and the only one that work for me.
Many thanks
Thanks. Welcome!
This is first fully working tutorial, and I checked many of them on the internet! Great JOB!
Ha Ha :). Thanks for your Great comment.