Install and configure Subversion on Ubuntu

Source: Internet
Author: User
Environment: Ubuntu10.10 objective: to access Subversion locally or through the Web. The most common configuration mode of SVN is integration with Apache, so that SVN can provide services through the WebDev protocol. The main benefits include: using Apache to penetrate the firewall through HTTP to facilitate use in the Internet environment, providing directory version control, and comparing files in pure binary format. 1. Install Subversionapt-getinstallsubversion

Environment: Ubuntu10.10

Objective: To access Subversion locally or through the Web.

The most common configuration mode of SVN is integration with Apache, so that SVN can provide services through the WebDev protocol. The main benefits include: using Apache to penetrate the firewall through HTTP to facilitate use in the Internet environment, providing directory version control, and comparing files in pure binary format.

1. Install Subversion

apt-get install subversionapt-get install subversion-tools

2. install Apache

apt-get install apache2apt-get install libapache2-svn

3. Integration of Apache and Subversion

View the/etc/apache2/mod-enabled/dav_svn.load file. The dynamic libraries mod_dav_svn.so and mod_authz_svn.so indicate that apache has loaded the Subversion access control module. If not, add it manually.

Edit the/etc/apache2/mod-enabled/dav_svn.conf file and add the following content at the end:

 
  DAV svnSVNParentPath /home/svnAuthType BasicAuthName "Subversion Repository"AuthUserFile /home/svn/passwd.confAuthzSVNAccessFile /home/svn/authz.confRequire valid-user
 

Run the touch/home/svn/passwd. conf and touch/home/svn/authz. conf commands to create the two files that do not exist.

   The available URL of the Subversion version is http: // SubversionServerIP/svn.

DAV SVNTell Apache which module responds to the URL request. Here it is the Subversion module.

SVNParentPath/Home/svn tells Subversion that the version library to be viewed is under/home/svn. If you do not want to set each project separately, you can store all projects in the same resource library directory and use the SVNParentPath command to specify the path for storing all projects. OtherwiseSVNPath

SVNPathUse this option to specify the path of a single version library, but do not use this option in multiple version libraries.

AuthType BasicThe authentication type is basic authentication, that is, the user name and password.

AuthName"Subversion repository" Certification name. A dialog box titled Subversion repository is displayed on the browser interface.

AuthUserFile/Home/svn/passwd. conf specifies the authentication password file used, that is, the file used to access the version library user, which is generated using the apache htpasswd command

AuthzSVNAccessFile/Home/svn/authz. conf: file used to set the permission to access the version Library

Require valid-userUsers must be authenticated, that is, anonymous access is not allowed. Without this statement, only the first user can access the new database.

In addition,SVNIndexXSLT "/svnindex. xsl"Use it to make your browser look better.

4. After adding the preceding content, you must restart the Apache2 HTTP server.

/etc/init.d/apache2 restart

5. Create a version library using Subversion

mkdir /home/svnmkdir /home/svn/repossvnadmin create --fs-type fsfs /home/svn/repos

Run the command to create a version library and specify the data storage as FSFS. If you want to specify the database as Berkeley DB, replace fsfs with bdb.

If everything is normal, the command returns quickly without any feedback. A new version library is created. We can check what is in the next version library.

The configuration files of the version library are stored in the conf directory, including user access control and permission control. The dav directory is the directory provided to related Apache modules, which is currently empty; the db directory stores all version-controlled data to be managed by Subversion. Different Storage Methods (Berkeley DB or FSFS) have different directory structures, however, we generally do not need to directly modify or view the contents in this directory. The Subversion command can safely operate on this directory. In addition, the hooks directory stores the hook script and its template (a version library event trigger Program), and the locks directory stores the locked data of the Subversion version library, which is used to track clients that access the file library; the format file is a text file with only one integer in it, indicating the version number configured in the current file library.

Note: The database and database cannot be included.

We can test whether Subversion can be detected.

6. Add a project using Subversion

The Administrator must consider whether to put each project in a different version library or a Unified Version library. The Unified Version library makes it easier for administrators to upgrade and back up data. However, because the access permission control is for the entire version library, the Unified Version Library also makes it difficult to configure different access permissions for different projects. Therefore, the administrator should consider the trade-off based on the actual situation.
I will use a Unified Version library as an example to add three projects: business, develop, and project. First, create the main directory tree of the three projects according to the general layout structure of Subversion version control under a temporary directory, as shown below:

Run the svn import command to import the existing directory tree.

svn import /home/svn/tmp/ file:///home/svn/repos/ --message "init"

You can use svn list to check whether the imported project is correct:

svn list --verbose file:///home/svn/repos/

To view the latest version information, run the svnlook info command:

svnlook info /home/svn/repos/

You can also add "-- revision version number" after the command to specify the display of a specific version.

You can also use the following command to display the Specific Tree Structure of the version library. The "-- show-ids" option next to it specifies to display the modified version ID of each display element.

svnlook tree /home/svn/repos/ --show-ids
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.