How to install WordPress in Linux

This article is for WordPress development learners and bloggers and also help for the web server administrators where to look when WordPress site is down. Let’s see how to install WordPress in Linux such as Red Hat Enterprise Linux 6.x and 5.x and Centos 6/x and 5.x versions.

WordPress installation Requirements

  1. PHP to be installed in Linux
  2. MySQL / MariaDB should be installed
  3. HTTPD / Apache / LAMP should be installed to host WP website
  4. Operating system RHEL 7.x/6.x/5.x and Centos 7.x/6.x and 5.x

Download wordpress for Linux

Click Here to Download

extract the WordPress zip file using below command

[root@ArkIT~]# unzip wordpress-4.5.2.zip
[root@ArkIT~]# tar -xzvf wordpress-4.5.2.tar.gz

Installing required Packages

In RHEL 6.x and 5.x installing MySQL

[root@ArkIT~]# yum install mysql*
[root@ArkIT~]# service mysqld restart
[root@ArkIT~]# chkconfig mysqld on
[root@ArkIT~]# /usr/bin/mysqladmin -u root password 'Set-NewPassword'
[root@ArkIT~]# mysql -u root -p
Enter Password:
mysql> create database wordpress;
Query OK, 1 row affected (0.02 sec)

As shown above install MySQL database and start MySQLd service. Set the New password for MySQL instance and login to MySQL then create a database of WordPress installation

Install http / Apache server 

[root@ArkIT~]# yum install http*
[root@ArkIT~]# service httpd start
[root@ArkIT~]# chkconfig httpd on
[root@ArkIT~]# chkconfig mysqld on

install php packages as PHP is the dependend for wordpress all the wordpress code is written in php

[root@ArkIT~]# yum install php*

Stop iptables / Firewall service OR write an rule to allow port 80

[root@ArkIT~]# service iptables stop
[root@ArkIT~]# chkconfig iptables off

Now copy all the extracted files to the default web server path /var/www/html

[root@ArkIT~]# cd wordpress
[root@ArkIT wordpress]# cp -Rv * /var/www/html/

Now edit the Apache main configuration file /etc/httpd/conf/httpd.conf

[root@ArkIT~]# vi /etc/httpd/conf/httpd.conf

** Change DirectoryIndex index.html file to index.php **

Restart Httpd/Apache to reflect the changes
[root@ArkIT~]# service httpd restart

How to install WordPress in RHEL 6.x/5.x and Centos 6.x and 5.x

Now to to web browser and type the IP address of the web server

wordpress first installation screen

whenever you access the web server from browser you will see the above screenshot click on Let’s Go

As shown in above figure it will ask you for the database details provide the database name, username, password and MySQL instance name and Click submit

Now it will though an error (Do not Panic) installation process will continue. Copy the code and go back to the server console and create a file wp-config.php and paste this copied code then click on Install WordPress

[root@ArkIT~]# vim /var/www/html/wp-config.php
<?php
/** http://arkit.co.in
 */
define('DB_NAME', 'wordpress');

/** MySQL database username */
define('DB_USER', 'root');

/** MySQL database password */
define('DB_PASSWORD', 'mysql');

/** MySQL hostname */
define('DB_HOST', 'localhost');

/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');

/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');

define('AUTH_KEY', '7 @M[jV{i=Mmz)zzel[O7,y]T`A;#JtmX$83.ySp-ntAj$](@chfoL4G(Bq2fhRB');
define('SECURE_AUTH_KEY', 'XKji}BnpL;K>DiCiB7|~|9I!jY!Jn_yb<JY }!-[J2*!q*5$o6 {}w2XQxZ`L)Q7');
define('LOGGED_IN_KEY', '(z*}yZ6 7/g#f4L^NFj@qSO,ZzEh3S=iUzdkAPO{{=p?H[Q+uWXgLZ;Ut)6,wejV');
define('NONCE_KEY', '}1>LBEkAvl{]/Aolz<$1:HEyIgXEw#gOKWH3-fzsrss#OR~])(3ruB-*OQWo$H<0');
define('AUTH_SALT', 'oI4=3koZ.KZBk^{c<X6B!iD!lcv<556,FTH$FNfX+dm,(MC(^+@1mg/$_Z}(w%^W');
define('SECURE_AUTH_SALT', 'l0vIy6gEg<<5IQb#;4q.FsCjLH|1{F+S/oN%d%5D*^hQ$gNS{AoU-(Z9hpT_<`[s');
define('LOGGED_IN_SALT', 'Qe8y>*J?B~w=,a.3tVwFID+&`Vr.q98vGo}.j)z yq-^:+uB}ogpR,z2DGhpdd+^');
define('NONCE_SALT', 'l*F>JaE37[6bd@0.jC`!eVbIbmY<-J1/)PMk4K841%]M?GuNcxVk9iw80r -)ud]');

/**#@-*/

/**
 * WordPress Database Table prefix.
 *
 * You can have multiple installations in one database if you give each
 * a unique prefix. Only numbers, letters, and underscores please!
 */
$table_prefix = 'wp_';

/**
 * For developers: WordPress debugging mode.
 *
 * Change this to true to enable the display of notices during development.
 * It is strongly recommended that plugin and theme developers use WP_DEBUG
 * in their development environments.
 *
 * For information on other constants that can be used for debugging,
 * visit the Codex.
 *
 * @link https://codex.wordpress.org/Debugging_in_WordPress
 */
define('WP_DEBUG', false);

/* That's all, stop editing! Happy blogging. */

/** Absolute path to the WordPress directory. */
if ( !defined('ABSPATH') )
 define('ABSPATH', dirname(__FILE__) . '/');

/** Sets up WordPress vars and included files. */
require_once(ABSPATH . 'wp-settings.php');

WordPress installation is successfully  Click on Login to Login to the WordPress

Now type the username and password to login to the WordPress

First look of WrodPress site as shown in above screenshot

To upload and install WordPress themes and Plugins configure FTP server with upload permissions

That’s about the How to install WordPress in Linux Article

Please provide your valuable feedback by commenting your feeling

SEO: how to install wordpress how to install wordpress how to install wordpress

Thanks for your wonderful Support and Encouragement