UPGRADING - mysql, Apache and Php on redhat distros
Mysql 4.0.20
apache 2.0.50
php 4.3.7
hope this helps someone out there
Before you start back up any data.
STEP 1
–----
switch off apache
switch off mysql
remove httpd
remove mysql (all)
remove php (all)
STEP 2
if not already installed – install
these can all be got with wget
gcc-3.2.3.tar.gz
ncurses-5.3-8.1.i386.rpm
ncurses-devel-5.3-8.1.i386.rpm
flex-2.5.31.tar.gz
bison-1.875.tar.gz
STEP 3
tar -xvzf zlib-1.2.1.tar.gz
cd zlib-1.1.4
./configure; make test
make install
cd ..
STEP 4
tar –xvzf libpcap-0.7.2.tar.gz
cd libpcap-0.7.2
./configure
make
make install
cd ..
STEP 5
If Mysql was already installed remove mysql from users and groups through webmin.
THEN Install MySQL:
Create the user and group for MySQL with the following commands:
groupadd mysql
useradd -g mysql mysql
In /root edit the .bash_profile file so the PATH line to read as follows:
PATH=$PATH:$HOME/bin:/usr/local/mysql/bin
install and configure MySQL.
tar –xvzf mysql-4.0.20.tar.gz
cd mysql-4.0.20
./configure --prefix=/usr/local/mysql
make
make install
scripts/mysqlinstalldb
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
Next, add the lines “/usr/local/mysql/lib/mysql” and “/usr/local/lib” to the /etc/ld.so.conf
file.
After you add the lines, run “ldconfig –v”, as root
Test to see if it worked:
/usr/local/mysql/bin/mysqld_safe --user=mysql &
(you might have to hit enter to get back to a shell prompt)
If you get no errors, type “ps –ef |grep mysql”. You should see something like this:
[root@patrick-redhat mysql-4.0.17]# ps -ef |grep mysql
root 13297 2290 0 11:20 pts/0 00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe –user=mysql
mysql 13319 13297 3 11:20 pts/0 00:00:00 /usr/local/mysql/libexec/mysqld --basedir=/usr/local/mysql
--datadir=/usr/local/mysql/var --user=mysql --pid-file=/usr/local/mysql/var/patrick-redhat.pid --skiplocking
If it all worked, then go to the next step, which is to make MySQL start when the system
boots up.
Set MySQL to start automatically.
Copy the file “mysql.server” from the support-files subfolder (it is under the source for
mysql. If you downloaded everything to /root/new, then the path will be
/root/new/mysql-4.0.20/support-files) to the /etc/init.d folder and call it mysql (the
command to copy it from the support-files directory is “
cd /root/new/mysql-4.0.20/support-files
cp mysql.server /etc/init.d/mysql
Use the following commands to create symbolic links in the startup folders for run levels
3 and 5. MySQL will now start automatically when you boot up
.
cd /etc/rc3.d
ln -s ../init.d/mysql S85mysql
ln -s ../init.d/mysql K85mysql
cd /etc/rc5.d
ln -s ../init.d/mysql S85mysql
ln -s ../init.d/mysql K85mysql
cd ../init.d
chmod 755 mysql
Then reboot,
Login to webmin goto SERVERS – MySQL Database Server – Module Config.
And check that the paths are pointing to
/usr/local/mysql/bin/mysqlshow
/usr/local/mysql/bin/mysqladmin
/usr/local/mysql/bin/mysql
/usr/local/mysql/bin/mysqldump
/usr/local/mysql/bin/mysqlimport
/etc/rc.d/init.d/mysql start
/etc/rc.d/init.d/mysql stop
Hit Save , then stop Mysql and exit Webmin.
STEP 6
Installing and configuring Apache with PHP
-----------------------------------------------------:
This procedure will install the Apache web server in “/www”. This is where I prefer to
install it. You can, however, modify it for whatever location you wish.
Go back to the download directory and do the following to install apache and the module
for PHP
tar -xvzf httpd-2.0.50.tar.gz
cd httpd-2.0.50
./configure --prefix=/www --enable-so
make
make install
type “ /www/bin/apachectl start “ to start apache
(do not worry about the message about the fully qualified domain name)
check the system to make sure the web server is working
(go to the IP of that system in a web browser. You will see the default Apache page)
type “ /www/bin/apachectl stop “ to stop apache
cd ..
STEP 7
tar -xvzf php-4.3.7.tar.gz
cd php-4.3.7
./configure --prefix=/www/php --with-apxs2=/www/bin/apxs --with-config-filepath=/www/php --enable-sockets --with-mysql=/usr/local/mysql
make
make install
cp php.ini-dist /www/php/php.ini
Then Open Webmin and edit the module Apache Webserver
/www
/www/bin/httpd
/www/bin/apachectl
/www/bin/apachectl start
/www/bin/apachectl stop
/www/bin/apachectl restart
Hit save.
Now edit your httpd.conf files (it's in /www/conf) and add:
LoadModule php4_module modules/libphp4.so (The new version of PHP seems to add it)
AddType application/x-httpd-php .php
DirectoryIndex index.php index.html index.html.var
IT WILL LOOK SOMETHING LIKE THIS WHEN YOU ARE DONE
#
LoadModule foomodule modules/modfoo.so
LoadModule php4_module modules/libphp4.so
AddType allows you to tweak mime.types without actually editing it, or $
make certain files to be certain types.
#
AddType application/x-tar .tgz
AddType image/x-icon .ico
AddType application/x-httpd-php .php
The index.html.var file (a type-map) is used to deliver content-
negotiated documents. The MultiViews Option can be used for the
same purpose, but it is much slower.
#
DirectoryIndex index.php index.html index.html.var
Apache 2.0.50 is now installed in the /www dir. Go into the /www/bin dir and do the
following commands:
cd /www/bin
cp apachectl /etc/init.d/httpd
cd /etc/rc3.d
ln -s ../init.d/httpd S85httpd
ln -s ../init.d/httpd K85httpd
cd /etc/rc5.d
ln -s ../init.d/httpd S85httpd
ln -s ../init.d/httpd K85httpd
(The above lines will add a start up script to the system for both run level 3 and 5)
To test the Apache – PHP install, create a file called test.php in the /www/htdocs
directory. Place the following line in the file “” (without the quotes).
Start Apache using “/etc/rc5.d/S85httpd start”. Now use a web browser to look at the file
(http://IP_Addess/test.php). It should give you info on your system, Apache, and PHP.
REBOOT.
(and hopefully everything starts and runs ok)
I did this on 3 different machines and then did it on the red hat small distro on my linode and everything seems to be running ok, If anyone out there notices any problems with this guide , please add to it and pm me so i can adjust it.
Cheers CrazyMAzeY