Centos7 yum安装并配置SVN

一.环境说明

系统环境:centos7 
安装方式:yum install ..

二.安装前检测

输入:rpm -qa subversion 检测是否有之前安装旧版本svn

[root@make3]#  rpm -qa subversion
subversion-1.7.14-10.el7.x86_64   #如果之前安装过就会显示,如果没有不会出现这个
[root@make3]#  yum remove subversion #如果有旧版本的存在才执行这一步。如果没有不用执行。

三.安装SVN

[root@make3]# yum -y install httpd httpd-devel subversion mod_dav_svn mod_auth_mysql

查看是否已经安装svn模块

[root@make3]# cd /etc/httpd/modules
[root@make3]# ls | grep svn
 mod_authz_svn.so
 mod_dav_svn.so

到这里,那么现在恭喜你已经安装成功啦!

四.简单的配置SVN

1.创建一个svn仓库(我们就在home里面创建吧)

[root@make3]#  mkdir /home/svn/

注释:这里创建的是一个大仓库,里面肯定还有很多小仓库

2.在/home/svn/里面创建小仓,这时候就需要用到svn命令啦!

[root@make3]# svnadmin create /home/svn/make3-1   

3.修改配置文件

[root@make3]# cd /home/svn/make3-1/
[root@make3 make3-1]# ls
 conf  db  format  hooks  locks  README.txt

注释:这时你会看见4个文件夹(conf.db.hooks.lockd),两个文件(format.README.txt),继续

 [root@make3 make3-1]# cd conf
 [root@make3 conf]# ls
  authz  passwd  svnserve.conf
 [root@make3 conf]# vi authz #这个文件是控制权限的
 ### This file is an example authorization            
 file for svnserve.
 ### Its format is identical to that of 
 mod_authz_svn authorization
 ### files.
 ### As shown below each section defines 
 authorizations for the path and
 ### (optional) repository specified by the 
 section name.
 ### The authorizations follow. An 
 authorization line can refer to:
 ###  - a single user,
 ###  - a group of users defined in a 
 special [groups] section,
 ###  - an alias defined in a special 
 [aliases] section,
 ###  - all authenticated users, using the 
 '$authenticated' token,
 ###  - only anonymous users, using the 
 '$anonymous' token,
 ###  - anyone, using the '*' wildcard.
 ###
 ### A match can be inverted by prefixing 
 the rule with '~'. Rules can
 ### grant read ('r') access, read-write   
 ('rw') access, or no access
 ### ('').
 [aliases]
  # joe = /C=XZ/ST=Dessert/L=Snake 
  City/O=Snake Oil, Ltd./OU=Research 
  Institute/CN=Joe Average

  [groups]
  # harry_and_sally = harry,sally
  # harry_sally_and_joe = harry,sally,&joe
  ###这里是添加的代码=======================
   [/]
  admin = rw
  ###这里是添加的代码=======================
  # [/foo/bar]
  # harry = rw
  # &joe = r
  # * =

  # [repository:/baz/fuz]
  # @harry_and_sally = rw
  # * = r
  ~

然后保存并退出!

  [root@make3 conf]# vi passwd

  ### This file is an example password file 
  for svnserve.
  ### Its format is similar to that of 
  svnserve.conf. As shown in the
  ### example below it contains one section 
  labelled [users].
  ### The name and password for each user 
  follow, one account per line.

  [users]
  # harry = harryssecret
  # sally = sallyssecret

  ###这里是添加的代码=======================
    make3user = make3password   #账号=密码
  ###这里是添加的代码=======================

然后保存并退出! [root@make3 conf]# vi svnserve.conf

   #这里面文件太多了就不贴出来了,只说改哪里。其实就是去掉几个“#”号。
   #######要修改的地方##############
   anon-access = read
   auth-access = write

   password-db = passwd

   authz-db = authz

   realm = My First Repository

   #######要修改的地方##############

和上面一样,保存并退出!

4.启动SVN

   [root@make3]# svnserve -d -r /home/svn/

5.打开端口 因为svn默认的是3690端口,所以把3690端口加入iptables,让外部访问!

   [root@make3]# /sbin/iptables -I INPUT -p tcp --dport 3690 -j ACCEPT   #加入
   [root@make3]# /etc/init.d/iptables save   #保存
   [root@make3]# /etc/init.d/iptables status #查看打开的端口

好了,到这里就安装完成了!是不是很简单,剩下就是连接了!

五.连接SVN

linux上连接 [root@make3]# svn co svn://服务器的ip/make3-1/ /var/www/html/
注释:svn co svn地址 [你要存放的目录]

参考: Apache™ Subversion


                              BILL ZHANG 

                                    谢谢!

评论
...

小明

有来过,666666。

4楼  2017-08-08  23:15发表