Linux Install WordPress with 3 Easy Steps
Install WordPress in Linux involves Easy Steps. Installing and Hosting Nichie WordPress in Linux or Hosting WordPress yourself in Linux Server is quite Easy way.This guide shows how to Install WordPress WP to build your site or something like a blog.
What is WordPress???
WordPress is a web software used to create nice Nichie beautiful website or blogs. This software is built by many volunteers, integrated with thousands of plugins which is used across 60 million people across the world.
Lets see the Pre-Requisites requirement for WordPress Installation. WordPress runs in Apache, MySQL & PHP, these are the core software’s.
Pre-Requisite Software Installation & Configurations – LAMP Stack:-
As said earlier, Apache, PHP & MySQL are required software, lets see installation & configuration. If your server have already these LAMP (Linux Apache MySQL PHP), skip these below step and directly jump into Installation of WordPress.
Install Apache, MySQL, PHP & supporting Libraries:-
Install Apache, MySQL, PHP & supporting libraries using below command as ROOT user,
# yum -y install httpd php5 mysql mysql-server php-mysql php5-gd
For Permanent Re-Boot configuration, If server is restarted, to make sure these processes to Turn on Automatically, Issue below commands as root user,
# chkconfig httpd on # chkconfig mysqld on
Configure MySQL Root Password :-
We need to configure MySQL root account so as to configure local user account for worpress in later topics. So Login into mysql prompt by entering mysql in the terminal
mysql> use mysql; mysql> update user set password=PASSWORD("ROOTPASSWORD") where user='root'; mysql> flush privileges; mysql> exit
Above MySQL scripts will create the root password, Please specify the root password accordingly.
Configure Apache Httpd Virtual Host
In the Apache Httpd configuration, Locate this file /etc/httpd/conf/httpd.conf, Edit or Copy,Paste following lines to the bottom of the file
# mkdir -p /var/www/www.thatislinux.com/htdocs # vim httpd.conf <VirtualHost *:80> DocumentRoot /var/www/www.thatislinux.com/htdocs // Change Accordingly ServerName www.thatislinux.com // Change Accordingly </VirtualHost>
Here, I have used domain Name as www.thatislinux.com, Please use relevant domain Name & also the server Name. And then restart the Apache httpd server.
# service httpd restart
Verify PHP Configuration:-
In the Domain Root directory, create test.php file with below contents,
# vim test.php <?php phpinfo(); ?> Save & Quit the file. # chmod 755 test.php
Hit in the browser with IP address or Domain Name, http://<IP>/test.php or http://<Domain>/test.php
If you get the PHP Configuration Page, Success !!! We can proceed with the WordPress Installation. If not, Any missing dependencies, we need to install it again.
For Detailed Installations of these software’s refer here
Installation of WordPress Begins:-
There are three major steps involved,
Step: 1 Download WordPress Software:-
Download the latest WordPress software from the official WordPress site using wget command.
# cd /var/www/ # wget http://wordpress.org/latest.tar.gz # tar -xvzf latest.tar.gz && rm -f latest.tar.gz
Extract the file & remove the .gz file to save disk space, Then change the permission accordingly,
# rsync -avP ./wordpress/ www.thatislinux.com/htdocs/ # chown -R apache:apache www.thatislinux.com/ # chmod -R g+w www.thatislinux.com/
Step 2: WordPress Database & User Account Creation in MySQL:-
For WordPress, we need to create separate database with user account with correct permissions. Main heart of WordPress is MySQL database, Lets see the queries to create it,
Login to MySQL Prompt with root login,
# mysql -u root -p
mysql> create database wordpress; Query OK, 1 row affected (0.00 sec) mysql> create user wp_user@localhost; Query OK, 0 rows affected (0.00 sec) mysql> SET PASSWORD FOR wp_user@localhost= PASSWORD("testpass"); Query OK, 0 rows affected (0.00 sec) mysql> grant all privileges on wordpress.* to wp_user@localhost identified by 'testpass'; Query OK, 0 rows affected (0.00 sec) mysql> flush privileges; Query OK, 0 rows affected (0.00 sec) mysql>exit
Database WordPress created & wp_user is configured with proper permission to access the tables.
Next Proceeding to Last & Final Step,
Step: 3 WordPress Configuration:-
Go to the domain root directory – /var/www/www.thatislinux.com/htdocs, Create the wp-config.php from sample file which is already present as a part of the installations.
We need to give the Database, User Credentials in the php file accordingly,
# cp wp-config-sample.php wp-config.php # chown apache:apache wp-config.php # vim wp-config.php define('DB_NAME', 'wordpress'); /** MySQL database username */ define('DB_USER', 'wp_user'); /** MySQL database password */ define('DB_PASSWORD', 'testpass');
then, Restart the Apache server,
# service httpd restart
That’s it, Once we hit the browser with http://<IP> or http://<Domain>, we will get the wordpress Installations screen or welcome screen as follows.
After providing the user credentials for wp-admin page, Click on Install WordPress button. It will lead to following page with successful Installation
Next You may Interested in other topics about WordPress,
Kindly do share this article & post your feedback or comments.