linux subversion安装包,linux 下subversion安装

linux 下subversion安装

系统环境: centos5

内核:2.6.18-8.el5

apache:2.2.8

www(

W@NeiWang0401)

一、安装apache

a. tar zxf httpd-2.2.8.tar.gz

b。安装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 install

c.安装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.gz

wget

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的整合情况

三、安装subversion

a. # tar jxf subversion-1.4.5.tar.bz2

b. # cd subversion-1.4.5

c. # ./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-ssl

d. # make

e. # make install

四、配置

a.创建库文件所在的目录

# mkdir -p /usr/local/svnroot/repository

b.进入subversion的bin目录

# cd /usr/local/subversion/bin

c.创建仓库"bjso"

# ./svnadmin create /usr/local/svnroot/repository/bjso

# cd /usr/local/svnroot/repository/bjso

# ls

conf  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.html

Committed revision 1.

下面语句为修改仓库权限

# chown -R www:www /usr/local/svnroot/repository

d。修改版本库配置文件

# vi /usr/local/svnroot/repository/bjso/conf/svnserve.conf

[general]

anon-access = none

auth-access = write

password-db = /usr/local/svnroot/repository/authfile

authz-db = /usr/local/svnroot/repository/authz.conf

realm = bjso

e.修改Apache配置文件

# vi /usr/local/apache2/conf/httpd.conf

确认下面2个模块是否存在

LoadModule dav_svn_module     modules/mod_dav_svn.so

LoadModule authz_svn_module   modules/mod_authz_svn.so

在最后面添加下面内容

NameVirtualHost 192.168.0.150

ServerAdmin

cuijie@beijingso.com

DocumentRoot /usr/local/www/

ServerName svn.bjso.com

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

//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的钩子来建立同步测试服务器。

ServerAdmin

cuijie@beijingso.com

DocumentRoot /home/cuijie/

ServerName cuijie.bjso.com

ErrorLog logs/192.168.0.150-error_log

CustomLog logs/192.168.0.150-access_log common

五、权限管理

a。增加用户

//由于htpasswd是apache的内置命令,所以先进入apache的命令目录

#/usr/local/apache2/bin/htpasswd  /usr/local/svnroot/repository/authfile username

//第一次设置用户时使用-c表示新建一个用户文件。回车后输入用户密码,完成对用户的增加,再增加别的用户时,不用加c

b.权限分配

配置用户访问权限,用于定义用户组和版本库目录权限

# 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 = rw

c.删除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/新建 文本文档.txt

A    /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/sh    svn update /usr/local/www/ >>/usr/local/svnroot/repository/bjso/hooks/svn_hook_log.txt 完成

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值