分类: LINUX
2011-03-09 16:15:43
apache + subversion for
linux 安装
SVN是一个进年来发展起来的版本控制工具,也是一个管理工程版本的必备工具,相对于其前身CVS来说,他有着很多的优势。以下是在linux下apache与subversion服务器端的安装配置步骤:
一.环境与软件版本:
1.
操作系统:RHEL5.3
2.
apr-1.3.6.tar.gz apr-util-1.3.8.tar.gz
3.
subversion-1.6.3.tar.gz
4.
httpd-2.2.6.tar.gz
二.安装软件:
1.
安装 apr
# tar zxvf
apr-1.3.6.tar.gz
# cd apr-1.3.6
# ./configure
# make && make
install
2.
安装apr-util
# tar zxvf
apr-util-1.3.8.tar.gz
# cd
apr-util-1.3.8
#./configure --with-apr=/usr/local/apr
# make
# make install
3.
安装apache
# tar
zxvf httpd-2.2.6.tar.gz
# cd httpd-2.2.6
#./configure --prefix=/opt/apache --enable-dav
--enable-so --enable-maintainer-mode --with-apr=/usr/local/apr/bin/apr-1-config
--with-apr-util=/usr/local/apr/bin/apu-1-config
# make
# make install
4.
安装subversion
# tar zxvf subversion-1.6.3.tar.gz
# cd subversion-1.6.3
#./configure --prefix=/opt/svn --with-apxs=/opt/apache/bin/apxs --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr
# make
# make install
注:此处会出现有关berkeley DB的问题,略去不管,我们不用此种DBD方式存储数据,用另一种方式来存储FSFS,直接编译安装
三.在apache中配置SVN
# vim /opt/apache/conf/httpd.conf
1.
如果你看到如下两句,说明安装是成功的
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule
authz_svn_module
modules/mod_authz_svn.so
如果有下面一句就用#注释掉
#LoadModule foo_module modules/mod_foo.so
2.
定义apache访问svn配置:
DAV svn
SVNParentPath /opt/svndata
AuthzSVNAccessFile /opt/svn/conf/authz.conf
AuthType Basic
AuthName "Subversion repository"
AuthUserFile /opt/svn/conf/passwd.conf
Require valid-user
四.配置SVN
1.
建立svn版本库目录
mkdir -p
/opt/svndata/repos #可以多建版本库目录
mkidr /opt/svndata/targtime
2.
建立svn版本库
svnadmin create
/opt/svndata/repos
svnadmin create
/opt/svndata/targtime
3.
建立本地访问控制文件
/opt/apache/bin/htpasswd –c /opt/svn/conf/passwd.conf steve(此处为username) 然后输入密码即可,默认是MD5加密的
注:当运行htpasswd命令的时候,有可能会报libapr的库文件不存在,要进行软链接,或者rpm包安装apr,apr-util
第一次设置用户时使用-c表示新建一个用户文件。回车后输入用户密码,完成对用户的增加
/opt/apache/bin/htpasswd /opt/svn/conf/passwd.conf kaka
/opt/apache/bin/htpasswd /opt/svn/conf/passwd.conf owen
/opt/apache/bin/htpasswd /opt/svn/conf/passwd.conf kaakoo
4.
建立本地项目控制文件
touch /opt/svn/conf/authz.conf
我的authz.conf文件内容如下:(首先定义访问组,再对访问组进行权限分配)
[groups]
admin=steve
custom=kaka,owen
targtime=kaakoo
[repos:/]
@admin = rw
[targtime:/]
@custom = rw
@targtime=rw
5.
对SVN的数据仓库的属性就行改变,不然会有权限问题
# chown –R daemon
/opt/svndata/repos
# chown –R daemon
/opt/svndata/targtime
# chmod –R 755
/opt/svndata/repos
# chmod –R 755
/opt/svndata/targtime
五.启动apache进行访问测试
/opt/apache/bin/apachect1
start
访问: 输入配置的用户名与密码
六.对SVN库的备份与恢复
# svnadmin dump
/opt/svndata/repos/ > /root/repos 备份
# svnadmin load /opt/svndata/repos/ < /root/repos 恢复
==================================================================
附:
linux下SVN客户端的应用 # svn -h usage: svn Subversion command-line client, version 1.4.2. Type 'svn help Type 'svn --version' to see the program version and RA modules or 'svn --version --quiet' to see just the version number. Most subcommands take file and/or directory arguments, recursing on the directories. If no arguments are supplied to such a command, it recurses on the current directory (inclusive) by default. Available subcommands: add blame (praise, annotate, ann) cat checkout (co) cleanup commit (ci) copy (cp) delete (del, remove, rm) diff (di) export help (?, h) import info list (ls) lock log merge mkdir move (mv, rename, ren) propdel (pdel, pd) propedit (pedit, pe) propget (pget, pg) proplist (plist, pl) propset (pset, ps) resolved revert status (stat, st) switch (sw) unlock update (up) Subversion is a tool for version control. For additional information, see ================================== 1.checkout版本库 # svn checkout --username=kaka --password=kaka # checkout,可以加用户名与密码 A doc/Ilan A doc/Ilan/perl.txt A doc/Ilan/197ftp-server.txt A doc/mkdir_much.sh Checked out revision 11. checkout后,doc目录将下载到当前目录下 2. 更新本地版本库 # cd doc/ # svn update # 更新,先进入到svn目录下 A Ilan/DNS.txt A Ilan/MYSQL命令.txt Updated to revision 12. 3.添加文件并提交 # cp /root/realserver.sh /root/time.sh doc/ # cd doc/ # svn add realserver.sh time.sh #先添加 A time.sh A realserver.sh # svn commit -m "add file" realserver.sh time.sh #再提交 Adding realserver.sh Adding time.sh Transmitting file data .. Committed revision 13. 4.删除文件并提交 # svn delete time.sh D time.sh # svn commit -m "del file" time.sh Deleting time.sh Committed revision 14.