Thursday, March 4, 2021

How to install wordpress on ubuntu 18.04 and 20.04

Hi Welcome to our blog, I am going to show you how to install the wordpress on ubuntu 18.04 and 20.04.

Step 1.

First download wordpress .tar.gz file from the worpress official site. Link

Step 2.

To install wordpress, run the following command in your terminal.

sudo apt upate

sudo apt install wordpress php libapache2-mod-php mysql-server php-mysql

If you have not installed MYSQL before, you will be asked for password for "root" MySQL user. You can leave this field empty.

Step 3.

Configre Apache for Wordpress. Create Apache site for wordpress. Create /etc/apache2/sites-available/wordpress.conf with following lines:

Alias /blog /usr/share/wordpress

<Directory /usr/share/wordpress>
    Options FollowSymLinks
    AllowOverride Limit Options FileInfo
    DirectoryIndex index.php
    Order allow,deny
    Allow from all
</Directory>
<Directory /usr/share/wordpress/wp-content>
    Options FollowSymLinks
    Order allow,deny
    Allow from all
</Directory>

Then, enable this site with sudo a2ensite wordpress, enable URL rewriting with sudo a2enmod rewrite and reload apache2 with sudo service apache2 reload.

Step 4.

In step 4 we are going to configure database.

To configure wordpress, we need to create MYSQL database. run the command in your terminal.

$ sudo mysql -u root

"Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 5.7.20-0ubuntu0.16.04.1 (Ubuntu)

Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> CREATE DATABASE wordpress;
Query OK, 1 row affected (0,00 sec)

mysql> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER
    -> ON wordpress.*
    -> TO wordpress@localhost
    -> IDENTIFIED BY '<your-password>';
Query OK, 1 row affected (0,00 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 1 row affected (0,00 sec)

mysql> quit
Bye"
 
Now, let's configure wordpress to use this database. 
Open /etc/worpress/config-localhost.php and write:
"<?php
define('DB_NAME', 'wordpress');
define('DB_USER', 'wordpress');
define('DB_PASSWORD', '<your-password>');
define('DB_HOST', 'localhost');
define('DB_COLLATE', 'utf8_general_ci');
define('WP_CONTENT_DIR', '/usr/share/wordpress/wp-content');
?>" 
 
Now Start MySql with sudo service mysql start
 
Step 5.
Open localhost/blog in your faverite browser. You will be asked for Site Name
or Title,username, password and email address. You can choose if you want to 
make your site indexed by search engines.
Now you can login under localhost/blogname/wp-login.php. 
Once you login you will see bunch of icons and options.
Don't worry, it's very easy!
 

 

3 comments:

  1. Thanks for this valuable blog. It was very informative and interesting. Keep sharing this kind of Information.
    Matlab in Chennai
    Matlab Training Center in Chennai

    ReplyDelete
  2. This post is so interactive and informative.keep updating more information...
    AWS Exams
    AWS Architecture Certification

    ReplyDelete

SEO 2021 - Learn White Hat SEO to Make Your Site Rank Higher.

SEO 2021 - Learn White Hat SEO to Make Your Site Rank Higher.      Description: Find out information on how to rank better on Google in 2021...