How to setup your wordpress blog locally on ubuntu 9.04

by bharat on December 15, 2009

Setting Blog locally:-

Follow step by step tutorial

This tutorial assumes that  you have sudo permission in ubuntu, So open gnome terminal in your machine and start executing following steps 

  • Install Apache server by running following  command .

Sudo apt-get install apache2

follow the instructions to install apache , once the installation is finished you can test whether this works fine or not , by typing 127.0.0.1 in browser , “it works” should appear in your browser.

  • Install mysql server by running following command.

sudo apt-get install mysql-server-5.0.

installation may take long depending on your internet speed, and you will be required to enter root password during this installation.

  • install php server.

sudo apt-get install php5.

  • install PHP module for mysql

sudo apt-get install php5-mysql

  • Download latest wordpress by clicking the following link.

wordpress

Now we have all the softwares installed , all we need is to configure these .follow  these steps in order.

first we need to enter the type of webpages we want our apache to support , so add following instructions at the end of apache2.conf file.
first open this file by executing following command

sudo gedit /etc/apache2/apache2.conf.

Add following lines at the end of this file.

AddType application/x-httpd-php .php .phtml .php3
AddType application/x-httpd-php-source .phps

Save and exit the editor .

Next step is to run mysql install script , executes following commnad .

sudo mysql_install_db

After competion log into mysql server ,

mysql -u root –p

Enter server root password you set during installtion . if password is right you will find yourself on mysql prompt .

now create Data base to be used by WordPress.

CREATE DATABASE wordpress;

Now create use let us consider name of this use is wordpress ,

CREATE USER user;

Now to create password for this user ,

SET PASSWORD FOR user = PASSWORD(“password”);

password should be replaced with your password .

now grant all the permission to this user by execting follwoing commnad .

GRANT ALL PRIVILEGES ON wordpress.* TO user@localhost IDENTIFIED BY ‘password’;

Now untar wordpress.tar.gz you obtain earlier in some directory in /var/www/ let us assume the name of this folder is wordpress .

exectue tar  -zxvf wordpress.tar.gz  /var/www/

Now lets make some changes in wordpress settings , execute follwoing commnad.

sudo gedit /var/www/wordpress/wp-config-sample.php

now change

Change putyourdbnamehere to wordpress.

Change usernamehere to user.

Put your password to same you choose while creating this user and granting all permission by execting GRANT command .Once you have your changes made , save your changed file to /var/www/wordpress as wp-config.php.

Now after doing these steps you should be able to run your blog on ubuntu , go to browser addressbar and type 127.0.0.01/wordpress you should be able to see the login setup page. rest all is similar to normal wordpress operations.

Common Problems

if you dont get your wordpress running by and get some phtml.part file can not open error do remember to restart your apache server by executing following command.

sudo  /etc/init.d/apache2 restart

This restart you should not give any warning or error related to localhost unknown if this kind of errors/warnings are being displayed then do make entry of localhost in httpd.conf by executing following commnad.

sudo vim /etc/apache2/httpd.conf

enter following line in this file

ServerName localhost

Then restarting of apache should be flawless and wordpress should run.

Another mistakes which normally people make is  of copying the commnads while entering in SQL prompt , please dont do so as while copying commnad some times extra blanks space also gets copied and sql start giving erros of syntactial mistakes.

Customization

if you want to change name of the blog to your blog name to be in proper sync to your original blog , visit setting section of wordpress dash board and change wordpress to the name of your blog.

now you should be able to see your blog running by execting commnad

127.0.0.1/nameofyourblog.

at any moment if you messed up with database you can delete this by going to sql prompt again and
execute

drop databasename ;

If you face any kind of problem do remeber to ping me by  sending comments to this article.


{ 1 comment… read it below or add one }

hermes birkin handbags May 4, 2010 at 10:12 pm

This is an interesting article. Thanks for sharing.

Reply

Leave a Comment

Previous post:

Next post: