您的位置:首页 > 运维架构 > Apache

Linux下源码安装Subversion及Apache

2013-03-17 16:05 555 查看

Linux下源码安装Subversion及Apache

最近将自己的电脑改造了下,建了一个SVN服务器,以便写代码。但由于没有配置Apache HTTP服务器,所以今天又重新源码安装了Apache和SVN,在此记录下安装过程:

1. 安装Apache HTTP Server

Apache 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:

安装APR

Apr & apr-util的下载地址:http://apr.apache.org/download.cgi

cd apr-1.4.6
// 
./buidconf
// 
./configure -h
// 
./configure --prefix=/usr/local/apr/


编译和Install

make
make 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




安装OpenSSL

下载OpenSSL,地址是http://www.openssl.org/source/openssl-1.0.1d.tar.gz

安装过程:

#tar -xvf openssl-1.0.1d.tar.gz 
#cd openssl-1.0.1d
#./config --prefix=/usr/local --openssldir=/usr/local/openssl
#make
#make test
#make install




安装PCRE

下载pare,地址:http://nchc.dl.sourceforge.net/project/pcre/pcre/8.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 --prefix=/usr/local/svn --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启动文件

#ln -s ./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-mirror/subversion/subversion-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


安装Neno

下载Neno, 下载地址: http://www.webdav.org/neon/neon-0.29.6.tar.gz
#tar -xvf neon-0.29.6.tar.gz 
#cd neon-0.29.6
#ll
#cat README  
#./configure --prefix=/usr/local/neon --with-ssl=openssl


安装过程中提示:
configure: error: no XML parser was found: expat or libxml 2.x required
需要先安装expat.

安装Expat

下载expat,地址 http://nchc.dl.sourceforge.net/project/expat/expat/2.1.0/expat-2.1.0.tar.gz 安装过程:

# tar -xvf expat-2.1.0.tar.gz 
# cd expat-2.1.0
#  ./configure 
# make
# make install


安装好了之后继续安装Neon:
#  ./configure --prefix=/usr/local/neno --with-ssl=openssl --with-expat
# 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 --with-neon=/usr/local/neon
#echo $? 0 #make #make install


安装okay之后,我们将svn可执行文件链接到/usr/local/sbin目录之下:

#ln -s /usr/local/svn/bin/svn /usr/local/sbin/
#ln -s /usr/local/svn/bin/svnadmin /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就安装好了。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: