YAZONG 我的开源

centos安装SVN

  , ,
0 评论0 浏览

一、前提条件

系统环境为:

[root@llyLinux application]# cat /etc/redhat-release

CentOS release 6.7 (Final)

[root@llyLinux application]# uname -r

2.6.32-573.el6.x86_64

需要准备的安装包为:

subversion-1.6.1.tar.gz

subversion-deps-1.6.1.tar.gz

apache-maven-3.3.3-bin.tar.gz

二、SVN部分

[root@softtest application]# pwd

/application

  

#上传subversion-1.6.1.tar.gz和subversion-deps-1.6.1.tar.gz到此目录下

[root@softtest application]# tar xf subversion-1.6.1.tar.gz

[root@softtest application]# tar xf subversion-deps-1.6.1.tar.gz 

  

#创建编译路径

[root@softtest application]# mkdir subversion

[root@softtest application]# ls -ld subversion

drwxr-xr-x 2 root root 4096 Sep  1 11:46 subversion

  

[root@softtest application]# cd subversion-1.6.1

  

[root@softtest subversion-1.6.1]#./configure --prefix=/application/subversion

checking openssl/opensslv.h usability... no

checking openssl/opensslv.h presence... no

checking for openssl/opensslv.h... no

configure: error: We require OpenSSL; try --with-openssl

configure failed for serf

  

#如果编译结束出现上述错误,那么需要安装下述软件之后再次编译

[root@softtest subversion-1.6.1]# yum install openssl openssl-devel -y

  

[root@softtest subversion-1.6.1]#make && make install

  

[root@softtest subversion-1.6.1]#cd /application/subversion/bin

  

[root@softtest bin]# svnserve --version

svnserve, version 1.6.11 (r934486)

   compiled Jul 23 2015, 23:48:52

  

Copyright (C) 2000-2009 CollabNet.

Subversion is open source software, see http://subversion.tigris.org/

This product includes software developed by CollabNet (http://www.Collab.Net/).

  

The following repository back-end (FS) modules are available:

  

* fs_base : Module for working with a Berkeley DB repository.

* fs_fs : Module for working with a plain file (FSFS) repository.

  

Cyrus SASL authentication is available.

  

  

[root@softtest bin]# cd /application/

  

[root@softtest application]# ln -s /application/subversion /application/svn

  

[root@softtest application]# ls svn/

bin  build-1  include  lib  share

  

[root@softtest application]# echo "PATH=/application/svn/bin:$PATH" >> /etc/profile         

  

[root@softtest application]# svnserve --version

  

[root@softtest application]# tail -1 /etc/profile

PATH=/application/svn/bin:/application/maven/bin:/application/jdk/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/root/bin

  

[root@softtest application]# source /etc/profile                  

  

[root@softtest application]# svnserve --version

  

#开启SVN服务进程  

[root@softtest application]# svnserve -d -r /application/

这个命令的作用是开启svn服务进程,并且把/application/目录作为我们的svn服务的根目录。以后,当我们要在客户端checkout代码的时候,svn服务进程就会从这里开始进行查询,类似于apache的/var/www/目录的作用。运行如下命令检查svn服务是否开启了。

[root@svnnexus /]# ps -ef|grep svn|grep -v grep

root     115292      1  0 16:19 ?        00:00:00 svnserve -d -r /application/

  

#创建SVN版本库

[root@softtest application]# mkdir /application/svnrepos -p

[root@softtest application]# svnadmin create /application/svnrepos

  

  

#修改SVN版本库配置文件,修改的配置文件内容,务必按照下面的弄,千万不要有多余空格

[root@softtest application]# cd svnrepos

[root@softtest svnrepos]# ls

conf  db  format  hooks  locks  README.txt

[root@softtest svnrepos]# cd conf/

  

#svn服务配置文件,该文件版本库目录的conf目录下

[root@softtest conf]# cp svnserve.conf svnserve.conf.ori

[root@softtest conf]# egrep "anon-access|auth-access|password-db|authz-db" /application/svnrepos/conf/svnserve.conf

# anon-access = read

anon-access = none#使非授权用户无法访问

# auth-access = write

auth-access = write#使授权用户有写权限

### The password-db option controls the location of the password

# password-db = passwd

password-db = passwd#指明密码文件路径

authz-db = authz#指定权限配置文件名,通过该文件可以实现以路径为基础的访问控制。

  

#修改SVN版本库用户,用户名口令文件,该文件名在文件svnserve.conf中指定,缺省为同目录下的

[root@softtest conf]# cp passwd passwd.ori

[root@svnnexus conf]# cat 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

#在最下面按照格式加入svn的用户名和密码,自定义即可

admin = admin 

zhangsan= zhangsanpwd 

  

#权限配置文件,该文件名也在文件svnserve.conf中指定,缺省为同目录下的

[root@softtest conf]# cp authz authz.ori

[root@svnnexus conf]# cat 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]

admin = admin 

zhangsan=zhangsan

# harry_and_sally = harry,sally

# harry_sally_and_joe = harry,sally,&joe

# [/foo/bar]

# harry = rw

# &joe = r

# * =

# [repository:/baz/fuz]

# @harry_and_sally = rw

# * = r

#最下面加入,这三行的意思是,目录[svnrepos:/](代码根目录,对应svnadmin的版本库名称)下的所有文件,如果没有特殊约定的话,zhangsan用户将具有读(r)和写(w)的权限。

[svnrepos:/]

@admin = rw 

@zhangsan = rw

  

#修改完svn配置文件,记得杀掉SVN进程后,重新开启SVN进程svnserve -d -r /application/

三、windows客户端连接

Screenshot20200105linux下安装SVN和MAVEN并依赖MAVEN环境打包MAVEN项目你可以选择不平凡51CTO博客.png


标题:centos安装SVN
作者:yazong
地址:https://blog.llyweb.com/articles/2016/09/01/1578157605934.html