Quantcast
Channel: Linux Candy » ubuntu
Viewing all articles
Browse latest Browse all 6

[How to] install wordpress in Ubuntu/Debain system or server

$
0
0

WordPress, no doubt is one of the most famous blogging platform. Before you begin the installation you must have a lamp server installed in your system. I have made a post on how to install lamp . Please follow the instruction there and come back here to install wordpress.

 

WordPress  is a free and open sourceblogging tool and content management system (CMS) based on PHP and MySQL. It has many features including a plug-in architecture and a template system. WordPress is used by over 14.7% of Alexa Internet‘s “top 1 million” websites and as of August 2011 manages 22% of all new websites WordPress is currently the most popular CMS in use on the Internet. -wikipedia

 

I assume that you have installed lamp in your system. Lets move onto installing wordpress now. You may need a little or no skills on php and mysql during the installation. If you have done even a piece of thing in php and/or mysql you will get whats going on otherwise you will be, by the end of post, done with installation yet not knowing what the hell happened. I will try my best to keep it as simple as possible and try to explain whats happening in each and every steps.

 

Installing wordpress on personal computer/laptop can be done differently since we don’t have to ssh/ftp into any server and hence the installation of wordpress in server goes little different. But in this post I have tried my best to keep the installation process for both the case similar making the difference minimal and choosing the most effective way.

 

Step 1: Download wordpress

> To download wordpress tar ball open your terminal and type this command:

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

 

Note: if you are installing this in your server ssh/ftp to your server and then download it anywhere  you like. we are going to move the files to the place it needs to be moved.

 

Step 2: Unzip the tar ball by using this command via terminal:

tar -xzvf latest.tar.gz 

your terminal should extract the files from the tar ball and the output looks something similar to this:

Step 3: Creating Database for WordPress and User

Now here we are going to do some mysql stuff. If you know mysql then it should be easy preasy for you. And if you don’t know then don’t worry just hit these commands and you will get what you need. :)

Now this can be done through multiple ways like from cpanel, or from phpmyadmin or bla bla bla. What I feel best is to use MySQL client.

Check out the screenshot:

CREATE DATABASE wordpress;
Query OK, 1 row affected (0.00 sec)  : 

The above command should be clear enough. Its self explanatory that it created a database of name “wordpress”.

mysql> CREATE USER ‘candy’@'localhost’ IDENTIFIED BY ‘password’;
Query OK, 0 rows affected (0.01 sec)

mysql> GRANT ALL PRIVILEGES ON wordpress.* TO “candy”@”localhost” IDENTIFIED BY “password”;
Query OK, 0 rows affected (0.00 sec)

Second command creates a user “candy” in this case and password is “password”. You can choose username and password of your choice. Don’t forget/miss the quotes while hitting those commands as in ‘candy’ and ‘localhost’ .

Later one is to grant the full access to the user “candy” to do anything with the database wordpress. Anything here means creating, deleting, updating etc of new/old databases.

Step 4: we now need to edit wp-config-sample.php and add some details there.

First we need to go the folder which we have installed wordpress. For now its in your current directory which your terminal is defaulty open. so you can hit this command form your terminal:

cd wordpress/

Now you are inside the directory.  Type command “ls” to see the list of files you have in the directory. You will see one file named “wp-config-sample.php” . Here we need to change the file name to “wp-config.php” . To do this hit this command

sudo mv wp-config-sample.php wp-config.php

You are half way of editing the file. If you are installing this in your computer then in next step you can choose any of your favorite editor to edit this config file for eg: gedit, vi, nano etc. To do that hit

sudo gedit wp-config.php  (to open via gedit)

or sudo vi wp-config.php (to open in vi)

If you are installing wordpress in your server then I would suggest you to use “vi”. If you haven’t installed “vim” then type “sudo apt-get install vim” to install it. In debian/ubuntu vi is default but not vim. Vim is vi improved.

Back to editing. Once you have opened the file you can search form DB_NAME and you should see something like this (I have used vi in this case)

we can see that fields like database name, username and password needs to be given.

Now edit the file and give the username, password and database name which you just created in above steps. For my case its
user: candy
database: wordpress
password: password

After making the changes:

Step 5: Now we need to move the contents of the folder to the desired place. Either we are in server or system the general place where our site will be hosted is /var/www/ but it may vary if you have different machine, operating system, hosting provider etc. For any of the case you need to move all the contents of the folder “wordpress” (not the folder itself) to the directory where your site is hosted. We are going to move it to /var/www/ folder. If you point your browser address bar to http://localhost/ then you will see a simple html page saying “It works” which you already saw that while installing lamp. Now we are going to see something else soon, yes our own wordpress site.

Now to move the contents to /var/www/ folder lets cd to the path

cd /var/www/

Now we are in the folder where we want our wordpress contents to be moved on.

Hit these two commands in bold:

chandan@linuxcandy:/var/www$ sudo cp /home/chandan/wordpress/* .
cp: omitting directory `/home/chandan/wordpress/wp-admin’
cp: omitting directory `/home/chandan/wordpress/wp-content’
cp: omitting directory `/home/chandan/wordpress/wp-includes’
chandan@linuxcandy:/var/www$ sudo cp -rf /home/chandan/wordpress/* .

The first command copies all the files ( * takes all) to the current folder ( don’t forget the dot “.” at last of the command to hit) and second command moves the directories inside the wordpress folder. Since the wordpress folder was in my /home/chandan/ directory the path to it is the same. You can give the path where you have the wordpress directory.

 

Excited to see your wordpress blog ? yay! we are just a couple of steps away.

Now if you have done everything up fine then you should be able to see something similar to below screenshot while pointing your browser to

http://localhost/wp-admin/install.php     (in case of your computer)
http://yourdomain.com/wp-admin/install.php (in case of your server)

Oh, yes you are done now. Give the informations you need to give. Then you will be taken to your wordpress login page. Login and start blogging! :)

Cheers!


Viewing all articles
Browse latest Browse all 6

Latest Images

Trending Articles



Latest Images