apache + subversion for linux 安装

来源:互联网 发布:铜陵网络台铜陵新闻 编辑:程序博客网 时间:2024/04/27 20:51

SVN是管理工程本版的必备工具,相对vss以及其前身cvs来说都有着无与伦比的优势

以下是apache+subversion服务端安装步骤:

一、准备好安装包:

①apr-1.3.6.tar.gz   下载地址:http://apr.apache.org/

②apr-util-1.3.8.tar.gz

③subversion-1.6.3.tar.gz  下载地址: http://subversion.tigris.org/

④subversion-deps-1.6.3.tar.gz

⑤httpd-2.2.9.tar.gz 下载地址:http://httpd.apache.org/

注意:apach的版本 与 subversion版本的兼容问题,官网都有介绍的

二、开始安装:把以上安装包上传至/usr/local目录,cd /usr/local 进入该目录

1、安装apr

      tar zxvf  apr-1.3.6.tar.gz #解压包

      cd apr-1.3.6

      ./configure

      make

      make install

2、安装apr-util

      tar zxvf apr-util-1.3.8.tar.gz

      cd apr-util-1.3.8

      ./configure --with-apr=/usr/local/apr

      make

      make install

3、安装 apache

      tar zxvf  httpd-2.2.9.tar.gz

      cd httpd-2.2.9

      ./configure --prefix=/usr/local/apache2.2.9 --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

4、安装subversion

      tar zxvf  subversion-1.6.3.tar.gz 

      tar zxvf  subversion-deps-1.6.3.tar.gz

      cd subversion-1.6.3

      ./configure --prefix=/opt/svn --with-apxs=/usr/local/apache2.2.9/bin/apxs --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr

      make

      make install

      至此,安装基本完毕,再配置下就可以使用了

 

      注意:因为这些安装包需要gcc编译,所以要确保linux上装有gcc程序,否则是没办法进行安装的

 

 三、在apache中配置SVN

      vi /usr/local/apache2.2.9/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/svndata/repos #可以多建版本库

      ③建立本地访问控制文件

      /usr/local/apache2.2.9/bin/htpasswd -c /opt/svn/conf/passwd.conf  username

      然后输入密码即可,默认是MD5加密的

      /usr/local/apache2.2.9/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目录的文件

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

五、测试连接

     ① 启动apache

      /usr/local/apache2.2.9/bin/apachectl start

     ② 打开浏览器,输入http://192.168.1.107/svn/repos #本例服务器ip是192.168.1.107

      使用刚才创建的权限用户名与密码登录即可访问

      注意:在你上传文件的时候可能会有如下权限不足的提示

      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:

       /usr/local/apache2.2.9/bin/apachectl stop

       /usr/local/apache2.2.9/bin/apachectl start

      

本例是通过Eclipse的svn插件客户端测试的,上传下载完全正常!服务器系统是 linux Fedora 7。

原创粉丝点击