zoukankan      html  css  js  c++  java
  • 配置64bit linux环境中的svn服务器

    关于linux下svn服务器的搭建,我是从准备、编译、安装、配置、使用的步骤进行的。由于我们的环境是64位linux,所有相关的软件源代码都要在64位下重新处理。

    以下是安装的主要过程:

    1.准备:

       为了保险起见,我使用的是subversion-1.4.5.tar.gz ,与它相关的其他安装包:apr-1.2.12,apr-util-1.2.12.这两个包是Apache Portal Runtime相关的。为了能够通过http访问我们的svn库,还需要neon的支持(我安装使用了neon-0.25.5),倘若要通过https://访问,则要同带ssl支持的neon编译。此外还需要有subversion的支持包,subversion-deps-1.4.5.tar.gz。除此之外就是Apache了:httpd-2.2.4.tar.gz

       以上就是需要的软件,注意版本的依赖。

    2.开始安装,以下的安装过程要注意先后顺序,其实没必要完全按部就班,但是因为库之间的依赖,还是要多多注意:

      1)apr-1.2.12,我们的环境是64bit linux,所以,一定要重建一下configure文件(这里一再强调32位跟64位之间的差别,是因为如果不重建,在后面的安装过程中会出现类似于“/usr/lib/libexpat.so: could not read symbols: File in wrong format”的错误!!)。

    以下是命令行的具体操作:

    #tar zxvf apr-1.2.12.tar.gz

    #cd apr-1.2.12

    #rm -f configure

    #./buildconf

    //以下就默认安装好了

    #./configure

    #make && make install (这个过程中,如果出现了什么问题,就把这两个命令分开执行,先make,等编译完,再make install,就会发现问题到底是哪一步发生了)

    2) apr-util-1.2.12,要注意的地方,跟上面差不多,要关注你的硬件是32位还是64位

    其他的如下:

    #tar zxvf apr-util-1.2.12.tar.gz

    #cd apr-util-1.2.12

    #rm -f configure

    #./buildconf

    //以下就默认安装好了

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

    #make && make install

    3) apache安装:

    #tar zxvf httpd-2.2.4.tar.gz

    #cd httpd-2.2.4

    #rm -f configure

    #./buildconf

    //以下就默认安装好了

    #./configure --prefix=/usr/local/apache2 \

                      --with-apr=/usr/local/apr/bin/apr-1-config \

                      --with-apr-util=/usr/local/apr/bin/apu-1-config \

                      --enable-modules=so \

                      --enable-dav \

                      --enable-maintainer-mode \

                      --enable-rewrite

     #make && make install

    到此已经完成了Apache相关的安装了。。

    上面的apache configure参数是一定不能少的,因为里面跟svn编译安装时生成的模块相关。

    4)subversion的安装:

         这一步的安装相对复杂一点,因为里面关联了其他几个模块(neon,subversion-dependences)。注意顺序。

        具体操作如下:

    #tar zxvf neon-0.25.5.tar.gz

    #cp -fR neon-0.25.5 neon ///说明:这一步是为了跟subversion包里面的那个neon对应起来做的

    #tar zxvf subversion-1.4.5.tar.gz

    #tar zxvf subversion-deps-1.4.5.tar.gz //它会自动的解压到subversion-1.4.5里面

    #cd subversion-1.4.5

    #rm -fR neon/    //把原来的这个neon路径删除,如果有的话

    #rm -f configure   ///原因很清楚了,64位的问题,如果是32位,你就不用管这个了

    #cd ..

    #cp neon subversion-1.4.5/

    #cd subversion-1.4.5/neon  //进入subversion-1.4.5下新拷入的neon来安装

    #rm -f configure

    #./autogen.sh  //这个是neon提供重建configure文件的方法,在安装过程中,基本上就是这两个文件,一个buildconf,一个是autogen.sh,根据具体情况看吧,如果我这里有写错的,包涵。

    #./configure --enable-shared  

    说明:这里要注意了,这里最好加上这个参数,否则可能会出现错误(命名成“头大问题”供下面使用):/usr/bin/ld: /home/prospet5/lib/libneon.a(ne_request.o): relocation R_X86_64_32 against `a local symbol’ can not be used when making a shared object; recompile with -fPIC
    /home/prospet5/lib/libneon.a: could not read symbols: Bad value
    collect2: ld returned 1 exit status
    make: *** [subversion/libsvn_ra_dav/libsvn_ra_dav-1.la] Error 1

    当然,有很多人提出了这个问题的解决方法,在此提供一个比较有用的链接,以供参考:http://joemaller.com/881/how-to-install-subversion-on-a-shared-host/

    继续工作:

    #make && make install

    #cd ..   //进入subversion-1.4.5的路径

    #./buildconf

    #./configure --prefix=/usr/local/subversion/ --with-apxs=/usr/local/apache2/bin/apxs --with-apr=/usr/local/apr/bin/apr-1-config --with-apr-util=/usr/local/apr/bin/apu-1-config --with-ssl --with-zlib --enable-maintainer-mode --libdir=/usr/lib64 --enable-shared    //这里的--enable-shared 参数也不要少,可能也会出现上面的头大问题的。

    #make   //祈祷吧,如果没出现问题,下面也就不用担心了,我们安装过程中,碰到的最大问题就是那个头大问题。

    #make install

    如果以上过程都没问题,那就可以进入配置阶段了。

    3.配置:

    创建svn和apache用户:

    #groupadd svn

    #useradd svnadmin -g svn -G svn

    #groupadd apache

    #useradd apache -g apache -G apache

    #mkdir -p /svn/project

    #chown -R svnadmin /svn/projects

    #su - svnadmin

    #/usr/local/subversion/bin/svnadmin create /svn/projects

    如果项目的存放路径是/tempprojectpath

    #/usr/local/svn/bin/svn  import   /tempprojectpath  file:///svn/projects -m “提交的注释”

    #exit

    #vi /usr/local/apache2/conf/httpd.conf

    在文档的最后加上

    <Location /svn>
       DAV svn 
       SVNParentPath /svn/projects
       AuthzSVNAccessFile /svn/authz.conf
       AuthType Basic
       AuthName "Hi! Have fan!" 
       AuthUserFile /svn/projects/authfile
       Require valid-user 
    </Location>

    说明:这里面指定的几个文件路径和文件,是后面要创建的。

     还要修改如下的这一部分(位置在httpd.conf比较靠上的地方):

    User daemon
    Group daemon

    User apache
    Group apache

    还要确保这个文件中有:

    LoadModule dav_svn_module modules/mod_dav_svn.so
    LoadModule authz_svn_module modules/mod_authz_svn.so

    都修改确认完后,保存退出来就可以。

    再接下来就是subversion使用的配置了。这一部分,还是不用重复了,网上一片一片的相同描述,

    找了个比较详细的:http://hi.baidu.com/hylun/blog/item/e0b27bedf5815fd7b31cb199.html

    还找了点trouble shooting:

    Troubleshooting
    1. Navigating to 'http://localhost/repos' results in a '403 Forbidden' Error. In the apache error logs, you should see this as well:
    No such file or directory: The URI does not contain the name of a repository.

    This indicates that you have used 'SVNParentPath' but did not specify the name of the repository. Apache will not allow anyone
    to view all the repositories it is hosting.

    2. Navigating to 'http://localhost/repos/foobar' results in xml being returned with the following message:
    Could not open the requested SVN filesystem

    And inspecting the apache error log, we see:
    (20014)Internal error: Can't open file '/tmp/repos/foobar/format': No such file or directory

    This indicates you miscorrectly used 'SVNParentPath' to specify a single repository. eg. you specified 'SVNParentPath
    /tmp/repos' in the apache configuration. This is what threw me off initially (and caused me to write this guide when I figured
    it out) as once again 'repos' is a single repository which we are simply using to store multiple projects. If you have ruled
    this possibility out, make sure apache has r/w access to all the repository files.

    copied from http://mo.morsi.org/blog/node/225

  • 相关阅读:
    作业5,6 2019/10/23
    作业1、2、3、4 2019/10/23
    实现Map传参Mybatis
    maven工程配置pom.xml实现mybatis的访问数据库操作
    测试
    Postman篇之命令行测试
    unittest框架
    测试
    测试
    测试
  • 原文地址:https://www.cnblogs.com/ericchen/p/1856300.html
Copyright © 2011-2022 走看看