gyts62 发表于 2018-11-21 11:28:24

centos配置apache+subversion

  一、软件包
  所需软件包:
  httpd-2.4.12.tar.bz2
  subversion-1.8.13.tar.bz2
  sqlite-amalgamation-3071501.zip
  serf-1.2.1.tar.bz2
  apr-1.5.2.tar.gz
  apr-util-1.5.4.tar.gz
  注:安装过程中可能提示要安装其他软件包,根据个人系统环境而定。
  

  二、安装和配置步骤:
  1、安装apr-1.5.2
# tar –zvxf apr-1.5.2.tar.gz
# cd apr-1.5.2
# ./configure --prefix=/usr/local/apr/* 安装不指定路径时 默认安装到/usr/local/apr
# make
#make install  2、安装 apr-util-1.5.4
# tar –zvxf apr-util-1.5.4.tar.gz
# cd apr-util-1.5.4
# ./configure --prefix=/usr/local/apu --with-apr=/usr/local/apr
# make
# make install  3、安装 httpd-2.4.12.tar.bz2
# tar –zvxf httpd-2.4.12.tar.bz2
# cd httpd-2.4.12
# ./configure
--prefix=/usr/local/apache
--with-apr=/usr/local/apr/bin/apr-1-config
--with-apr-util=/usr/local/apu/bin/apu-1-config
--enable-modules=so /* DSO模式安装apache (或 --enable-so)
--enable-dav
--enable-maintainer-mode
-- enable-rewrite
# make
# make install  4、安装serf-1.2.1.tar.bz2
  解决svn http://...的时候提示svn: Unrecognized URL scheme的错误。1.8版本之前的需要加neon,1.8版本之后弃用neon而改使用serf;
#tar –zvxf serf-1.2.1.tar.bz2
#./configure
--prefix=/usr/local/serf
--with-apr=/usr/local/apr/bin/apr-1-config
--with-arp-util=/usr/local/apu/bin/apu-1-config
# make
# make install  

  5、安装和配置 subversion-1.8.13.tar.bz2
#tar –zvxf subversion-1.8.13.tar.bz2
#./configure
--prefix=/usr/local/subversion
--with-apxs=/usr/local/apache/bin/apxs
--with-apr=/usr/local/apr/bin/apr-1-config
--with-apr-util=/usr/local/apu/bin/apu-1-config
--with-ssl
--with-zlib
--enable-maintainer-mode
--with-serf=/usr/local/serf
#make
#make install  注:configure的时候会报错:
configure: checking sqlite library
checking sqlite amalgamation... no
checking sqlite amalgamation... no
checking sqlite3.h usability... no
checking sqlite3.h presence... no
checking for sqlite3.h... no
checking sqlite library version (via pkg-config)... no
An appropriate version of sqlite could not be found.We recommmend
3.7.15.1, but require at least 3.7.12.
Please either install a newer sqlite on this system
or
get the sqlite 3.7.15.1 amalgamation from:
    http://www.sqlite.org/sqlite-amalgamation-3071501.zip
unpack the archive using unzip and rename the resulting
directory to:
/root/subversion-1.8.13/sqlite-amalgamation
configure: error: Subversion requires SQLite  安装上面提示,下载sqlite放到subversion目录里并重命名,重新configure通过
wget http://www.sqlite.org/sqlite-amalgamation-3071501.zip
unzipsqlite-amalgamation-3071501.zip
mv sqlite-amalgamation-3071501 subversion-1.8.13/sqlite-amalgamation  确定一下svn有没有安装成功
#/usr/local/svn/bin/svnserve --version  会看到相关版本信息!
  安装完后在libexec下会看到两个库文件:
  mod_authz_svn.somod_dav_svn.so
  6、配置apache支持svn
  a、拷贝mod_authz_svn.somod_dav_svn.so到apache的module目录下
  在config文件里开启这两个库的支持:
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so  b、开始建立版本库
#/usr/local/subversion/bin/svnadmin create /svn/project/www/*创建仓库"www"
#ls /svn/project/www /*查看有没有创建好,如果多了一些文件则说明版本库已经创建好  c、修改svn版本库权限
  由于apache启动默认用户是daemon:daemon,svn启动默认用户是root
chown -R root:daemon /svn/project/www
chmod -R 775 /sv/project/www  d、配置apche支持svn
#vi /usr/local/apache/conf/httpd.conf
#在文件末尾添加

DAV svn
SVNParentPath /svn/project /*(此处配置你的版本库根目录)
AuthType Basic /*(连接类型设置 基本验证)
AuthName "Hello welcome to here" /*(此处字符串内容修改为提示对话框标题)
AuthUserFile /svn/passwd /*(此处修改为访问版本库用户的文件,用apache 的htpasswd命令生成)
AuthzSVNAccessFile /svn/auth.conf /*(此处修改为访问版本库权限的文件)
Require valid-user /*("Require valid-user"告诉apache在authfile中所有的用户都可以访问。如果没有它,则只能第一个用户可以访问新建库)
  保存文件退出!
  重新启动apache

/usr/local/apache/bin/apachectl restart  先使用浏览器检测一下
  打开浏览器访问 http://192.168.1.220/svn/www 会提示输入用户名密码
  等到完成下面步骤就可以进去访问了,进去后如果有东西显示就说明成功。
  7、配置svn权限管理(即authz.conf的配置)
  a、添加用户:
# /usr/local/apache/bin/htpasswd –c /svn/passwd user1  第一次设置用户时使用-c表示新建一个用户文件。回车后输入用户密码,完成对用户的增加

  第二次添加用户不需要带 –c 参数 如:
# /usr/local/apache/bin/htpasswd /svn/passwd user2  b、权限分配:
#vi /svn/auth.conf
/*这个表示群组设置
Admin=usr1,user2 /*这个表示admin群组里的成员 user1,user2
Develop=u1, u2 /*这个表示Develop群组里的成员 u1,u2
/*这表示,仓库www的根目录下的访问权限
user1 = rw /*www仓库user1用户具有读和写权限user2 = r /* www仓库userl用户具只有读权限
@develop=rw /*这表示 群 develop的成员都具有读写权限[/] /*这个表示在所有仓库的根目录下* = r /*这个表示对所有的用户都具有读权限  注意:在编辑authz.conf文件时,所有行都必须要顶头写,不能有缩行出现,否则会报错:"Access denied: 'user1' ",里面的内容可以根据自己的需要自行添加,不必与我上面所写的相同!
  8、重启apache服务和启动svn服务
#/usr/local/apache/bin/apachectl –k restart  就可以通过 http://192.168.1.220/svn/www 这个URL来访问仓库了,当然,受权限的限制,必须是合法用户才能访问且具有相应的权限
  最后启动svn
#/usr/local/svn/bin/svnserve -d -r /svn/project  -d 表示以 daemon 方式(后台运行)运行
  -r /svn/project 指定根目录是/svn/project
  检查服务器是否启动正常:
#ps –ef|grep svnserve  如果显示如下,即为启动成功:
root   45224   10 15:45 ?      00:00:00 svnserve -d -r /svn/project/  接下来客户端TortoiseSVN直接安装,重启客户端计算机。
  配置完成。



页: [1]
查看完整版本: centos配置apache+subversion