Install and configure the SubVersion service in Ubuntu

Source: Internet
Author: User
Directory 1SubVersion service installation and setup 1.1 Introduction 1.2 suppose that the scope of this article is 1.3 installation 1.4 server configuration 1.5.1 create SVN repository 1.5 access method 1.6.1 direct access to the file repository (file ://) 1.6.2 access through WebDAV protocol (http: //) 1.6.3 access through WebDAV protocol with secure socket (SSL) (https: //) 1.6.4 access through built-in protocol (svn ://)

Directory
1. SubVersion service installation settings
1.1 Introduction
1.2 hypothesis
1.3 Scope of this Article
1.4 Installation
1.5 Server Configuration
1.5.1 create a SVN Repository
1.6 access method
1.6.1 direct access to the file repository (file ://)
1.6.2 access through WebDAV protocol (http ://)
1.6.3 access through the WebDAV protocol with Secure Sockets (SSL) (https ://)
1.6.4 access through the built-in protocol (svn ://)
1.6.5 access through the built-in protocol protected by the SSH tunnel (svn + ssh ://)

This document describes how to set Subversion (also known as svn) on Ubuntu ). We assume that the readers of this article are Linux users and system administrators with some experience.


Introduction

If you are still unfamiliar with Subversion, this section will give you a brief introduction to Subversion.

Subversion is an open-source version control system. With Subversion, You can reload the source code and historical version of the document. Subversion manages the version of source code in various periods. A file tree is concentrated in a file repository. This file repository is like a traditional file server, but it can remember every change in files and directories.

Hypothesis

First, we assume that you can operate Linux commands, edit files, start and stop services In Ubuntu. Of course, we also think that your Ubuntu is running and you can use

Scope of this Article

To access the SVN File Repository through HTTP, you must install and configure the Web server. Apache 2 has been proven to work well with SVN. The installation of Apache 2 is beyond the scope of this article. However, this article still involves how to configure Apache 2 to use SVN.

Similarly, to access the SVN File Repository through the HTTPS protocol, you need to install and configure the digital certificate in your Apache 2, which is not covered in this article.

Install

Fortunately, the Subversion is included in the main repository. Therefore, to install the Subversion, you only need to run the following code:

$ sudo apt-get install subversion$ sudo apt-get install libapache2-svn

If the system reports dependency errors, find the corresponding software packages and install them. If you have other problems, resolve them by yourself. If you still cannot solve these problems, you can seek support through the Ubuntu website, Wiki, forum, or email list.

Server Configuration

You must have installed the preceding software package. This section describes how to create an SVN File Repository and how to set project access permissions.

Create SVN Repository

Many locations can be placed in the Subversion File Repository, two of which are most commonly used:/usr/local/svn and/home/svn. To make it simple and clear in the following description, we assume that your Subversion File Repository is placed in/home/svn, and your project name is "myproject ".

Likewise, there are many common ways to set access permissions for a File Repository. However, this is also the most common cause of errors during the installation process, so we will provide a detailed description of this. Generally, you should create a user group named "Subversion", which is the owner of the directory where the SVN repository is located. The following is a quick operation description. For more information, see the relevant documentation for details:

  • Choose system> System Management> users and groups from the Ubuntu menu ";
  • Switch to the "Group" label;
  • Click "add group;
  • The group name is "subversion ";
  • Add yourself and "www-data" (Apache user) to the group members;
  • Click "OK" to confirm the modification and close the program.

Or use the command to complete the above functions (add a group and add users to the Group ):

sudo addgroup subversionsudo usermod -G subversion -a www-data

Alternatively, you can directly use the command to edit the group file "sudo vi/etc/group" to add groups and Members (not recommended ):

$ sudo vi /etc/group

The result looks like this.

$ cat /etc/group|grep subversionsubversion:x:1001:www-data,exp

You need to log out and then log on so that you can become a member of the subversion group, and then you can perform the Check in (also known as submitting a file) operation.

Run the following command:

$ sudo mkdir /home/svn$ cd /home/svn$ sudo mkdir myproject$ sudo chown -R root:subversion myproject

The following command is used to create an SVN File Repository:

$ sudo svnadmin create /home/svn/myproject

Grant the group members the following permissions to all new files added to the File Repository:

$ sudo chmod -R g+rws myproject

If the preceding command is run before the SVN File Repository is created, you may encounter the following error when checking in:

Can't open '/home/svn/myproject/db/txn-current-lock': Permission denied

View the permissions and user and group information of the txn-current-lock file, which should be similar:

$ ls -l /home/svn/myproject/db/txn-current-lock-rw-rwSr-- 1 root subversion  0  2009-06-18  15:33  txn-current-lock

In addition to permissions, users and their groups still encounter the above problems if they are not correct. You can run the following command again:

$ sudo chown -R root:subversion myproject
Access Method

The Subversion File Repository can be accessed (checked Out and checked Out) in many different ways-either through a local hard disk or through various network protocols. In any case, the location of the File Repository is always represented by a URL. The following table shows the access methods for different URL modes:

Mode Access Method
File :/// Direct access to the file warehouse on the local hard disk
Http :// Use the WebDAV protocol to access Apache 2 Web servers that support Subversion
Https :// Similar to http: //, SSL encryption is supported.
Svn :// Access the svnserve server through the built-in protocol
Svn + ssh :// Similar to svn: //, supports the SSH Channel


In this section, we will see how to configure SVN to make it accessible through all methods. Of course, here we will discuss the basic methods. For more advanced usage, we recommend that you read the "Use Subversion for Version Control" ebook. For more information, see http://www.linuxidc.com/linux/2011-11/47129.htm.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.