Thursday, October 28, 2010

How to remove mysql4 and php4 and install mysql5 and php5 on Redhat RHEL 4

# This note is on how to remove LAMP4 and install LAMP5 stack on Redhat RHEL 4.5
# Author: Vijay
# Date: 10/28/2010

#Remove existing packages:

# rpm -e squirrelmail-1.4.8-4.el4.noarch --test (--test will tell if package can be removed and there are no dependencies)

# Remove PHP first
rpm -e squirrelmail-1.4.8-4.el4.noarch
rpm -e php-ldap
rpm -e php-mysql
rpm -e php-odbc
rpm -e php-gd
rpm -e php-imap
rpm -e php-ncurses
rpm -e php-snmp
rpm -e php-xmlrpc
rpm -e php-domxml
rpm -e php-devel
rpm -e php-pgsql
rpm -e php-mbstring
rpm -e php php-pear # Need to remove both together

# Then remove Mysql server and related
rpm -e mysql-server
rpm -e mysql-devel
rpm -e mysql-bench
rpm -e mod_auth_mysql
rpm -e libdbi-dbd-mysql
rpm -e MyODBC
rpm -e qt-MySQL
rpm -e cyrus-sasl-sql --allmatches
rpm -e MySQL-python
rpm -e mysql --allmatches

# Download all IUS packages for Mysql5 and PHP5
# Downloaded from: http://dl.iuscommunity.org/pub/ius/stable/Redhat/4/x86_64/
# Downloaded mysql50-5.0.91*.rpm and php52-5.2.14*.rpm to: /var/tmp/lamp5

# Now to install Mysql 5

cd /var/tmp/lamp5
rpm -ivh mysqlclient14-4.1.22-2.ius.el4.x86_64.rpm mysqlclient14-devel-4.1.22-2.ius.el4.x86_64.rpm
rpm -ivh mysqlclient15-5.0.91-1.ius.el4.x86_64.rpm mysqlclient15-devel-5.0.91-1.ius.el4.x86_64.rpm
rpm -ivh epel-release-1-1.ius.el4.noarch.rpm ius-release-1.0-6.ius.el4.noarch.rpm mysql50-5.0.91-2.ius.el4.x86_64.rpm mysql50-bench-5.0.91-2.ius.el4.x86_64.rpm mysql50-devel-5.0.91-2.ius.el4.x86_64.rpm mysql50-server-5.0.91-2.ius.el4.x86_64.rpm

# Now to install PHP 5
# Also need to install sqlite-3 for php52-pdo which is required for php52-mysql
cd /var/tmp/lamp5
rpm -ivh sqlite-3.3.6-0.3.el4.x86_64.rpm

cd /var/tmp/lamp5
rpm -ivh php52-5.2.14-1.ius.el4.x86_64.rpm php52-bcmath-5.2.14-1.ius.el4.x86_64.rpm php52-cli-5.2.14-1.ius.el4.x86_64.rpm php52-common-5.2.14-1.ius.el4.x86_64.rpm php52-dba-5.2.14-1.ius.el4.x86_64.rpm php52-devel-5.2.14-1.ius.el4.x86_64.rpm php52-gd-5.2.14-1.ius.el4.x86_64.rpm php52-imap-5.2.14-1.ius.el4.x86_64.rpm php52-ldap-5.2.14-1.ius.el4.x86_64.rpmphp52-mbstring-5.2.14-1.ius.el4.x86_64.rpmphp52-mysql-5.2.14-1.ius.el4.x86_64.rpm php52-ncurses-5.2.14-1.ius.el4.x86_64.rpm php52-odbc-5.2.14-1.ius.el4.x86_64.rpm php52-pdo-5.2.14-1.ius.el4.x86_64.rpm php52-pgsql-5.2.14-1.ius.el4.x86_64.rpm php52-snmp-5.2.14-1.ius.el4.x86_64.rpm php52-soap-5.2.14-1.ius.el4.x86_64.rpm php52-xml-5.2.14-1.ius.el4.x86_64.rpm php52-xmlrpc-5.2.14-1.ius.el4.x86_64.rpm

# This should do it, you can now have LAMP running with PHP5 and Mysql5
chkconfig httpd on
chkconfig mysqld on
/etc/init.d/mysqld start
/etc/init.d/httpd start

# Need to upgrade existing mysql 4 tables to mysql 5, otherwise "create user" fails.
mysql_upgrade -v

No comments:

Post a Comment