Linux下基于Apache安装SVN及相关配置
http://blog.csdn.net/colinchan/article/details/1865154
軟件獲取地址
apache下載地址
http://httpd.apache.org/
subversion下載地址
http://subversion.tigris.org/
apr下載地址
http://apr.apache.org/
sqllite下載地址
http://www.sqlite.org/download.html
neon下载地址
http://www.webdav.org/neon/
一、準備工作
# mkdir -P /usr/local/src/{tarbag,software} # cd /usr/local/src/tarbag apache-2.2.21 # wget http://mirror.bjtu.edu.cn/apache//httpd/httpd-2.2.21.tar.gz subversion-1.7.2 # wget http://mirror.bjtu.edu.cn/apache/subversion/subversion-1.7.2.tar.gz apr-1.4.5 # wget http://labs.renren.com/apache-mirror//apr/apr-1.4.5.tar.gz apr-util-1.3.12 # wget http://labs.renren.com/apache-mirror//apr/apr-util-1.3.12.tar.gz sqllite-3.7.9 # wget http://www.sqlite.org/sqlite-autoconf-3070900.tar.gz neon-0.29.6 # wget http://www.webdav.org/neon/neon-0.29.6.tar.gz
二、安裝Apache
由於本篇重點講解svn安裝配置,如果Apache安裝有疑問的可參見:http://www.ttlsa.com/archives/654
這裡重點講解與SVN有關的參數
如果有安裝過apache,使用如下命令查看
# apachectl -M | grep dav 如下所示,即可跳過 dav_module (shared) dav_fs_module (shared) Syntax OK 如果沒有則需要重新編譯apache # ./configure --enable-dav --enable-dav-fs # make # make install
三、安裝Apr和Apr-util
# cd /usr/local/src/tarbag/ # tar zxvf apr-1.4.5.tar.gz -C ../software/ # tar zxvf apr-util-1.3.12.tar.gz -C ../software/ # cd ../software/ # cd apr-1.4.5/ # ./configure --prefix=/usr/local/apr/ && make && make install # cd ../apr-util-1.3.12/ # ./configure --prefix=/usr/local/apr-util/ --with-apr=/usr/local/apr/ && make && make install
四、安裝Sqllite
# cd /usr/local/src/tarbag/ # tar zxvf sqlite-autoconf-3070900.tar.gz -C ../software/ # cd ../software/sqlite-autoconf-3070900/ # ./configure --prefix=/usr/local/sqlite && make && make install
五、安裝Subversion
# cd /usr/local/src/tarbag/ # tar zxvf subversion-1.7.2.tar.gz -C ../software/ # cd ../software/subversion-1.7.2/ # ./configure --prefix=/usr/local/subversion \ --with-apxs=/usr/local/apache-2.2.21/bin/apxs \ --with-apr=/usr/local/apr/ --with-apr-util=/usr/local/apr-util/ \ --with-sqlite=/usr/local/sqlite/ && make && make install
六、相關配置
1、配置subversion
拷貝相關類庫
# cd /usr/local/src/software/subversion-1.7.2/ # cp ./subversion/mod_dav_svn/.libs/mod_dav_svn.so /usr/local/apache-2.2.21/modules/ # cp ./subversion/mod_authz_svn/.libs/mod_authz_svn.so /usr/local/apache-2.2.21/modules/
添加svn的驗證文件svn-auth.conf
# /usr/local/apache-2.2.21/bin/htpasswd -cm /data/svn/svn-auth.conf tonyty163 New password: Re-type new password: Adding password for user tonyty163
注:只有第一次需要加-c參數,後期再添加用戶千萬不能加-c,否則會將原文件覆蓋的,如下:
# /usr/local/apache-2.2.21/bin/htpasswd -m /data/svn/svn-auth.conf admin New password: Re-type new password: Adding password for user admin
配置svn權限控制文件svn-access.conf
# vi /data/svn/svn-access.conf [groups] admin = admin, tonyty163 developers = tonyty163 # Default access rule for ALL repositories # Everyone can read, admins can write, tonyty163 is excluded. [/] * = r @admin = rw tonyty163 = # Allow developers complete access to their project repos [project1:/] @developers = rw # Give the doc people write access to all the docs folders [/trunk/doc] @developer = rw # Give trainees write access in the training repository only [TrainingRepos:/] @training = rw
權限控制文件裏面要把握3個核心概念
1、[]中的內容
這裡面的內容主要包括幾個分類,如本例中:
組[group],庫[repositories:/],目錄[/trunk/doc]
2、用戶
如本例中的:admin, tonyty163
注:用戶可以直接定義,以svn-auth.conf裏的用戶為准,不是一定要加入組的
3、權限
r讀,W寫
一般常用的也就這兩種,其他的目前也沒用過
2、配置apache
# vi /usr/local/apache-2.2.21/conf/httpd.conf 查找LoadModule LoadModule dav_svn_module modules/mod_dav_svn.so LoadModule authz_svn_module modules/mod_authz_svn.so 並在配置文件最後添加 <Location /svn> DAV svn SVNParentPath /data/svn AuthType Basic AuthName "Subversion repository" AuthUserFile /data/svn/svn-auth.conf Require valid-user AuthzSVNAccessFile /data/svn/svn-access.conf </Location>
配置詳解
AuthUserFile /data/svn/svn-auth.conf指定的是SVN訪問帳號密碼文件
AuthzSVNAccessFile /data/svn/svn-access.conf指定的是SVN的訪問控制文件
七、新建第一個庫
# svnadmin create /data/svn/project1
在瀏覽器中輸入http://IP/svn/project1如果輸出
project1 - Revision 0: /
即表示成功
八、排錯
1、當配置完成,在瀏覽器中輸入http://IP/svn/會出現
403 Forbbident
這裡需要注意,必須要建立庫,並且訪問到該庫才行,如:
http://IP/svn/project1
2、编译时提示configure: error: subversion requires zlib
出现缺失zlib的错误时,需要安装zlib-devel包,配置好yum源就可以了
3、安装完sqllite后,仍然出现缺少缺少sqllite的提示
An appropriate version of sqlite could not be found. We recommmend
3.7.6.3, but require at least 3.6.18.
Please either install a newer sqlite on this system
or
get the sqlite 3.7.6.3 amalgamation from:
http://www.sqlite.org/sqlite-amalgamation-3.7.6.3.tar.gz
unpack the archive using tar/gunzip and copy sqlite3.c from the
resulting directory to:
/usr/local/src/software/subversion-1.7.2/sqlite-amalgamation/sqlite3.c
configure: error: Subversion requires SQLite
发现自己安装的是更高的版本,而且是autoconf的源码包,本不该出现这个提示啊,仔细看了下错误提示,于是键入find /usr/local/ -name sqlite3.c
找到如下文件
/usr/local/src/software/sqlite-autoconf-3070900/sqlite3.c
于是在subversion源码包下,创建目录sqlite-amalgamation/,将sqlite3.c复制到其下,再重新编译即可大功告成
4、出现svn: Unrecognized URL scheme for ‘http://…..’ 時的解決方式
具体细节就不阐述了,网上有现成的解决方法:请参见http://blog.wabow.com/archives/1017
这里要一个注意点就是安装neon插件的时候,需要先安装libxml-devel类库,libxml-devel用yum安装即可
# yum install -y libxml*
本文由主机测评网发布,不代表主机测评网立场,转载联系作者并注明出处:https://zhuji.jb51.net/yunwei/8320.html