Installing Apache/MySQL/PHP on ELCOT provided BOSS Linux

Today one of home town’s job seekers come home directly seeking advice on LAMP development.He said , he tried with XAMPP on his Windows7 , but it refuses to start the web server the Apache.

The laptop he own is a decent one, brought to him by the Government of Tamilnadu for Students in College/Higher education.

I tried to uninsatll the exisiting XAMPP package and re-install the same.Still no luck. The problem is with Windows Socket server and it is not listening at port 80 and others.

Whenever I try to start the Apache, I received the message:

Syntax error on line ## of :path/to/apache/conf/httpd.conf:
Listen setup failed
....
alloc_listener: failed to get a socket

As the laptop comes with Dual-OS pre-installed with C-DAC ‘s version of Debian/Linux OS, the BOSS, I go for LAMP and not XAMPP and/or WAMP.

1) Get your root password : I don’t have the root privilege and need it now.

elcot@boss:~$ sudo -i
root@boss[~]#passwd
You can now choose the new password or passphrase.

A valid password should be a mix of upper and lower case letters,digits, and other characters.  You can use an 8 character long password with characters from at least 3 of these 4 classes, or a 7 character long password containing characters from all the classes.  An upper case letter that begins the password and a digit that ends it do not count towards the number of character classes used.

A passphrase should be of at least 3 words, 11 to 40 characters
long, and contain enough different characters.

Alternatively, if no one else can see your terminal now, you can pick this as your password: "Canvas$assure3victim".

Enter new password:
Re-type new password:
passwd: password updated successfully
root@boss[~]#

2) Install the Apache web server

root@boss[~]#apt-get install apache2
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  apache2-mpm-worker apache2-utils apache2.2-common
Suggested packages:
  apache2-doc apache2-suexec apache2-suexec-custom
The following NEW packages will be installed:
  apache2 apache2-mpm-worker apache2-utils apache2.2-common
0 upgraded, 4 newly installed, 0 to remove and 44 not upgraded.
Need to get 474 kB of archives.
After this operation, 2,675 kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://packages.bosslinux.in/boss/ savir/main apache2-utils i386 2.2.16-3 [164 kB]
Get:2 http://packages.bosslinux.in/boss/ savir/main apache2.2-common i386 2.2.16-3 [307 kB]
Get:3 http://packages.bosslinux.in/boss/ savir/main apache2-mpm-worker i386 2.2.16-3 [2,224 B]
Get:4 http://packages.bosslinux.in/boss/ savir/main apache2 i386 2.2.16-3 [1,386 B]
Fetched 474 kB in 32s (14.7 kB/s)
Selecting previously deselected package apache2-utils.
(Reading database ... 160490 files and directories currently installed.)
Unpacking apache2-utils (from .../apache2-utils_2.2.16-3_i386.deb) ...
Selecting previously deselected package apache2.2-common.
Unpacking apache2.2-common (from .../apache2.2-common_2.2.16-3_i386.deb) ...
Selecting previously deselected package apache2-mpm-worker.
Unpacking apache2-mpm-worker (from .../apache2-mpm-worker_2.2.16-3_i386.deb) ...
Selecting previously deselected package apache2.
Unpacking apache2 (from .../apache2_2.2.16-3_i386.deb) ...
Processing triggers for man-db ...
Setting up apache2-utils (2.2.16-3) ...
Setting up apache2.2-common (2.2.16-3) ...
Enabling site default.
Enabling module alias.
Enabling module autoindex.
Enabling module dir.
Enabling module env.
Enabling module mime.
Enabling module negotiation.
Enabling module setenvif.
Enabling module status.
Enabling module auth_basic.
Enabling module deflate.
Enabling module authz_default.
Enabling module authz_user.
Enabling module authz_groupfile.
Enabling module authn_file.
Enabling module authz_host.
Enabling module reqtimeout.
Setting up apache2-mpm-worker (2.2.16-3) ...
Starting web server: apache2apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
.
Setting up apache2 (2.2.16-3) ...
root@boss[~]#

Now pointing the browser at http://locahost/ must reports that “It works” kind of message.

Open the Web root located at

root@boss[~]#cd /var/www

3) Install the MySQL DB server

root@boss[~]#apt-get install mysql-server
Reading package lists... Done
Building dependency tree 
Reading state information... Done
The following extra packages will be installed:
 libdbd-mysql-perl libdbi-perl libhtml-template-perl libnet-daemon-perl libplrpc-perl mysql-client-5.1 mysql-server-5.1 mysql-server-core-5.1
Suggested packages:
 libipc-sharedcache-perl libterm-readkey-perl tinyca
The following NEW packages will be installed:
 libdbd-mysql-perl libdbi-perl libhtml-template-perl libnet-daemon-perl libplrpc-perl mysql-client-5.1 mysql-server mysql-server-5.1 mysql-server-core-5.1
0 upgraded, 9 newly installed, 0 to remove and 44 not upgraded.
Need to get 21.3 MB of archives.
After this operation, 50.5 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://packages.bosslinux.in/boss/ savir/main libnet-daemon-perl all 0.43-1 [46.6 kB]
Get:2 http://packages.bosslinux.in/boss/ savir/main libplrpc-perl all 0.2020-2 [36.0 kB]
Get:3 http://packages.bosslinux.in/boss/ savir/main libdbi-perl i386 1.612-1 [879 kB]
Get:4 http://packages.bosslinux.in/boss/ savir/main libdbd-mysql-perl i386 4.016-1 [138 kB] 
Get:5 http://packages.bosslinux.in/boss/ savir/main mysql-client-5.1 i386 5.1.49-1 [8,301 kB] 
Get:6 http://packages.bosslinux.in/boss/ savir/main mysql-server-core-5.1 i386 5.1.49-1 [3,933 kB] 
Get:7 http://packages.bosslinux.in/boss/ savir/main mysql-server-5.1 i386 5.1.49-1 [7,814 kB] 
Get:8 http://packages.bosslinux.in/boss/ savir/main libhtml-template-perl all 2.9-2 [65.9 kB] 
Get:9 http://packages.bosslinux.in/boss/ savir/main mysql-server all 5.1.49-1 [64.4 kB] 
Fetched 21.3 MB in 6min 36s (53.7 kB/s) 
Preconfiguring packages ...
Selecting previously deselected package libnet-daemon-perl.
(Reading database ... 160956 files and directories currently installed.)
Unpacking libnet-daemon-perl (from .../libnet-daemon-perl_0.43-1_all.deb) ...
Selecting previously deselected package libplrpc-perl.
Unpacking libplrpc-perl (from .../libplrpc-perl_0.2020-2_all.deb) ...
Selecting previously deselected package libdbi-perl.
Unpacking libdbi-perl (from .../libdbi-perl_1.612-1_i386.deb) ...
Selecting previously deselected package libdbd-mysql-perl.
Unpacking libdbd-mysql-perl (from .../libdbd-mysql-perl_4.016-1_i386.deb) ...
Selecting previously deselected package mysql-client-5.1.
Unpacking mysql-client-5.1 (from .../mysql-client-5.1_5.1.49-1_i386.deb) ...
Selecting previously deselected package mysql-server-core-5.1.
Unpacking mysql-server-core-5.1 (from .../mysql-server-core-5.1_5.1.49-1_i386.deb) ...
Selecting previously deselected package mysql-server-5.1.
Unpacking mysql-server-5.1 (from .../mysql-server-5.1_5.1.49-1_i386.deb) ...
Selecting previously deselected package libhtml-template-perl.
Unpacking libhtml-template-perl (from .../libhtml-template-perl_2.9-2_all.deb) ...
Selecting previously deselected package mysql-server.
Unpacking mysql-server (from .../mysql-server_5.1.49-1_all.deb) ...
Processing triggers for man-db ...
Setting up libnet-daemon-perl (0.43-1) ...
Setting up libplrpc-perl (0.2020-2) ...
Setting up libdbi-perl (1.612-1) ...
Setting up libdbd-mysql-perl (4.016-1) ...
Setting up mysql-client-5.1 (5.1.49-1) ...
Setting up mysql-server-core-5.1 (5.1.49-1) ...
Setting up mysql-server-5.1 (5.1.49-1) ...
Stopping MySQL database server: mysqld.
130118 13:07:42 [Note] Plugin 'FEDERATED' is disabled.
130118 13:07:42 InnoDB: Started; log sequence number 0 44233
130118 13:07:42 InnoDB: Starting shutdown...
130118 13:07:47 InnoDB: Shutdown completed; log sequence number 0 44233
Starting MySQL database server: mysqld.
Checking for corrupt, not cleanly closed and upgrade needing tables..
Setting up libhtml-template-perl (2.9-2) ...
Setting up mysql-server (5.1.49-1) ...

4) Verify that MySQL is up and running

root@boss[~]#mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 41
Server version: 5.1.49-1 (Debian)

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.

This software comes with ABSOLUTELY NO WARRANTY. This is free software,and you are welcome to modify and redistribute it under the GPL v2 license

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> Bye

5) Install the stable PHP5

root@boss[~]#apt-get install php5
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  apache2-mpm-prefork libapache2-mod-php5 libonig2 libqdbm14 php5-cli php5-common php5-suhosin
Suggested packages:
  php-pear
The following packages will be REMOVED:
  apache2-mpm-worker
The following NEW packages will be installed:
  apache2-mpm-prefork libapache2-mod-php5 libonig2 libqdbm14 php5 php5-cli php5-common php5-suhosin
0 upgraded, 8 newly installed, 1 to remove and 44 not upgraded.
Need to get 6,391 kB of archives.
After this operation, 16.8 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://packages.bosslinux.in/boss/ savir/main apache2-mpm-prefork i386 2.2.16-3 [2,284 B]
Get:2 http://packages.bosslinux.in/boss/ savir/main libonig2 i386 5.9.1-1 [134 kB]
Get:3 http://packages.bosslinux.in/boss/ savir/main libqdbm14 i386 1.8.77-3.1 [147 kB]
Get:4 http://packages.bosslinux.in/boss/ savir/main php5-common i386 5.3.2-2 [518 kB]
Get:5 http://packages.bosslinux.in/boss/ savir/main libapache2-mod-php5 i386 5.3.2-2 [2,768 kB]   Get:6 http://packages.bosslinux.in/boss/ savir/main php5 all 5.3.2-2 [1,072 B]                    Get:7 http://packages.bosslinux.in/boss/ savir/main php5-cli i386 5.3.2-2 [2,741 kB]              Get:8 http://packages.bosslinux.in/boss/ savir/main php5-suhosin i386 0.9.32.1-1 [80.8 kB]                            
Fetched 6,391 kB in 2min 15s (47.2 kB/s)                             
dpkg: apache2-mpm-worker: dependency problems, but removing anyway as you requested:
 apache2 depends on apache2-mpm-worker (= 2.2.16-3) | apache2-mpm-prefork (= 2.2.16-3) | apache2-mpm-event (= 2.2.16-3) | apache2-mpm-itk (= 2.2.16-3); however:
  Package apache2-mpm-worker is to be removed.
  Package apache2-mpm-prefork is not installed.
  Package apache2-mpm-event is not installed.
  Package apache2-mpm-itk is not installed.
(Reading database ... 161407 files and directories currently installed.)
Removing apache2-mpm-worker ...
Stopping web server: apache2apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
 ... waiting ..
Selecting previously deselected package apache2-mpm-prefork.
(Reading database ... 161403 files and directories currently installed.)
Unpacking apache2-mpm-prefork (from .../apache2-mpm-prefork_2.2.16-3_i386.deb) ...
Setting up apache2-mpm-prefork (2.2.16-3) ...
Starting web server: apache2apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
.
Selecting previously deselected package libonig2.
(Reading database ... 161408 files and directories currently installed.)
Unpacking libonig2 (from .../libonig2_5.9.1-1_i386.deb) ...
Selecting previously deselected package libqdbm14.
Unpacking libqdbm14 (from .../libqdbm14_1.8.77-3.1_i386.deb) ...
Selecting previously deselected package php5-common.
Unpacking php5-common (from .../php5-common_5.3.2-2_i386.deb) ...
Selecting previously deselected package libapache2-mod-php5.
Unpacking libapache2-mod-php5 (from .../libapache2-mod-php5_5.3.2-2_i386.deb) ...
Selecting previously deselected package php5.
Unpacking php5 (from .../archives/php5_5.3.2-2_all.deb) ...
Selecting previously deselected package php5-cli.
Unpacking php5-cli (from .../php5-cli_5.3.2-2_i386.deb) ...
Selecting previously deselected package php5-suhosin.
Unpacking php5-suhosin (from .../php5-suhosin_0.9.32.1-1_i386.deb) ...
Processing triggers for man-db ...
Setting up libonig2 (5.9.1-1) ...
Setting up libqdbm14 (1.8.77-3.1) ...
Setting up php5-common (5.3.2-2) ...
Setting up libapache2-mod-php5 (5.3.2-2) ...

Creating config file /etc/php5/apache2/php.ini with new version
Reloading web server config: apache2apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
.
Setting up php5 (5.3.2-2) ...
Setting up php5-cli (5.3.2-2) ...

Creating config file /etc/php5/cli/php.ini with new version
update-alternatives: using /usr/bin/php5 to provide /usr/bin/php (php) in auto mode.
Setting up php5-suhosin (0.9.32.1-1) ...

Now say a Hello, to php!

root@boss[~]#php
<?php
echo "Hello \n";
?>
Hello
root@boss[~]#

6) Configure Apache with PHP

Then I wrote some sample PHP scripts and try to load via the browser. OMG! The source PHP is delivered to client directly without getting phrased by the PHP Interpreter.

Find the httpd.conf located inside /etc/apache2/ and the following few lines to it.

<FilesMatch \.php$>
    SetHandler application/x-httpd-php
</FilesMatch>

Try to load it now! Works good…

7) Finally link PHP5-MySQL

Before leaving the spot, that LAMP is successfully installed and I just do a small task on reading contents from DB.

root@boss[elcot]#php /var/www/friends.php 
HiPHP Fatal error: Call to undefined function mysql_connect() in /var/www/friends.php on line 7

Opps! PHP is not talking with MySQL. Here’s how to make them.

root@boss[elcot]#apt-get install php5-mysql
Reading package lists... Done
Building dependency tree 
Reading state information... Done
The following NEW packages will be installed:
 php5-mysql
0 upgraded, 1 newly installed, 0 to remove and 44 not upgraded.
Need to get 64.2 kB of archives.
After this operation, 242 kB of additional disk space will be used.
Get:1 http://packages.bosslinux.in/boss/ savir/main php5-mysql i386 5.3.2-2 [64.2 kB]
Fetched 64.2 kB in 0s (70.8 kB/s) 
Selecting previously deselected package php5-mysql.
(Reading database ... 161480 files and directories currently installed.)
Unpacking php5-mysql (from .../php5-mysql_5.3.2-2_i386.deb) ...
Processing triggers for libapache2-mod-php5 ...
Reloading web server config: apache2apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
.
Setting up php5-mysql (5.3.2-2) ...
root@boss[elcot]#service apache2 restart
Restarting web server: apache2apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
 ... waiting apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
.
root@boss[elcot]#

That’s all. Job Done.

Happy LAMP’ing…

This entry was posted in linux, technology and tagged , , , , , , , , , . Bookmark the permalink.

9 Responses to Installing Apache/MySQL/PHP on ELCOT provided BOSS Linux

  1. Tessier Lyford says:

    Thank you a lot for sharing this with all folks you really understand what you are talking about! Bookmarked. We

  2. vps says:

    Nice blog

  3. Anonymous says:

    Love your blog..

  4. Jones sabo says:

    I was looking through some of your posts on this internet site and I believe this internet site is really instructive! Continue posting.

  5. Gros says:

    I appreciate, cause I found exactly what I was looking for. You’ve ended my 4 day long hunt! God Bless you man. Have a great day. Bye

  6. Travino Guerero says:

    Thank you, I have recently been looking for info approximately this subject for a while and yours is the best I’ve found out till now. You are very intelligent.

  7. longchamp says:

    Thanks for sharing.

  8. Jeffery Montesi says:

    Dear Webmaster! I just discovered your Blog and all the interesting and useful Information that you provide.Have a nice day!

  9. Jones sabo says:

    I see something truly interesting about your blog so I saved to my bookmarks .

Leave a Reply

Your email address will not be published. Required fields are marked *


nine − 5 =