免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1300 | 回复: 0
打印 上一主题 下一主题

Apache PHP MySQL Zend GD OpenSSL vsftpd 完全编译安装手册 [复制链接]

论坛徽章:
2
丑牛
日期:2013-09-29 09:47:222015七夕节徽章
日期:2015-08-21 11:06:17
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-05-28 20:29 |只看该作者 |倒序浏览
系统 Debian Linux v3.1r0 (Sarge) Kernel v2.6.11 i686
安装方式:源码编译
版权:本文章可以任意转载,但请注明作者和出处,谢谢
作者:keelort
微米天空: http://www.micronsky.net
原文链接: http://bbs.micronsky.net/viewtopic.php?t=160
################
##### 软件 #####
################
Apache v2.0.54 官方主页: http://www.apache.org
http://www.apache.org/dist/httpd/httpd-2.0.54.tar.gz  [7.16MB]
PHP v4.3.11 官方主页: http://www.php.net
http://cn.php.net/distributions/php-4.3.11.tar.gz  [4.64MB]
Zend Optimizer v2.5.10 官方主页: http://www.zend.com
http://downloads.zend.com/optimizer/2.5.10/ZendOptimizer-2.5.10-linux-glibc21-i386.tar.gz  [3.36MB]
MySQL v4.0.24 官方主页: http://www.mysql.com
http://ftp.stu.edu.tw/pub/Unix/Database/Mysql/Downloads/MySQL-4.0/mysql-4.0.24.tar.gz  [16.1MB] phperz~com
GD Library v2.0.33 官方主页: http://www.boutell.com/gd/
http://www.boutell.com/gd/http/gd-2.0.33.tar.gz  [573KB]
FreeType v2.1.10 官方主页: http://www.freetype.org
http://savannah.nongnu.org/download/freetype/freetype-2.1.10.tar.gz  [1.31MB]
Jpeg v6b 官方主页: http://www.ijg.org
ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v6b.tar.gz  [598KB]
LibPNG v1.2.8 官方主页: http://www.libpng.org/pub/png/
http://switch.dl.sourceforge.net/sourceforge/libpng/libpng-1.2.8.tar.gz  [498KB]
OpenSSL v0.9.7g 官方主页: http://www.openssl.org
http://www.openssl.org/source/openssl-0.9.7g.tar.gz  [2.98MB]
vsftpd v2.0.3 官方主页: http://vsftpd.beasts.org
ftp://vsftpd.beasts.org/users/cevans/vsftpd-2.0.3.tar.gz  [149KB]
zlib v1.2.2 官方主页: http://www.gzip.org/zlib/ phperz~com
http://www.zlib.net/zlib-1.2.2.tar.gz  [420KB]
ClibPDF v2.02-r1-1 官方网站: http://www.fastio.com
http://www.fastio.com/clibpdf202r1.tar.gz  [836KB]
mod_limitipconn v0.22 官方网站: http://dominia.org/djao/
http://dominia.org/djao/limit/mod_limitipconn-0.22.tar.gz  [6.18KB]
Bandwidth Module v0.6 官方网站: http://www.ivn.cl/apache/
http://www.ivn.cl/apache/bw_mod-0.6.tgz  [28.5KB]
Apache DoS Evasive Maneuvers Module v1.10 官方网站: http://www.nuclearelephant.com/projects/dosevasive/
http://www.nuclearelephant.com/projects/dosevasive/mod_dosevasive_1.10.tar.gz  [19.1KB]
################
##### 安装 #####
################
1、解压缩,把所有源码压缩包放在一个目录中,解压缩所有 .tar.gz 压缩包
for i in `ls *.gz`;do tar zxvf $i; done;
phperz.com
2、开始安装
##### zlib #####
cd zlib-1.2.2
./configure
make
make install
cd ..
##### OpenSSL #####
cd openssl-0.9.7g
./config --prefix=/usr/local/ssl \
--openssldir=/usr/local/ssl \
shared \
zlib
make
make install
ln -s /usr/local/ssl /usr/lib/ssl
cd ..
##### MySQL #####
cd mysql-4.0.24
编辑 sql/mysqld.cc :
搜索:&max_connections, 0, GET_ULONG, REQUIRED_ARG, 100, 1, 16384, 0, 1,
修改:&max_connections, 0, GET_ULONG, REQUIRED_ARG, 1000, 1, 16384, 0, 1,
groupadd mysql
useradd -g mysql mysql
./configure \
--prefix=/server/mysql \
--sysconfdir=/server/mysql \
www.phperz.com
--without-isam \
--without-debug \
--enable-assembler \
--with-unix-socket-path=/tmp/mysql.sock \
--with-mysqld-user=mysql \
--with-extra-charset=all \
--with-client-ldflags=-all-static \
--with-mysqld-ldflags=-all-static \
--localstatedir=/data/mysql/data
如果出现了以下错误:
checking for tgetent in -ltermcap... no
checking for termcap functions library... configure: error: No curses/termcap library found
说明 curses/termcap 库没有安装
apt-cache search curses | grep lib
安装 libncurses5-dev ,然后重新运行配置
mkdir /data
mkdir /data/mysql
mkdir /data/mysql/data
make
make install
/server/mysql/bin/mysql_install_db --user=mysql
chown -R mysql /data/mysql
chgrp -R mysql /data/mysql
www.phperz.com
chown -R root /server/mysql
chgrp -R mysql /server/mysql
cp /server/mysql/share/mysql/my-medium.cnf /server/mysql/my.cnf
/server/mysql/share/mysql/mysql.server start
/server/mysql/bin/mysqladmin -u root password 123456789
cd ..
##### Apache2 #####
cd httpd-2.0.54
./configure --prefix=/server/httpd \
--enable-so \
--with-mysql=/server/mysqld \
--enable-cgi \
--with-config-file-path=/server/httpd/conf \
--enable-track-vars \
--enable-mods-shared=all \
--enable-cache \
--enable-disk-cache \
--enable-mem-cache \
--enable-rewrite \
--with-mpm=worker \
--with-ssl=/usr/local/ssl \
--enable-ssl
make
make install
cd ..
##### mod_deflate #####
php程序员之家
cd httpd-2.0.54/modules/filters
/server/httpd/bin/apxs -i -c -a mod_deflate.c
修改 Apache 配置文件 /server/httpd/conf/httpd.conf :
添加:

# Insert filter
SetOutputFilter DEFLATE
# Netscape 4.x has some problems...
BrowserMatch ^Mozilla/4 gzip-only-text/html
# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4\.0[678] no-gzip
# MSIE masquerades as Netscape, but it is fine
# BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
# NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
# the&nbsaoenbsp;regex won''''t work. You can use the following
# workaround to get the desired effect: php程序员站
BrowserMatch \bMSI[E] !no-gzip !gzip-only-te/tl
# Don''''t compress images
SetEnvIfNoCase Request_URI \
\.(?:gif|jpe?g|png|ico)$ no-gzip dont-vary
# Make&nbssr&bsp;proxies don''''t deliver the wrong content
#Header append Vary User-Agent env=!dont-vary

DeflateFilterNote&nb;ai
LogFormat ''''"%v %h %l %u %t "%r" %>s %b "%{Referer}i" "%{UseAeti"" (%{ratio}n)'''' deflate
CustomLog logs/deflate_log deflate
然后
cd ../../../
##### FreeType #####
cd freetype-2.1.10
./configure --prefix=/usr/local/freetype
make
make install
cd ..
##### LibPNG #####
phperz.com
cd libpng-1.2.8
cp scripts/makefile.linux makefile
make test
make install
cd ..
##### Jpeg #####
cd jpeg-6b
mkdir /usr/local/jpeg
mkdir /usr/local/jpeg/bin
mkdir /usr/local/jpeg/lib
mkdir /usr/local/jpeg/include
mkdir /usr/local/jpeg/man
mkdir /usr/local/jpeg/man/man1
./configure --prefix=/usr/local/jpeg --enable-shared --enable-static
make
make install
cd ..
##### GD Library #####
cd gd-2.0.33
./configure --prefix=/usr/local/gd \
--with-jpeg=/usr/local/jpeg \
--with-freetype=/usr/local/freetype \
--with-png \
--with-zlib
make
make install
cd ..
##### ClibPDF #####
cd ClibPDF/source
cp Makefile.Linux makefile
phperz.com
make
make install
cd ..
##### PHP #####
cd php-4.3.11
./configure --prefix=/server/php \
--with-apxs2=/server/httpd/bin/apxs \
--with-gd=/usr/local/gd \
--enable-gd \
--enable-gd-native-ttf \
--with-jpeg-dir=/usr/local/jpeg \
--with-png \
--with-ttf \
--with-zlib \
--with-freetype-dir=/usr/local/freetype \
--enable-magic-quotes \
--with-mysql=/server/mysql \
--with-mysql-sock=/tmp/mysql.sock \
--with-iconv \
--with-mbstring \
--enable-mbstring \
--enable-track-vars \
--enable-force-cgi-redirect \
--enable-ftp \
--with-config-file-path=/server/httpd/conf \
--with-openssl=/usr/local/ssl \
--with-openssl-dir=/usr/local/ssl \
--with-cpdflib=/usr/local \
--with-pear=/server/php/pear
php程序员站
make
make install
cp php.ini-dist /server/httpd/conf/php.ini
cd ..
##### Zend Optimizer #####
cd ZendOptimizer-2.5.10-linux-glibc21-i386
./install
操作 [OK] [EXIT] [YES] [/server/zend] [/server/httpd/conf] [YES] [/server/httpd/bin/apachectl] [OK] [OK] [NO]
cd ..
##### mod_limitipconn #####
cd mod_limitipconn-0.22
/server/httpd/bin/apxs -i -c -a mod_limitipconn.c
修改 Apache 配置文件 /server/httpd/conf/httpd.conf:
查找:#ExtendedStatus On ,去掉注释"#"
查找:CustomLog logs/access_log common ,修改成 CustomLog logs/access_log common env=!LIMITIP
添加:

     www.phperz.com
MaxConnPerIP 5
NoIPLimit image/*
     
     
MaxConnPerIP 2
OnlyIPLimit audio/mpeg video
     

然后
cd ..
##### Bandwidth Module #####
cd bw_mod-0.6
/server/httpd/bin/apxs -i -c -a bw_mod-0.6.c
cd ..
带宽限制在虚拟主机中设置
##### Apache DoS Evasive Maneuvers Module #####
cd mod_dosevasive
/server/httpd/bin/apxs -i -c -a mod_dosevasive20.c
cd ..
等一下启动 Apache2 后可以测试
perl test.pl
###############################################################################################
现在,WEB 服务已经安装完毕! php程序员站
测试 WEB 服务:
mkdir /data/vhosts
mkdir /data/vhosts/localhost
启动 Apache2
/server/httpd/bin/apachectl start
如果出错请参考下一贴中的 httpd.conf 和 虚拟主机配置文件示例
MySQL 服务前面已经启动了,密码是:123456789
编辑一个 info.php 放在&nbbsp;/data/vbsp;/data/vhosts/localhost 下面,内容如下:

测试: http://localhost/info.php
OK,看到 PHP 信息了吧  
##### 开机自动启动服务 #####
cp /server/httpd/bin/apachectl /etc/init.d/httpd
cp /server/mysql/share/mysql/mysql.server /etc/init.d/mysql
recconf
配置,已经有 httpd 和 mysql 选项了,选中,OK
如果没有 rcconf ,用 apt-get install rcconf 安装
#######################
##### 使 SSL 工作 ##### www.phperz.com
#######################
mkdir /server/ssl
cd /server/ssl
##### 手工签署证书 #####
/usr/local/ssl/bin/openssl genrsa -des3 \
-rand 任意大文件1:任意大文件2 \
-out server.key 1024
输入密码
重复密码
/usr/local/ssl/bin/openssl req -new -key server.key -out server.csr
Enter pass phrase for localhost.key:  #www~phperz~com
If you enter ''''.'''', the field will be left blank.
-----
Country Name (2 letter code) [AU]:CN  #Pleaens;enter the following ''''extra'''' attributes
to be sent with your certificate request
A challenge password []:  #www.phperz.com
An optional company name []:  #
# Exit if vsftpd.conf doesn''''t have listen=yes or listen_ipv6=yes
# (mandatory for standalone operation)
if [ -f /server/vsftpd/conf/vsftpd.conf ] && ! egrep -iq "^ *listen(_ipv6)? *= *yes"  php程序员站
/server/vsftpd/conf/vsftpd.conf; then  
    exit 0
fi
DAEMON=/server/vsftpd/vsftpd
NAME=vsftpd
test -x $DAEMON || exit 0
case "$1" in
  start)
    echo -n "Starting FTP server: $NAME"
    start-stop-daemon --start --background -m --pidfile /tmp/vsftpd.pid --exec $DAEMON
    echo "."
    ;;
  stop)
    echo -n "Stopping FTP server: $NAME"
    start-stop-daemon --stop --pidfile /tmp/vsftpd.pid --oknodo --exec $DAEMON
    echo "."
      ;;
  restart)
www.phperz.com
    echo -n "Restarting FTP server: $NAME"
    start-stop-daemon --stop --pidfile /tmp/vsftpd.pid --oknodo --exec $DAEMON
    start-stop-daemon --start --background -m --pidfile /tmp/vsftpd.pid --exec $DAEMON
    echo "."
    ;;
  reload|force-reload)
    echo "Reloading $NAME configuration files"
    start-stop-daemon --stop --pidfile /tmp/vsftpd.pid --signal 1 --exec $DAEMON
    echo "."
    ;;
  *)
    echo "Usage: /etc/init.d/$NAME {start|stop|restart|reload}"
    exit 1
    ;;
phperz.com
esac
exit 0
[/code:1:b9bd2e7e99]
运行 rcconf 选中 vsftpd ,确定
重新启动,试试试不是所有的服务都启动了,呵呵...
全文完
最后编辑 [2005-06-27]
文章比较长,难免有错误,还请高手指教,谢谢 :)
原文链接: http://bbs.micronsky.net/viewtopic.php?t=160


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/4206/showart_714574.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP