- 视频下载地址:
- ==> 点击这里下载Linux上编译安装apache httpd-2.2.8视频演示入门教程
- 解压密码:www.17rumen.com
首先是到 apache 官方网站 www.apache.org 下载 httpd-2.2.8.tar.gz 到本地计算机上
www.apache.org -> HTTP Server ->Apache 2.2.8 Released Download ->Unix Source: httpd-2.2.8.tar.gz [PGP] [MD5]或者到 www.17rumen.com 下载 httpd-2.2.8.7z
下载地址:http://www.17rumen.com/download/tools/httpd-2.2.8.7z
解压密码为: www.17rumen.com 解压将得到 httpd-2.2.8.tar.gz我已经下载好了。下面启动 虚拟机,等下看我演示如何将下载好的 httpd-2.2.8.tar.gz 传到虚拟机上的
CentOS5.1 操作系统上去。我用 putty 登陆上CentOS5.1, Linux 的ip是192.168.1.118
思路是这样的:
通过一个工具 webserver 在window上架设一个简单的web服务器
http://www.17rumen.com/download/tools/webserver.7z 下载webserver这个工具http://127.0.0.1:2000 测试 webserver 是否成功工作 , 看到这个页面表示成功了
192.168.1.101 这是我 window 的ip地址。 最后看我操作
httpd-2.2.8.tar.gz 放进 webserv 目录
在CentOS5.1上通过 get命令来获取刚才我们下载的 httpd-2.2.8.tar.gz
[root@localhost opt]# wget http://192.168.1.101:2000/httpd-2.2.8.tar.gz如果你的CentOS5.1出现网络问题,请看一个视频教程
http://www.17rumen.com/archives/8.html
来解决虚拟机上CentOS5.1上网的网络问题,那个视频是Redhat9.0上演示的同样适合CentOS5.1解压
]# tar xvzf httpd-2.2.8.tar.gz
进入 httpd-2.2.8 目录
]# cd httpd-2.2.8
httpd-2.2.8]# ./configure --sysconfdir=/etc --enable-ssl --enable-modules
出现一个错误:
checking whether to enable mod_ssl... checking dependencies
checking for SSL/TLS toolkit base... none
checking for OpenSSL version... checking openssl/opensslv.h usability... no
checking openssl/opensslv.h presence... no
checking for openssl/opensslv.h... no
checking openssl/ssl.h usability... no
checking openssl/ssl.h presence... no
checking for openssl/ssl.h... no
no OpenSSL headers found
checking for SSL-C version... checking sslc.h usability... no
checking sslc.h presence... no
checking for sslc.h... no
no SSL-C headers found
configure: error: ...No recognized SSL/TLS toolkit detected========================================
解决办法:安装 openssl
# yum -y install openssl-devel
下载安装和更新的东西不少,下面是列表信息
Running Transaction
Updating : e2fsprogs-libs ####################### [ 1/15]
Updating : krb5-libs ####################### [ 2/15]
Installing: e2fsprogs-devel ####################### [ 3/15]
Installing: libsepol-devel ####################### [ 4/15]
Installing: libselinux-devel ####################### [ 5/15]
Installing: keyutils-libs-devel ####################### [ 6/15]
Installing: krb5-devel ####################### [ 7/15]
Installing: zlib-devel ####################### [ 8/15]
Installing: openssl-devel ####################### [ 9/15]
Updating : krb5-workstation ####################### [10/15]
Updating : e2fsprogs ####################### [11/15]
Cleanup : e2fsprogs-libs ####################### [12/15]
Cleanup : krb5-workstation ####################### [13/15]
Cleanup : e2fsprogs ####################### [14/15]
Cleanup : krb5-libs ####################### [15/15]Installed: openssl-devel.i386 0:0.9.8b-8.3.el5_0.2
Dependency Installed: e2fsprogs-devel.i386 0:1.39-10.el5_1.1 keyutils-libs-devel.i386 0:1.2-1.el5 krb5-devel.i386 0:1.6.1-17.el5_1.1 libselinux-devel.i386 0:1.33.4-4.el5 libsepol-devel.i386 0:1.15.2-1.el5 zlib-devel.i386 0:1.2.3-3
Dependency Updated: e2fsprogs.i386 0:1.39-10.el5_1.1 e2fsprogs-libs.i386 0:1.39-10.el5_1.1 krb5-libs.i386 0:1.6.1-17.el5_1.1 krb5-workstation.i386 0:1.6.1-17.el5_1.1
Complete!=============================
这样再 configure 就不会出现错误了, 生成makefile
httpd-2.2.8]# ./configure --sysconfdir=/etc --enable-ssl --enable-modules
下面进行编译
httpd-2.2.8]# make
安装
httpd-2.2.8]# make install这样 apache 2.2.8 就安装完成了,
启动服务
]# /usr/local/apache2/bin/apachectl start &测试访问 查看一下端口
]# netstat -tnl看, 打开了 80 端口了,说明apache 正常启动了
我们在 window 上访问一下。
Linux 上的 ip 地址是 192.168.1.118看 显示页面 It works! 成功访问了
默认首页目录 /usr/local/apache2/htdocs/index.html
随着 CentOS5.1 Linux 启动时候 自动启动 apache
]# echo "/usr/local/apache2/bin/apachectl start &" >> /etc/rc.local
下面重启一下CentOS5.1 ,看看apache是否自动启动重启 Linux 命令: shutdown -r now
而关闭Linux :shutdown -h now
好了,我们登陆进去看看
显示 80 端口自动打开,说明apache 自动运行成功。
在window 访问一下, 成功访问好了,演示就到这里,如果有什么建议,或者遇到什么问题
欢迎到 www.17rumen.com 参与文章的评论
谢谢大家的支持