您现在的位置是:网站首页 > 代码编程 > 服务器服务器

【原】linux环境下svn安装图文教程

不忘初心 不忘初心 2017-11-13 围观() 评论() 点赞() 服务器

简介:尝试使用二进制方式安装svn,太麻烦了,光是它的依赖库就需要一堆,还是使用简单的yum来安装一下吧,以后有时间和精力再去尝试使用二进制方式安装。直接yuminstallsubversion[root@VM_41_196_centos~]#yuminstallsubversionLoadedplugins:fastestmirror,langpacksepel

尝试使用二进制方式安装svn,太麻烦了,光是它的依赖库就需要一堆,还是使用简单的yum来安装一下吧,以后有时间和精力再去尝试使用二进制方式安装。

直接 yum install subversion

[root@VM_41_196_centos ~]# yum install subversion
Loaded plugins: fastestmirror, langpacks
epel                                                                                                                                                                                                                                                   | 4.7 kB  00:00:00     
extras                                                                                                                                                                                                                                                 | 3.4 kB  00:00:00     
os                                                                                                                                                                                                                                                     | 3.6 kB  00:00:00     
updates                                                                                                                                                                                                                                                | 3.4 kB  00:00:00     
(1/7): epel/7/x86_64/group_gz                                                                                                                                                                                                                          | 261 kB  00:00:00     
(2/7): epel/7/x86_64/updateinfo                                                                                                                                                                                                                        | 847 kB  00:00:00     
(3/7): extras/7/x86_64/primary_db                                                                                                                                                                                                                      | 129 kB  00:00:00     
(4/7): os/7/x86_64/group_gz                                                                                                                                                                                                                            | 156 kB  00:00:00     
(5/7): updates/7/x86_64/primary_db                                                                                                                                                                                                                     | 3.6 MB  00:00:01     
(6/7): os/7/x86_64/primary_db                                                                                                                                                                                                                          | 5.7 MB  00:00:02     
(7/7): epel/7/x86_64/primary_db                                                                                                                                                                                                                        | 6.1 MB  00:00:02     
Determining fastest mirrors
Resolving Dependencies
--> Running transaction check
---> Package subversion.x86_64 0:1.7.14-11.el7_4 will be installed
--> Processing Dependency: subversion-libs(x86-64) = 1.7.14-11.el7_4 for package: subversion-1.7.14-11.el7_4.x86_64
--> Processing Dependency: libsvn_wc-1.so.0()(64bit) for package: subversion-1.7.14-11.el7_4.x86_64
--> Processing Dependency: libsvn_subr-1.so.0()(64bit) for package: subversion-1.7.14-11.el7_4.x86_64
--> Processing Dependency: libsvn_repos-1.so.0()(64bit) for package: subversion-1.7.14-11.el7_4.x86_64
--> Processing Dependency: libsvn_ra_svn-1.so.0()(64bit) for package: subversion-1.7.14-11.el7_4.x86_64
--> Processing Dependency: libsvn_ra_neon-1.so.0()(64bit) for package: subversion-1.7.14-11.el7_4.x86_64
--> Processing Dependency: libsvn_ra_local-1.so.0()(64bit) for package: subversion-1.7.14-11.el7_4.x86_64
--> Processing Dependency: libsvn_ra-1.so.0()(64bit) for package: subversion-1.7.14-11.el7_4.x86_64
--> Processing Dependency: libsvn_fs_util-1.so.0()(64bit) for package: subversion-1.7.14-11.el7_4.x86_64
--> Processing Dependency: libsvn_fs_fs-1.so.0()(64bit) for package: subversion-1.7.14-11.el7_4.x86_64
--> Processing Dependency: libsvn_fs_base-1.so.0()(64bit) for package: subversion-1.7.14-11.el7_4.x86_64
--> Processing Dependency: libsvn_fs-1.so.0()(64bit) for package: subversion-1.7.14-11.el7_4.x86_64
--> Processing Dependency: libsvn_diff-1.so.0()(64bit) for package: subversion-1.7.14-11.el7_4.x86_64
--> Processing Dependency: libsvn_delta-1.so.0()(64bit) for package: subversion-1.7.14-11.el7_4.x86_64
--> Processing Dependency: libsvn_client-1.so.0()(64bit) for package: subversion-1.7.14-11.el7_4.x86_64
--> Processing Dependency: libneon.so.27()(64bit) for package: subversion-1.7.14-11.el7_4.x86_64
--> Processing Dependency: libaprutil-1.so.0()(64bit) for package: subversion-1.7.14-11.el7_4.x86_64
--> Processing Dependency: libapr-1.so.0()(64bit) for package: subversion-1.7.14-11.el7_4.x86_64
--> Running transaction check
---> Package apr.x86_64 0:1.4.8-3.el7 will be installed
---> Package apr-util.x86_64 0:1.5.2-6.el7 will be installed
---> Package neon.x86_64 0:0.30.0-3.el7 will be installed
--> Processing Dependency: libpakchois.so.0()(64bit) for package: neon-0.30.0-3.el7.x86_64
---> Package subversion-libs.x86_64 0:1.7.14-11.el7_4 will be installed
--> Running transaction check
---> Package pakchois.x86_64 0:0.4-10.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==============================================================================================================================================================================================================================================================================
 Package                                                               Arch                                                         Version                                                               Repository                                                     Size
==============================================================================================================================================================================================================================================================================
Installing:
 subversion                                                            x86_64                                                       1.7.14-11.el7_4                                                       updates                                                       1.0 M
Installing for dependencies:
 apr                                                                   x86_64                                                       1.4.8-3.el7                                                           os                                                            103 k
 apr-util                                                              x86_64                                                       1.5.2-6.el7                                                           os                                                             92 k
 neon                                                                  x86_64                                                       0.30.0-3.el7                                                          os                                                            165 k
 pakchois                                                              x86_64                                                       0.4-10.el7                                                            os                                                             14 k
 subversion-libs                                                       x86_64                                                       1.7.14-11.el7_4                                                       updates                                                       921 k

Transaction Summary
==============================================================================================================================================================================================================================================================================
Install  1 Package (+5 Dependent packages)

Total download size: 2.3 M
Installed size: 8.1 M
Is this ok [y/d/N]: y
Downloading packages:
(1/6): apr-util-1.5.2-6.el7.x86_64.rpm                                                                                                                                                                                                                 |  92 kB  00:00:00     
(2/6): apr-1.4.8-3.el7.x86_64.rpm                                                                                                                                                                                                                      | 103 kB  00:00:00     
(3/6): pakchois-0.4-10.el7.x86_64.rpm                                                                                                                                                                                                                  |  14 kB  00:00:00     
(4/6): neon-0.30.0-3.el7.x86_64.rpm                                                                                                                                                                                                                    | 165 kB  00:00:00     
(5/6): subversion-libs-1.7.14-11.el7_4.x86_64.rpm                                                                                                                                                                                                      | 921 kB  00:00:00     
(6/6): subversion-1.7.14-11.el7_4.x86_64.rpm                                                                                                                                                                                                           | 1.0 MB  00:00:00     
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                                                                                         2.1 MB/s | 2.3 MB  00:00:01     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : apr-1.4.8-3.el7.x86_64                                                                                                                                                                                                                                     1/6 
  Installing : apr-util-1.5.2-6.el7.x86_64                                                                                                                                                                                                                                2/6 
  Installing : pakchois-0.4-10.el7.x86_64                                                                                                                                                                                                                                 3/6 
  Installing : neon-0.30.0-3.el7.x86_64                                                                                                                                                                                                                                   4/6 
  Installing : subversion-libs-1.7.14-11.el7_4.x86_64                                                                                                                                                                                                                     5/6 
  Installing : subversion-1.7.14-11.el7_4.x86_64                                                                                                                                                                                                                          6/6 
  Verifying  : subversion-libs-1.7.14-11.el7_4.x86_64                                                                                                                                                                                                                     1/6 
  Verifying  : neon-0.30.0-3.el7.x86_64                                                                                                                                                                                                                                   2/6 
  Verifying  : apr-1.4.8-3.el7.x86_64                                                                                                                                                                                                                                     3/6 
  Verifying  : apr-util-1.5.2-6.el7.x86_64                                                                                                                                                                                                                                4/6 
  Verifying  : pakchois-0.4-10.el7.x86_64                                                                                                                                                                                                                                 5/6 
  Verifying  : subversion-1.7.14-11.el7_4.x86_64                                                                                                                                                                                                                          6/6 

Installed:
  subversion.x86_64 0:1.7.14-11.el7_4                                                                                                                                                                                                                                         

Dependency Installed:
  apr.x86_64 0:1.4.8-3.el7                        apr-util.x86_64 0:1.5.2-6.el7                        neon.x86_64 0:0.30.0-3.el7                        pakchois.x86_64 0:0.4-10.el7                        subversion-libs.x86_64 0:1.7.14-11.el7_4                       

Complete!
[root@VM_41_196_centos ~]# ll
total 4
-rw-------. 1 root root 2523 Apr 21  2016 anaconda-ks.cfg
[root@VM_41_196_centos ~]# ll
total 4
-rw-------. 1 root root 2523 Apr 21  2016 anaconda-ks.cfg

yum 安装的,我们查看一下装到哪里去了


[root@VM_41_196_centos ~]# rpm -ql subversion
/etc/subversion
/etc/sysconfig/svnserve
/run/svnserve
/usr/bin/svn
/usr/bin/svnadmin
/usr/bin/svndumpfilter
/usr/bin/svnlook
/usr/bin/svnrdump
/usr/bin/svnserve
/usr/bin/svnsync
/usr/bin/svnversion
/usr/lib/systemd/system/svnserve.service
/usr/lib/tmpfiles.d/svnserve.conf
/usr/share/bash-completion/completions/svn
/usr/share/bash-completion/completions/svnadmin
/usr/share/bash-completion/completions/svndumpfilter
/usr/share/bash-completion/completions/svnlook
/usr/share/bash-completion/completions/svnsync
/usr/share/bash-completion/completions/svnversion
/usr/share/doc/subversion-1.7.14
/usr/share/doc/subversion-1.7.14/BUGS
/usr/share/doc/subversion-1.7.14/CHANGES
/usr/share/doc/subversion-1.7.14/COMMITTERS
/usr/share/doc/subversion-1.7.14/INSTALL
/usr/share/doc/subversion-1.7.14/LICENSE
/usr/share/doc/subversion-1.7.14/NOTICE
/usr/share/doc/subversion-1.7.14/README
/usr/share/doc/subversion-1.7.14/backup
/usr/share/doc/subversion-1.7.14/backup/hot-backup.py
/usr/share/doc/subversion-1.7.14/bdb
/usr/share/doc/subversion-1.7.14/bdb/erase-all-text-data.py
/usr/share/doc/subversion-1.7.14/bdb/skel.py
/usr/share/doc/subversion-1.7.14/bdb/svn-bdb-view.py
/usr/share/doc/subversion-1.7.14/bdb/svnfs.py
/usr/share/doc/subversion-1.7.14/bdb/whatis-rep.py
/usr/share/doc/subversion-1.7.14/examples
/usr/share/doc/subversion-1.7.14/examples/SvnCLBrowse
/usr/share/doc/subversion-1.7.14/examples/blame.py
/usr/share/doc/subversion-1.7.14/examples/check-modified.py
/usr/share/doc/subversion-1.7.14/examples/dumpprops.py
/usr/share/doc/subversion-1.7.14/examples/get-location-segments.py
/usr/share/doc/subversion-1.7.14/examples/getfile.py
/usr/share/doc/subversion-1.7.14/examples/getlocks_test.c
/usr/share/doc/subversion-1.7.14/examples/geturl.py
/usr/share/doc/subversion-1.7.14/examples/headrev.c
/usr/share/doc/subversion-1.7.14/examples/info.rb
/usr/share/doc/subversion-1.7.14/examples/minimal_client.c
/usr/share/doc/subversion-1.7.14/examples/putfile.py
/usr/share/doc/subversion-1.7.14/examples/revplist.py
/usr/share/doc/subversion-1.7.14/examples/svnlog2html.rb
/usr/share/doc/subversion-1.7.14/examples/svnlook.py
/usr/share/doc/subversion-1.7.14/examples/svnlook.rb
/usr/share/doc/subversion-1.7.14/examples/svnput.c
/usr/share/doc/subversion-1.7.14/examples/svnserve-sgid.c
/usr/share/doc/subversion-1.7.14/examples/svnshell.py
/usr/share/doc/subversion-1.7.14/examples/svnshell.rb
/usr/share/doc/subversion-1.7.14/examples/testwrite.c
/usr/share/doc/subversion-1.7.14/hook-scripts
/usr/share/doc/subversion-1.7.14/hook-scripts/commit-access-control.cfg.example
/usr/share/doc/subversion-1.7.14/hook-scripts/commit-access-control.pl
/usr/share/doc/subversion-1.7.14/hook-scripts/commit-email.rb
/usr/share/doc/subversion-1.7.14/hook-scripts/log-police.py
/usr/share/doc/subversion-1.7.14/hook-scripts/mailer
/usr/share/doc/subversion-1.7.14/hook-scripts/mailer/mailer.conf.example
/usr/share/doc/subversion-1.7.14/hook-scripts/mailer/mailer.py
/usr/share/doc/subversion-1.7.14/hook-scripts/mailer/tests
/usr/share/doc/subversion-1.7.14/hook-scripts/mailer/tests/mailer-init.sh
/usr/share/doc/subversion-1.7.14/hook-scripts/mailer/tests/mailer-t1.output
/usr/share/doc/subversion-1.7.14/hook-scripts/mailer/tests/mailer-t1.sh
/usr/share/doc/subversion-1.7.14/hook-scripts/mailer/tests/mailer-tweak.py
/usr/share/doc/subversion-1.7.14/hook-scripts/mailer/tests/mailer.conf
/usr/share/doc/subversion-1.7.14/hook-scripts/svn2feed.py
/usr/share/doc/subversion-1.7.14/hook-scripts/svnperms.conf.example
/usr/share/doc/subversion-1.7.14/hook-scripts/svnperms.py
/usr/share/doc/subversion-1.7.14/hook-scripts/validate-extensions.py
/usr/share/doc/subversion-1.7.14/hook-scripts/verify-po.py
/usr/share/doc/subversion-1.7.14/mod_authz_svn-INSTALL
/usr/share/doc/subversion-1.7.14/xslt
/usr/share/doc/subversion-1.7.14/xslt/svnindex.css
/usr/share/doc/subversion-1.7.14/xslt/svnindex.xsl
/usr/share/emacs/site-lisp/psvn-init.el
/usr/share/emacs/site-lisp/psvn.el
/usr/share/locale/de/LC_MESSAGES/subversion.mo
/usr/share/locale/es/LC_MESSAGES/subversion.mo
/usr/share/locale/fr/LC_MESSAGES/subversion.mo
/usr/share/locale/it/LC_MESSAGES/subversion.mo
/usr/share/locale/ja/LC_MESSAGES/subversion.mo
/usr/share/locale/ko/LC_MESSAGES/subversion.mo
/usr/share/locale/nb/LC_MESSAGES/subversion.mo
/usr/share/locale/pl/LC_MESSAGES/subversion.mo
/usr/share/locale/pt_BR/LC_MESSAGES/subversion.mo
/usr/share/locale/sv/LC_MESSAGES/subversion.mo
/usr/share/locale/zh_CN/LC_MESSAGES/subversion.mo
/usr/share/locale/zh_TW/LC_MESSAGES/subversion.mo
/usr/share/man/man1/svn.1.gz
/usr/share/man/man1/svnadmin.1.gz
/usr/share/man/man1/svndumpfilter.1.gz
/usr/share/man/man1/svnlook.1.gz
/usr/share/man/man1/svnrdump.1.gz
/usr/share/man/man1/svnsync.1.gz
/usr/share/man/man1/svnversion.1.gz
/usr/share/man/man5/svnserve.conf.5.gz
/usr/share/man/man8/svnserve.8.gz
/usr/share/xemacs/site-packages/lisp/psvn.el

安装在 /usr/share 文件夹下,没关系,这些文件,我们基本上用不到,所以不用管它,爱装哪里装哪里。

因为是yum,所以是一步到位的,环境和依赖什么的,都不需要我们来操心,下面直接来建立我们自己的版本库

[root@VM_41_196_centos local]# svnadmin create /usr/local/svn

/usr/local/svn,这个文件夹是我们手动创建的,也就是说这个文件夹就是我们的版本库所在,一些托管的代码和相应的配置都是在这个文件夹下

linux环境下svn安装图文教程

如上图所示,执行了上面的命令之后,这空文件夹就有了很多文件了,db就是存储文件的地方,conf就是配置文件所在的地方。

conf文件夹下有三个配置文件:

authz                   #权限

passwd               #密码

svnserve.conf    #服务配置

linux环境下svn安装图文教程

我们来配置一个账户,看看效果,用户test,密码test,先给他配置权限

### 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

# [/foo/bar]
# harry = rw
# &joe = r
# * =

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

[/]
test = rw

注意test上面的中括号,这个代表的就是访问目录,只有一个斜杠,代表根目录,如果只想让test用户访问test目录,那么就是 [/test]

再给test用户配置一个密码

### 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

test = test

很简单,一目了然,前面是账号,后面是密码,一个账号配置占一行,多个就配置多行。

还需要配置一下svnserve.conf,最重要的就是配置版本库所在的目录

### This file controls the configuration of the svnserve daemon, if you
### use it to allow access to this repository.  (If you only allow
### access through http: and/or file: URLs, then this file is
### irrelevant.)

### Visit http://subversion.apache.org/ for more information.

[general]
### The anon-access and auth-access options control access to the
### repository for unauthenticated (a.k.a. anonymous) users and
### authenticated users, respectively.
### Valid values are "write", "read", and "none".
### Setting the value to "none" prohibits both reading and writing;
### "read" allows read-only access, and "write" allows complete 
### read/write access to the repository.
### The sample settings below are the defaults and specify that anonymous
### users have read-only access to the repository, while authenticated
### users have read and write access to the repository.
anon-access = read
auth-access = write
### The password-db option controls the location of the password
### database file.  Unless you specify a path starting with a /,
### the file's location is relative to the directory containing
### this configuration file.
### If SASL is enabled (see below), this file will NOT be used.
### Uncomment the line below to use the default password file.
password-db = passwd
### The authz-db option controls the location of the authorization
### rules for path-based access control.  Unless you specify a path
### starting with a /, the file's location is relative to the the
### directory containing this file.  If you don't specify an
### authz-db, no path-based access control is done.
### Uncomment the line below to use the default authorization file.
authz-db = authz
### This option specifies the authentication realm of the repository.
### If two repositories have the same authentication realm, they should
### have the same password database, and vice versa.  The default realm
### is repository's uuid.
realm = /usr/local/svn
### The force-username-case option causes svnserve to case-normalize
### usernames before comparing them against the authorization rules in the
### authz-db file configured above.  Valid values are "upper" (to upper-
### case the usernames), "lower" (to lowercase the usernames), and
### "none" (to compare usernames as-is without case conversion, which
### is the default behavior).
# force-username-case = none

[sasl]
### This option specifies whether you want to use the Cyrus SASL
### library for authentication. Default is false.
### This section will be ignored if svnserve is not built with Cyrus
### SASL support; to check, run 'svnserve --version' and look for a line
### reading 'Cyrus SASL authentication is available.'
# use-sasl = true
### These options specify the desired strength of the security layer
### that you want SASL to provide. 0 means no encryption, 1 means
### integrity-checking only, values larger than 1 are correlated
### to the effective key length for encryption (e.g. 128 means 128-bit
### encryption). The values below are the defaults.
# min-encryption = 0
# max-encryption = 256

配置中的几个地方,分别是:

anon-access = read            #匿名用户可读

auth-access = write            #授权用户可写

password-db = passwd     #使用哪个文件作为账号文件

authz-db = authz                #使用哪个文件作为权限文件

realm = /usr/local/svn       # 认证空间名,版本库所在目录

好了,我们的配置已经OK了,下面我们启动svn服务

[root@VM_41_196_centos svn]# svnserve -d -r /usr/local/svn

查看一下,启动成功了没有

[root@VM_41_196_centos svn]# ps -ef|grep svn
root     10859     1  0 17:09 ?        00:00:00 svnserve -d -r /usr/local/svn
root     10865  9711  0 17:09 pts/0    00:00:00 grep --color=auto svn

用本地小乌龟来访问一下,测试是否完全能用了

linux环境下svn安装图文教程

没问题,一次成功

linux环境下svn安装图文教程

上图中,我们新建了一个test目录,再来将test账号的权限给他缩小到只能访问test目录,直接将 [/] 改成 [/test]

linux环境下svn安装图文教程

基本上是没啥问题了,但是之前碰到过一次,在eclipse或者idea中,查看不了代码提交的历史信息,会出现 item is not readable 的错误,最后发现是设置匿名用户可读的地方出了问题。

解决方法:将 anon-access = read 改为 anon-access = none,就好了。

linuxsvnsubversion

看完文章,有任何疑问,请加入群聊一起交流!!!

很赞哦! ()

文章评论

  • 请先说点什么
    人参与,条评论

请使用电脑浏览器访问本页面,使用手机浏览器访问本页面会导致下载文件异常!!!

雨落无影

关注上方公众号,回复关键字【下载】获取下载码

用完即删,每次下载需重新获取下载码

若出现下载不了的情况,请及时联系站长进行解决

站点信息

  • 网站程序:spring + freemarker
  • 主题模板:《今夕何夕》
  • 文章统计:篇文章
  • 标签管理标签云
  • 微信公众号:扫描二维码,关注我们