侧边栏壁纸
博主头像
落叶人生博主等级

走进秋风,寻找秋天的落叶

  • 累计撰写 130562 篇文章
  • 累计创建 28 个标签
  • 累计收到 9 条评论
标签搜索

目 录CONTENT

文章目录

记一次CentOS6.4 安装SVN

2023-12-18 星期一 / 0 评论 / 0 点赞 / 125 阅读 / 6565 字

1、检查系统是否已经安装如果安装就卸载 rpm -qa subversionyum remove subversion2、安装yum install subversion 3、建立SVN库mkdir

1、检查系统是否已经安装如果安装就卸载

 rpm -qa subversion
yum remove subversion

2、安装

yum install  subversion 

3、建立SVN库

mkdir -p /home/svn/repossvnadmin create /home/svn/repos

执行上面的命令后,自动建立repositories库,查看/home/svn/repos 文件夹发现包含了conf, db,format,hooks, locks, README.txt等文件,说明一个SVN库已经建立。4、进入/home/svn/repos/上面生成的文件夹下,进行配置authz文件配置目的是设置哪些用户可以访问哪些目录,向authz文件追加以下内容

[/]afa4j = rwabs = rw

passwd文件配置是添加用户名和密码文件,修改如下

[users]# harry = harryssecret# sally = sallyssecretafa4j = afa4jabs = abs123

svnserve.conf 文件配置配置访问权限

[general]anon-access = noneauth-access = writepassword-db = passwdauthz-db = authzrealm = /home/svn/repos

5、启动svn

 /etc/init.d/svnserve start

6、检查进程和监听端口

 ps -ef |grep svn |grep -v greproot     23580     1  0 20:10 ?        00:00:00 /usr/bin/svnserve --daemon --pid-file=/var/run/svnserve.pidnetstat -antlp |grep :3690tcp        0      0 0.0.0.0:3690               0.0.0.0:*                   LISTEN      23580/svnserve 

7、修改默认端口为20016打开

vim /etc/init.d/svnserveargs="--daemon --pid-file=${pidfile} $OPTIONS --listen-port 20016"

找到这一行添加 --listen-port 20016
保存8、重启

service svnserve restart ps -ef |grep svn |grep -v greproot     23580     1  0 20:10 ?        00:00:00 /usr/bin/svnserve --daemon --pid-file=/var/run/svnserve.pid --listen-port 20016netstat -antlp |grep :20016tcp        0      0 0.0.0.0:20016               0.0.0.0:*                   LISTEN      23580/svnserve 

9、TortoiseSVN客户端连接测试版本库URL svn://xxx.xxx.xxx:20016/home/svn/repos弹出对话框输入前面添加的用户名密码

10、SVN开启apache支持

root@ UAT测试环境 @mc1.domain.com:yum install httpd mod_dav_svnroot@ UAT测试环境 @mc1.domain.com:/home/svn/project#rpm -ql mod_dav_svn/etc/httpd/conf.d/subversion.conf/usr/lib64/httpd/modules/mod_authz_svn.so/usr/lib64/httpd/modules/mod_dav_svn.soroot@ UAT测试环境 @mc1.domain.com:/home/svn/project#htpasswd /home/svn/project/password kcwNew password:Re-type new password:Adding password for user kcwroot@ UAT测试环境 @mc1.domain.com:/home/svn/project#cat /etc/httpd/conf.d/subversion.confLoadModule dav_svn_module     modules/mod_dav_svn.soLoadModule authz_svn_module   modules/mod_authz_svn.so## Example configuration to enable HTTP access for a directory# containing Subversion repositories, "/var/www/svn".  Each repository# must be both:##   a) readable and writable by the 'apache' user, and##   b) labelled with the 'httpd_sys_content_t' context if using#   SELinux### To create a new repository "http://localhost/repos/stuff" using# this configuration, run as root:##   # cd /var/www/svn#   # svnadmin create stuff   #   # chown -R apache.apache stuff#   # chcon -R -t httpd_sys_content_t stuff##<Location /repos>#   DAV svn#   SVNParentPath /var/www/svn##   # Limit write permission to list of valid users.#   <LimitExcept GET PROPFIND OPTIONS REPORT>#      # Require SSL connection for password protection.#      # SSLRequireSSL##      AuthType Basic#      AuthName "Authorization Realm"#      AuthUserFile /path/to/passwdfile#      Require valid-user#   </LimitExcept>#</Location><Location /svn>   DAV svn   #SVNParentPath /home/svn/project   SVNPath /home/svn/project   SVNListParentPath on      AuthType Basic      AuthName "Musingtec SVN Authorization"      AuthUserFile /home/svn/project/password   # Limit write permission to list of valid users.  # <LimitExcept GET PROPFIND OPTIONS REPORT>      # Require SSL connection for password protection.      # SSLRequireSSL      Require valid-user   #</LimitExcept></Location>

重启apache后以http://IP/svn如图

这里说明如下

SVNParentPath:支持多个具备相同父目录的Subversion版本库。SVNPath:只支持一个父目录的Subversion版本库

SVNPath /svn/repository/project1 #如果你想对每个项目单独配置,使用该项

SVNParentPath /svn/repository #设定一个根,所有项目均放在此目录下

并且, 如果设置为SVNParentPath .....,当访问 http://localhost/XXXX时,即使也是要求输入验证,但会提示forbidden错误页. 必须接着输入 http://localhost/xxxx/project1..

转自 http://blog.163.com/litianyichuanqi@126/blog/static/115979441201231701630864/apache2 里面的svn配置<Location /svn/repository>DAV svnSVNPath /svn/repository#SVNParentPath /svn/repository#SVNListParentPath on

(此处配置你的版本库根目录) --注意这里不要是svnpath

AuthType Basic#(连接类型设置 基本验证)AuthName "Hello welcome to here"

(此处字符串内容修改为提示对话框标题)

AuthUserFile /svn/repository/conf/passwd

(此处修改为访问版本库用户的文件, 用apache 的htpasswd命令生成)

AuthzSVNAccessFile /svn/repository/conf/authz#(此处修改为访问版本库权限的文件)Require valid-user#("Require valid-user"告诉apache在authfile中所有的用户都可以访问。</Location>

[groups]Admin=usr1#/*这个表示admin群组里的成员 user1,user2#Develop=u1, u2
#/*这个表示Develop群组里的成员 u1,u2[repository:/]#/*这表示,仓库www的根目录下的访问权限user1 = rw#/www仓库user1用户具有读和写权限user2 = r#/ www仓库userl用户具只有读权限#@develop=rw
#/*这表示 群 develop的成员都具有读写权限[/]#/*这个表示在所有仓库的根目录下

  • = r#/*这个表示对所有的用户都具有读权限

广告 广告

评论区