All Categories

How to Install WordPress on Linux Server

WordPress is a free and open-source content management system (CMS) which uses PHP and MySQL. WordPress is a freely available web tool that you can use to create beautiful websites. It was released on May 27, 2003, by Matt Mullenweg and Mike Little. You can refer to the link given below for complete details of WordPress. So, let us understand, how to install WordPress on Linux (Centos instance).

How to Install WordPress?

https://en.wikipedia.org/wiki/WordPress

Pre-requisites

Following are the recommended software required to run WordPress:

  • PHP version 5.6 or greater
  • MySQL version 5.6 or greater

WordPress community recommends Apache or Nginx as the most robust and featured server for running WordPress, but any server that supports PHP and MySQL can also be used.

Here, in this tutorial, we will install Linux, Apache, MySQL, PHP (LAMP) stack On CentOS 6 with the above prerequisites.

Let us now understand each of them one by one.

So, what is LAMP?

LAMP stack stands for Linux, Apache, MySQL, and PHP.  It.is a group of open source software used to run dynamic websites and servers. This setup requires a user who has root privileges, so we need to create a pseudo user first.

Creating a “pseudo” User

Step1: Login to root and add a new user

useradd  acadgild

useradd

passwd acadgild

passwd acadgild

Step 2: Provide root privileges to this user

visudo

visudo

Refer to the image given below to configure Acadgild by providing root privileges. Add the highlighted line below root line.

visudo

Step 3: Save it and restart the ssh services.

service sshd restart

service sshd restart
Hadoop

LAMP Installation

Login to pseudo user which we have added recently with root privileges (that’s a must)

 Step 1: Install Apache web server-

sudo yum install httpd -y

yum httpd install

Step 2: Once installation gets over you can start Apache and its services.

sudo service httpd start

service httpd restart

Note: To check if Apache is installed, open your browser with your domain name or server’s IP address (e.g. http://192.168.198.131). The page should display a static page like below:

apache homepage

Installing MySQL database

MySQL is an open-source relational database management system (RDBMS) for organizing data on a server.

Follows these commands to install MySQL:

sudo yum install mysql-server -y

yum install mysql

sudo service mysqld start

mysql start

mysql restart

Once it is done, you should set a root MySQL password. Follow this command to set it:

sudo mysql_secure_installation

Note: A prompt will ask you for your current root password as you have just installed MySQL, so leave it blank by pressing enter.

mysql installation

mysql installation

Configure MySQL according to your need. If you don’t want to go through all that, then allow all the prompts ( press ‘y’ for every prompt).

mysql installation

Installing PHP

PHP is a server-side scripting language, designed for web development. PHP is a powerful tool for making dynamic and interactive Web pages. It is also used as a general-purpose programming language.

Follow the below mentioned commands to install PHP:

sudo yum install php -y

yum install php

Install php-mysql plugin into Linux server

sudo yum install php-mysql -y

yum install php mysql

Note: Press ‘y’ if the prompt comes up.

Now LAMP stack is configured on your instance.

Next, We need to set the ‘httpd’ and ‘mysqld’ processes to run automatically every time the Linux server restarts. We don’t need to do for php because it will run automatically once Apache starts.

sudo chkconfig httpd on
sudo chkconfig mysqld on
sudo service httpd restart


Once you have the prerequisite software, you can start installing WordPress!

Installing WordPress

Step 1: First, download WordPress from below link:

wget http://wordpress.org/latest.tar.gz

wordpress download

Step 2: Unzip the compressed file into the desired location.

tar -xvzf  latest.tar.gz

unzip wordpress

Step 3: Creating MySQL User and database for WordPress-

Login to MySQL Shell:

mysql -u root -p

mysql root shell

A prompt will ask for MySQL root password, which we have created earlier.

Now, We need a database and an user in that database.

create database wp_db;

Output: Query OK, 1 row affected (0.00 sec)

create database

create user wp_user;

create wp-user

Set password to this user:

Set password for wp_user=password("password");

set password for wordpress user

Now, provide all privileges to this new user.

grant all privileges on wp_db.* to wp_user identified by 'password';

Query OK, 0 rows affected (0.00 sec)

grant all privilages


Note: This is important to provide all privileges to this user else WordPress will not be able to start.

At last, refresh MySQL:-

Flush privileges;

Query OK, 0 rows affected (0.00 sec)

exit

flush privileges

WordPress configuration

List all to see the WordPress directory:

ls

ls

Copy wp-config-sample.php to wp-config.php

wordpress sample

Open wp-config.php, update the database, user, and its password

vi wp-config.php

wp-config.php

Find the section that contains the fields given below and modify in the correct name for the database, username, and password.

wp-config configuration

Save it.

Copy this WordPress directory into Server

sudo cp -r ~/wordpress/* /var/www/html

upload wordpress to server

Download php-gd, if the form does require a specific php module to run and is not yet installed on your server.

sudo yum install php-gd -y

php-gd

Next restart Apache services.

sudo service httpd restart

service httpd restart
Hadoop

WordPress Installation

Once all the above are in place and installed, go to browser setting and type server’s IP address or domain name(hostname) of the server(Linux). WordPress online installation page will come up. Access the page by adding /wp-admin/install.php to your site’s domain or IP address (e.g. http://192.168.198.131/wp-admin/install.php) or simply type your domain name. WordPress installation page will come up automatically.  Refer the below screenshot:

Fill out the form accordingly to your need. E.g. your site title, username, password, email and other entries.

wordpress admin panel

Click to install.

WordPress is now installed to your Linux instance (Centos Server).

Now, Login using username and password. A screen as shown below will get displayed:

wordpress admin panel

Here you can Customize your website.

Hope this blog was helpful for you. Keep visiting our blog  site: https://acadgild.com/blog/

Spark

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Related Articles

Close