Linux下搭建SVN服务器环境(svnserve方式)环境:redhat5(apr.apr-util.zlib.subversion的压缩文件都是放在/usr/linuxsvn目录下,下面的解压命令tarzvxf解压出来的文件就直接是放在这个目录下,文件名跟压缩文件的名字是一样的)一、安装apr、apr-util跟zlib1、下载apr、apr-util与zlibapr-1.3.3.tar.gzapr-util-1.3.4.tar.gzzlib-1.2.3.tar.gzopenssl-0.9.8k.tar.gzhttpd-2.2.9.tar.bz2libxml2-2.7.3.tar.gz2、解压tarzvxfapr-1.3.3.tar.gztarzvxfapr-util-1.3.4.tar.gztarzvxfzlib-1.2.3.tar.gztar-jxvfhttpd-2.2.9.tar.bz2tar–zvxfopenssl-0.9.8k.tar.gztar-zxvflibxml2-2.7.3.tar.gz3、安装cdapr-1.3.3./configure--prefix=/usr/local/apr//装在/usr/local/apr目录下make&&makeinstallcdapr-util-1.3.4./configure--with-apr=/usr/local/apr//装在/usr/local/apr目录下Make&&makeinstallcdhttpd-2.2.9./configure--prefix=/usr/local/apache2--enable-so--enable-dav--with-apr=/usr/local/apr/bin/apr-1-config--with-apr-util=/usr/local/apr/bin/apu-1-configmake&&makeinstall/usr/local/apache2/bin/apachectlstart(启动apache)ps-ef|grepapache查看有没有启动测试打开浏览器输入http://服务器ip如果出现ItWorks!Apache安装成功如果出现这个错误Invalidcommand'AuthDigestProvider',perhapsmisspelledordefinedbyamodulenotincludedintheserverconfiguration/usr/local/apache2/conf/extra/httpd-dav.conf提示这个文件31行有问题,那么你就Vi/usr/local/apache2/conf/extra/httpd-dav.conf找到31行,把这个注释掉#AuthDigestProviderfile这样就ok了!cdopenssl-0.9.8k./config--prefix=/usr/local/ssl/makemakeinstallcdlibxml2-2.7.3viINSTALL./configure--help./configuremakemakeinstallcdopenssl-0.9.8k./config./config-tmakedependmakemaketestmakeinstallcdzlib-1.2.3./configure--prefix=/usr/local/zlib//装在/usr/local/zlib目录下make&&makeinstallcd/usr/local/src/zlib-1.2.3catINDEX(看看而已)cd/usr/local/src/ln-szlib-1.2.3cd/usr/local/cdmkdir-p/home/svnadmin/access/usersmkdir-p/home/svnadmin/access/controlmkdir-p/home/svnadmin/reposcd/home/svnadmin/cd/usr/local/apache2/bin/cd/home/svnadmin/access/rm-rfcontrolrm-rfusers/touchcontroltouchusersviusers(建立了就有用户)cd..svnadmincreate/home/svnadmin/repos/networks(建立新库)cdrepos/lscd/usr/local/apache2/conf/cphttpd.confhttpd.conf.0818vihttpd.conf(在最后加入以下东西):Directory/home/svnadminorderallow,denyallowfromall/DirectoryLocation/svnDAVsvnSVNParentPath/home/svnadmin/repos///此处配置你的版本库根目录SatisfyAnyAuthTypeBasicAuthName96333SubversionServer//提示对话框标题AuthUserFile/home/svnadmin/access/users/访问版本库用户的文件,须用apache的htpasswd命令生成AuthzSVNAccessFile/home/svnadmin/access/control//用户权限配置文件Requirevalid-user/Location跟备份之前的对比,看看53行有没有这两行LoadModuledav_svn_modulemodules/mod_dav_svn.soLoadModuleauthz_svn_modulemodules/mod_authz_svn.soIncludeconf/extra/httpd-dav.conf//将这行的注释去掉.二、安装subversion1、下载subversion-1.5.2.tar.bz2subversion-1.5.0.tar.gz,subversion-deps-1.5.2.tar.bz22、安装tar-jvxfsubversion-1.5.2.tar.bz2tar-jxvfsubversion-deps-1.5.2.tar.bz2cdsubversion-1.5.2rm-rfaprrm-rfapr-util/./configure--prefix=/usr/local/svn--with-apxs=/usr/local/apache2/bin/apxs--with-apr=/usr/local/apr/bin/apr-1-config--with-apr-util=/usr/local/apr/bin/apu-1-config--with-openssl=/usr/local/ssl--enable-maintainer-modemakecleanmakemakeinstallsvnserve–version测试是否安装成功,出现以下,就证明成功了svnserve,版本1.3.2(r19776)编译于Jul132006,04:22:38Copyright(C)2000-2006CollabNet.Subversionisopensourcesoftware,see().Thefollowingrepositoryback-end(FS)modulesareavailable:*fs_base:模块与伯克利数据库(BerkeleyDB)档案库一起工作。*fs_fs:模块与纯文本文件(FSFS)档案库一起工作。3、建立用户测试cd/usr/local/apache2/bin/./htpasswd-b/home/svnadmin/access/userstest123456建立用户cd/home/svnadmin/access/lsviuserscp/usr/local/apache2/conf/httpd.conf/home//usr/local/svn/bin/svn–dcd/usr/local/apache2/bin/./htpasswd-b/home/svnadmin/access/usershuangyucai96333再次建立用户cd/home/svnadmin/access/lsviusers(查看是否有用户)vicontrol(建立权限,加入以下内容)###userdefine[groups]admin=admin,huangyucai,test(添加用户要在这里添加)a=huangyucai,a组的人c=chanpinc组的人###groupdefine[/](目录)admin=rw(根目录只有admin有RW权限)[networks:/]@admin=rw(networkadmin组跟a组有RW权限)@a=rw[networks:/chanpin]@c=rw*=r(所有人都有R权限)huangyucai=rw[networks:/trunk/ri_zu_ui]@c=rw*=r4、收尾工作vi/etc/sysconfig/i18n(看看是否支持中文显示)source/etc/sysconfig/i18nuseraddsvnadmingroupaddsvnadmincd/usr/local/apache2/conf/vimhttpd.conf看看是否正常/usr/local/apache2/bin/apachectlstopcd/usr/local/svn/lib/setenforcesestatusvi/etc/selinux/restorecond.conf添加/etc/localtime/etc/lvm/.cache/var/log/faillog/var/log/tallylog/var/log/wtmpvi/etc/selinux/semanage.confvi/etc/selinux/targeted/seusers有下面就okroot:root:s0-s0:c0.c1023__default__:user_u:s0vi/etc/selinux/configsetenforce0cd/usr/local/apache2/bin/./htpasswd-b/home/svnadmin/access/usersyoucaiyoucai/usr/local/apache2/bin/apachectlstop/usr/local/apache2/bin/apachectlstartvi/home/svnadmin/access/control(添加youcai这个用户)cd/home/chown-Rsvnadmin:svnadminsvnadmin(给svnadmin文件加组别权限)(如果你要再创建库,新建一个文件,那么要再一次付给svnadmin权限,例如:svnadmincreate/home/svnadmin/repos/travel新建一个库然后chown-Rsvnadmin:svnadmintravel/给权限)cdsvnadmin/chmod-R777repos/(给所有人对repos具有777的权限)netstat-antlgetenforcevi/etc/sysconfig/selinux/usr/bin/setstatus-vsetstatus-vsetenforce0/usr/local/apache2/bin/apachectlstartvi/etc/rc.d/rc.local(添加)/usr/local/apache2/bin/apachectlstartdatentpdate211.100.37.140datecrontab–e(添加)*/30****/usr/sbin/ntpdate211.100