发布时间:2014-09-05 17:13:23作者:知识屋
环境 Centos 5.5 32位 服务器地址 192.168.1.250
1 安装apache
tar -zxvf httpd-2.2.17.tar.gz
cd httpd-2.2.17
./configure --prefix=/usr/local/httpd --enable-so --enable-rewrite --with-mpm=worker
make
make install
/usr/local/httpd/bin/apachectl start
echo "/usr/local/httpd/bin/apachectl start &">>/etc/rc.d/rc.local
检验安装情况
a 检验/usr/local/httpd是否存在
b检查编译进来的模块 /usr/local/httpd/bin/apachectl -l(静态模块查看) 输出结果应包含 worker.c 和mod_rewrite.c
c检查apache能否正常运行 执行命令: /usr/local/httpd/bin/apachectl -t(检查apache语法)只要输出 Systax OK 就可以了
d 访问http://192.168.1.250/ 查看
2 安装mysql
请参考我写的mysql安装
3 安装php准备工作
a curl安装
tar -zxvf curl-7.15.0.tar.gz
cd curl-7.15.0
./configure --prefix=/usr/local/curl
make && make install
b expat安装
tar -zxvf expat-2.0.1.tar.gz
cd expat-2.0.1
./configure --prefix=/usr/local/expat
make && make install
c gzip安装
tar -zxvf gzip-1.3.5.tar.gz
cd gzip-1.3.5
./configure --prefix=/usr/local/gzip
make && make install
D.libxml2安装
tar -zxvf libxml2-2.6.19.tar.gz
cd libxml2-2.6.19
./configure --prefix=/usr/local/libxml2
make && make install
E.zlib安装
tar -zxvf zlib-1.2.3.tar.gz
cd zlib-1.2.3
./configure
make && make install
F.jpeg6安装
mkdir -p /usr/local/jpeg6
mkdir -p /usr/local/jpeg6/bin
mkdir -p /usr/local/jpeg6/lib
mkdir -p /usr/local/jpeg6/include
mkdir -p /usr/local/jpeg6/man
mkdir -p /usr/local/jpeg6/man1
mkdir -p /usr/local/jpeg6/man/man1
tar -zvxf jpegsrc.v6b.tar.gz
cd jpeg-6b
./configure --prefix=/usr/local/jpeg6/ --enable-shared --enable-static
make && make install
G.安装libpng
tar -zxvf libpng-1.2.37.tar.gz
cd libpng-1.2.37
./configure //这个如同上面zlib的说明一样,不要带参数,让它默认安装到相应目录
make && make install
H 安装 freetype
tar -zvxf freetype-2.3.5.tar.gz
cd freetype-2.3.5
mkdir -p /usr/local/freetype
./configure --prefix=/usr/local/freetype
make && make install
I 安装libmcrypt 加解密包(以免登陆phpmyadmin 报错)
tar zxvf libmcrypt-2.5.7.tar.gz
cd libmcrypt-2.5.7
./configure
make && make install
J 安装fontconfig
tar zxvf fontconfig-2.4.2.tar.gz
cd fontconfig-2.4.2
./configure --prefix=/usr/local/fontconfig --with-freetype-config=/usr/local/freetype/bin/freetype-config
make && make install
k 安装gettext-devel
yum -y install gettext gettext-devel
(如果不安装,make gd时报错 `AM_ICONV’ not found in library )
k 安装gd
tar -zxvf gd-2.0.35.tar.gz
cd gd-2.0.35
./configure --prefix=/usr/local/gd --with-jpeg=/usr/local/jpeg6/ --with-png --with-zlib --with-freetype=/usr/local/freetype/ --with-fontconfig=/usr/local/fontconfig
make && make install
4 安装php
tar -zxvf php-5.2.11.tar.gz
cd php-5.2.11
./configure --prefix=/usr/local/php --with-gd=/usr/local/gd --with-apxs2=/usr/local/httpd/bin/apxs --enable-mbregex --enable-bcmath --with-mysql=/usr/local/mysql -with-zlib-dir --enable-mbstring=all --with-pdo-mysql --with-freetype-dir=/usr/local/freetype --with-mcrypt --enable-sockets
(编译报错 configure: error: Cannot find MySQL header files under 执行 cp /usr/local/mysql/bin/mysql_config /usr/bin/mysql_config 和 ln -s /usr/local/mysql/include/mysql/mysql.h /usr/include/) 然后重新make
make && make install
cp php.ini-dist /usr/local/php/lib/php.ini
说明 --with-mcrypt (以免登陆phpmyadmin报错) --enable-sockets (cacti 需要)
5验证安装
a 看/usr/local 下是否有 gd和php
b 检查php于apache相关联情况 包括 在 /usr/local/httpd/modules 自动生成 libphp5.so 和在apache主配置文件中自动插入 LoadModule php5_module modules/libphp5.so
c 更全面检查 在/usr/local/httpd/htdocs 下建立test.php 内容为
<?
PHPinfo();
?>
d 稍微修改apache配置文件 在<IfModule mime_module> </IfModule>之间增加 AddType application/x-httpd-php .php .php3 .phtml 和 AddType application/x-httpd-php-source .phps
修改 DirectoryIndex index.php index.html
e 执行apache语法检查 /usr/local/httpd/bin/apachectl -t 没问题后手动启动apache服务 /usr/local/httpd/bin/apachectl start
f 检查apache进程和监听 lsof -i:80
g 在浏览器输入http://192.168.1.2/test.php 看是否正常
h 把我提供的index.php上传到 /usr/local/httpd/htdocs/下 测试mysql (记得将附件改名为index.php)
6 安装phpmyadmin
tar -zxvf phpMyAdmin-3.2.2.1-all-languages.tar.gz
mkdir /usr/local/httpd/htdocs/phpmysql
mv phpMyAdmin-3.2.2.1-all-languages/* /usr/local/httpd/htdocs/phpmysql/
cd /usr/local/httpd/htdocs/phpmysql
cp config.sample.inc.php config.inc.php
7 安装 ZendOptimizer
tar -zxvf ZendOptimizer-3.3.0a-linux-glibc21-i386.tar.gz
cd ZendOptimizer-3.3.0a-linux-glibc21-i386
./install
中途填写php.ini路径 /usr/local/php/lib
apachectl路径 填写 /usr/local/httpd/bin/apachectl
其余点ok或者下一步 按照系统默认走
Zend Optimizer Installation
------------------------------------------------------------------------------
+-------------------------- Zend Optimizer 3.3.0a ---------------------------+
| |
| The following configuration changes have been made: |
| |
| - The php.ini file has been relocated from /usr/local/php/lib to /usr/local/
Zend/etc |
| - A symbolic link for the php.ini file has been created in /usr/local/php/li
b. |
| - The original php.ini was backed up to |
| /usr/local/php/lib/php.ini-zend_optimizer.bak |
| |
| |
| |
+----------------------------------------------------------------------------+
| < OK > |
+----------------------------------------------------------------------------+
8 安装 eaccelerator
tar -jxvf eaccelerator-0.9.5.2.tar.bz2
cd eaccelerator-0.9.5.2
/usr/local/php/bin/phpize
./configure --enable-eaccelerator=shared --with-php-config=/usr/local/php/bin/php-config
make && make install
vi /usr/local/php/lib/php.ini
[eaccelerator]
extension_dir="/usr/local/php/lib/php/extensions"
extension="/no-debug-zts-20060613/eaccelerator.so"
eaccelerator.shm_size="128"
eaccelerator.cache_dir="/tmp/eaccelerator"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="300"
eaccelerator.shm_prune_period="120"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"
创建缓存文件夹
mkdir /tmp/eaccelerator
chmod 0777 /tmp/eaccelerator
重启apache让配置生效
/usr/local/httpd/bin/apachectl restart
至此 配置完毕,欢迎拍砖。
linux一键安装web环境全攻略 在linux系统中怎么一键安装web环境方法
Linux网络基本网络配置方法介绍 如何配置Linux系统的网络方法
Linux下DNS服务器搭建详解 Linux下搭建DNS服务器和配置文件
对Linux进行详细的性能监控的方法 Linux 系统性能监控命令详解
linux系统root密码忘了怎么办 linux忘记root密码后找回密码的方法
Linux基本命令有哪些 Linux系统常用操作命令有哪些
Linux必学的网络操作命令 linux网络操作相关命令汇总
linux系统从入侵到提权的详细过程 linux入侵提权服务器方法技巧
linux系统怎么用命令切换用户登录 Linux切换用户的命令是什么
在linux中添加普通新用户登录 如何在Linux中添加一个新的用户
2012-07-10
CentOS 6.3安装(详细图解教程)
Linux怎么查看网卡驱动?Linux下查看网卡的驱动程序
centos修改主机名命令
Ubuntu或UbuntuKyKin14.04Unity桌面风格与Gnome桌面风格的切换
FEDORA 17中设置TIGERVNC远程访问
StartOS 5.0相关介绍,新型的Linux系统!
解决vSphere Client登录linux版vCenter失败
LINUX最新提权 Exploits Linux Kernel <= 2.6.37
nginx在网站中的7层转发功能