UbuntuSubVersion service installation settings

Source: Internet
Author: User
Tags svn update
UbuntuSubVersion service installation settings-Linux Enterprise Application-Linux server application information. For details, refer to the following section. 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.

2. 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. You can use sudo and you intend to use Subversion.

We assume that you may need to use all possible methods to access the SVN File Repository. We also think that you have configured your/etc/apt/sources. list file.

3. 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.

4. Installation

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 cannot solve these problems, you can seek support from the Ubuntu website, Wiki, forum, or email list.

5. 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.

5.1. Create an 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. In typical cases, you should create a group named "Subversion" to own the directory where the file warehouse 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.

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

$ Sudo chmod-R g + rws myproject

The last command grants the group members the corresponding permissions on all files added to the file warehouse.

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

$ Sudo svnadmin create/home/svn/myproject

6. 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 online ebook "Use Subversion for version control.

6.1. directly access the file Repository (file ://)

This is the simplest of all access methods. It does not need to run any SVN service in advance. This access method is used to access the local SVN File Repository. Syntax:

$ Svn co file: // home/svn/myproject

Or

$ Svn co file: // localhost/home/svn/myproject

Note: If you are not sure about the host name, you must use three slashes (//). If you specify the Host Name, you must use two slashes (//).

The access permission to the file warehouse is based on the permission of the file system. If the user has read/write permissions, he/she can check out/submit the modifications. If you set a group as described above, you can simply add a user to the "subversion" group so that it has the permission to check out and submit.

6.2. Access through WebDAV protocol (http ://)

To access the SVN File Repository through the WebDAV protocol, you must configure your Apache 2 Web server. You must add the following code snippet to your/etc/apach2/apache2.conf file:

DAV svn

SVNPath/home/svn/myproject

AuthType Basic

AuthName "myproject subversion repository"

AuthUserFile/etc/subversion/passwd

Require valid-user

When you add the preceding content, you must restart the Apache 2 Web server. Enter the following command:

Sudo/etc/init. d/apache2 restart

Next, you need to create the/etc/subversion/passwd file, which contains the details of user authorization. To add a user, run the following command:

Sudo htpasswd2/etc/subversion/passwd user_name

It will prompt you to enter the password. When you enter the password, the user will be created. You can use the following command to access the File Repository:

$ Svn co http: // hostname/svn/myproject -- username user_name

It prompts you to enter the password. You must enter the password you set using htpasswd2. After verification, the project file is checked out.

Warning the password is transmitted in plain text. If you are worried about password leakage, we recommend that you use SSL encryption. For more information, see the next section.

6.3. access through the WebDAV protocol with Secure Sockets (SSL) (https ://)

Accessing the SVN File Repository (https: //) through the SSL-encrypted WebDAV protocol is very similar to the content described in the previous section, except that you must set a digital certificate for your Apache 2 Web server.

You can install digital signatures issued by Verisign or your own digital signatures.

Assume that you have installed and configured the corresponding Digital Certificate for the Apache 2 Web server. Visit the SVN File Repository as described in the previous section. Do not forget to change http: // to https ://. Almost identical!

6.4. access through the built-in protocol (svn ://)

When you create a SVN File Repository, you can modify/home/svn/myproject/conf/svnserve. conf to configure its access control.

For example, you can cancel the following annotator to set the authorization mechanism:

# [General]

# Password-db = passwd

Now, you can maintain the user list in the "passwd" file. Edit the "passwd" file in the same directory and add new users. Syntax:

Username = password

For more information, see this file.

Now, you can run svnserver locally or remotely through svn: // when SVN is used, you can run svnserve. The syntax is as follows:

$ Svnserve-d -- foreground-r/home/svn

#-D -- daemon mode

# -- Foreground -- run in foreground (useful for debugging)

#-R -- root of directory to serve

For more information, enter:

$ Svnserve -- help

When you execute this command, SVN starts to listen to the default port (3690 ). You can use the following command to access the File Repository:

$ Svn co svn: // hostname/myproject -- username user_name

The server-based configuration requires a password. Once the verification is passed, the code in the File Repository is checked out.

To synchronize the file warehouse and local copy, you can execute the update sub-command. The syntax is as follows:

$ Cd project_dir

$ Svn update

To learn more about SVN sub-commands, refer to the manual. For example, to learn about the co (checkout) command, execute:

$ Svn co help

6.5. access through the built-in protocol with secure socket (SSL) (svn + ssh ://)

The configuration and server process are the same as described in the previous section. Assume that you have run the "svnserve" command.

We also assume that you have run the ssh service and allow access. To verify this, try logging on to your computer using ssh. If you can log on, it will be done. If not, resolve it before performing the following steps.

Svn + ssh: // The protocol uses SSL encryption to access the SVN File Repository. As you know, data transmission is encrypted. To access such a File Repository, enter:

$ Svn co svn + ssh: // hostname/home/svn/myproject -- username user_name

Note: In this mode, you must use the full path (/home/svn/myproject) to access the SVN File Repository.

The server-based configuration requires a password. You must enter the password you used to log on to the ssh service. Once the verification is successful, the code in the File Repository is checked out.

You should also refer to SVN book for details about svn + ssh: // protocol.

7. References

Setting up Apache on Ubuntu

SVN Home page

SVN Book

Apache 2 Documentation

Mod-SSL

Apache-SSL
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.