How to install Apache2, PHP5, MySQL5 on RedHat
2008-02-07 08:06:22
Author: Kewan
Versions:
libxml2-2.6.23
mysql-5.0.27
php-5.2.0
zlib-1.2.3
httpd-2.2.3
MySQL
cd /usr/local/src
tar xfz mysql-4.1.11.tar.gz
cd mysql-5.0.27
groupadd mysql
useradd -g mysql -c "MySQL Server" -d /dev/null -s /sbin/nologin mysql
./configure \
--prefix=/usr/local/mysql \
--localstatedir=/usr/local/mysql/data \
--disable-maintainer-mode \
--with-mysqld-user=mysql \
--with-unix-socket-path=/tmp/mysql.sock \
--without-comment \
--without-debug \
--without-bench
make && make install
./scripts/mysql_install_db
chown -R root:mysql /usr/local/mysql
chown -R mysql:mysql /usr/local/mysql/data
cp support-files/my-medium.cnf /etc/my.cnf
chown root:sys /etc/my.cnf
chmod 644 /etc/my.cnf
echo "/usr/local/mysql/lib/mysql" >> /etc/ld.so.conf
ldconfig
cp ./support-files/mysql.server /etc/rc.d/init.d/mysql
chmod +x /etc/rc.d/init.d/mysql
/sbin/chkconfig --level 3 mysql on
cd /usr/local/mysql/bin
for file in *; do ln -s /usr/local/mysql/bin/$file /usr/bin/$file; done
/etc/rc.d/init.d/mysql stop
/etc/rc.d/init.d/mysql start
mysqladmin version
mysqladmin -u root password data88
mysql -u root -p
drop database test;
use mysql;
delete from db;
delete from user where not (host="localhost" and user="root");
flush privileges;
update user set user="theadmin" where user="root";
flush privileges;
create database test;
drop database test;
show databases;
quit
APACHE
cd /usr/local/src
tar xzf httpd-2.2.3.tar.gz
cd httpd-2.2.3
./configure --prefix=/usr/local/apache \
--enable-rewrite --enable-max=shared \
--enable-so
make && make install
cd /usr/local/apache/bin
./apachectl start
ZLIB
cd /usr/local/src
tar xzf zlib-1.2.3.tar.gz
cd zlib-1.2.3
./configure
make && make install
locate libz.a
vi /etc/ld.so.conf
make sure dir where libz.a is in there
ldconfig
LIBXML
cd /usr/local/src
tar xzf libxml2-2.6.23.tar.gz
cd libxml2-2.6.23
./configure
make && make install
PHP5
cd /usr/local/src
tar xzf php-5.2.0.tar.gz
cd php-5.2.0
./configure --prefix=/usr/local \
--enable-xslt \
--with-apxs2=/usr/local/apache/bin/apxs \
--with-mysql=/usr/local/mysql \
--with-pear \
--with-curl \
--enable-sockets \
--enable-sigchild \
--enable-soap \
--enable-pcntl
make && make install
cp php.ini-dist /usr/local/lib/php/php.ini
vi /usr/local/apache/conf/httpd.conf
after the line #AddType application/x-tar .tgz add:
AddType application/x-httpd-php .php .php5
AddType application/x-httpd-php-source .phps
change the the DirectoryIndex line to:
DirectoryIndex index.htmi index.php index.php5
cd /usr/local/apache/bin
./apachectl restart