Linux配置安装svn服务,此次配置环境为centos6.6,内核版本2.6.32.
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
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作为客户端:
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
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: <svn://1.1.1.32:3690> 3c9e524f-5a71-49bf-92d5-0a9b8d86bc7e 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: <svn://1.1.1.32:3690> 3c9e524f-5a71-49bf-92d5-0a9b8d86bc7e Password for 'byrd': ----------------------------------------------------------------------- ATTENTION! Your password for authentication realm: <svn://1.1.1.32:3690> 3c9e524f-5a71-49bf-92d5-0a9b8d86bc7e 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 |
非yum(编译)安装:
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
[root@svn subversion-1.8.11]# yum install gcc gcc-c++ -y [root@svn ~]# mkdir /byrd/tools -p [root@svn ~]# mkdir /byrd/service [root@svn ~]# cd /byrd/tools/ [root@svn tools]# wget http://archive.apache.org/dist/apr/apr-1.5.1.tar.gz [root@svn tools]# tar zxf apr-1.5.1.tar.gz [root@svn tools]# cd apr-1.5.1 [root@svn apr-1.5.1]# ./configure [root@svn apr-1.5.1]# make && make install [root@svn apr-1.5.1]# cd .. [root@svn tools]# tar zxf apr-util-1.5.4.tar.gz [root@svn tools]# cd apr-util-1.5.4 [root@svn apr-util-1.5.4]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr [root@svn apr-util-1.5.4]# make && make install [root@svn apr-util-1.5.4]# cd .. ##########################版本太低,要高于sqlite 3.7.15.1################################## [root@svn tools]# wget www.sqlite.org/sqlite-amalgamation-3.6.13.tar.gz [root@svn tools]# tar zxf sqlite-amalgamation-3.6.13.tar.gz [root@svn tools]# cd sqlite-3.6.13/ [root@svn sqlite-3.6.13]# ./configure [root@svn sqlite-3.6.13]# make && make install ##########################版本太低,要高于sqlite 3.7.15.1################################## [root@svn tools]# wget http://mirror.bit.edu.cn/apache/subversion/subversion-1.8.11.tar.gz [root@svn tools]# tar zxf subversion-1.8.11.tar.gz [root@svn tools]# wget http://www.sqlite.org/sqlite-amalgamation-3071501.zip [root@svn tools]# unzip sqlite-amalgamation-3071501.zip [root@svn tools]# mv sqlite-amalgamation-3071501 ./subversion-1.8.11/sqlite-amalgamation [root@svn tools]# wget http://liquidtelecom.dl.sourceforge.net/project/libpng/zlib/1.2.8/zlib-1.2.8.tar.gz [root@svn tools]# tar zxf zlib-1.2.8.tar.gz [root@svn tools]# cd zlib-1.2.8 [root@svn zlib-1.2.8]# ./configure [root@svn zlib-1.2.8]# make && install [root@svn tools]# cd subversion-1.8.11 [root@svn subversion-1.8.11]# ./configure --prefix=/byrd/service/subversion-1.8.11 --without-berkeley-db --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util [root@svn subversion-1.8.11]# make && make install [root@svn subversion-1.8.11]# ln -s /byrd/service/subversion-1.8.11 /usr/local/svn [root@svn tools]# /usr/local/svn/bin/svnserve --version svnserve, version 1.8.11 (r1643975) #完成 ################################################################################### 将/usr/local/svn/bin加入环境变量PATH=$PATH:$HOME/bin:/usr/local/svn/bin ################################################################################### [root@svn ~]# mkdir /byrd/svndata -p [root@svn ~]# svnserve -d -r /byrd/svndata/ [root@svn ~]# svnadmin create /byrd/svndata/linuxerdox [root@svn ~]# cd /byrd/svndata/linuxerdox/conf/ [root@svn conf]# cp svnserve.conf svnserve.$(date +%F).conf [root@svn conf]# sed -i 's#\# anon-access = read#anon-access = none#g' svnserve.conf [root@svn conf]# sed -i 's#\# auth-access = write#auth-access = write#g' svnserve.conf [root@svn conf]# mkdir /byrd/svnpasswd [root@svn conf]# sed -i 's/\# password-db = passwd/password-db = \/byrd\/svnpasswd\/passwd/g' svnserve.conf [root@svn conf]# sed -i 's/\# authz-db = authz/authz-db = \/byrd\/svnpasswd\/authz/g' svnserve.conf [root@svn conf]# sed -i 's/\# authz-db = authz/authz-db = \/byrd\/svnpasswd\/authz/g' svnserve.conf [root@svn conf]# cp authz passwd /byrd/svnpasswd/ [root@svn conf]# chmod 700 /byrd/svnpasswd/* [root@svn conf]# sed -i 's#\# harry = harryssecret#byrd = admin#g' /byrd/svnpasswd/passwd [root@svn conf]# tail -3 /byrd/svnpasswd/authz [linuxerdox:/] byrd = rw * = ################################################################################### 重新启动svn服务。 svnserve -d -r /byrd/svndata/linuxerdox ################################################################################### # grep -vE "^$|#" svnserve.conf [general] anon-access = none auth-access = write password-db = /data/svn/data/conf/pwfile/passwd authz-db = /data/svn/data/conf/pwfile/authz [sasl] # grep -vE "^$|#" pwfile/authz [aliases] [groups] [data:/dev] byrd = rw * = [data:/] byrd = rw # grep -vE "^$|#" pwfile/passwd [users] byrd = 12345 |
错误整理:SourceByrd's Weblog-https://note.t4x.org/environment/linux-config-subversion/
Q:rm: cannot remove `libtoolT': No such file or directory
A:http://note.t4x.org/error/rm-cannot-remove-libtoolt-no-such-file-or-directory/
Q:configure: error: Subversion requires SQLite
A:wget http://www.sqlite.org/sqlite-amalgamation-3071501.zip
Q:configure: error: subversion requires zlib
A:wget http://liquidtelecom.dl.sourceforge.net/project/libpng/zlib/1.2.8/zlib-1.2.8.tar.gz
Q:configure: error: Subversion requires LZ4 >= r129, or use --with-lz4=internal
A:./configure命令添加 --with-lz4=internal
Q:configure: error: Subversion requires UTF8PROC
A:./configure命令添加 --with-utf8proc=internal SourceByrd's Weblog-https://note.t4x.org/environment/linux-config-subversion/
到此配置完成,记得要防火墙开启对应的端口。当然你可以临时关闭防火墙。THX.SourceByrd's Weblog-https://note.t4x.org/environment/linux-config-subversion/ SourceByrd's Weblog-https://note.t4x.org/environment/linux-config-subversion/