虚幻0516 发表于 2018-11-21 10:41:18

Centos6.5源码搭建SVN+Apache

  


1、所需软件包

  apr-util-1.5.4.tar.gz #下载地址 wget http://mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-util-1.5.4.tar.gz
  

  apr-1.5.2.tar.gz #下载地址 wget http://mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-1.5.2.tar.gz
  

  sqlite-autoconf-3071700.tar.gz #下载地址
wget http://www.sqlite.org/2013/sqlite-autoconf-3071700.tar.gz  subversion-1.8.13.tar.gz #下载地址 wget http://mirrors.hust.edu.cn/apache/subversion/subversion-1.8.13.tar.gz
  

  httpd-2.2.29.tar.gz #下载地址 wget http://mirrors.cnnic.cn/apache//httpd/httpd-2.2.29.tar.bz2
  

  2、创建管理用户
  # groupadd benet
  # useradd -d /opt/benet -g benet benet
  # echo "benet" | passwd --stdin benet
  

  3、创建软件包目录soft、安装目录app、库文件目录applib
  # cd /opt/
  # mkdir soft
  # mkdir applib
  # mkdir app
  

  4、安装httpd
  # tar xf httpd-2.2.29.tar.gz
  # cd httpd-2.2.29
  # ./configure --prefix=/opt/app/apache --enable-dav --enable-so --enable-modules=most
  # make
  # make install
  5、安装apr
  # tar xf apr-1.5.2.tar.gz
  # cd apr-1.5.2
  # ./buildconf## ./buildconf   #验证系统是否已经安装python、autoconf、libtool,如果没有安装,使用yum或rpm方式安装相应包即可。
  buildconf: checking installation...
  buildconf: python version 2.7.8 (ok)
  buildconf: autoconf version 2.63 (ok)
  buildconf: libtool version 2.2.6b (ok)
  buildconf: copying libtool helper files using /usr/bin/libtoolize
  buildconf: creating include/arch/unix/apr_private.h.in ...
  buildconf: creating configure ...
  buildconf: generating 'make' outputs ...
  buildconf: rebuilding rpm spec file
  # ./configure --prefix=/opt/app/apr --libdir=/opt/applib/

  # make
  # make install
  6、安装apr-util
  # tar xf apr-util-1.5.4.tar.gz
  # cd apr-util-1.5.4
  # ./configure --prefix=/opt/app/apr-util --with-apr=/opt/app/apr
  # make
  # make install
  
  # echo "/opt/applib/" >> /etc/ld.so.conf.d/applib.conf##由于安装apr是指定了库文件位置为/opt/applib所以需要添加到共享库中否则启动Apache是会找不到apr
  # ldconfig
  


  7、安装sqlite
  # tar xf sqlite-autoconf-3071700.tar.gz
  # cd sqlite-autoconf-3071700
  # ./configure --prefix=/opt/app/sqlite
  # make
  # make install
  8、安装subversion
  # tar xf subversion-1.8.13.tar.gz
  # cd subversion-1.8.13
  # ./configure --prefix=/opt/app/subversion --with-apxs=/opt/app/apache/bin/apxs --with-apr=/opt/app/apr/bin/apr-1-config --with-apr-util=/opt/app/apr-util/bin/apu-1-config --with-sqlite=/opt/app/sqlite/ --with-opensll --with-zlib--enable-maintarner-mod
  # make
  # make install
  

  9、创建SVN仓库
  # mkdir /opt/svnroot/oa -p#创建svn数据库目录
  # chmod -R 777 /opt/#为了测试方便赋予/opt目录777权限
  # /opt/app/subversion/bin/svnadmin create /opt/svnroot/oa/test #使用svnadmin create 创建一个名为test的库
  10、创建权限配置文件
  # vi /opt/svnroot/oa/authz.conf #添加如下内容
  [/]
  * = r   ##表示对所有用户开放的权限
  
  wangenzhi = rw   ##表示对wangenzhi这个用户开放的权限
  

  11、创建用户认证文件

  # /opt/app/apache/bin/htpasswd -c /opt/svnroot/oa/authfile wangenzhi
  

  12、加载模块
  ##subversion安装完成以后会在/opt/app/subversion/libexec/目录下生成mod_authz_svn.somod_dav_svn.so 两个模块,将这两个模块拷贝到/opt/app/apache/modules目录下
  # cd /opt/app/subversion/libexec/
  # ls
  mod_authz_svn.somod_dav_svn.so
  # cp /opt/app/subversion/libexec/* /opt/app/apache/modules/
  

  13、编辑Apache配置文件
  # cp /opt/app/apache/conf/httpd.conf /opt/app/apache/conf/httpd.conf.bak #做任何操作之前先将配置文件备份一份
  # vi /opt/app/apache/conf/httpd.conf
  User benet#66行修改为benet
  Group benet #修67行改为benet
  ServerName www.example.com:80 #去掉本行前面注释
  

  # LoadModule foo_module modules/mod_foo.so
  #添加如下两行
  LoadModule dav_svn_module   modules/mod_dav_svn.so
  LoadModule authz_svn_module   modules/mod_authz_svn.so
  #最后一行下面添加如下内容保存退出
  
  

  DAV svn
  

  SVNParentPath "/opt/svnroot/oa"
  

  AuthzSVNAccessFile "/opt/svnroot/oa/authz.conf"
  

  AuthType Basic
  

  AuthName "Subversion.zoneyump"
  

  AuthUserFile "/opt/svnroot/oa/authfile"
  

  Require valid-user
  

  
  

  14、启动Apache
  # /opt/app/apache/bin/apachectl start
  # service iptables stop ##为了测试将防火墙关掉
  15、使用SVN客户端测试


  16、使用Windows下的TortoiseSVN客户端chkout 下载操作,Windows下安装TortoiseSVN这里不再演示按照默认下一步安装即可。下载TortoiseSVN,百度TortoiseSVN即可
  




  ######################至此安装结束,写的不好请大家多多指点。谢谢###########################

  




页: [1]
查看完整版本: Centos6.5源码搭建SVN+Apache