`
a420144030
  • 浏览: 83672 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

Ubuntu 如何配置svn 服务器

阅读更多

Setting up a Subversion Server on Ubuntu Gutsy Gibbon server

<!-- start main content -->

<!-- google_ad_section_start -->

All the required packages are available in the Ubuntu repositories.

Installing Subversion

Use apt-get:

sudo apt-get update
sudo apt-get install subversion

Creating a Repository

Let's say you want your repository to be in /var/svn/repos, type in these commands:

cd /var
sudo mkdir svn
sudo svnadmin create /var/svn/repos

In order to control who has access to the repository we will now add a user who will own the repository files. Adding a user also adds a group with the same name.

sudo adduser svn

Now make it impossible for anyone to log in as this user by editing /etc/passwd to set the svn user shell to /bin/false. Do this using the vipw command. Find the line which starts svn (it should be the last line in the file) and change /bin/bash to /bin/false.

Now change the ownership of the repository files.

sudo chown -R svn.svn svn

In order for someone to be permitted to use the repository they must be added to the svn group. My user name is martin so I am going to add myself to the svn group.

sudo vigr

Go to the end of the file and add your user name to the end of the line which starts svn. The end of the file should look similar to this:

admin:x:110:martin
svn:x:1001:martin

Now set up an ssh server, clients will connect to this machine using ssh:

sudo apt-get install openssh-server

The repository can now be accessed using the svn+ssh protocol. Test this as follows:

svn co svn+ssh://username@machinename/var/svn/repos

You will be prompted about the RSA fingerprint of the server and asked for your password. You should end up with a directory called repos which is a working copy of your new repository.

As things stand you will be asked for your password every time you connect to the machine which is rather tedious. You can also authenticate with ssh by using a public/private key pair. If you are using a Windows client then install PuTTY and use PuTTYgen to create a key. Don't forget to save the public and private key files. There is a text box at the top of the PuTTYgen window labeled "Public key for pasting into OpenSSH authorized_keys file", you need to put the line of text in that box into a file called .ssh/authorized_keys2 in your home directory on the server. Set the permissions on the files like this:

chmod 0700 .ssh
chmod 0600 .ssh/authorized_keys2

On the Windows machine fire up pageant (another program which comes with PuTTY) and load your private key. You should now be able to connect to the server without being asked for a password. I prefer to disable password based access to the server by editing /etc/ssh/sshd_config and adding the line PasswordAuthentication no.

On a Linux client use ssh-keygen to create the key pair.

Apache

Subversion also supports the WebDAV protocol, to set this up Apache is needed. I am assuming that you installed Ubuntu as a LAMP server.

sudo apt-get install libapache2-svn

The following isn't recommended for a real implementation as we are going to add to the default web files. It would be far better to create a new virtual host, but that is a subject itself.

Ubuntu has a file for each active virtual host in /etc/apache2/sites-enabled, after installing Ubuntu server there will be a file called 000-default in the sites-enabled directory and this is the file we are going to edit.

cd /etc/apache2/sites-enabled
sudo vi 000-default

In the directive add:

    <Location /svn/repos>
      DAV svn
      SVNPath /var/svn/repos
    </Location>

Then execute this command:

sudo /etc/init.d/apache2 force-reload

You should now be able to see the repository at the URL http://machinename/svn/repos.

Securing Web Access

Add this to the location directive:

      AuthType Basic
      AuthName "Subversion Repository"
      AuthUserFile /etc/apache2/passwords
      Require valid-user

Now add a user name and password to the Apache password file:

sudo htpasswd -cb /etc/apache2/passwords martin dgjan08

And another forced reload:

sudo /etc/init.d/apache2 force-reload

Now if you visit the repository URL you will have to enter a valid user name and password.

Trac

Trac is a ticketing system and Wiki which integrates very well with Subversion. Start by installing Trac:

sudo apt-get install trac python-setuptools libapache2-mod-python enscript

Now create a Trac database:

sudo mkdir /var/www/trac
sudo trac-admin /var/www/trac/repos initenv

Then answer its questions, take the defaults, our Subversion repository is in /var/svn/repos.

Now to get Apache to run Trac.

cd /var/www
sudo chown -R www-data.svn trac

Head back to /etc/apache2/sites-enabled and edit 000-default again, adding this:

    <Location /trac/[[:alnum]]+/login">
      AuthType Basic
      AuthName "Subversion Repository"
      AuthUserFile /etc/apache2/passwords
      Require valid-user
    </Location>

    <Location /trac>
      SetHandler mod_python
      PythonInterpreter main_interpreter
      PythonHandler trac.web.modpython_frontend
      PythonOption TracEnvParentDir /var/www/trac
      PythonOption TracUriRoot /trac
    </Location>

And then run this again:

sudo /etc/init.d/apache2 force-reload

Building Trac from source

If you want the most recent version of Trac (0.10.4) then you will have to build and install it. Do the following:

sudo apt-get remove trac
wget http://ftp.edgewall.com/pub/trac/trac-0.10.4.tar.gz
tar zxf trac-0.10.4.tar.gz
cd trac-0.10.4/
sudo mkdir /usr/local/trac
sudo python setup.py install --prefix=/usr

The rest of the instructions are the same.

<!-- google_ad_section_end -->
Wed, 2007-12-19 16:32
如何出现问题:
Can’t open file ‘XXXXXXXX\db\txn-current-lock’: 拒绝访问。
则执行一下代码
chmod  –R  o+rw  /home/svn

 

分享到:
评论

相关推荐

    ubuntu下SVN服务器安装配置

    Ubuntu 下 SVN 服务器安装配置 本资源提供了 Ubuntu 下 SVN 服务器安装配置的详细步骤,旨在帮助用户快速安装和配置 SVN 服务器。下面是本资源的主要知识点: 1. SVN 简介:Subversion 是一款开放源代码的版本控制...

    Ubuntu+svn+ssl+ldap

    完成上述步骤后,你将拥有一个配置了SSL安全和LDAP认证的Ubuntu SVN服务器,允许团队成员通过HTTP/HTTPS安全地访问和操作版本库。这个过程确保了数据的保密性和用户的身份验证,提高了协作的效率和安全性。在实际...

    ubuntu12.04 svn 服务器配置

    通过以上步骤,您已经成功地在Ubuntu 12.04上配置了一个基本的SVN服务器。这使得团队成员可以通过指定的URL访问代码库,进行代码的提交、更新和版本控制。记住,根据实际项目需求,可能还需要进一步配置防火墙规则、...

    Ubuntu下配置svn服务器

    ### Ubuntu下配置SVN服务器详解 #### 一、前言 在开源软件开发及团队协作过程中,版本控制系统扮演着至关重要的角色。Subversion (SVN) 是一款非常流行且功能强大的集中式版本控制系统,适用于各种规模的项目。...

    Linux或Ubuntu下SVN服务器自动发送邮件配置

    在Linux或Ubuntu环境中,配置SVN(Subversion)服务器自动发送邮件主要涉及到以下几个关键步骤,这些步骤可以帮助开发者在每次提交代码时,...同时,了解如何配置SVN服务器发送邮件也是提升DevOps效率的一个关键技能。

    Ubuntu 18.04 LTS 搭建SVN服务器

    在Ubuntu 18 LTS环境中,搭建一个简单apache2+subversion的版本控制。

    ubuntu安装svn步骤及所需文件

    若要启动一个基于HTTP/HTTPS的服务,以便远程访问仓库,你需要安装Apache HTTP服务器并配置SVN模块。执行以下命令安装Apache2和`libapache2-svn`包: ```bash sudo apt install apache2 libapache2-svn ``` 然后,...

    ubuntu下svn服务器配置

    通过以上步骤,你已经在Ubuntu 9.04上成功配置了一个SVN服务器,提供了两种不同的访问方式:本地文件访问和通过WebDAV的HTTP访问。记住,根据实际需求,可能还需要配置防火墙规则、SSL证书等,以确保安全性和远程...

    Ubuntu上搭建SVN服务器全攻略

    ### Ubuntu上搭建SVN服务器全攻略 #### 1. 概述 本文旨在详细介绍如何在Ubuntu环境下搭建SVN(Subversion)服务器,并结合Apache服务器以及SSL加密技术,实现安全、高效的版本控制服务。通过HTTPS协议访问SVN...

    ubuntu16 下搭建svn服务器

    在Ubuntu 16.04 LTS环境下搭建...以上步骤为在Ubuntu 16.04 LTS系统中搭建SVN服务器的具体操作,由亲测经验得出,可作为参考。如果在实践过程中遇到任何问题,需要根据具体的错误信息进行相应的问题排查和解决。

    ubuntu下svn服务器的搭建

    本文将详细介绍如何在Ubuntu上配置和运行一个SVN服务器。 首先,我们需要了解SVN的基本概念。SVN是一个开源的版本控制系统,它允许用户对文件和目录进行版本控制,便于多人协作开发,同时保持代码的历史记录。通过...

    svn服务器的安装与配置

    SVN(Subversion)是一种广泛使用的版本控制系统,用于管理软件项目的源代码和其他文件的变更历史。它使得多人协作开发变得简单,...随着对SVN服务器配置的深入理解和实践,你将能够更好地管理和维护你的项目源代码。

    ubuntu下简单安装svn服务器

    在Ubuntu操作系统下安装SVN服务器是一个较为直接的过程,虽然本指南针对的是Ubuntu 9.10版本,但其基本步骤对于大多数Ubuntu及其衍生版本都是适用的。SVN,即Subversion,是一种版本控制系统,广泛用于代码的版本...

    Ubuntu上搭建SVN服务器全攻略.docx

    本文将详细介绍 Ubuntu 环境下搭建 SVN 服务器的过程,包括安装 Ubuntu 服务器、安装 Apache 服务器、创建 SVN 服务器、配置 Apache 服务器、设置 SVN 权限等步骤。 标题:Ubuntu 上搭建 SVN 服务器全攻略 描述:...

    ubuntu下svn+apache安装配置

    本文档将指导您在 Ubuntu 操作系统下安装和配置 SVN(Subversion)和 Apache 服务器。 一、准备源码包 在开始安装之前,需要下载以下三个源码包: 1. Subversion 1.6.17:...

    ubuntu linux 配置svn+apache+ssl

    【创建SVN服务器】 4.1 安装SVN 搜索并安装subversion和subversion-tools软件包。安装完成后,可以继续接下来的步骤。 4.2 增加组 创建名为"subversion"的组,并将"administrator"和"Apollo-data"(Apache的运行...

    svn+ldap+sasl认证(svn通过ldap用户进行认证登陆)

    在实现 svn+ldap+sasl 认证时,需要安装 ldap 服务器和配置 ldap 服务,然后在 svn 服务器中配置 sasl 认证协议,使用 ldap 服务器进行用户认证。下面是实现 svn+ldap+sasl 认证的步骤: 1. 安装 ldap 服务器 首先...

    svn 服务器+sasl认证在ubuntu 10.04安装文档

    ### SVN服务器+SASL认证在Ubuntu 10.04上的安装与配置 #### 安装Subversion(SVN) 1. **安装Subversion:** 首先确保Ubuntu 10.04系统已安装Subversion。可以使用`sudo apt-get install subversion`命令进行安装...

    ubuntu下Apache2+Svn详细配置

    * `conf`:Svn 服务器配置文件 * `db`:版本库数据库 * `locks`:版本库锁文件 * `format`:版本库格式文件 * `readme.txt`:版本库说明文件 配置 Svn 服务器 首先,我们需要编辑 `project/conf/svnserve.conf` ...

Global site tag (gtag.js) - Google Analytics