svn与apache整合(源码)

#源码安装前准备
rpm -qa|grep subversion
subversion-1.4.4.el5
rpm -e --allmatches subversion
rpm -qa|grep apr
apr-1.2.7-11
apr-util-1.2.7-7.el5
apr-1.2.7-11
apr-util-1.2.7-7.el5
rpm -e --allmatches apr-util
rpm -e --allmatches apr
#以上步骤一定要检查

[apr]
tar zxvf apr-1.4.6.tar.gz
cd apr-1.4.6
./configure --prefix=/usr/local/apr
make && make install

[apr-util]
tar zxvf apr-util-1.4.1.tar.gz
cd apr-util-1.4.1
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make && make install

[apache]
tar zxvf httpd-2.2.22.tar.gz
cd httpd-2.2.22
./configure -prefix=/usr/local/apache2.2 --enable-dav --enable-so --enable-modules=so --enable-maintainer-mode --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util -enable-rewrite
make && make install

[测试apache]
/usr/local/apache2.2/bin/apachectl start
curl http://localhost

[neon]
tar zxvf neon-0.29.6.tar.gz
cd neon-0.29.6
./configure -prefix=/usr/local/neon
make&&make install

[svn]
tar zxvf subversion-deps-1.6.18.tar.gz
tar zxvf subversion-1.6.18.tar.gz
cd subversion-1.6.18
rm -rf apr
rm -rf apr-util
cd zlib
./configure --prefix=/usr/local/zlib
make && make install
cd ..
#注:如果没有sqlite-amalgamation怎手动创建并sqlite3.c到该目录下
mkdir sqlite-amalgamation
cp ../subversion-1.6.18/sqlite-amalgamation/sqlite3.c ./sqlite-amalgamation/
chown -R 3304.3304 sqlite-amalgamation

./configure --prefix=/usr/local/subversion --with-apxs=/usr/local/apache2.2/bin/apxs --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-neon=/usr/local/neon --with-ssl --with-zlib=/usr/local/zlib --enable-maintainer-mode
make&&make install

ln -s /usr/local/subversion/bin/svn /usr/sbin/svn

【svn配置】
#创建目录
mkdir -p /data/svnroot/repository
#创建test项目
/usr/local/subversion/bin/svnadmin create /data/svnroot/repository/test
chown -R apache:apache /data/svnroot

#检出以前svn的库
svn co http://192.168.10.50:8080/svn/test/branches/test-branch /data/orcs/test
#将以前svn的库导入test中
svn import /data/orcs/test -m "old svn"
svn import /data/orcs/test -m "old svn"
svn mkdir -m "标签"
svn mkdir -m "主支"
svn mkdir -m "个人研究"

#创建test账号
/usr/local/apache2.2/bin/htpasswd -c /data/svnroot/repository/passwd.conf test
#注意:第一次设置用户密码要加入 -c 这个参数,以后创建新用户则不用
#创建authz.conf
vim /data/svnroot/repository/authz.conf
[groups]
valid-user=test,test1
invalid-user=test2
[test:/]
@valid-user=rw
@invalid-user=

cat /usr/local/apache2.2/conf/httpd.conf是否存在以下模块,若没有则追加(一般安装完subversion后就会存在)
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so

useradd apache -s /sbin/nologin
chown -R apache.apache /data/svnroot
vim /usr/local/apache2.2/conf/httpd.conf
追加以下内容
<Location /svn>
DAV svn
SVNParentPath /data/svnroot/repository
AuthType Basic
AuthName "Subversion repository test"
AuthUserFile /data/svnroot/repository/passwd.conf
AuthzSVNAccessFile /data/svnroot/repository/authz.conf
Require valid-user
</Location>
修改
User daemon
Group daemon

User apache
Group apache

#重启apache并进行测试

/usr/local/apache2.2/bin/apachectl restart
http://服务器ip/svn

你可能感兴趣的:(源码,SVN,apache整合)