很多人觉得手动编译安装很麻烦,用RPM包安装方便,其实不然,因为安装与删除是同等重要的,RPM包安装方便,但删除的过程如果你配置完之后更改了很多默认设置的话,会删除不完全,很麻烦的。如果是手动编译一步步安装,可以了解全部文件目录结构和过徎,学得更多。对包的依赖关系了解更深。
为了简单明了,只做了代码笔记,主要是说明用什么代码去安装配置LAMP,环境。注释部分用//表示了,是扩展提示,非必须运行。
mysql-5.5.12-linux2.6-i686.tar.gz
httpd-2.2.18.tar.gz
php-5.2.17.tar.bz2
ZendOptimizer-3.3.9-linux-glibc23-i386.tar.gz
phpMyAdmin-3.4.0-all-languages.tar.gz
yum install ibus-table-chinese-wubi-haifeng
yum -y install kernel-devel rpm-build gcc make
yum -y install patch make gcc gcc-c++ gcc-g77 flex bison file
yum -y install libxml2 libxml2-devel
yum -y install curl curl-devel
yum -y install libjpeg libjpeg-devel
yum -y install libpng libpng-devel
yum -y install libmcrypt libmcrypt-devel
##INSTALL_MYSQL##
cd /home/lifision/LAMP
tar -zvxf mysql-5.5.12-linux2.6-i686.tar.gz
mv /home/lifision/LAMP/mysql-5.5.12-linux2.6-i686 /usr/local/mysql
cd /usr/local/mysql
groupadd mysql
useradd -p mysql -g mysql mysql
scripts/mysql_install_db --user=mysql
cp /usr/local/mysql/support-files/my-medium.cnf /etc/my.cnf
/usr/local/mysql/support-files/mysql.server start #########################
/usr/local/mysql/bin/mysql
/usr/local/mysql/bin/mysqladmin -u root password ***
/usr/local/mysql/support-files/mysql.server stop
/usr/local/mysql/bin/mysql -u root -p
//userdel -r mysql
//groupdel -r mysql
//chmod 777 /usr/local/mysql
//chown -R root /usr/local/mysql
//chown -R mysql /usr/local/mysql/data
//chown -R mysql:mysql /usr/local/mysql/data
//ps -A|grep mysql
//8016 pts/2 00:00:00 mysqld_safe
//kill -9 8016
##INSTALL_APACHE##
cd /home/lifision/LAMP
tar -zvxf httpd-2.2.18.tar.gz
cd httpd-2.2.18
./configure --prefix=/usr/local/apache --enable-module=so --enable-mods-shared='rewrite'
make
make install
/usr/local/apache/bin/apachectl start ###########################
/usr/local/apache/bin/apachectl stop
http://127.0.0.1/
mkdir /www
chmod 777 /www
gedit /usr/local/apache/conf/httpd.conf
DocumentRoot /usr/local/apache/htdocs => /www
<Directory "/usr/local/apache/htdocs"> => <Directory "/www">
##INSTALL_PHP##
//rm -rf /home/lifision/LAMP/php-5.2.17
cd /home/lifision/LAMP
tar -jxvf php-5.2.17.tar.bz2
cd php-5.2.17
./configure --prefix=/usr/local/php -with-apxs2=/usr/local/apache/bin/apxs --with-curl --with-gd --with-mysql=/usr/local/mysql
make
make install
~~~ADD~~~
DirectoryIndex index.html index.php
<Directory "/www">
</Directory>
~~~ADD~~~
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
~~~ADD~~~
LoadModule php5_module modules/libphp5.so
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
index.php
<?php phpinfo(); ?>
##INSTALL_phpMyAdmin##
cd /home/lifision/LAMP
tar -zvxf phpMyAdmin-3.4.0-all-languages.tar.gz
cp /home/lifision/LAMP/phpMyAdmin-3.4.0-all-languages/config.sample.inc.php => /home/lifision/LAMP/phpMyAdmin-3.4.0-all-languages/config.inc.php
mv /home/lifision/LAMP/phpMyAdmin-3.4.0-all-languages /www/phpMyAdmin
##INSTALL_ZendOptimizer##
cd /home/lifision/LAMP
tar -zvxf ZendOptimizer-3.3.9-linux-glibc23-i386.tar.gz
mkdir /usr/local/php/include/php/ext/zend
cp /home/lifision/LAMP/ZendOptimizer-3.3.9-linux-glibc23-i386/data/5_2_x_comp/ZendOptimizer.so /usr/local/php/include/php/ext/zend/ZendOptimizer.so
//find / -name php.ini*
cp /home/lifision/LAMP/php-5.2.17/php.ini-dist /usr/local/php/lib/php.ini
gedit /usr/local/php/lib/php.ini
In ***“Dynamic ”
……
;extension=php_mcrypt.dll
……
~~ADD~~
zend_optimizer.optimization_level=1
zend_extension="/usr/local/php/include/php/ext/zend/ZendOptimizer.so"
#chcon -u system_u /usr/local/php/include/php/ext/zend
#chcon -t httpd_sys_content_t /usr/local/php/include/php/ext/zend
#chcon -u system_u /usr/local/php/include/php/ext/zend/ZendOptimizer.so
#chcon -t texrel_shlib_t /usr/local/php/include/php/ext/zend/ZendOptimizer.so
selinux problem
execstack -c /usr/local/php/include/php/ext/zend/ZendOptimizer.so
/usr/local/php/bin/php -v
from http://www.51osos.com/a/Apachexinwen/anzhuangpeizhi/2010/1108/ZendOptimizer.html
http://www.hduo.net/archives/linux-php-zendoptimizer-install.html
END