linux 下subversion安装推荐

linux 下subversion安装系统环境: centos5内核:2.6.18-8.el5apache:2.2.8www(W@NeiWang0401)下载软件包:apache:wget http://apache.mirror.phpchina.com/httpd/httpd-2.2.6.tar.bz2berkeley-db:wget http://download.oracle.com/berkeley-db/db-4.6.21.tar.gzsubversion:wget http://subversion.tigris.org/downloads/subversion-1.4.5.tar.bz2一、安装apachea. tar zxf httpd-2.2.8.tar.gzb。安装apr apr-util# cd srclib/apr#./configure –prefix=/usr/local/apr# make# make install# cd apr-util/#./configure –prefix=/usr/local/apr-util –with-apr=/usr/local/apr/# make# make installc.安装apache#./configure –prefix=/usr/local/apache2 –enable-module=so –enable-mods-shared=all –enable-cache –enable-file-cache –enable-mem-cache –enable-disk-cache –enable-static-support –enable-static-htpasswd –enable-static-htdigest –enable-static-rotatelogs –enable-static-logresolve –enable-static-htdbm –enable-static-ab –enable-static-checkgid –with-mpm=worker –enable-ssl –enable-deflate –with-included-apr –enable-so –enable-rewrite –enable-proxy=share –enable-proxy-ajp=share –enable-dav=share –enable-dav-fs –with-apr=/usr/local/apr/ –with-apr-util=/usr/local/apr-util/#make#make install(测试一下apache是否安装成功)二、安装php下载 ming-0.4.0.beta4.tar.gzwget http://downloads.sourceforge.net/ming/ming-0.4.0.beta4.tar.gz?modtime=1174994374 big_mirror=0# tar zxf ming-0.4.0.beta4.tar.gz# cd ming-0.4.0.beta4# ./configure # make# make install# tar zxf php-5.2.5.tar.gz# cd ming-0.4.0.beta4/php_ext/# cp * /home/web/php-5.2.5/ext/ming/ (出现是否让覆盖的提示是选择否就ok了)# cd php-5.2.5# ./configure –with-apxs2=/usr/local/apache2/bin/apxs –prefix=/usr/local/php –enable-track-var –with-dom –enable-wddx –with-zlib –enable-bcmath –with-bz2 –enable-calendar –with-curl –with-curlwrappers –enable-exif –enable-ftp –with-gettext –with-mysql=/usr/local/mysql –with-mysqli=/usr/local/mysql/bin/mysql_config –enable-soap –enable-sockets –with-iconv –enable-xslt –with-xslt-ablot=/usr/local/sablot/lib –enable-mbstring=all –enable-mbstr-enc-trans –enable-mbregex –with-pdo –with-pdo-mysql –with-pdo-sqlite –with-pdo-pqsql –with-xmlrpc –with-config-file-path=/etc –with-openssl –with-libxml-dir=/usr/include/libxml2/libxml –enable-memory-limit –enable-static –enable-maintainer-zts –enable-zend-multibyte –enable-inline-optimization –enable-zend-multibyte –with-expat-dir –with-xsl –with-gd –with-jpeg-dir –with-zlib-dir –with-png-dir –with-freetype-dir –with-ttf –enable-fastcgi –enable-force-cgi-redirect –disable-cli –enable-cal –with-kerberos –with-ming# make# make install# cp php.ini-dist /etc/php.ini在apache配置文件中添加下面内容AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps 测试apache和php的整合情况三、安装subversiona. # tar jxf subversion-1.4.5.tar.bz2 b. # cd subversion-1.4.5c. # ./configure –prefix=/usr/local/subversion –with-apxs2=/usr/local/apache/bin/apxs –with-apr=/usr/local/apr –with-apr-util=/usr/local/apr-util –with-ssld. # makee. # make install四、配置a.创建库文件所在的目录# mkdir -p /usr/local/svnroot/repositoryb.进入subversion的bin目录# cd /usr/local/subversion/binc.创建仓库”bjso”# ./svnadmin create /usr/local/svnroot/repository/bjso# cd /usr/local/svnroot/repository/bjso# lsconf dav db format hooks locks README.txt(看看是不是多了些文件,如果是则说明Subversion安装成功了)# cd /usr/local/subversion/bin/下面这条语句将把路径/home/user/import下找到的文件导入到你创建的Subversion仓库中去,提交后的修订版为1。./svn import -m “New import” /usr/local/www/ file:///usr/local/svnroot/repository/bjso/Adding /home/cuijie/web/index.htmlCommitted revision 1.下面语句为修改仓库权限# chown -R www:www /usr/local/svnroot/repositoryd。修改版本库配置文件# vi /usr/local/svnroot/repository/bjso/conf/svnserve.conf[general]anon-access = noneauth-access = write password-db = /usr/local/svnroot/repository/authfileauthz-db = /usr/local/svnroot/repository/authz.confrealm = bjsoe.修改Apache配置文件# vi /usr/local/apache2/conf/httpd.conf确认下面2个模块是否存在LoadModule dav_svn_module modules/mod_dav_svn.soLoadModule authz_svn_module modules/mod_authz_svn.so在最后面添加下面内容NameVirtualHost 192.168.0.150 VirtualHost 192.168.0.150 ServerAdmin cuijie@beijingso.comDocumentRoot /usr/local/www/ServerName svn.bjso.com Location / DAV svn SVNParentPath /usr/local/svnroot/repository/ AuthzSVNAccessFile /usr/local/svnroot/repository/authz.conf AuthType Basic AuthName “Subversion” AuthUserFile /usr/local/svnroot/repository/authfile Require valid-user /Location /VirtualHost //SVNParentPath /usr/local/svnroot/repository/ 目录不能与DocumentRoot目录一样,否则会出现使用浏览器访问svn仓库正常,但是当用客户端svn命令check out的时候提示错误: 301 Moved Permanently subversion //其中authfile是通过htpasswd -b -c /usr/local/svnroot/repository/authfile cuijie cuijie@bjso//来创建的 -c Create a new file. -b Use the password from the command line rather than prompting for it.//”Require valid-user”告诉apache在authfile中所有的用户都可以访问。//下面这一部分是用来配置一个虚拟主机,用subversion的钩子来建立同步测试服务器。 VirtualHost 192.168.0.150 ServerAdmin cuijie@beijingso.comDocumentRoot /home/cuijie/ServerName cuijie.bjso.comErrorLog logs/192.168.0.150-error_logCustomLog logs/192.168.0.150-access_log common /VirtualHost 五、权限管理a。增加用户//由于htpasswd是apache的内置命令,所以先进入apache的命令目录#/usr/local/apache2/bin/htpasswd /usr/local/svnroot/repository/authfile username//第一次设置用户时使用-c表示新建一个用户文件。回车后输入用户密码,完成对用户的增加,再增加别的用户时,不用加cb.权限分配配置用户访问权限,用于定义用户组和版本库目录权限# vi /usr/local/svnroot/repository/authz.conf注意:* 权限配置文件中出现的用户名必须已在用户配置文件中定义。也就是在前面用htpasswd添加的用户* 对权限配置文件的修改立即生效,不必重启svn。用户组格式:[groups]admin = 用户1,用户2其中,1个用户组可以包含1个或多个用户,用户间以逗号分隔。版本库目录格式:[版本库:/项目目录]@用户组名 = 权限用户名 = 权限其中,方框号内部分可以有多种写法:/,表示根目录及以下。根目录是svnserve启动时指定的,我们指定为/usr/local/svnroot/repository。这样,/就是表示对全部版本库设置权限。bjso:/,表示对版本库bjso设置权限[groups]admin = wanglei liguang duanhaibo liangzhongzheng lijing suiliang gaoyueqiu zhangchuanming zhouanning cuijie[/]@admin = rw[bjso:/]@admin = rwc.删除Subversion默认安装库文件权限文件authz,passwd# rm /usr/local/svnroot/repository/bjso/conf/authz# rm /usr/local/svnroot/repository/bjso/conf/passwd 六、测试测试如果顺利的话,就可以通过http://192.168.0.150/bjso访问了,GoodLuck!七、建立一个subversion的同步测试服务器原理: 基于subversion的钩子,即hook。在subversion执行一个操作时,那会相应的首先去调用相关的钩子程序(如果存在的话)。那么实现一个同步的测试服务器,我们只需要在一个用户执行完毕一个commit操作之后,让钩子程序去自动更新测试服务器的文件即可。通过这个思路,我们需要作的就是建立一个post-commit的钩子。a。使用checkout建立一个工作副本#mkdir /usr/local/www# chown -R www:www /usr/local/www/ //apache运行用户对此目录有完全的可读写操作权限# svn checkout file:///usr/local/svnroot/repository/bjso/ /usr/local/www///取出subversion上的文件,可能需要密码//如果成功则会提示类似下面输出A /usr/local/www/新建文件夹A /usr/local/www/新建 文本文档.txtA /usr/local/www/新建文件夹 (2)A /usr/local/www/index.php取出修订版 6请保证执行checkout语句的用户是daemon,否则在以后钩子调用update时会出现无法创建或修改文件的错误b。设置apache,把你需要的域名指向这个文件夹。打开http://192.168.1.251 用来进行同步测试。c。建立钩子。# cd /usr/local/svnroot/repository/bjso/hooks/# vi post-commit (以www用户身份)#!/bin/shsvn update /usr/local/www/ /usr/local/svnroot/repository/bjso/hooks/svn_hook_log.txt完成 少一点预设的期待,那份对人的关怀会更自在

linux 下subversion安装推荐

相关文章:

你感兴趣的文章:

标签云: