• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
sharadchhetri

sharadchhetri

Tutorials On Linux, Unix & Open Source

  • Home
  • Linux Commands
  • Resources
    • Learn Linux
  • My WordPress plugins

How to install wordpress on LAMP stack ( Ubuntu 14.04 LTS Server )

May 12, 2014 by Sharad Chhetri 5 Comments

In this tutorial we will learn, how to install wordpress on LAMP stack. We are doing this practical on Ubuntu 14.04 LTS Server edition. In our last post, we have written step by step tutorial on “How to setup LAMP stack on Ubuntu 14.04 LTS Server” .

WordPress , a very popular Open Source CMS widely use in Internet Web world. It has been reported that millions of Website and blogs are based on WordPress.

WordPress is written on PHP langauge and for database primarily MySQL is used. You can alternatively also use MariaDB instead of MySQL . For WordPress, it is recommended to use Apache HTTP Server but with the Nginx Web server WordPress performance is awesome and speedy.

At the time of writing this post, WordPress stable version 3.9.1 was available.

In this tutorial we will install WordPress on LAMP stack. Follow the given below steps –

(1) Install Apache, PHP and MySQL Server :

First setup the LAMP stack by installing Apache , PHP and MySQL .In Ubuntu 14.04 LTS , by default Apache version 2.4 will be installed . We will also install PHP 5.x and MySQL Server 5.6 version.

sudo apt-get install apache2 php5 php5-mysql mysql-server-5.6

During installation, it will ask for setting MySQL root password. Give the root password and reconfirm once again. See the below given screenshot how it appears.

mysql Ubuntu 14.04

MySQL Server 5.6 Ubuntu 14.04

(2) Download latest WordPress :

We will download latest WordPress with the help of command line. Use given below wget command

cd ~
wget wordpress.org/latest.tar.gz

Note: cd ~ command will change directory to currently login user’s home directory. In above we will download the WordPress in user’s home directory

(3) Extract the WordPress tar ball

Now extract the WordPress tarball i.e latest.tar.gz to /var/www/html directory

sudo tar -xvzf ~/latest.tar.gz -C /var/www/html

After extraction you can find the wordpress directory inside /var/www/html

sharad@ubuntu:~$ ls -lhrt /var/www/html/
total 4.0K
drwxr-xr-x 5 www-data www-data 4.0K May 11 05:20 wordpress
sharad@ubuntu:~$

(4) Create MySQL user for WordPress Application

We will create a application user for WordPress in MySQL Database Server . The user will have only access to WordPress database. It is good for security point of view, to create a mysql user which has all privileges to only Application’s database.

First check if mysql service is running. Generally in Ubuntu, just after installation of MySQL, the service started automatically. Yet, we should follow the common practice . ( tip for new Linux System Admins)

sudo service mysql status

In case, the mysql service is stopped. Then start the service .

sudo service mysql start

or

sudo service mysql restart

Login as MySQL root user. It will prompt for password.Give mysql’s root password

mysql -u root -p

After login, you will get mysql prompt like this mysql>

NOTE : In below given commands, you do not have to write mysql> . It is just a mysql prompt

Create database for WordPress. I am giving database name as “wordpress”

mysql> create database wordpress;

Create mysql user for WordPress application and set its password in liner command.
Replace P@ssword with your password

mysql> create user 'wpuser'@'localhost' identified by 'P@ssword' ;

Grant all privileges to WordPress user called “wpuser” which we have created in just above given command.

mysql> grant all on wordpress.* to 'wpuser'@'localhost';

Reload the privileges (do not forget this step at the end)

mysql> flush privileges;

(5) Configuring Apache HTTP Server for WordPress

For this practical we will setup IP Based Virtual hosting in Apache. If you have domain name, you can also configure the Name Based Virtual Hosting in Apache.

First get your server IP address by using ifconfig command.

I will use the IP address 192.168.56.101. You can replace with your IP Address

sharad@ubuntu:~$ ifconfig 
eth0      Link encap:Ethernet  HWaddr 08:00:27:ad:5f:7b  
          inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fead:5f7b/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:11037 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4446 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:12811912 (12.8 MB)  TX bytes:340279 (340.2 KB)

eth1      Link encap:Ethernet  HWaddr 08:00:27:75:2b:db  
          inet addr:192.168.56.101  Bcast:192.168.56.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe75:2bdb/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:7819 errors:0 dropped:0 overruns:0 frame:0
          TX packets:9325 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1027489 (1.0 MB)  TX bytes:10030301 (10.0 MB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:201 errors:0 dropped:0 overruns:0 frame:0
          TX packets:201 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:19992 (19.9 KB)  TX bytes:19992 (19.9 KB)

sharad@ubuntu:~$ 

Create apache wordpress configuration file. I use vi, you can use your favorite file editor.

sudo vi /etc/apache2/sites-enabled/wordpress.conf

And paste the below given contents in file wordpress.conf and save it.



	ServerAdmin webmaster@localhost
	DocumentRoot /var/www/html/wordpress
	ErrorLog ${APACHE_LOG_DIR}/error.log
	CustomLog ${APACHE_LOG_DIR}/access.log combined


(6) Restart the Apache HTTP Server

After creating wordpress apache’s configuration file, restart the Apache service

sudo service apache2 restart

(7) Create wp-config.php file :

Now we will create wp-config file in wordpress directory. The short cut method is just copy the wp-config-sample.php file and then give the database information in the wp-config.php file.

sudo cp -p /var/www/html/wordpress/wp-config-sample.php /var/www/html/wordpress/wp-config.php

Now edit the file wp-config.php . Give the database information in the file.

Database Name: wordpress
Database User’s Name: wpuser
Database User’s password: P@ssword
Database Host Address: localhost (If it is remote Database server, give its IP Address)

Below given is the reference from wp-config.php file

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'wordpress');

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

/** MySQL database password */
define('DB_PASSWORD', 'P@ssword');

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

(8) Follow final WordPress installation step from Web interface

Open the Web browser (example: Chrome/firefox/Opera etc.) . Now type the ‘IP Address’ of Server in address bar of web browser.
Here,our IP address of Server was 192.168.56.101. Replace it with your actual IP Address.

Example:

http://192.168.56.101

It will redirect to wp-admin/install.php itself.
Set the values Site Name, Username (for wordpress admin dashbaord), admin password, your email address and check box is conditional in case you want your blog to be listed in search engine (eg. google.com , yahoo.com, bing.com etc. )

Install wordpress Ubuntu 14.04

After filling all the details, press “Install WordPress” button.

Now you will get the below given screen on successful installation.

wordpress installation

Login into WordPress Admin dashboard

To login into WordPress Admin Dashbaord, open web browser and append wp-admin in URL with IP-Address or domain name.

Example. (Replace 192.168.56.101 with your Server IP Address)

http://192.168.56.101/wp-admin

Give WordPress user name and password for login into WordPress Admin dashboard.

Wordpress

After login, you will see many options in admin dashboard. Now you can start creating post,pages,changing theme, adding plugins and much more.

Wordpress installation

Explore the WordPress, it is quite easy. Start creating your blog or website. You can visit wordpress.org for more information .

To see your wordpress blog/website. Simply type the IP Address of server Or domain name in URL field of web browser.

wordpress

Share this:

  • Twitter
  • Facebook
  • More
  • Print
  • Email
  • LinkedIn
  • Reddit
  • Tumblr
  • Pinterest
  • Pocket
  • Telegram
  • WhatsApp
  • Mastodon

Related posts:

  1. How to setup LAMP stack on Ubuntu 14.04 LTS Server
  2. Install Openssh server on Ubuntu Desktop / Server
  3. How to install nagios server in Ubuntu 12.04 LTS
  4. Install MongoDB server on Ubuntu 12.04 LTS
  5. How to install Owncloud 6 on Ubuntu 14.04 LTS Server
  6. Install Owncloud 7 on Ubuntu 14.04 LTS Server
  7. Install bugzilla with MySQL 5.6 on Ubuntu 14.04 LTS server
  8. Install Cacti from source on Ubuntu 14.04 LTS Server
  9. How to install MySQL Server 5.7 on Ubuntu 14.04 LTS
  10. Install and compile nginx 1.14 on Ubuntu 18.04 LTS server

Filed Under: Linux, Wordpress Tagged With: wordpress

Reader Interactions

Comments

  1. Shaktishakar says

    May 23, 2016 at 8:09 pm

    We may need to adjust the permissions however. This depends on how you prefer to work. WordPress will generate the necessary rewrite rules for you. If it has write permissions to this file, it can implement the rules automatically. If it does not, you will have to manually edit this file to add the correct rules.

  2. sharad chhetri says

    April 11, 2015 at 3:51 am

    Hello Kaushal,

    Share the screenshot at admin@sharadchhetri.com .

    Regards
    Sharad

  3. Kal says

    April 10, 2015 at 6:23 pm

    Hello Sharad-

    Many thanks for your instructions! After following all steps you have outlined I’m receiving the following message when trying to update plugins: “To perform the requested action, WordPress needs to access your webserver. Please enter your FTP credentials to proceed.”

    I’m sure this must be a simple fix but I have yet to find a working solution. I’ve tried adding define(‘FS_METHOD’,’direct’); which kind of worked but then I got permissions issue writing to parent folder. Any suggestions?

    Thanks!

  4. sharad chhetri says

    January 31, 2015 at 4:02 am

    Hello Manuel,

    When we get the error : Error establishing a database connection
    Check following things –

    1) database Username and password in wp-config.php
    2) Database Host in wp-config
    3) Check the mysql server is running
    4) With the help of command line , use all db credential info and try to connect to mysql server

    Regards
    Sharad

  5. Manuel says

    January 29, 2015 at 8:35 pm

    Hello.. I have done all the steps on my EC2 instance to install wordpress.
    But on step
    ” 8) Follow final WordPress installation step from Web interface
    Open the Web browser (example: Chrome/firefox/Opera etc.) . Now type the ‘IP Address’ of Server in address bar of web browser.”

    I’m still getting the Apache2 Ubuntu Default Page and the message “It works”

    I have also tried putting the http://my-IP/wp-admin/install and get this error:
    The requested URL /wp-admin/install was not found on this server.

    Or http://my-IP/wordpress/
    get this error: Error establishing a database connection

    Please advice on what I’m missing. I have follow the details on this tutorial step by step.
    Thanks

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.

Primary Sidebar

Our Social Media Presence

  • Facebook
  • GitHub
  • Twitter

Linux Commands

Save iptables permanently on Ubuntu

cat,sed and awk commands to display file contents

How to find installation date and time of rpm package

Install lxml by using pip command on Ubuntu 14.04 LTS

Force linux user to change password upon login

grep command to remove commented lines

How to install libxml2 and libxslt packages on CentOS 6.5

Explore 70+ Articles On Linux Commands

Always Useful Tips And Tricks

postgres database backup script using database user password inside

Error: Could not stat() command file ‘/var/lib/nagios3/rw/nagios.cmd’!

How to hide php version information in header

Error installing rails

How to install pam_mysql in CentOS or Red Hat

SSH WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED

4 Different commands to find system uptime in linux

Explore 90+ Article On "Linux Tips And Tricks"

You Might Like These Articles!

Internal External Command

What is Linux/Unix Internal And External Command

Linux basic command

Linux Basic Commands With Examples For Every Beginner

simplecodesyntax wordpress plugin

SimpleCodeSyntax : My Another WordPress Plugin

Install Nginx

How To Install Nginx On Ubuntu 22.04 LTS

Install Latest Git package in Ubuntu Operating System

How To Always Install Latest Git Package In Ubuntu Operating System

Bash script for installing VirtualBox on Ubuntu 22.04 LTS Desktop

Install VirtualBox On Ubuntu 22.04 LTS Desktop (Bash Script)

Copyright © 2023 ·
The material in this site cannot be republished either online or offline, without our permission but Schools and Colleges can do in their Private Network
Proudly Blogging From Bharat.

  • Contact
  • About Me
  • My WordPress plugins
  • Privacy Policy