Build a Subversion server on VPS

Source: Internet
Author: User

Subversion (SVN) is a famous version control software. It is especially suitable for controlling and managing software source code through the Internet in different places. Recently, I plan to work with my colleagues to develop something, so I decided to fully explore the favorable resources of our Linode VPS and install the SVN service terminal on the VPS. In this way, we can remotely develop software through SVN.
I haven't installed the SVN server in Linux before, so I have no experience. I finally found some suitable tutorials for reference by searching online materials. Most of the tutorials on the Internet mentioned that installing the SVN server must work with the apache server. However, this can make me depressed. My Linode is based on the LNMP architecture and the Web Server is Nginx. It seems that some articles on the Internet have mentioned using Nginx to work with SVN. I planned to install another Apache server. I suddenly saw in a tutorial that the SVN server can be installed in a relatively independent way in addition to apache. So I installed it on VPS, and it was a success. Therefore, I plan to use this document as an example of how to install the Subversion server. It may also be used in the future.

First, I mentioned my server environment: Linode's VPS, installed Ubuntu's 32-bit OS, and used the LNMP one-key installation package to build a web environment. In order not to install apache or access SVN through http, you only need the client to Commit & update. Therefore, I plan to build the SVN server by installing the SVN independent server.

The following describes the installation steps:

Step 1, get the latest version of Subversion, official site address: http://subversion.apache.org
I plan to obtain and download the latest official source code by obtaining the source code and compiling and installing it. The latest version is subversion-1.6.12.
The source code package to be downloaded has two
A. subversion-1.6.12.tar.gz
B .subversion-deps-1.6.12.tar.gz this package is some of the dependent files extracted from apache, mandatory!

Step 2: Decompress the source code package and compile and install the Subversion.

View Code BASH
Tar xfvz subversion-1.6.12.tar.gz
Tar xfvz subversion-deps-1.6.12.tar.gz
Cd subversion-1.12.6
./Configure -- prefix =/usr/local/svn -- without-berkeley-db

(Note: Run in svnserve mode without adding apache compilation parameters. Store the version library in fsfs format without compiling berkeley-db. Next, compile and install the version library directly.

View Code BASH
Make & make install

After the installation, you can test whether the Subversion is correctly installed:

View Code BASH
/Usr/local/svn/bin/svnserve -- version

If the version information of Subversion is displayed, the installation is normal.

Step 3: Configure Subversion

First, determine where your source code data is stored. Here I use/usr/local/svndata to store my source code data.

View Code BASH
Mkdir/usr/local/svndata
# Create a test project directory testproject and use this directory as the repository of the project
Mkdir/usr/local/svndata/testproject
# Create a version library for testproject
/Usr/local/svn/bin/svnadmin create/usr/local/svndata/testproject

After the version library is created, go to this directory and you will find that the Subversion has generated a directory and configuration file for you to store your source code data and version control information, you don't need to worry much about this. We need to pay attention to the/conf/svnserve in this directory. conf. This file contains the version library configuration information of testproject. Use vim or nano to modify the file and add the following information:

[General]

Anon-access = none

Auth-access = write

Password-db =/usr/local/svn/conf/passwd. conf

Authz-db =/usr/local/svn/conf/authz. conf

Realm = testproject

This information includes some permission settings and SVN user name and password verification configuration information. For ease of use, I put both password-db and authz-db in svn, so that multiple version libraries can share the same password and verification information.

Next, go to/usr/local/svn to create the conf directory and create the passwd. conf and authz. conf files.

Let's take a look at passwd. conf:

[Users]

Username = password

Username2 = password2

In addition to the users tags, each row following the list corresponds to the username and password used to access SVN. the username and password are separated by equal signs in the middle. After saving them, they exit directly.

Let's take a look at the authz. conf file:

[Groups]

Admin = username, username2

[/]

@ Admin = rw

Groups indicates the user group. Here username and username2 are all set to an admin group.

[/] Indicates the root directory and the following. The root directory is specified when svnserve is started. We specify it as/usr/local/svndata, [/] means to set permissions for all version libraries. @ Admin = rw indicates that all users in the admin group have read and write permissions. For specific settings of this configuration file, go to the official website for reference.

Step 4: After all the configuration files are ready, you can start the Subversion. We do not recommend running Subversion as root for the sake of VPS security. Therefore, we need to add a Linux running account for Subversion.

View Code BASH
Useradd svn-d/home/svn-s/bin/sh
# Then, run the Subversion server as the svn user
Su-svn-c "/usr/local/svn/bin/svnserve-d -- listen-port 8888-r/usr/local/svndata"
#-D indicates that the process is running in the background and the listening port is 8888.

In this way, the Subversion server is started. To ensure security, run the following command: netstat-anp | grep svnserve. the following result is displayed: tcp 0 0 0.0.0.0: 8888 0.0.0.0: * LISTEN 13711/svnserve. After the server is started, we can access the server through the client. For example, we have installed the SVN client in win7, you can use this address to access testproject:

Svn: // {your-server-ip}: 8888/testproject/

If you find that the IP address cannot be accessed, make sure that your VPS iptables allows port 8888 to pass. For detailed configuration, refer to my previous article on iptables rule configuration.

In terms of the running effect, the Subversion server occupies a small amount of memory and feels very good.

This article also ends, and the job is closed ~~

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.