httpd-2.2.17.tar.gz
mysql-5.1.51.tar.gz
php-5.2.17.tar.gz
mysql的安装
#安装需要的库
yum -y install ncurses ncurses-devel
#创建MySQL用户及用户组
groupadd mysql
useradd -g mysql -s /sbin/nologin mysql
cp /home/root/mysql-5.1.41.tar.gz /usr/local/src
cd /usr/local/src
tar zxvf mysql-5.1.41.tar.gz
chown -R mysql:mysql mysql-5.1.41
cd mysql-5.1.41
./configure \
--prefix=/usr/local/mysql \
--localstatedir=/usr/local/mysql/data \
--with-unix-socket-path=/usr/local/mysql/data/mysql.sock \
--with-plugins=innobase,partition,myisam,heap \
--enable-assembler \
--with-charset=utf8 \
--enable-thread-safe-client \
--with-client-ldflags=-all-static \
--with-mysqld-ldflags=-all-static \
--enable-static=yes \
--with-big-tables
make
make install
-------------------------
#根据应用程序的负载选择对应的配置文件
mkdir /usr/local/mysql/etc
cp /usr/local/mysql/share/mysql/my-medium.cnf /usr/local/mysql/etc/my.cnf
vi /usr/local/mysql/etc/my.cnf
#在[mysqld]中添加:
pid-file = /usr/local/mysql/etc/mysql.pid
datadir = /usr/local/mysql/data
#设置pid位置及数据存放位
chown -R mysql:mysql /usr/local/mysql
--------------------------
#安装系统表
/usr/local/mysql/bin/mysql_install_db \
--basedir=/usr/local/mysql \
--defaults-file=/usr/local/mysql/etc/my.cnf \
--skip-external-locking \
--user=mysql
#启动MySQL
/usr/local/mysql/bin/mysqld_safe \
--defaults-file=/usr/local/mysql/etc/my.cnf \
--user=mysql &
--------------------------
#将MySQL添加到系统服务
cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysqld
chmod 700 /etc/init.d/mysqld
chkconfig --add mysqld
Apache的安装
#安装需要的库
yum -y install zlib-devel
cp /home/root/httpd-2.2.17.tar.gz /usr/local/src
cd /usr/local/src
tar xzvf httpd-2.2.17.tar.gz
./configure --prefix=/usr/local/apache2 --enable-so --enable-threads--with-mpm=worker --enable-cache --enable-rewrite=shared -enable-deflate=shared--enable-expires=shared
make
make install
-----------------------------
#启动apache
/usr/local/apache2/bin/apachectl start
#若出现notice如httpd: Could notreliably determine the server's fully qualified domain name, using 127.0.0.1for ServerName
vi /usr/local/apache2/conf/httpd.conf
修改ServerName那行为:ServerNamelocalhost:80
/usr/local/apache2/bin/apachectl restart
php的安装
#先安装需要的库
#yum -y install libxml2
#yum -y install libxml2-devel
#yum -y install gd
#yum -y install gd-devel
#yum -y install curl curl-devel
#yum -y install libjpeg libjpeg-devellibpng libpng-devel
#yum -y install freetypefreetype-devel
#yum -y install openldap
#yum -y install openldap-devel
#
#cp /home/root/php-5.2.17.tar.gz/usr/local/src
#cd /usr/local/src
#tar xzvf php-5.2.17.tar.gz
#
#./configure --prefix=/usr/local/php5\
#--with-mysql=/usr/local/mysql \
#--with-apxs2=/usr/local/apache2/bin/apxs\
#--with-libxml-dir=/usr/local/lib\
#--with-gd \
#--with-jpeg-dir=/usr/local/jpeg6\
#--with-zlib \
#--with-curl \
#--with-ldap \
#--with-gettext \
#--with-iconv \
#--enable-mbstring \
#--enable-soap \
#--with-png-dir=/usr/local/libpng2\
#--with-freetype-dir=/usr/local/freetype\
#--with-xmlrpc \
#--with-config-file-path=/usr/local/php5/etc
#
#make
#make install
#
#cp /usr/local/src/php.ini-dist/usr/local/php5/etc/php.ini
#配置
#vi /usr/local/apache2/conf/httpd.conf
#DirectoryIndex index.html后增加index.php
#DirectoryIndex index.html index.php
#
##<IfModule mime_module>中增加:
#AddType application/x-httpd-php .php .phtml
#AddType application/x-httpd-php-source .phps
#
#/usr/local/apache2/bin/apachectl restart
##若遇到错误如:/usr/local/apache2/modules/libphp5.so: cannotrestore segment prot after reloc: Permission denied
##解决办法:
#setenforce 0
#chcon -c -v -R -u system_u -r object_r -t textrel_shlib_t/usr/local/apache2/modules/libphp5.so
#/usr/local/apache2/bin/apachectl restart
#setenforce 1
#/usr/local/apache2/bin/apachectl restart