zoukankan      html  css  js  c++  java
  • Subversion安装

    一、Subversion介绍

    1. Subversion是一个集中式的信息共享系统。版本库是Subversion的核心部分,是数据的中央仓库。版本库以典型的文件和目录结构形式文件系统树来保存信息。任意数量的客户端连接到Subversion 版本库,读取、修改这些文件。客户端通过写数据将信息分享给其他人,通过读取数据获取别人共享的信息。

    二、环境

    1. [root@localhost ~]# cat /etc/redhat-release
    2. CentOS release 6.6 (Final)
    3. [root@localhost ~]# uname -a
    4. Linux localhost 2.6.32-504.el6.x86_64 #1 SMP Wed Oct 15 04:27:16 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
    5. [root@localhost ~]# ifconfig
    6. eth0 Link encap:Ethernet HWaddr 00:0C:29:0C:BA:2E
    7. inet addr:192.168.1.107 Bcast:192.168.1.255 Mask:255.255.255.0
    8. inet6 addr: fe80::20c:29ff:fe0c:ba2e/64 Scope:Link
    9. UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    10. RX packets:12430 errors:0 dropped:0 overruns:0 frame:0
    11. TX packets:7334 errors:0 dropped:0 overruns:0 carrier:0
    12. collisions:0 txqueuelen:1000
    13. RX bytes:13341760 (12.7 MiB) TX bytes:598263 (584.2 KiB)
    14. lo Link encap:Local Loopback
    15. inet addr:127.0.0.1 Mask:255.0.0.0
    16. inet6 addr: ::1/128 Scope:Host
    17. UP LOOPBACK RUNNING MTU:65536 Metric:1
    18. RX packets:0 errors:0 dropped:0 overruns:0 frame:0
    19. TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
    20. collisions:0 txqueuelen:0
    21. RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)

    三、安装subversion

    1. [root@localhost ~]# yum -y install subversion

    四、验证是否安装

    1. [root@localhost ~]# svnserve --version
    显示内容:

    五、创建版本库

    1. [root@localhost ~]# mkdir /data/svn # 在/data目录下创建一个svn目录,便于管理
    2. [root@localhost ~]# svnadmin create /data/svn/repo0 # 我将svn作为所有版本库的目录,并创建了一个名为repo0的版本库
    3. [root@localhost ~]# cd /data/svn/repo0/
    4. [root@localhost repo0]# ls
    5. conf db format hooks locks README.txt
    6. [root@localhost repo0]# pwd
    7. /data/svn/repo0
    8. [root@localhost repo0]# cd conf/
    9. [root@localhost conf]# ls
    10. authz passwd svnserve.conf
    11. 说明:
    12. 1 svnserve.conf svn服务综合配置文件。
    13. 2 passwd 用户名口令文件。
    14. 3 authz 权限配置文件。

    六、设置版本库的账号密码

    编辑用户口令文件添加svn账号和密码

    1. [root@localhost conf]# cat passwd
    2. ### This file is an example password file for svnserve.
    3. ### Its format is similar to that of svnserve.conf. As shown in the
    4. ### example below it contains one section labelled [users].
    5. ### The name and password for each user follow, one account per line.
    6. [users]
    7. # harry = harryssecret
    8. # sally = sallyssecret
    9. zhangcong = zhang_cong123 # 添加账号密码,左边账号,右边密码,等号两边有无空格无所谓

    七、设置svn用户权限

    1. [root@localhost conf]# cat authz
    2. ### This file is an example authorization file for svnserve.
    3. ### Its format is identical to that of mod_authz_svn authorization
    4. ### files.
    5. ### As shown below each section defines authorizations for the path and
    6. ### (optional) repository specified by the section name.
    7. ### The authorizations follow. An authorization line can refer to:
    8. ### - a single user,
    9. ### - a group of users defined in a special [groups] section,
    10. ### - an alias defined in a special [aliases] section,
    11. ### - all authenticated users, using the '$authenticated' token,
    12. ### - only anonymous users, using the '$anonymous' token,
    13. ### - anyone, using the '*' wildcard.
    14. ###
    15. ### A match can be inverted by prefixing the rule with '~'. Rules can
    16. ### grant read ('r') access, read-write ('rw') access, or no access
    17. ### ('').
    18. [aliases] # 用来设置别名,别名后面的内容没搞懂是啥东西
    19. # joe = /C=XZ/ST=Dessert/L=Snake City/O=Snake Oil, Ltd./OU=Research Institute/CN=Joe Average
    20. [groups] # 设置组和组成员,svn账户较多的时候能派上用场
    21. # harry_and_sally = harry,sally
    22. # harry_sally_and_joe = harry,sally,&joe
    23. # [/foo/bar] # 这个是目录,定义下面的用户、别名、组对这个目录有啥权限
    24. # harry = rw
    25. # &joe = r
    26. # * =
    27. # [repository:/baz/fuz]
    28. # @harry_and_sally = rw
    29. # * = r
    30. [repo0:/] # 定义一个目录,为repo0版本库下面的根目录
    31. zhangcong = rw # zhangcong用户对该目录有读写权限

    八、修改svnserve.conf

    1. [root@localhost conf]# cat svnserve.conf | grep -v ^# | grep -v ^$
    2. [general]
    3. anon-access = read # 控制没有登录的用户不能访问
    4. auth-access = write # 登录的用户可以写入
    5. password-db = passwd # 密码文件为当前目录下的passwd
    6. authz-db = authz # 验证文件为当前目录下的authz
    7. [sasl]

    九、启动和关闭svn服务端

    1)启动svn服务端

    1. [root@localhost conf]# svnserve -d -r /data/svn/

    2)检查svn服务端是否启动

    1. [root@localhost conf]# netstat -anpt | grep svn
    2. tcp 0 0 0.0.0.0:3690 0.0.0.0:* LISTEN 2187/svnserve

    3)关闭svn服务端

    1. ①找到svn服务端的进程号
    2. [root@localhost conf]# ps aux | grep svn
    3. root 2187 0.0 0.0 157000 776 ? Ss 01:13 0:00 svnserve -d -r /data/svn/
    4. ②杀掉该进程
    5. [root@localhost conf]# kill 2187

    十、导入工程(将新的目录导入到版本库中 – 服务端)

    1)创建需要导入的目录文件

    1. [root@localhost conf]# cd /data/
    2. [root@localhost data]# mkdir MyProject
    3. [root@localhost data]# mkdir MyProject/trunk
    4. [root@localhost data]# mkdir MyProject/branches
    5. [root@localhost data]# mkdir MyProject/tags
    6. [root@localhost MyProject]# touch test.txt
    7. [root@localhost MyProject]# ll
    8. 总用量 12
    9. drwxr-xr-x 2 root root 4096 3 26 01:19 branches
    10. drwxr-xr-x 2 root root 4096 3 26 01:19 tags
    11. -rw-r--r-- 1 root root 0 3 26 01:20 test.txt
    12. drwxr-xr-x 2 root root 4096 3 26 01:18 trunk
    13. [root@localhost MyProject]# pwd
    14. /data/MyProject

    2)将创建好的目录导入到svn版本库中

    1. [root@localhost MyProject]# svn import /data/MyProject/ svn://192.168.1.107/repo0/MyProject -m 'first import project'
    2. 认证领域: <svn://192.168.1.107:3690> 974ca905-8b23-4d8a-bc99-a7e4f409eba7
    3. root”的密码: # 这个地方直接回车就好
    4. 认证领域: <svn://192.168.1.107:3690> 974ca905-8b23-4d8a-bc99-a7e4f409eba7
    5. 用户名: zhangcong # 输入svn服务端定义的svn账号密码
    6. zhangcong”的密码:
    7. -----------------------------------------------------------------------
    8. 注意! 你的密码,对于认证域:
    9. <svn://192.168.1.107:3690> 974ca905-8b23-4d8a-bc99-a7e4f409eba7
    10. 只能明文保存在磁盘上! 如果可能的话,请考虑配置你的系统,让 Subversion
    11. 可以保存加密后的密码。请参阅文档以获得详细信息。
    12. 你可以通过在“/root/.subversion/servers”中设置选项“store-plaintext-passwords”为“yes”或“no”,
    13. 来避免再次出现此警告。
    14. -----------------------------------------------------------------------
    15. 保存未加密的密码(yes/no)?yes
    16. -----------------------------------------------------------------------
    17. 注意! 你的密码,对于认证域:
    18. <svn://192.168.1.107:3690> 974ca905-8b23-4d8a-bc99-a7e4f409eba7
    19. 只能明文保存在磁盘上! 如果可能的话,请考虑配置你的系统,让 Subversion
    20. 可以保存加密后的密码。请参阅文档以获得详细信息。
    21. 你可以通过在“/root/.subversion/servers”中设置选项“store-plaintext-passwords”为“yes”或“no”,
    22. 来避免再次出现此警告。
    23. -----------------------------------------------------------------------
    24. 保存未加密的密码(yes/no)?yes
    25. 增加 /data/MyProject/trunk
    26. 增加 /data/MyProject/branches
    27. 增加 /data/MyProject/test.txt
    28. 增加 /data/MyProject/tags
    29. 提交后的版本为 1

    十一、导出工程(将svn服务端的版本库导出到当前目录下 – 客户端)

    1. [root@localhost ~]# yum -y install subversion # 安装svn
    2. [root@localhost ~]# mkdir /data # 创建svn数据存储目录
    3. [root@localhost ~]# cd /data/
    4. [root@localhost data]# svn co svn://192.168.1.107/repo0/MyProject # 将svn服务器端版本库中的数据下载至当前目录下
    5. 认证领域: <svn://192.168.1.107:3690> 974ca905-8b23-4d8a-bc99-a7e4f409eba7
    6. root”的密码: # 这里回车就好
    7. 认证领域: <svn://192.168.1.107:3690> 974ca905-8b23-4d8a-bc99-a7e4f409eba7
    8. 用户名: zhangcong # 输入svn服务器存储的账号密码
    9. zhangcong”的密码:
    10. -----------------------------------------------------------------------
    11. 注意! 你的密码,对于认证域:
    12. <svn://192.168.1.107:3690> 974ca905-8b23-4d8a-bc99-a7e4f409eba7
    13. 只能明文保存在磁盘上! 如果可能的话,请考虑配置你的系统,让 Subversion
    14. 可以保存加密后的密码。请参阅文档以获得详细信息。
    15. 你可以通过在“/root/.subversion/servers”中设置选项“store-plaintext-passwords”为“yes”或“no”,
    16. 来避免再次出现此警告。
    17. -----------------------------------------------------------------------
    18. 保存未加密的密码(yes/no)?yes
    19. A MyProject/trunk
    20. A MyProject/branches
    21. A MyProject/test.txt
    22. A MyProject/tags
    23. 取出版本 1
    24. # 查看从服务器端版本库中down下来的数据
    25. [root@localhost data]# ls
    26. MyProject
    27. [root@localhost data]# ll MyProject/
    28. 总用量 12
    29. drwxr-xr-x 3 root root 4096 3 26 02:07 branches
    30. drwxr-xr-x 3 root root 4096 3 26 02:07 tags
    31. -rw-r--r-- 1 root root 0 3 26 02:07 test.txt
    32. drwxr-xr-x 3 root root 4096 3 26 02:07 trunk

    参考:
    http://www.centoscn.com/CentosServer/ftp/2014/0306/2505.html





  • 相关阅读:
    HTML5新标签与特性---多媒体
    HTML5新标签与特性---新表单+新属性----综合案例1
    字体图标引入到HTML---复制用代码
    字体图标网站---常用汇总
    滑动门出现的背景---实例微信导航栏(a盒子里面包span盒子,文字写在span里)
    【Web前端开发】---前端培训roadmap
    清除浮动的4种方法
    进度更新---Responsive Web Design Certification (300 hours)
    Python实现一个桌面版的翻译工具【新手必学】
    Python爬虫老是被封的解决方法【面试必问】
  • 原文地址:https://www.cnblogs.com/CongZhang/p/5319868.html
Copyright © 2011-2022 走看看