Saturday, May 13, 2006

Installation of commonly required opensource software on Linux

I strongly feel that all software will become open source in next ten years. As the software become commodity, source code really does not matter. How you create business around your software matters a lot. Opensource software on Linux is a persuading combination for computer adoption by common people from developing countries like India, China etc. Most of the middle class educated people can not afford Microsoft products. There are tons of small scale businesses in India who are willing to go for back office automation but the hurdle is license cost and support cost. Hardware cost is really not a big deal.

I thought, let's install commonly used openSource software on Linux and see how mature is the market in this domain. I found lot of interesting information around business models based on OpenSource software. I will post that information in next blogs.

I will focus on installation part in today's blog.


1. Introduction
------------------
This document talks about creating Linux partition on laptop and installation of followings software:

Linux distro Ubuntu 5.10
Apache, PHP and MySQL (Great gift for small-medium size business IT)
SugarCRM (Successful opensource customer relationship management)
Drupal (Content management opensource software)


2 Creating new partition on laptop
-------------------------------------------
Before install, I used QTParted on a Knoppix CD to resize my WinXP partition to 80GB from 90GB.


3 Installation of Ubuntu Linux distro
---------------------------------------------

3.1 Ubuntu 5.10 installation
----------------------------------
CD image for Ubuntu 5.10 (ubuntu-5.10-install-i386.iso) is available at http://mirror.mcs.anl.gov/pub/ubuntu-iso/CDs/5.10/
I burned a CD with above image and installed Ubuntu on remaining 10GB partition.


3.2 Updating installation
-------------------------------
I updated installation by issuing following command
# sudo apt-get update


3.3 Activating wireless connection
-----------------------------------------
We need to first make sure that the wireless card on laptop is recognized by Ubuntu installation. I confirmed it from network settings as follows:
1. Go to System -> Administration -> Networking
2. Click on “Wireless connection” and then click on “Properties”.
3. Select Network name from list of available networks.
4. In “Connection settings” section, set configuration to “DHCP”.
5. Click OK.

This will set up a wireless connection.


3.4 Configuration of Printer
----------------------------------
Follow the steps for printer configuration:
Go to System-> Administration-> Printing
Click on “New Printer”
Select “Network Printer”
Specify URI. In my case, it was a printer within my company.



4 Installation of Apache2
-------------------------------
Ubuntu has provided apt-get utility for installing standard packages like Apache, PHP and MySQL. We can install these software by issuing following commands:
# sudo apt-get install apache2
It installed Apache version 2.0.54
You can re-start apache for sanity check by following command
# /etc/init.d/apache2 restart
Forcing reload of web server (Apache2)...
We can confirm the installation by going to http://localhost/apache2-default/ through browser.


5 Installation of PHP
-------------------------
PHP version 5.0.5-2 was installed using following command.
# sudo apt-get install php5
In order to test PHP, I created a small testphp.php page as follows:

Copied testphp.php to /var/www. It was viewed through http://localhost/testphp.php.


6 Installation of MySQL
-----------------------------
I followed instructions on MySQL's website http://dev.mysql.com/doc/refman/5.0/en/Linux-rpm.rpm.html to install MySQL server 5.0.19.
Later I followed post installation steps from http://dev.mysql.com/doc/refman/5.0/en/unix-post-installation.html for validating and testing installation.


7 Installation of sugarCRM
---------------------------------
I went through following steps for installation of sugarCRM.

1. Download latest stable version of suagarCRM from http://www.sugarforge.org/frs/download.php/1104/SugarSuite-4.0.1e.zip

2. Copy SugarSuite-4.0.1e.zip to apache2's public html directory. In my case, I copied to /var/www

3. Unzip SugarSuite-4.0.1e.zip

4. Rename SugarSuite-4.0.1e to sugarCRM for convenience.

5. Restart apache2

root@prashant:~# /etc/init.d/apache2 restart
* Forcing reload of web server (Apache2)...

6. Go to http://localhost/sugarCRM. It starts the installation wizard on browser itself. This wizard will take you through license acceptance and registration.

7. Continue following the wizard. It does a system acceptance check. It asks you to perform certain tasks if the system is not ready for installation. In my case, I had to do following corrections:

- I needed to give write permissions to following directories and their1 sub-
directories in /var/www/sugarCRM:
custom, modules, data, cache,

- I needed to give write permissions to /var/www/sugarCRM/config.php

- It asked me to increase PHP memory limit to 20M or larger. This was done
by modifying /etc/php5/apache2/php.ini file. We need to search for word
'memory_limit' and set it to 20M as follows

memory_limit = 20M

8. The next step is to do database configuration. It was done with following parameters
- Host Name : localhost
- DatabaseName : sugarCRM
- User Name for SugarCRM : sugarcrm
- Password for SugarCRM : welcome
- SugarCRM admin password : welcome

9. With these steps, I was supposed to be done with installation but I faced one hurdle. SugarCRM was not connecting to MySQL database. It gave me following error:

Database admin user name and/or password is invalid (Error 1251: Client does not support authentication protocol requested by server; consider upgrading MySQL client).

I restarted MySQL database and restarted Apche2 but the error did not go away. I went to SugarCRM help forum and posted this question twice but I did not get any response. Finally, I found some information in MySQL documentation http://dev.mysql.com/doc/refman/5.0/en/old-client.html

This documentation explained the configuration steps for old client. The error was due to the fact that the sugarCRM latest stable version uses older MySQL client. We need to update MySQL root password using “OLD_PASSWORD” API.

mysql> UPDATE mysql.user SET Password = OLD_PASSWORD('welcome')
-> WHERE Host = 'localhost' AND User = 'root';

mysql> FLUSH PRIVILEGES;
This step resolved the issue with database connection and I was able to complete installation.


8 Installation of Drupal

I followed the instruction on http://wiki.clug.org.za/wiki/Drupal_CMS_on_Ubuntu_5.10_(Breezy)
for drupal installation. Drupal installation was very straightforward and I could complete it without any hurdle. Here are the steps used :

1. Download Drupal in some directory
wget http://drupal.org/files/projects/drupal-4.6.5.tar.gz

2. Extract the contents of above archive.
tar -zxvf drupal-4.6.5.tar.gz

3. Move Drupal into web server's root directory
sudo mv drupal-4.6.5/* /var/www
sudo nv drupal-4.6.5/.htaccess /var/www

4. Create the Drupal database:

mysqladmin -u root -p create drupal

5. Set database access rights for Drupal database:

# mysql -u root -p
mysql> GRANT ALL PRIVILEGES ON drupal.* TO root@localhost IDENTIFIED BY 'welcome';
mysql> FLUSH PRIVILEGES;
mysql> quit

6. Load Drupal database schema.
mysql -u root -p drupal < database/database.mysql

7.Configure Drupal to access MySQL

cd /var/www/sites/default
sudo vi settings.php
Search for word mysql and modify db_url as follows:
$db_url = 'mysql://root:welcome@localhost/drupal';

We need to remove previous index.html (if any) from /var/www directory.

8. This completes the Drupal installation. Drupal does not create any sub-directory in apache's public html. In other words, we can log on to Drupal by going to http://localhost. We need to remove previous index.html (if any) from /var/www directory.

No comments: