入职拓展学习--SVN

搭建SVN服务器

RedHat Linux安装svn:

yum install svn

判断是否安装成功:

svn --version

创建版本库:

[root@VM_0_6_centos ~]# mkdir test;
[root@VM_0_6_centos ~]# cd test/
[root@VM_0_6_centos test]# svnadmin create svn;
[root@VM_0_6_centos test]# ll svn/
total 24
drwxr-xr-x 2 root root 4096 Apr 10 20:18 conf
drwxr-sr-x 6 root root 4096 Apr 10 20:18 db
-r--r--r-- 1 root root    2 Apr 10 20:18 format
drwxr-xr-x 2 root root 4096 Apr 10 20:18 hooks
drwxr-xr-x 2 root root 4096 Apr 10 20:18 locks
-rw-r--r-- 1 root root  229 Apr 10 20:18 README.txt

使用命令svnserve启动服务

svnserve -d -r 目录 --listen-port 端口号

–listen-port: 指定SVN监听端口,不加此参数,SVN默认监听3690

如果目录指定的是create时的目录,创建的是单库svnserve。即:

svnserver -d -r svn

进入svn文件夹,会看到以下文件:

[root@VM_0_6_centos test]# cd svn/
[root@VM_0_6_centos svn]# ls
conf  db  format  hooks  locks  README.txt

[root@VM_0_6_centos svn]# cd conf/
[root@VM_0_6_centos conf]# ls
authz  passwd  svnserve.conf

其中conf是我们关注的重点:

authz是授权文件、passwd是密码文件、svnserve.conf则是svn服务器的配置文件。

先从passwd文件开始看,passwd文件定义了对svn服务器的用户密码。例如:

[root@VM_0_6_centos 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]
user1=123
user2=123
# harry = harryssecret
# sally = sallyssecret

定义了用户user1和user2,以及密码123。

查看authz文件,其中注释部分需要留意:

[root@VM_0_6_centos 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=user1
dev=user2
[/]
@admin=rw
user2=r

# 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

前面部分[groups]指示将等号后面的用户成组。即类似于admin=user1,user2,user3,在下面部分则直接使用 @admin 调用。

后面部分指的是权限的分配部分,/ 代表是整个目录下的权限分配,可以对用户组、用户、别名、*(代表任何人)进行权限分配,包括’r,rw,w’和’’(无权限)

接着看svnserve.conf文件,看的时候直接看没注释的部分:

[root@VM_0_6_centos conf]# cat 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 = My First Repository
### 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指定版本库的认证域,即在登录时提示的认证域名称。
若两个版本库的 认证域相同,建议使用相同的用户名口令数据文件。默认是一个UUID。
简单认证与安全层 (SASL) 是一个在网络协议中用来认证和数据加密的构架,一般不用。

SVN的基本使用

svn的使用一般都在windows下,首先Tortoisesvn下载Tortoisesvn和语言包:
https://tortoisesvn.net/downloads.html 按步骤安装。

svn的使用其实概念上和git很类似。具体的命令在这里我不多说。其中svn和git的区别有一点是svn对中文支持更加友好,入门的门槛相当于git会更加低一些,对许多非职能部门的小姐姐来说也可以快速上手,如果按上面的搭建好svn的服务器,我们在windows下右键就可以直接使用,这里建议看文末的参考文档。

在学习了基本使用后我产生了一个疑问:
客户端svn上传后,原始文件在服务器的什么位置? 参考如下文章,一般情况下原始文件会变成FSFS格式的自定义压缩文件,然后存在db下的revs和revprops文件夹。
https://blog.csdn.net/qq_29945729/article/details/52936900

git和svn的区别

其实在学习svn的过程中,这个疑问一直伴随着我。

个人理解主要是这几点:

  1. svn和git虽然都是版本控制,但是git更加偏向于分布式、而svn更加偏向于集中式。git的commit首先是对本地工作区的commit,然后再通过push推到集中的服务器上。而svn的每一次commit都类似于直接进行push,那么如果断网,无法push到远程的集中式代码库,就不能进行正常的工作。
  2. svn对中文的支持很好,可视化界面也更加优秀。相较而言,git则更加偏向技术这边。svn支持项目管理,而git更加支持代码管理。
  3. svn里分支(branch)是一个完整的目录,且这个目录拥有完整的实际文件。而git里的分支在融合前不会对实际文件造成改变。

参考文档

http://www.runoob.com/svn/svn-tutorial.html
https://blog.csdn.net/mine_song/article/details/70770467
https://blog.csdn.net/hellow__world/article/details/72529022
https://help.github.com/en/articles/what-are-the-differences-between-subversion-and-git

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
提供的源码资源涵盖了Java应用等多个领域,每个领域都包含了丰富的实例和项目。这些源码都是基于各自平台的最新技术和标准编写,确保了在对应环境下能够无缝运行。同时,源码中配备了详细的注释和文档,帮助用户快速理解代码结构和实现逻辑。 适用人群: 适合毕业设计、课程设计作业。这些源码资源特别适合大学生群体。无论你是计算机相关专业的学生,还是对其他领域编程感兴趣的学生,这些资源都能为你提供宝贵的学习和实践机会。通过学习和运行这些源码,你可以掌握各平台开发的基础知识,提升编程能力和项目实战经验。 使用场景及目标: 在学习阶段,你可以利用这些源码资源进行课程实践、课外项目或毕业设计。通过分析和运行源码,你将深入了解各平台开发的技术细节和最佳实践,逐步培养起自己的项目开发和问题解决能力。此外,在求职或创业过程中,具备跨平台开发能力的大学生将更具竞争力。 其他说明: 为了确保源码资源的可运行性和易用性,特别注意了以下几点:首先,每份源码都提供了详细的运行环境和依赖说明,确保用户能够轻松搭建起开发环境;其次,源码中的注释和文档都非常完善,方便用户快速上手和理解代码;最后,我会定期更新这些源码资源,以适应各平台技术的最新发展和市场需求。 所有源码均经过严格测试,可以直接运行,可以放心下载使用。有任何使用问题欢迎随时与博主沟通,第一时间进行解答!
提供的源码资源涵盖了小程序应用等多个领域,每个领域都包含了丰富的实例和项目。这些源码都是基于各自平台的最新技术和标准编写,确保了在对应环境下能够无缝运行。同时,源码中配备了详细的注释和文档,帮助用户快速理解代码结构和实现逻辑。 适用人群: 适合毕业设计、课程设计作业。这些源码资源特别适合大学生群体。无论你是计算机相关专业的学生,还是对其他领域编程感兴趣的学生,这些资源都能为你提供宝贵的学习和实践机会。通过学习和运行这些源码,你可以掌握各平台开发的基础知识,提升编程能力和项目实战经验。 使用场景及目标: 在学习阶段,你可以利用这些源码资源进行课程实践、课外项目或毕业设计。通过分析和运行源码,你将深入了解各平台开发的技术细节和最佳实践,逐步培养起自己的项目开发和问题解决能力。此外,在求职或创业过程中,具备跨平台开发能力的大学生将更具竞争力。 其他说明: 为了确保源码资源的可运行性和易用性,特别注意了以下几点:首先,每份源码都提供了详细的运行环境和依赖说明,确保用户能够轻松搭建起开发环境;其次,源码中的注释和文档都非常完善,方便用户快速上手和理解代码;最后,我会定期更新这些源码资源,以适应各平台技术的最新发展和市场需求。 所有源码均经过严格测试,可以直接运行,可以放心下载使用。有任何使用问题欢迎随时与博主沟通,第一时间进行解答!
提供的源码资源涵盖了Java应用等多个领域,每个领域都包含了丰富的实例和项目。这些源码都是基于各自平台的最新技术和标准编写,确保了在对应环境下能够无缝运行。同时,源码中配备了详细的注释和文档,帮助用户快速理解代码结构和实现逻辑。 适用人群: 适合毕业设计、课程设计作业。这些源码资源特别适合大学生群体。无论你是计算机相关专业的学生,还是对其他领域编程感兴趣的学生,这些资源都能为你提供宝贵的学习和实践机会。通过学习和运行这些源码,你可以掌握各平台开发的基础知识,提升编程能力和项目实战经验。 使用场景及目标: 在学习阶段,你可以利用这些源码资源进行课程实践、课外项目或毕业设计。通过分析和运行源码,你将深入了解各平台开发的技术细节和最佳实践,逐步培养起自己的项目开发和问题解决能力。此外,在求职或创业过程中,具备跨平台开发能力的大学生将更具竞争力。 其他说明: 为了确保源码资源的可运行性和易用性,特别注意了以下几点:首先,每份源码都提供了详细的运行环境和依赖说明,确保用户能够轻松搭建起开发环境;其次,源码中的注释和文档都非常完善,方便用户快速上手和理解代码;最后,我会定期更新这些源码资源,以适应各平台技术的最新发展和市场需求。 所有源码均经过严格测试,可以直接运行,可以放心下载使用。有任何使用问题欢迎随时与博主沟通,第一时间进行解答!

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值