最近将自己的电脑改造了下,建了一个SVN服务器,以便写代码。但由于没有配置Apache HTTP服务器,所以今天又重新源码安装了Apache和SVN,在此记录下安装过程:
1. 安装Apache HTTP ServerApache HTTP server下载地址: http://httpd.apache.org/download.cgi 安装步骤:
- cd httpd-2.4.4
- ./buildconf
- ./buildconf --with-apr=/work/prjs/apr-1.4.6
- ./buildconf --with-apr=/work/prjs/apr-1.4.6 --with-apr-util=/work/prjs/apr-util-1.4.1
- ./configure -h
- ./configure --prefix=/usr/local/
安装过程提示缺少apr,那就先安装apr:
安装APRApr & apr-util的下载地址:http://apr.apache.org/download.cgi
- cd apr-1.4.6
- //
- ./buidconf
- //
- ./configure -h
- //
- ./configure --prefix=/usr/local/apr/
编译和Install
安装APR-UTIL下载地址:http://www.fayea.com/apache-mirror//apr/apr-util-1.5.1.tar.bz2
安装步骤:
- cd apr-util-1.5.1
- ./buildconf
- ./configure --prefix=/usr/local/apr-util/
- ./configure --prefix=/usr/local/apr-util/ --with-apr=/usr/local/apr
- make
- make install
安装PCRE下载pare,地址:http://nchc.dl.sourceforge.net/p ... 32/pcre-8.32.tar.gz
解压之后安装:
- cd pcre-8.32
- ./configure -h
- ./configure --prefix=/usr/local/pcre
- make
- make install
继续安装Apache HTTP Server,./configure 时加上参数 --with-apr=/usr/local/apr/ --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre,这个问题就解决了:
- ./configure --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre/
注意:Apache在安装时不会检查参数是否正确,错误的参数会直接被丢弃,不会报告给用户。但可以使用echo $?命令检查是否有错误,当输出结果为0时表示没有错误。
#echo $?
0
#make
#make install
编译过程在我那台破电脑上花了好长时间。
HTTP Server配置复制Apache启动文件
#cp ./apache2/bin/apachectl ./sbin/
启动Apache
#apachectl start
启动之后,我们打开Browser, 输入127.0.0.1,就可以看到界面显示: It works!
设置Apache开机自启动
#vi /etc/rc.d/rc.local
增加一行 /sbin/apachectl start
或者将httpd服务添加到ntsysv服务管理工具
#apachectl stop //关闭Apache以免不必要的麻烦
#cp /usr/local/apache2/bin/apachectl /etc/rc.d/init.d/httpd
#vi /etc/rc.d/init.d/httpd
修改为
#!/bin/sh
#
#chkconfig: 345 85 15 //#不能省略,注意空格
#description: httpd for 52lamp 20101016 21:54 //任意字符串
#
......
第二行中345的含义:
# 0 - operation completed successfully
# 1 -
# 2 - usage error
# 3 - httpd could not be started
# 4 - httpd could not be stopped
# 5 - httpd could not be started during a restart
修改有关权限
#cd /etc/rc.d/init.d/
#chmod a+x httpd
#chkconfig --add httpd
#ntsysv
httpd已经在列表中,按F1可以看到刚才编写的服务描述httpd for 52lamp 20101016 21:54。
#apachectl start
#ps -e |grep httpd
23247 ? 00:00:00 httpd
23248 ? 00:00:00 httpd
23249 ? 00:00:00 httpd
23251 ? 00:00:00 httpd
23252 ? 00:00:00 httpd
在浏览器中输入127.0.0.1,看起来一切正常;但是局域网内其他电脑不能访问!
#service iptables stop
如果不想关闭防火墙,放开80端口即可。
#vi /etc/sysconfig/iptables
增加一行-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
#service iptables restart //重启防火墙
到此Apache HTTP Server就配置Okay了。
2. 源码安装SVN下载subversion源码:http://www.fayea.com/apache-mirr ... ersion-1.7.8.tar.gz 安装步骤:
- #cd subversion-1.7.8
- #./configure -h
安装sqlite
- #cd sqlite-autoconf-3071300
- #./configure -h
- #./configure --prefix=/usr/local/sqlite
- #make
- #make install
安装zlib
- #cd zlib-1.2.7
- #./configure --prefix=/usr/local/zlib
- #make
- #make install
安装好了之后,我们就快接近成功了,我们使用以下命令:
- #./configure --prefix=/usr/local/svn --with-apxs=/usr/local/apache2/bin/apxs --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --with-sqlite=/usr/local/sqlite/ --without-berkeley-db --with-zlib=/usr/local/zlib/ --with-ssl --enable-maintainer-mode
- #echo $?
- 0
- #make
- #make install
安装okay之后,我们将svn可执行文件拷贝到/usr/local/sbin目录之下:
- #cp /usr/local/svn/bin/* /usr/local/sbin/
执行:
#svnadmin --version
- # svnadmin --version
- svnadmin, version 1.7.8 (r1419691)
- compiled Mar 17 2013, 15:59:42
-
- Copyright (C) 2012 The Apache Software Foundation.
- This software consists of contributions made by many people; see the NOTICE
- file for more information.
- Subversion is open source software, see http://subversion.apache.org/
-
- The following repository back-end (FS) modules are available:
-
- * fs_fs : Module for working with a plain file (FSFS) repository.
Okay,至此,我们的SVN和apache就安装好了。
|