`

[Linux]安装,配置Subversion 1.4.5

    博客分类:
  • SVN
阅读更多
1. SVN 依赖的APR版本。

2. Linux下权限问题
* 在svn使用过程中牵扯到几种权限:文件系统的权限,linux系统权限,svn用户的权限,apache进程的权限;
* 文件系统的权限,linux系统权限:这里相同的意思,就是平时大家使用linux时文件夹和文件的访问权限;
* apache进程的权限:因为所有跟仓库传输的操作都是通过apache进程进行的,所以即使你给svn用户设置了很大的权限,但是apache进程没有访问仓库或者相关文件的权限也没有用。

软件环境

1. 版本
软件 版本 说明
Linux redhat 2.6.9-5.EL
APR APR-1.2.12 Apache可移植运行库
APR-util APR-util-1.2.12
Apache httpd-2.2.6.tar.gz
Subversion subversion-1.4.5.tar.gz
Subversion-deps subversion-deps-1.4.5.tar.gz svn编译时需要的程序

2. 下载
* Subversion相关软件下载:http://www.tigris.org/servlets/NewsItemView?newsItemID=1940
* Apache相关软件下载:http://httpd.apache.org/download.cgi

安装(完全按以下命令配置即可)
安装APR-1.2.12和APR-util-1.2.12

1.

# tar zxvf apr-1.2.12.tar.gz
# cd apr-1.2.12
# ./configure
# make
# make install

2.
# tar zxvf apr-util-1.2.12.tar.gz
# cd apr-util-1.2.12
# . /configure --with-apr=/usr/local/apr
# make
# make install

安装apache 2.2.6
1. 解包 httpd-2.2.6.tar.gz

# tar xzvf httpd-2.2.6.tar.gz
# cd httpd-2.2.6

2. 生成配置文件

# ./configure --prefix=/usr/local/apache2 --enable-dav --enable-modules=so --enable-maintainer-mode --enable-rewrite --with-apr=/usr/local/apr/bin/apr-1-config --with-apr-util=/usr/local/apr/bin/apu-1-config

3. 生成make文件,并安装

# make
# make install

4. 编辑配置文件httpd.conf

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

修改内容:
ServerName www.example.com:80
ServerName localhost:80
保存退出

* apache的默认端口为80
* Svn的默认端口为3690
5. 启动Apache服务:

# /usr/local/apache2/bin/apachectl start

6. 浏览网站:
用浏览器查看http://localhost/,得到it works,说明apache已经配置成功了。

* 需要将linux的防火墙关闭,否则其他IP地址无法访问
* 关闭防火墙命令:service iptables stop
7. 停止Apache服务:

# /usr/local/apache2/bin/apachectl stop

8. 设置启动系统后,自启动Apache服务
编辑etc/rc.d/rc.local

# vi /etc/rc.d/rc.local

在最后加上一句:

/usr/local/apache2/bin/apachectl start

安装subversion

1. 解包

# tar xvzf subversion-1.4.5.tar.gz
# tar xvzf subversion-deps-1.4.5.tar.gz

2. 转入解包目录并生成配置文件

# cd subversion-1.4.5
# rm -rf apr
# rm -rf apr-util
#./configure --with-apxs=/usr/local/apache2/bin/apxs --prefix=/usr/local/subversion --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

SVN 依赖的APR版本要正确。如果Apache为2.0.x,对应的APR版本应为0.9.x;Apache为2.2.x,对应的APR版本应为1.2.x。由于subversion-deps包里的APR是0.9.x的,因此编译svn时要删除从deps里解压出来的apr, apr-util,改而使用apache 2.2里提供的。(这里指定为开始安装的apr目录)
如果apache不是安装在默认路径,configure必須加上--with-apxs选项,如:./configure --with-apxs=/usr/local/apache2/bin/apxs

* configure可能存在的问题及解决方法
1. configure: error: could not find library containing RSA_new
o yum install openssl-devel
2. configure: error: no XML parser was found: expat or libxml 2.x required
o yum install expat-devel
3. configure: error: --with-zlib requires an argument.
o 去掉此选项。

* httpd: Syntax error on line 54 of /usr/local/apache2/conf/httpd.conf: Cannot load /usr/local/apache2/modules/mod_dav_svn.so into server: /usr/local/apache2/modules/mod_dav_svn.so: undefined symbol: dav_register_provider
o make sure you have your apache compiled with the dav options:

--enable-dav --enable-dav-fs --enable-dav-lock
3. 编译安装

# make
# make install

4. 查看subversion两个动态库有没有安装成功

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

看到下面两个模块说明安装成功
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
5. 配置apache 支持svn

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

在文件末尾加上


DAV svn
SVNParentPath /subversion/ (此处配置你的版本库根目录的父目录)
AuthType Basic
AuthName "Subversion repository" (此处字符串内容修改为提示对话框标题)
AuthUserFile /subversion/passwd (此处修改为访问版本库用户的文件,用apache 的 htpasswd命令生成)
AuthzSVNAccessFile /subversion/auth (此处修改为访问版本库权限的文件)
Require valid-user


6. 建立访问库用户文件

# /usr/local/apache2/bin/htpasswd -c /subversion/passwd dyf

第一次添加用户需先创建文件,所以有参数-c,以后添加用户可以不用添加参数)
按照提示输入密码

7. 建立访问库权限文件

# vi /subversion/auth

内容按照以下格式

[groups]
Tester=test,dyf
Developer=zb
[test:/]
@Tester = rw
dyf = rw
zb = r

8. 浏览器+权限 访问版本库
重起apache
在浏览器中输入http://servername/svn/test
输入拥有访问权限的用户名,密码登陆。

1. error info:

Could not open the requested SVN filesystem


* Make sure SVNParentPath correct.
客户端无法提交文件

Can't open file "/opt/subversion/AT2/db/txn-current-lock" Permission denied
增加权限:chmod -R o+rw /opt/subversion/
注意

* 要通过apache来访问svn,需要:
1. 关闭httpd服务:service httpd stop
2. 启用apache服务:/usr/local/apache2/bin/apachectl start

安装之后httpd.conf配置文件
#
# This is the main Apache HTTP server configuration file.  It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.2> for detailed information.
# In particular, see
# <URL:http://httpd.apache.org/docs/2.2/mod/directives.html>
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do.  They're here only as hints or reminders.  If you are unsure
# consult the online docs. You have been warned. 
#
# Configuration and logfile names: If the filenames you specify for many
# of the server's control files begin with "/" (or "drive:/" for Win32), the
# server will use that explicit path.  If the filenames do *not* begin
# with "/", the value of ServerRoot is prepended -- so "logs/foo.log"
# with ServerRoot set to "/etc/svn/apache2" will be interpreted by the
# server as "/etc/svn/apache2/logs/foo.log".

#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# Do not add a slash at the end of the directory path.  If you point
# ServerRoot at a non-local disk, be sure to point the LockFile directive
# at a local disk.  If you wish to share the same ServerRoot for multiple
# httpd daemons, you will need to change at least LockFile and PidFile.
#
ServerRoot "/etc/svn/apache2"

#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 8001

#
# Dynamic Shared Object (DSO) Support
#
# To be able to use the functionality of a module which was built as a DSO you
# have to place corresponding `LoadModule' lines at this location so the
# directives contained in it are actually available _before_ they are used.
# Statically compiled modules (those listed by `httpd -l') do not need
# to be loaded here.
#
# Example:
# 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

#

<IfModule !mpm_netware_module>
#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch. 
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User daemon
Group daemon
</IfModule>

# 'Main' server configuration
#
# The directives in this section set up the values used by the 'main'
# server, which responds to any requests that aren't handled by a
# <VirtualHost> definition.  These values also provide defaults for
# any <VirtualHost> containers you may define later in the file.
#
# All of these directives may appear inside <VirtualHost> containers,
# in which case these default settings will be overridden for the
# virtual host being defined.
#

#
# ServerAdmin: Your address, where problems with the server should be
# e-mailed.  This address appears on some server-generated pages, such
# as error documents.  e.g. admin@your-domain.com
#
ServerAdmin you@example.com

#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
#ServerName www.example.com:80

#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/etc/svn/apache2/htdocs"

#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the "default" to be a very restrictive set of
# features. 
#
<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>

#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#

#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/etc/svn/apache2/htdocs">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.2/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
    AllowOverride None

    #
    # Controls who can get stuff from this server.
    #
    Order allow,deny
    Allow from all

</Directory>

#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
    DirectoryIndex index.html
</IfModule>

#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#
<FilesMatch "^\.ht">
    Order allow,deny
    Deny from all
    Satisfy All
</FilesMatch>

#
# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here.  If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog logs/error_log

#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel warn

<IfModule log_config_module>
    #
    # The following directives define some format nicknames for use with
    # a CustomLog directive (see below).
    #
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%h %l %u %t \"%r\" %>s %b" common

    <IfModule logio_module>
      # You need to enable mod_logio.c to use %I and %O
      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
    </IfModule>

    #
    # The location and format of the access logfile (Common Logfile Format).
    # If you do not define any access logfiles within a <VirtualHost>
    # container, they will be logged here.  Contrariwise, if you *do*
    # define per-<VirtualHost> access logfiles, transactions will be
    # logged therein and *not* in this file.
    #
    CustomLog logs/access_log common

    #
    # If you prefer a logfile with access, agent, and referer information
    # (Combined Logfile Format) you can use the following directive.
    #
    #CustomLog logs/access_log combined
</IfModule>

<IfModule alias_module>
    #
    # Redirect: Allows you to tell clients about documents that used to
    # exist in your server's namespace, but do not anymore. The client
    # will make a new request for the document at its new location.
    # Example:
    # Redirect permanent /foo http://www.example.com/bar

    #
    # Alias: Maps web paths into filesystem paths and is used to
    # access content that does not live under the DocumentRoot.
    # Example:
    # Alias /webpath /full/filesystem/path
    #
    # If you include a trailing / on /webpath then the server will
    # require it to be present in the URL.  You will also likely
    # need to provide a <Directory> section to allow access to
    # the filesystem path.

    #
    # ScriptAlias: This controls which directories contain server scripts.
    # ScriptAliases are essentially the same as Aliases, except that
    # documents in the target directory are treated as applications and
    # run by the server when requested rather than as documents sent to the
    # client.  The same rules about trailing "/" apply to ScriptAlias
    # directives as to Alias.
    #
    ScriptAlias /cgi-bin/ "/etc/svn/apache2/cgi-bin/"

</IfModule>

<IfModule cgid_module>
    #
    # ScriptSock: On threaded servers, designate the path to the UNIX
    # socket used to communicate with the CGI daemon of mod_cgid.
    #
    #Scriptsock logs/cgisock
</IfModule>

#
# "/etc/svn/apache2/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/etc/svn/apache2/cgi-bin">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</Directory>

#
# DefaultType: the default MIME type the server will use for a document
# if it cannot otherwise determine one, such as from filename extensions.
# If your server contains mostly text or HTML documents, "text/plain" is
# a good value.  If most of your content is binary, such as applications
# or images, you may want to use "application/octet-stream" instead to
# keep browsers from trying to display binary files as though they are
# text.
#
DefaultType text/plain

<IfModule mime_module>
    #
    # TypesConfig points to the file containing the list of mappings from
    # filename extension to MIME-type.
    #
    TypesConfig conf/mime.types

    #
    # AddType allows you to add to or override the MIME configuration
    # file specified in TypesConfig for specific file types.
    #
    #AddType application/x-gzip .tgz
    #
    # AddEncoding allows you to have certain browsers uncompress
    # information on the fly. Note: Not all browsers support this.
    #
    #AddEncoding x-compress .Z
    #AddEncoding x-gzip .gz .tgz
    #
    # If the AddEncoding directives above are commented-out, then you
    # probably should define those extensions to indicate media types:
    #
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz

    #
    # AddHandler allows you to map certain file extensions to "handlers":
    # actions unrelated to filetype. These can be either built into the server
    # or added with the Action directive (see below)
    #
    # To use CGI scripts outside of ScriptAliased directories:
    # (You will also need to add "ExecCGI" to the "Options" directive.)
    #
    #AddHandler cgi-script .cgi

    # For type maps (negotiated resources):
    #AddHandler type-map var

    #
    # Filters allow you to process content before it is sent to the client.
    #
    # To parse .shtml files for server-side includes (SSI):
    # (You will also need to add "Includes" to the "Options" directive.)
    #
    #AddType text/html .shtml
    #AddOutputFilter INCLUDES .shtml
</IfModule>

#
# The mod_mime_magic module allows the server to use various hints from the
# contents of the file itself to determine its type.  The MIMEMagicFile
# directive tells the module where the hint definitions are located.
#
#MIMEMagicFile conf/magic

#
# Customizable error responses come in three flavors:
# 1) plain text 2) local redirects 3) external redirects
#
# Some examples:
#ErrorDocument 500 "The server made a boo boo."
#ErrorDocument 404 /missing.html
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
#ErrorDocument 402 http://www.example.com/subscription_info.html
#

#
# EnableMMAP and EnableSendfile: On systems that support it,
# memory-mapping or the sendfile syscall is used to deliver
# files.  This usually improves server performance, but must
# be turned off when serving from networked-mounted
# filesystems or if support for these functions is otherwise
# broken on your system.
#
#EnableMMAP off
#EnableSendfile off

# Supplemental configuration
#
# The configuration files in the conf/extra/ directory can be
# included to add extra features or to modify the default configuration of
# the server, or you may simply copy their contents here and change as
# necessary.

# Server-pool management (MPM specific)
#Include conf/extra/httpd-mpm.conf

# Multi-language error messages
#Include conf/extra/httpd-multilang-errordoc.conf

# Fancy directory listings
#Include conf/extra/httpd-autoindex.conf

# Language settings
#Include conf/extra/httpd-languages.conf

# User home directories
#Include conf/extra/httpd-userdir.conf

# Real-time info on requests and configuration
#Include conf/extra/httpd-info.conf

# Virtual hosts
#Include conf/extra/httpd-vhosts.conf

# Local access to the Apache HTTP Server Manual
#Include conf/extra/httpd-manual.conf

# Distributed authoring and versioning (WebDAV)
#Include conf/extra/httpd-dav.conf

# Various default settings
#Include conf/extra/httpd-default.conf

# Secure (SSL/TLS) connections
#Include conf/extra/httpd-ssl.conf
#
# Note: The following must must be present to support
#       starting without SSL on platforms with no /dev/random equivalent
#       but a statically compiled-in mod_ssl.
#
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>

<Location /svn>
   DAV svn
   SVNParentPath /subversion/project
   AuthType Basic
   AuthName "Subversion repository"
   AuthUserFile /subversion/passwd
   #AuthzSVNAccessFile /subversion/auth
   Require valid-user
</Location>


测试apache2 存放位置:/etc/svn/apache2
分享到:
评论

相关推荐

    Linux subversion-1.4.5的安装包

    3. **配置**:进入源代码目录,运行`./configure`以检查系统环境并配置Subversion的编译选项。这一步可能会根据你的系统设置和需求进行定制。 4. **编译**:执行`make`命令来编译源代码。 5. **安装**:使用`sudo ...

    subversion-deps-1.4.5.tar subversion-1.4.5.tar

    本篇文章将深入讲解如何在Linux环境下搭建SVN服务器,以"subversion-deps-1.4.5.tar"和"subversion-1.4.5.tar"这两个文件为基础进行安装和配置。 首先,我们需要了解这两个文件。"subversion-deps-1.4.5.tar"包含了...

    linux下安装配置svn独立服务器.pdf

    本文将详细介绍如何在Linux(以CentOS 4.6为例)环境下安装并配置一个独立的SVN服务器。 首先,我们需要获取SVN的安装包。可以从Subversion的官方网站下载最新版本的源码包,例如`subversion-1.4.5.tar.gz`和`...

    Subversion zip 版本安装

    通过以上步骤,您可以成功安装Subversion ZIP 版本,并配置好必要的环境变量及服务,从而能够在本地或网络环境中使用Subversion进行版本控制。对于初学者来说,了解这些基础知识非常重要,因为它们是进行项目管理和...

    linux下安装配置svn独立服务器

    ### Linux 下安装配置 SVN 独立服务器 #### 一、概述 随着软件开发的日益复杂,版本控制工具成为团队协作不可或缺的一部分。Subversion(SVN)作为一种分布式版本控制系统,在项目管理和版本控制方面表现突出,...

    subversion-1.8.1.tar.gz源码安装以及依赖包.rar

    5. 配置Subversion服务器,如设置用户权限和仓库位置。 6. 启动Subversion服务。 在实际操作中,可能还需要安装其他依赖,例如apr-iconv、neon、serf等,这些库可能没有包含在提供的压缩包内,但通常可以从Linux...

    linux下安装配置svn独立服务器参照.pdf

    总之,安装和配置Linux下的独立SVN服务器涉及获取安装包、编译安装、创建版本库、修改配置文件以及启动服务等步骤。通过这样的配置,团队可以安全地进行源代码管理和协作,有效地跟踪项目进度和变更历史。

    linux下安装配置svn独立服务器收集.pdf

    总之,安装和配置Linux下的svn独立服务器涉及获取和编译源代码、创建版本库、配置版本库以及设置用户认证和权限。通过这种方式,你可以搭建一个安全且可控的版本控制系统,方便团队协作和项目管理。

    Linux 下Svn客户端安装.pdf

    - 接着需要解压和配置subversion、neon和sqlite。 - 最后安装subversion,需要使用bash脚本进行配置,并指定apr和apr-util的路径。 4. **安装过程** - 安装apr和apr-util需要使用tar命令解压文件到指定目录,并...

    linux上svn、apache安装

    ### Linux环境下Subversion (SVN) 和 Apache 的安装配置指南 #### 一、Apache的安装配置 Apache是一款广泛使用的Web服务器软件,它以其强大的功能、稳定性、安全性等优点深受用户的喜爱。在Linux环境下安装Apache...

    Linux下SVN服务器的搭建与配置

    Linux下SVN服务器的搭建与配置是指在Linux操作系统下搭建和配置Subversion(SVN)服务器的过程。Subversion是一种版本控制系统,能够帮助开发团队更好地管理代码和文件变更。 搭建SVN服务器 要搭建SVN服务器,首先...

    Linux-RedHat9上配置svn+apache服务器

    在Linux RedHat9系统上配置SVN(Subversion)与Apache服务器的集成是开发者和系统管理员常用的操作,以便实现版本控制系统和Web服务器的完美融合,提供便捷的代码管理和Web访问功能。以下是一份详细的配置指南: ...

    Linux下SVN服务器的搭建与配置.pdf

    4. **配置Subversion安装**: ```bash ./configure --with-apxs=/usr/local/apache2/bin/apxs --prefix=/usr/local/subversion \ --with-apr=/usr/local/apache2 --with-apr-util=/usr/local/apache2 \ --with-...

    关于linux下apache+SVN(转)归纳.pdf

    1. **安装依赖**:首先安装Apache(如httpd-2.2.4)、APR(如apr-1.2.12)、APR_Util(如apr-util-1.2.12)以及Subversion(如subversion-1.4.5和subversion-deps-1.4.5)。确保在安装过程中解决所有依赖问题。 2. ...

Global site tag (gtag.js) - Google Analytics