Apache 2, MySQL 4.1 Alpha and PHP 4.3 on Red Hat Linux 9
Posted on Monday, April 21, 2003 @ 21:25:31 EDT by Prashant Somashekar
This guide will walk you through installing and minimally configuring
Apache 2 web server, MySQL 4.1 Alpha database and PHP 4.3 on a Red Hat linux 9 computer.
Theses instructions should hold true for all Linux distros and most Unix variants.
In the above scenarios (mostly UNIX), there will be some minor differences, such as dependencies,
but you can gauge what you need by the package names included,
as well as other additions that will be made from the instructions below.
Let's get started...
Boot up (Start) your Red Hat linux 9 pc and
get to a shell, or drop to a console (Ctrl-Alt-F2 (Ctrl-Alt-F7 will bring you back to X if you were originally there).
Then either su - or login as root.
Note: Replace the statements in CAPS with the actual information. For example, EMAIL_ADDRESS would be replaced with your actual email address.
make sure you have wget installed:
if you do not see /usr/bin/wget , then:
rpm -ivh wget-1.8.2-5.i386.rpm
Note: For those without the Red Hat Linux 9 CDROM(s) in their posession->
Please read first before you start executing commands until you get to the ----->
The instructions below assume that if the main package is not installed, than dependencies are not either.
Make sure to check to see if you have any or all of the packages needed to be installed, otherwise you will have wasted time downloading things that you already have installed.
I also may have included 2 or 3 packages extra that may not need to be installed for this specific project, but it is good to have for future projects that you may encounter.
You can do a: rpm -qa | grep PACKAGE_NAME , and look for those packages installed starting with/ have PACKAGE_NAME in them.
For example, when looking at this line:
if you wanted to check if you had the package installed, then you would: rpm -qa | grep gcc , and look for similar and or matching output to the version number 3.2.2-5.
For those with the CD's, you can insert the CDROM, and if it doesnt automount if for you, you can type: mount /mnt/cdrom . Then you can access the cd by: cd /mnt/cdrom , then ls (to list files).
make sure you have make installed:
if you do not see /usr/bin/make , then (each line starting with wget is one whole line (wget following a space than the URL)):
rpm -ivh make-3.79.1-17.i386.rpm
make sure you have gcc installed:
if you do not see /usr/bin/gcc , then (each line starting with wget is one whole line (wget following a space than the URL)):
make sure you have libgcc:
rpm -qa | grep libgcc
if you do not see packages with libgcc on output, then (each line starting with wget is one whole line (wget following a space than the URL)):
make sure you have glibc:
rpm -qa | grep glibc
if you do not see packages with glibc on output, then (each line starting with wget is one whole line (wget following a space than the URL)):
rpm -ivh glibc-devel-2.3.2-11.9.i386.rpm
rpm -ivh glibc-common-2.3.2-11.9.i386.rpm
rpm -ivh glibc-2.3.2-11.9.i386.rpm
rpm -ivh libgcc-3.2.2-5.i386.rpm
rpm -ivh gcc-gnat-3.2.2-5.i386.rpm
rpm -ivh gcc-3.2.2-5.i386.rpm
rpm -ivh gcc-c++-3.2.2-5.i386.rpm
make sure you have perl installed:
if you do not see /usr/bin/perl , then (each line starting with wget is one whole line (wget following a space than the URL)):
rpm -ivh perl-5.8.0-88.i386.rpm
rpm -ivh perl-CPAN-1.61-88.i386.rpm
make sure you have binutils installed:
rpm -qa | grep binutils
if you do not see packages with binutils on output, then (each line starting with wget is one whole line (wget following a space than the URL)):
rpm -ivh binutils-184.108.40.206.18-9.i386.rpm
make sure you have libtool installed:
rpm -qa | grep libtool
if you do not see packages with libtool on output, then (each line starting with wget is one whole line (wget following a space than the URL)):
rpm -ivh libtool-libs-1.4.3-5.i386.rpm
rpm -ivh libtool-1.4.3-5.i386.rpm
rpm -ivh autoconf-2.57-3.noarch.rpm
rpm -ivh automake-1.6.3-5.i386.rpm
rpm -ivh m4-1.4.1-13.i386.rpm
rpm -ivh mktemp-1.5-18.i386.rpm
(each line starting with wget is one whole line (wget following a space than the URL))
(each line that is a command is one whole line before the start of a new line. Each command line that is long, has a doublespace before the new line to eliminate confusion (excluding the wget lines, as it was just mentioned above)
tar zxf /packages/httpd-2.0.45.tar.gz
tar zxf /packages/php-4.3.2RC1.tar.gz
tar zxf /packages/mysql-4.1.0-alpha.tar.gz
echo /opt/apache/bin/apachectl start >init.d/apache2
chmod u+x init.d/apache2
echo /opt/apache/bin/apachectl stop >init.d/apache2_K
chmod u+x init.d/apache2_K
ln -s init.d/apache2 rc3.d/S99apache2
ln -s init.d/apache2 rc5.d/S99apache2
ln -s init.d/apache2_K rc3.d/K99apache2
ln -s init.d/apache2_K rc5.d/K99apache2
useradd -g mysql mysql
cp support-files/mysql.server /etc/rc.d/init.d
chmod u+x /etc/rc.d/init.d/mysql.server
chown -R root /usr/local/mysql
chown -R mysql /usr/local/mysql/var
chgrp -R mysql /usr/local/mysql
cp support-files/my-medium.cnf /etc/my.cnf
ln -s ../init.d/mysql.server rc3.d/S99mysql
ln -s ../init.d/mysql.server rc5.d/S99mysql
ln -s ../init.d/mysql.server rc0.d/K99mysql
ln -s ../init.d/mysql.server rc6.d/K99mysql
chmod u+x init.d/mysql.server
Note: In the line below, there is a space after /opt/apache/bin/apxs right before the -- .
./configure --with-mysql=/usr/local/mysql --with-apxs2=/opt/apache/bin/apxs --disable-cli
cp php.ini-dist /usr/local/lib/php.ini
Note: Replace the statements in CAPS with the actual information.
For example: IP_ADDRESS:PORT would be replaced with the actual IP and Port the server will run on
(172.16.1.7:8080 (if your on a LAN) or if your internet connection is hooked straight in to the machine
hit forward slash then type: AddType allows you to add then hit enter (/AddType allows you to add (enter))
hit j 4 times
hit o (letter)
type the 3 statements below and hit enter after each line:
DirectoryIndex index.html index.php index.htm index.cgi
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
hit colon then 1 (:1 (enter))
hit forward slash then type ServerAdmin then enter (/ServerAdmin (enter))
hit zero then i then pound (above the 3) then Esc (0 i # Esc (enter))
hit o (letter)
type this in: ServerAdmin EMAIL_ADDRESS
hit forward slash then type in ServerName then enter (/ServerName (enter))
hit zero then i then type in pound symbol (above the 3) then hit Esc (0 i # Esc (enter))
hit o (letter)
type in: ServerName IP_ADDRESS:PORT
hit colon then 1 (:1 (enter))
hit forward slash then type in Listen then enter (/Listen (enter))
hit n 3 times
hit zero then i then type in a pound symbol (above the 3) then hit Esc (0 i # Esc (enter))
hit o (letter)
type in: Listen IP_ADDRESS:PORT
hit colon then w then q then exclamation point (above the 1) then enter (:wq! (enter))
hit forward slash then type in mysql then enter (/mysql (enter))
hit f then forward slash (f /)
hit l (letter)
hit x until your cursor is on top of the :
type in: usr/local/mysql/var
hit colon then w then q then exclamation point then enter (:wq! (enter))
Enter a password for the mysql system user account
Note: Replace the statements in CAPS with the actual information. For example: NEW-PASSWORD would be replaced with a password.
./mysqladmin -u root password 'NEW-PASSWORD'
./mysqladmin -u root -h HOSTNAME password 'NEW-PASSWORD'
rm -r httpd-2.0.45
rm -r mysql-4.1.0-alpha
rm -r php-4.3.2RC1
You have just installed and minimally configured Apache 2, PHP 4.3 and MySQL 4.1 Alpha, created and linked startup and shutdown scripts to automate things in times of reboot and created a mysql admin remote account.