【www.bbyears.com--linux】
Linux配置安装svn服务,此次配置环境为centos6.6,内核版本2.6.32.
Last login: Sat Mar 14 06:12:56 2015
[root@Svn-Server ~]# cat /etc/redhat-release
CentOS release 6.6 (Final)
[root@Svn-Server ~]# uname -rm
2.6.32-504.el6.x86_64 x86_64
[root@Svn-Server ~]# rpm -qa subversion
[root@Svn-Server ~]# yum install subversion -y
Dependencies Resolved
Package Arch Version Repository Size
Installing:
subversion x86_64 1.6.11-12.el6_6 updates 2.3 M
Installing for dependencies:
apr x86_64 1.3.9-5.el6_2 base 123 k
apr-util x86_64 1.3.9-3.el6_0.1 base 87 k
gnutls x86_64 2.8.5-14.el6_5 base 346 k
libproxy x86_64 0.3.0-10.el6 base 39 k
libproxy-bin x86_64 0.3.0-10.el6 base 9.0 k
libproxy-python x86_64 0.3.0-10.el6 base 9.1 k
neon x86_64 0.29.3-3.el6_4 base 119 k
pakchois x86_64 0.4-3.2.el6 base 21 k
perl x86_64 4:5.10.1-136.el6_6.1 updates 10 M
perl-Module-Pluggable x86_64 1:3.90-136.el6_6.1 updates 40 k
perl-Pod-Escapes x86_64 1:1.04-136.el6_6.1 updates 32 k
perl-Pod-Simple x86_64 1:3.13-136.el6_6.1 updates 212 k
perl-URI noarch 1.40-2.el6 base 117 k
perl-libs x86_64 4:5.10.1-136.el6_6.1 updates 578 k
perl-version x86_64 3:0.77-136.el6_6.1 updates 51 k
Transaction Summary
=====================================================================================================================================
Install 16 Package(s)
[root@Svn-Server ~]# mkdir /byrd/svndata -p
[root@Svn-Server ~]# svnserve -d -r /byrd/svndata/
[root@Svn-Server ~]# ps -ef |grep svn
root 1216 1 0 06:31 ? 00:00:00 svnserve -d -r /byrd/svndata/
[root@Svn-Server ~]# rpm -qa subversion
subversion-1.6.11-12.el6_6.x86_64
[root@Svn-Server ~]# netstat -tunlp #lsof -i :3690
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1053/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1130/master
tcp 0 0 0.0.0.0:3690 0.0.0.0:* LISTEN 1216/svnserve
tcp 0 0 :::22 :::* LISTEN 1053/sshd
tcp 0 0 ::1:25 :::* LISTEN 1130/master
[root@Svn-Server ~]# which svnadmin
/usr/bin/svnadmin
[root@Svn-Server ~]# svnadmin create /byrd/svndata/linuxerdox #创建svn版本库(This is a Subversion repository)
[root@Svn-Server ~]# cd /byrd/svndata/linuxerdox/conf/
[root@Svn-Server conf]# cp svnserve.conf svnserve.$(date +%F).conf #备份svnserve.conf配置文件
[root@Svn-Server conf]# sed -i "s#\# anon-access = read#anon-access = none#g" svnserve.conf #取消svn匿名访问
[root@Svn-Server conf]# sed -i "s#\# auth-access = write#auth-access = write#g" svnserve.conf
[root@Svn-Server conf]# mkdir /byrd/svnpasswd #创建公共密码区域
[root@Svn-Server conf]# sed -i "s/\# password-db = passwd/password-db = \/byrd\/svnpasswd\/passwd/g" svnserve.conf
[root@Svn-Server conf]# sed -i "s/\# authz-db = authz/authz-db = \/byrd\/svnpasswd\/authz/g" svnserve.conf
[root@Svn-Server conf]# diff svnserve.*
12,13c12,13
< # anon-access = read
< # auth-access = write
---
> anon-access = none
> auth-access = write
20c20
< # password-db = passwd
---
> password-db = /byrd/svnpasswd/passwd
27c27
< # authz-db = authz
---
> authz-db = /byrd/svnpasswd/authz
[root@Svn-Server conf]# cp authz passwd /byrd/svnpasswd/
[root@Svn-Server conf]# chmod 700 /byrd/svnpasswd/*
[root@Svn-Server conf]# ll /byrd/svnpasswd/
total 8
-rwx------. 1 root root 1080 Mar 14 20:54 authz
-rwx------. 1 root root 309 Mar 14 20:54 passwd
[root@Svn-Server conf]# sed -i "s#\# harry = harryssecret#byrd = admin#g" /byrd/svnpasswd/passwd
[root@Svn-Server svndata]# tail -3 /byrd/svnpasswd/authz
[linuxerdox:/]
byrd = rw
* =
[root@Svn-Server svndata]# netstat -tunlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1052/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1129/master
tcp 0 0 0.0.0.0:3690 0.0.0.0:* LISTEN 1267/svnserve
tcp 0 0 :::22 :::* LISTEN 1052/sshd
tcp 0 0 ::1:25 :::* LISTEN 1129/master
[root@Svn-Server svndata]# pkill svnserve
[root@Svn-Server svndata]# svnserve -d -r /byrd/svndata/
linux作为客户端:
co:checkout
ci:commit
up:update
ls:list
[root@Svn-Server linuxerdox]# svn co svn://1.1.1.32/linuxerdox /tmp/ --username=byrd --password=admin
-----------------------------------------------------------------------
ATTENTION! Your password for authentication realm:
can only be stored to disk unencrypted! You are advised to configure
your system so that Subversion can store passwords encrypted, if
possible. See the documentation for details.
You can avoid future appearances of this warning by setting the value
of the "store-plaintext-passwords" option to either "yes" or "no" in
"/root/.subversion/servers".
-----------------------------------------------------------------------
Store password unencrypted (yes/no)? no
Checked out revision 3.
[root@Svn-Server linuxerdox]# svn co svn://1.1.1.32/linuxerdox /tmp/ --username=byrd --password=admin
A /tmp/111.txt
Checked out revision 4.
[root@Svn-Server linuxerdox]# ll /tmp/
total 4
-rw-r--r--. 1 root root 46 Mar 14 21:45 111.txt
[root@Svn-Server linuxerdox]# touch /tmp/abc.txt
[root@Svn-Server linuxerdox]# svn add /tmp/abc.txt
A /tmp/abc.txt
[root@Svn-Server linuxerdox]# svn ci
svn: "/byrd/svndata/linuxerdox" is not a working copy
[root@Svn-Server linuxerdox]# svn ci -m "abc"
svn: "/byrd/svndata/linuxerdox" is not a working copy
[root@Svn-Server linuxerdox]# cd /tmp/
[root@Svn-Server tmp]# svn ci -m "abc"
Authentication realm:
Password for "byrd":
-----------------------------------------------------------------------
ATTENTION! Your password for authentication realm:
can only be stored to disk unencrypted! You are advised to configure
your system so that Subversion can store passwords encrypted, if
possible. See the documentation for details.
You can avoid future appearances of this warning by setting the value
of the "store-plaintext-passwords" option to either "yes" or "no" in
"/root/.subversion/servers".
-----------------------------------------------------------------------
Store password unencrypted (yes/no)? no
Adding abc.txt
Transmitting file data .
Committed revision 5.
[root@Svn-Server tmp]# svn co file:///byrd/svndata/linuxerdox /tmp/ --username=byrd --password=admin
svn: "/tmp" is already a working copy for a different URL
[root@Svn-Server tmp]# ll
total 0
-rw-r--r--. 1 root root 0 Mar 14 22:10 abc.txt
-rw-------. 1 root root 0 Feb 10 17:11 yum.log
到此配置完成,记得要防火墙开启对应的端口。当然你可以临时关闭防火墙。THX.