LAMP Installation on RHE 3

SECTION 1
Download
-mySQL
-Apache
-PHP
 

SECTION 2
-Configure mySQL
 

SECTION 3
-Configure and install Apache


SECTION 4
-Configure and install PHP


SECTION 5
-Changes to be done in httpd.conf
 

SECTION 5
-
Final Configuration
-Precautions

1. Download the Packages:

The following packages have to be downloaded from the appropriate sites:

mySQL : From www.mysql.com download the latest mysql-standard-version.tar.gz. I had downloaded mysql-standard-4.0.24-pc-linux-gnu-i686.tar.gz

Apache : From www.apache.org. Go to the httpd section / downloads and get the apache source. Be careful about downloading the version. It has to be 1.3.something. For version 2, this manual may not be proper. I had downloaded the version : 1.3.33. (File : apache_1.3.33.tar.gz).

PHP : From www.php.net. Download the latest source file from this site. With version 5 I was unable to compile with apache. The necessary changes were not getting incorporated with httpd.conf. So I had used : php-4.3.11. File downloaded was php-4.3.11.tar.gz.

 

2 Configure mySQL:
- Copy the mysql-standard-4.0.24-pc-linux-gnu-i686.tar.gz in /usr/local/src directory and run the following commands as root:
    # gunzip mysql-standard-4.0.24-pc-linux-gnu-i686.tar.gz
    # tar -xvf mysql-standard-4.0.24-pc-linux-gnu-i686.tar
-  Add the group and user mysql as below:
    # groupadd mysql
    # useradd -g mysql mysql
    #  cd /usr/local
- Create a Link from the mysql directory to /usr/local/mysql as below:
    # ln -s /usr/local/src/mysql-standard-4.0.24-pc-linux-gnu-i686 mysql
- Go to the mysql directory (cd /usr/local/mysql)
- Run the following commands :
    # ./scripts/mysql_install_db --user=mysql
    # chown -R root .
    # chown -R mysql data
    # chgrp -R mysql .
    # ./bin/mysqld_safe --user=mysql &
- Copy the file /usr/local/mysql/support-files/mysql.server to /etc/rc.d/init.d/mysql.
- Run the command : /etc/rc.d/init.d/mysql restart
- This will restart the mysql server.
- Add the following path in your user's PATH (add in the .bash_profile file in the PATH section):
                     /usr/local/mysql/bin
-Run the command
    # mysqladmin -u root password 'XXXXXXXX'
     (If this gives an error mysqladmin not found, run the command: PATH=$PATH:/usr/local/mysql/bin; export PATH)
-Run the command
    # mysql -h localhost -D test -u root -pXXXXXXXX
You should see the mysql> prompt. If it does not come, please check the INSTALL-BINARY file given along with the package.
If you see the mysql> prompt, you are done with the mysql configuration, and can proceed to the next section gracefully.
In order to add the mysql in the runlevel 3 and 5 so that the same can be included in ntsysv run the command
#chkconfig --level 35 mysql on
3 Configure Apache :
- Copy the apache_1.3.33.tar.gz  in /usr/local/src directory and run the following commands as root:
    # gunzip apache_1.3.33.tar.gz
    # tar -xvf apache_1.3.33.tar
(This will create the directory apache_1.3.33 in /usr/local/src).
- Then run the following commands one by one:
    # cd apache_1.3.33
    # ./configure --prefix=/var/www --enable-module=so
    # make
    # make install
This will install the apache web server with DSO support and the BASEDIR of Web Server being /var/www

4. Configure PHP :
- Copy the source file php-4.3.11.tar.gz to /usr/local/src directory and run the following commands:
    # gunzip php-4.3.11.tar.gz
    # tar -xvf php-4.3.11.tar
(This will create the directory php-4.3.11 in /usr/local/src).
-Run the following command for configuring:
    # ./configure --with-mysql --with-apxs=/var/www/bin/apxs
    # make
    # make install
- Now copy the php.ini-dist file from the /usr/local/src/php-4.3.11 directory to /usr/local/lib/ as php.ini.

Modifications to be done in httpd.conf:
- Go to the /var/www/conf directory and open the file httpd.conf.
Carry out the following changes:
    LoadModule php4_module libexec/libphp4.so. -- Uncomment this line, if commented.
    AddType application/x-httpd-php .php .phtml -- Add this line
    AddType application/x-httpd-php-source .phps -- Add this line.
 - It is suggested to add the line -- AddModule mod_php4.c in the AddModule section of the httpd.conf file. However, I couldn't find the line, so I did not carry out this modification.
 
5.1 Final Configuration :
- The final configuration required involves the changes in the httpd.conf directory as mentioned above. Apart from this no other changes were required. This integrated Apache, mySQL and PHP.
- Whether PHP works can be tested by creating a page : index.php in the /var/www/htdocs directory with contents <? phpinfo() ?>. Accessing this page would show the php configuration pages.
- The above installation procedure is the  Apache Shared Module Version.
- Alternatively installation of Static Module Installation for
Apache) for PHP can also be done.
In the Static Module Installation, I have got an error, during the apache web server startup as apr_bucket - variable not found.
5.2 Precautions :
- Precautions should be taken during the changing of ownership and group of the various directories in the mysql directory.
- After the installation of mysql it is necessary to see of the server is starting up, by running the command : /etc/rc.d/init.d/mysql start and then check with ps -ef | grep mysql.


 

  
http://www.mysql.com




    
http://www.apache.org




 



http://www.php.net