How to install WordPress Locally

Hi all,

In this post, I am going to explain about installing WordPress in your local computer. I started using WordPress locally because my Internet connection was very slow and I was not able to update and preview files often.

This is very useful for designers & users, who want to test new plugins and themes before using them in their own website. By installing WordPress locally you can also save time & money.

The following 5 steps will help you install WordPress locally,

  1. Install a Local Server
  2. Download WordPress
  3. Create a New Database
  4. Create configuration File
  5. Install WordPress

Install a Local Server

In order to run any PHP/database application locally in your system, you need a local host (ie., Apache + MySQL). For Linux, use LAMP. For Windows, use WAMP.

Requirements to run WordPress locally,

  • PHP version 4.3 or higher
  • MySQL version 4.1.2or higher

I am using Linux here, so I am going to install LAMP. LAMP stands for Linux, Apache, MySQL, PHP. Here is my previous post about How To Setup a LAMP Server for Ubuntu.

Download WordPress

Step 1: Download WordPress from wordpress.org.

Step 2: After downloading WordPress (.zip or .tar.bz ), extract it in a folder (say wordpress) and move the wordpress folder inside the /var/www/ directory. So now your installation url will be http://localhost/wordpress/ where you can have access to your WordPress.

Create a New Database

Step 1: Open up any web browser & type the following web address,

http://localhost/phpmyadmin/

Step 2: You will be taken to the login page and provide the root password.Step 3: Now create a database with the database name wordpress,

then create a new user: wpadmin with all privileges and password: wppass.Note: If you face problems to open WordPress url, then you must change permissions for /var/www/wordpress with this command as root in your terminal:

chmod -c 777 -R /var/www/wordpress/

Create configuration File

Step 1: To create the configuration file, open up wp-config-sample.php in /var/www/wordpress and paste the following lines of code:

 // *** MySQL settings *** // 
 define('DB_NAME', 'wordpress'); 
define('DB_USER', 'wpadmin'); 
 define('DB_PASSWORD', 'wppass'); 
 define('DB_HOST', 'localhost');

save it as wp-config.php.

The username & password specified in the wp-config file, is used by WordPress to access the MySQL database.

Install WordPress

Step 1: Run the WordPress installation script by pointing your browser to,

http://localhost/wordpress/wp-admin/install.php.

Once you have set up WordPress, you can initially log in as ‘admin’ with a system-generated password which will be emailed to you. Then set up a second administrator account with a strong password, log off and then log in with that account and delete the default ‘admin’.Choose something you will remember for both username and password.

You can login to WordPress at,

http://localhost/wordpress/wp-login.php

You can preview WordPress by pointing the browser to the below web address,

http://localhost/wordpress/

Now that we have successfully installed WordPress locally.

Hope you find this post helpful. Happy blogging 🙂

To Setup a LAMP Server on Ubuntu

Hi all,
This post will help you install LAMP server in your Ubuntu machine. LAMP stands for Linux, Apache, MySQL, PHP.
There are 3 basic steps in installing the LAMP Server,

  1. Installing & Testing Apache
  2. Installing & Testing PHP
  3. Installing & Testing MySQL

Installing Apache

Step 1: Open up the Terminal.

Step 2: Copy & Paste the following code into the terminal,

sudo apt-get install apache2

Step 3: You will be asked for root password, provide that. Now you have installed Apache.

Testing Apache
To make sure that you have correctly installed it, we will now test Apache to ensure that it is working correctly.

Step 1: Open up any web browser & enter the following web address,

http://localhost

If Apache is working properly, you will see a page like thisInstalling PHP

Step 1: Open up the terminal.

Step 2: Copy & Paste the following code into the terminal,

sudo apt-get install php5 libapache2-mod-php5

Step 3: To make the PHP work, we have to restart Apache by using the following code,

sudo /etc/init.d/apache2 restart
Testing PHP
Step 1: Open up the terminal.

Step 2: Copy & Paste the following code into the terminal,

sudo gedit /var/www/testphp.php

The above code will open up a file testphp.php.

Step 3: Now copy & paste the following PHP code into the testphp.php file,

<?php phpinfo(); ?>

Step 4: Save the file and close it.

Step 5: Open up any web browser & enter the following web address,

http://localhost/testphp.php

If the installed Apache & PHP are working properly, you will see a page like thisInstalling & Testing MySQL

Step 1: Open up the Terminal.

Step 2: Copy & Paste the following code,

sudo apt-get install mysql-server

Step 3: Now you can set the MySQL root password by using the following code,

mysql -u root

Following that Copy & Paste this code,

mysql>SET PASSWORD FOR 'root'@'localhost' = PASSWORD('yourpassword');

Note: Make sure that you change “yourpassword” to your root password.

Step 4: Now we are going to install a new program phpmyadmin, which is an easy tool to edit your database. So Copy & Paste the following code into the terminal,

sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin

Step 5: Our next task is to get PHP to work with MySQL by editing the php.ini file using the following code,

gksudo gedit /etc/php5/apache2/php.ini

Now we are going to uncomment the following line by removing the semicolon(;),

;extension=mysql.so

to look like,

extension=mysql.so

Step 6: Now restart Apache by using the following code,

sudo /etc/init.d/apache2 restart

Step 7: Now you can test your phpmyadmin installation by entering the following web address in your web browser,

http://localhost/phpmyadmin

You will see a page like thisNote: In this post I am referring Apache2 and PHP5 versions.

Now you have successfully installed the LAMP server in your Ubuntu machine. Hope this post was very useful. 🙂

How to configure BSNL Broadband for Ubuntu 10.04

Hi all,

I had trouble connecting BSNL Broadband in Ubuntu 10.04. I used the following steps to configure it and now my Internet connection is working pretty good.

Step 1: Open up the Terminal

Step 2: Type

                       sudo pppoeconf

         This command will automatically detect your interfaces, 
         so keep the Modem ON.

Step 3: A prompt box will open now and after few clicks on yes, 
         you will be prompted for username and next for password,
         provide that.

Step 4: Now it will ask you about connection type,
             1. To activate connection on every system startup
             2. Do you want to activate connection right now
         Give your option.

         On the last screen it will show you the commands to 
         activate and deactivate the connection.

To Activate the connection again use,
                      sudo pon dsl-provider


To Terminate the connection use,
                      sudo poff dsl-provider



Enjoy and Welcome to Ubuntu 🙂