Finally Installed! WordPress! Phew!!!!!

This wordpress installation was a nightmare! But actually most of it was my fault. I did not look at the right places.Plus i had no clue of how to go about with LAMP (Linux, Apache, MySQL, PHP).  However, found some great posts lying around on the web, installed it and then it was ready to go….

Firstly , a big thanks to all those guys who have posted the How Tos …I will sum them up.

Now, getting down to the installtion. To remind you guys, this installtion is on Ubuntu 9.04 (As i dont use windows, no offence but i’m very scared of virus and spyware!! :D)

It must be noted that you need to ensure you have the universe repository enabled. To do that go to System->Administration->software sources  and tick the universe option. Then close it. It will ask  to reload repos. Click on reload to update the repositories.

screenshot

Installing LAMP (  Thnks to Linerd) [ For those who are afraid of the terminal, Each of these softwares can be installed from synaptic, but it will take a long time, CLI is a faster option. Trust me! ;)]

Copy and paste this following command into the terminal. (BTW: Terminal can found in Applications-> Accessories -> Terminal). Do it exactly as given, along with the cap at the end.

  sudo apt-get install lamp-server^   apt_lamp_install

Then follow the onscreen instructions to create a MySQL password. Remember it is very important to create the password and u must give something which u can remember easily.  For the record, the username for the root user is root.lamp_installation_completemysql_change_password

MySQL is now installed and should operate fairly smooth and without issue. However, if the goal is to strictly use WordPress then the MySQL daemon should be tweaked a bit in order to save on memory consumption.

sudo gedit /etc/mysql/my.cnf

Ensure the following entries have similar options set in the MySQL configuration file:

key_buffer = 16M
max_allowed_packet = 8M
thread_stack = 64K
thread_cache_size = 4
skip-innodb

The last entry is an important one and will lower MySQL memory consumption considerably.

Testing the installation

Testing Apache

Open a web browser and enter the address http://localhost/.  You should see a webpage displaying the text “It Works!

Testing PHP

Now we’re going to test our PHP installation. To do this we’ll create a file called testing.php in /var/www. Open a terminal and enter:

 gksudo gedit /var/www/testing.php

Now, Enter the line below and  save the file. Then exit the text editor.

<?php phpinfo(); ?>

Now we need to restart Apache.Type the follwing command in the terminal

sudo /etc/init.d/apache2 restart

Now, open your browser and enter http://localhost/testing.php/. You should see a bunch of information about your version of PHP. You need to delete this testing.php after the testing is over.  do so by

sudo rm -f /var/www/testing.php
Configuring MySQL

Now we need to configure MySQL to be associated with the IP address of your machine. Since I’m installing the LAMP stack for a web development environment I’m going to bind MySQL to the localhost IP address, which in my case is 127.0.0.1. You can verify this address with:

cat /etc/hosts | grep localhost

Now open the .cnf file with the following command.

gksudo gedit /etc/mysql/my.cnf

Verify that the bind-address line looks like this (adjust for your IP address).

bind-address = 127.0.0.1

Now, one step which is optional, but I highly recommend it as it becomes very easy to administer the MySQL database especially for new users.

Install phpMyAdmin

Issue the following command at the terminal.

sudo apt-get install libapache2-mod-auth-mysql phpmyadmin
config_phpmyadmin_dbconfig-common

During the installation you will be prompted to select your web server for automatic configuration. Use the space bar to mark apache2 and then hit <Enter>.You will also be asked if you want to configure phpMyAdmin with a new database called dbconfig-common. Select Yes and hit <Enter>.

Next you’ll be prompted for the password for MySQL’s administrator. Enter the MySQL root password that you created earlier in the installation. Hit <Tab> to select Ok and hit <Enter>.

Next you’ll be prompted to create an application password for phpMyAdmin to talk to MySQL. If you leave it blank, a random password will be generated for you.

After configuring the password, the installation should complete.

To set up under Apache all you need to do is include the following line in /etc/apache2/apache2.conf.

Include /etc/phpmyadmin/apache.conf

PS: open the above file with any text editor like gedit/nano/kate with gksudo/sudo

Once phpMyAdmin is installed point your browser to http://localhost/phpmyadmin to start using it. You should be able to login using any users you’ve setup in MySQL.Default user created is root.

Installing WordPress

At the terminal, apply this command

sudo apt-get install wordpress php5-gd 

Now, issue the following to install WordPress in the /wordpress directory of your default web site.

sudo ln -s /usr/share/wordpress /var/www/wordpress 

Now, browse to “http://localhost/wordpress” in your browser and click on the “install.php” link.

Configuring WordPress…..

When wordpress is installed there are two places where it is installed

1. /etc/wordpress ( which contains the wp-conf.php file)

2. /usr/share/wordpress (which contains the basic installation files including wp-conf-sample.php)

so we need to give permission to these two folders to run the install script. For that issue the follwoing commands at these places.

/etc$ sudo chmod 777 wordpress/
/usr/share$ sudo chmod 777 wordpress

Now we need to  Run the Install Script

Using your  web browser , visit wp-admin/install.php within the directory into which you just installed WordPress  which is.

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

If WordPress can’t find the wp-config.php file, it will tell you and offer to try to create and edit the file itself. (You can do also do this directly by loading http://localhost/wordpress/wp-admin/setup-config.php in your web browser.) WordPress will ask you the database details and write them to a new wp-config.php file.
After installation we need to remove the permission by using these commands.
/usr/share$ sudo chmod 755 wordpress
/etc$ sudo chmod 755 wordpress

That should be it. You can use WordPress now!

wordpress2wordpress2setup-config640px-install-step5640px-install-step6


While Uploading pictures you might get error like this “Unable to create directory /usr/share/wordpress/wp-content/uploads/2006/02. Is its parent directory writable by the server?”

For that do a

 sudo mkdir /usr/share/wordpress/wp-content/uploads; chown www-data:www-data /usr/share/wordpress/wp-content/uploads

at the termnial

If the install file does not work then you would need to follow the procedure shown below ( thanks to supriyadisw) and try going to the address http://localhost/wordpress/wp-admin/install.php

Prepare MySQL Database for WordPress

Create a database for WordPress on your Ubuntu, as well as a MySQL user who has all privileges for accessing and modifying it. You can use phpMyAdmin to make it easier ;)

  • First create dababase: wordpress
  • Then create a new user: wordpress with password: wordpresspassword

Write down the values you used for databasename, wordpressusername, hostname, and password for future purpose ;)

Configure WordPress Setting

Copy the wp-config-sample.php(can be found in /usr/share/wordpress)  file to wp-config.php(can be found in /etc/wordpress). Open and edit wp-config.php file

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

Leave a Reply

tuxtrixmod
Scroll to Top