apache + subversion for linux 安装

来源:互联网 发布:软件设计师重要吗 编辑:程序博客网 时间:2024/04/27 21:09


以下是apache+subversion服务端安装步骤:
一、准备好安装包:
简要说明下:之前试了许多svn版本安装不是缺少这个相关依赖包就是缺少另一个而且相关问题不断,没有对此有重温的认识,最后从网上找了相关文档自己总结按照下面的安装包安装可安装成功。
①apr-1.5.2.tar.gz   下载地址:http://apr.apache.org/
②apr-util-1.5.4.tar.gz
③subversion-1.7.1.tar.gz  下载地址: http://subversion.tigris.org/
④expat-2.1.0.tar.gz
⑤zlib-1.2.8.tar.gz
⑥httpd-2.2.31.tar.gz 下载地址:http://httpd.apache.org/
⑦openssl-1.0.0a.tar.gz
⑧sqllit数据库
注意:apach的版本 与 subversion版本的兼容问题,官网都有介绍的
二、开始安装:把以上安装包上传至/root/personal目录,cd /root/personal 进入该目录
Ⅰ安装apr
      tar zxvf  apr-1.5.2.tar.gz #解压包
      cd apr-1.5.2
      ./configure
      make
      make install
Ⅱ安装apr-util-1.5.4
      tar zxvf apr-util-1.5.4.tar.gz
      cd apr-util-1.5.4
      ./configure --with-apr=/usr/local/apr
      make
      make install
Ⅲ安装openssl
 tar -zxvf openssl-1.0.0a.tar.gz
 cd openssl-1.0.0a
 ./config
 ./config -t
 make depend
 make
 make test
 make install
Ⅳ安装 apache
      tar zxvf  httpd-2.2.31.tar.gz
      cd httpd-2.2.31
      ./configure --prefix=/usr/local/apache --enable-dav --enable-so --enable-maintainer-mode --with-apr=/usr/local/apr/bin/apr-1-config --with-apr-util=/usr/local/apr/bin/apu-1-config
 #--prefix表示把apache安装在指定目录
      make
      make install
Ⅴ安装subversion
      tar zxvf  subversion-1.7.1.tar.gz
      cd subversion-1.7.1
      ./configure --prefix=/usr/local/svn --with-apxs=/usr/local/apache/bin/apxs --with-apache-libexecdir=/usr/local/apache/modules --with-apr=/usr/local/apr/bin/apr-1-config --with-apr-util=/usr/local/apr/bin/apu-1-config --with-openssl=/usr/local/ssl --with-zlib --enable-maintainer-mode --without-berkeley-db
      make
      make install
      至此,安装基本完毕,再配置下就可以使用了
      注意:因为这些安装包需要gcc编译,所以要确保linux上装有gcc程序,否则是没办法进行安装的
 三、在apache中配置SVN
①检查apache/modules目录下是否存在mod_dav_svn.so和mod_authz_svn.so,没有安装第二节,第5部重装
      vi /usr/local/apache/conf/httpd.conf
     ②vi /usr/local/apache/conf/httpd.conf
 检查是否有如下两句
      LoadModule dav_svn_module     modules/mod_dav_svn.so
      LoadModule authz_svn_module   modules/mod_authz_svn.so
      没有请找到下面这句,在其下面添加上上面这两句
      #LoadModule foo_module modules/mod_foo.so
     ③定义apache访问svn配置:
      <Location /svn>
              DAV  svn
 #SVNPath /opt/svndata
              SVNParentPath /opt/svndata
              AuthzSVNAccessFile /opt/svn/conf/authz.conf
              AuthType Basic
              AuthName "Subversion repository"
              AuthUserFile /opt/svn/conf/passwd.conf
              Require valid-user
      </Location>
 四、配置svn
      ①建立svn版本库目录
      mkdir -p /opt/svndata/repos #可以多建版本库目录
      ②建立svn版本库
      svnadmin create /opt/svndata/repos
      ③建立本地访问控制文件
 mkdir -p /opt/svn/conf 
      /usr/local/apache/bin/htpasswd -c /opt/svn/conf/passwd.conf  username #可以自定义自己想要的用户名
      然后输入密码即可,默认是MD5加密的
      /usr/local/apache/bin/htpasswd  /opt/svn/conf/passwd.conf  username1 #追加用户
      ④建立本地项目控制文件
      touch /opt/svn/conf/authz.conf
       本例authz.conf内容为:
      [groups]
      #<groupname1>=<username1>,<username2>
      admin=username


      #[<versionLib>:projectName/directory]
      #@<groupsname>=<authorities>
      #<username>=<authorities>


      [/]
      @admin = rw      #指定用户组成员可以读写根目录所有应用


      [repos:/abc/aaa]
      username1= rw      #指定用户username1可以读写:/abc/aaa目录的文件
 将上面的内容添加进/opt/svn/conf/authz.conf文件


至此,整个安装过程完成了!


五、测试连接
     ① 启动apache
      /usr/local/apache/bin/apachectl start
 可以先/usr/local/apache/bin/apachectl -t 测试下刚才配置的是否有问题
     ② 打开浏览器,输入http://120.24.177.119:11080/svn/repos/ #本例服务器ip是120.24.177.119
      使用刚才创建的权限用户名与密码登录即可访问


      注意:在你上传文件的时候可能会有如下权限不足的提示
      Permission denied
      svn: Commit failed (details follow):
      svn: Can't create directory '/opt/svndata/repos/db/transactions/0-1.txn': Permission denied
      这是因为apache在线程用户没有权限访问svn的仓库,两者分别属于不同的用户者
      本例apache属于daemon拥有者,而svn仓库属于svn拥有者
      解决方法:
      chown -R daemon /opt/svndata/repos
      chmod -R 755 /opt/svndata/repos
 相关apache命令
       重启apache:
  /usr/local/apache/bin/apachectl restart
  停止apache:
       /usr/local/apache/bin/apachectl stop
启动apache:
       /usr/local/apache/bin/apachectl start


      


本例是通过TortoiseSVN的svn客户端测试的,上传下载完全正常!服务器系统是 Cent os 6.3。


六、问题汇总
①configure的时候可能回出现 configure: error: no XML parser was found: expat or libxml 2.x required
onfigure配置SVN时可能提示如下错误信息:
configure: error: no XML parser was found: expat or libxml 2.x required
错误提示需要安装expat
下载expat :http://sourceforge.net/project/showfiles.php?group_id=10127
cd /usr/local
tar -xvzf expat2.tar.gz
cd expat2
./configure
make
make install
② OpenSSL
configure配置SVN时可能提示如下错误信息:
configure: error: We require OpenSSL; try --with-openssl
解决方法:
错误提示需要安装openssl,所以我就安装了一个openssl,安装方法如下:
下载openssl:http://www.openssl.org/source/openssl-1.0.0a.tar.gz
cd /usr/local
tar -zxvf openssl-1.0.0a.tar.gz
cd openssl-1.0.0a
./config
./config -t
make depend
make
make test
make install
安装之后会在/usr/local下生成一个ssl目录,配置SVN时加上openssl路径
参考网址:http://www.cnblogs.com/dengqiye/archive/2009/07/11/1521464.html
0 0
原创粉丝点击