linux之apache+svn+svnmanager安装于配置
软件准备
apr-1.4.8.tar.gz
apr-util-1.5.2.tar.gz
httpd-2.4.6.tar.gz
subversion-1.8.1.tar.gz
1.安装apr-1.4.8
tar xzvf apr-1.4.8.tar.gz
cd apr-1.4.8
./configure --prefix=/web/server/apr
make
make install
#/web/server/apr/bin/apr-1-config
2.安装apr-util-1.5.2
tar xzvf apr-util-1.5.2.tar.gz
cd apr-util-1.5.2
./configure --prefix=/web/server/apr-util --with-apr=/web/server/apr
make
make install
#/web/server/apr-util/bin/apu-1-config
3.安装httpd-2.4.6
tar xzvf httpd-2.4.6.tar.gz
cd http-2.4.6
./configure --prefix=/web/server/apache --with-apr=/web/server/apr/bin/apr-1-config --with-apr-util=/web/server/apr-util/bin/apu-1-config --enable-so --enable-dav --enable-maintainer-mode --enable-rewrite
make
make install
启动httpd
/web/server/apache/bin/apachectl -k start
/web/server/apache/conf/httpd.conf修改配置
User www
Group www
ServerName 127.0.0.1:88
listen 88
如果出现如下错误
[Mon Dec 02 22:52:52.277496 2013] [unique_id:alert] [pid 6145:tid 47669805221584] (EAI 2)Name or service not known: AH01564: unable to find IPv4 address of "cch"
AH00016: Configuration Failed
造成apache 不能启动
第一方法:
在/etc/hosts 下添加
127.0.0.31 cch
第二种方法
将httpd.conf里的ServerName 改为IP对应
在/etc/rc.conf中添加一行 apache_enable="YES"
4.安装subversion-1.8.1
tar xzvf subversion-1.8.1.tar.gz
cd subversion-1.8.1
./configure --prefix=/web/server/subversion/ --with-apr=/web/server/apr/bin/apr-1-config --with-apr-util=/web/server/apr-util/bin/apu-1-config --with-apxs=/web/server/apache/bin/apxs --with-zlib --enable-maintainer-mode
make
make install
注意:需要sqlite支持,将sqlite-amalgamation-3071501.zip 解压放在subversion-1.8.1下面。重命名为sqlite-amalgamation
查看有没有安装成功
/web/server/subversion/bin/svnserve --version
出现如下错误
/web/server/subversion/bin/svnserve: error while loading shared libraries: libiconv.so.2: cannot open shared object file: No such file or directory
查找错误原因
ldd /web/server/subversion/bin/svnserve 出现如下提示
libiconv.so.2 => not found
libiconv.so.2 => not found
libiconv.so.2 => not found
libiconv.so.2 => not found
libiconv.so.2 => not found
libiconv.so.2 => not found
libiconv.so.2 => not found
libiconv.so.2 => not found
查找libiconv.so.2
find /usr/local/lib/ -name libiconv.so.2
/usr/local/lib/libiconv.so.2
该文件存在,说明动态链接出现问题
解决方案:在/etc/ld.so.conf中加一行/usr/local/lib,运行ldconfig
ld.so.conf和ldconfig是维护系统动态链接库的。
再次运行/web/server/subversion/bin/svnserve --version
出现如下代码
svnserve, version 1.8.1 (r1503906)
compiled Dec 3 2013, 09:46:44 on x86_64-unknown-linux-gnu
Copyright (C) 2013 The Apache Software Foundation.
This software consists of contributions made by many people;
see the NOTICE file for more information.
Subversion is open source software, see http://subversion.apache.org/
The following repository back-end (FS) modules are available:
* fs_fs : Module for working with a plain file (FSFS) repository.
安装subversion成功!
apache加载相关模块
cp /web/server/subversion/libexec/mod_dav_svn.so /web/server/apache/modules/mod_dav_svn.so
cp /web/server/subversion/libexec/mod_authz_svn.so /web/server/apache/modules/mod_authz_svn.so
httpd.conf载入模块
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
开始建立版本库
/web/server/subversion/bin/svnadmin create /web/svn/repos/www /*创建仓库"www"
配置提高svn版本库的安全性
chmod -R 700 /web/svn/repos/ 不让其他人有该目录的权限
chown -R www.www /web/svn/repos/
svn 启动 /web/server/subversion/bin/svnserve -d -r /web/svn/repos
配置apache支持svn
vi /web/server/apache/conf/httpd.conf
文件末尾加入如下配置
DAV svn
SVNListParentPath on
SVNParentPath /web/svn/repos
AuthType Basic
AuthName "VSUCH SVN"
AuthUserFile /web/svn/repos/passwdfile
AuthzSVNAccessFile /web/svn/repos/accessfile
Require valid-user
保存文件退出!
重新启动apache
/web/server/apache/bin/apachectl -k restart
配置svn权限管理
1 . 添加用户:
/web/server/apache/bin/htpasswd -c /web/svn/repos/passwdfile wuwenlong
第一次设置用户时使用-c表示新建一个用户文件。回车后输入用户密码,完成对用户的增加
第二次添加用户不需要带 –c 参数 如:
/web/server/apache/bin/htpasswd /web/svn/repos/passwdfile wwllcchf
2 . 权限分配:
vi /web/svn/repos/accessfile
[groups] /*这个表示群组设置
Admin=usr1,user2 /*这个表示admin群组里的成员 user1,user2
Develop=u1, u2 /*这个表示Develop群组里的成员 u1,u2
[www:/] /*这表示,仓库www的根目录下的访问权限
user1 = rw /*www仓库user1用户具有读和写权限
user2 = r /* www仓库userl用户具只有读权限
@develop=rw /*这表示 群 develop的成员都具有读写权限
[/] /*这个表示在所有仓库的根目录下
* = r /*这个表示对所有的用户都具有读权限
配置svnmanager
需要安装VersionControl_SVN-0.4.0 网址:http://pear.php.net/package/VersionControl_SVN/download/0.4.0
./pear install VersionControl_SVN-0.4.0
svn本地导出本地导出:/web/server/subversion/bin/svn co svn://127.0.0.1/demo/ /web/vhost/demo.wwllcchf.com
svn钩子程序
export LANG=en_US.UTF-8
/web/server/subversion/bin/svn update /web/vhost/demo.wwllcchf.com
启动apache的时候出现错误httpd: Syntax error on line 157 of /usr/local/webserver/apache/conf/httpd.conf: Cannot load modules/mod_dav_lock.so into server: /usr/local/webserver/apache/modules/mod_dav_lock.so: wrong ELF class: ELFCLASS32 , 表示mod_dav_lock.so是32位的,但是运行在64为操作系统上了
post-commit hook failed (exit code 255) with no output
2013-12-03 下午 4:44如果出现这样的错误提示,则说明post-commint没有执行权限,需要修改此文件权限
如果在编译apr的时候,出现这个错误:cannot remove `libtoolT’: No such file or directory
2014-03-28 下午 1:45解决:在configure里面 RM=’$RM -f’ 这里的$RM后面一定有一个空格。 如果后面没有空格,直接连接减号,就依然会报错。把RM=’$RM’改为RM=’$RM -f’