×
Community Blog Deploy SVN by Using svnserve

Deploy SVN by Using svnserve

This article describes how to use svnserve to deploy Apache Subversion (SVN).

By Alibaba Cloud ECS Team

Prerequisites

  • An Alibaba Cloud account is created. To create an Alibaba Cloud account, go to the Sign up to Alibaba Cloud page.
  • An Elastic Compute Service (ECS) instance of the ecs.g6.large instance type is created and runs a CentOS operating system. For information about how to create an ECS instance, see Creation methods.
  • Inbound rules are added to the security groups of the instance to allow traffic on port 3690, which is the default port of SVN. For more information, see Add a security group rule.

Background Information

In this article, the following software versions are used to manually deploy SVN. Operations may vary based on your software versions.

  • Operating system: CentOS 7.2 64-bit public image
  • SVN: 1.7.14

Procedure

  • Step 1: Install SVN
  • Step 2: Configure SVN
  • Step 3: Use a Windows client to test SVN

Step 1: Install SVN

1.  Connect to a Linux instance by using a password.

2.  Run the following command to install SVN:

yum install subversion

3.  Run the following command to check the SVN version:

svnserve --version

1

Step 2: Configure SVN

1.  Run the following command to create a root directory for an SVN repository:

mkdir /var/svn

2.  Run the following commands in sequence to create an SVN repository.

cd /var/svn
svnadmin create /var/svn/svnrepos

3.  Run the following commands in sequence to check the files that are automatically generated in the SVN repository:

cd svnrepos
ls

2

The following table describes the SVN directories and files.

Directory and file Description
db Stores all version control data files.
hooks Stores hook scripts.
locks The client used to track access to the SVN repository.
format The text file that contains a single integer value. The value indicates the version number of the current SVN repository.
conf The configuration file of the SVN repository, which stores the usernames and permissions for accessing the repository.

4.  Configure the username and password of the SVN repository.

a) Run the cd conf/ command.
b) Run the vi passwd command to open the configuration file.
c) Press the I key to enter the edit mode.
d) Move the pointer over [users] and add the username and password.

Note: Add the username and password in the following format: username = password. Example: userTest = passWDTest, as shown in the following figure. You must add a space before and after the equal sign (=).

3

e) Press the Esc key to exit the edit mode and enter :wq to save and close the file.

5.  Configure the read and write permissions for the account.

a) Run the vi authz command to open the access control file.
b) Press the I key to enter the edit mode.
c) Move the pointer over the end of the file and add the following code. In the code, userTest specifies the username, r specifies the read permissions, and w specifies the write permissions.

[/]
userTest=rw

4

d) Press the Esc key to exit the edit mode and enter :wq to save and close the file.

6.  Modify the configurations of SVN.

Run the vi svnserve.conf command to open the configuration file of SVN.

Press the I key to enter the edit mode.

Move the pointer over the following lines and delete the number sign (#) and space from the beginning of each line.

Note: Lines cannot start with a space. You must add a space before and after the equal sign (=).

anon-access = read # Grant read permissions to anonymous users. You can also set anon-access to none to deny access by anonymous users. If you set anon-access to none, the operation dates in the SVN log can be shown properly.
auth-access = write # Grant write permissions.
password-db = passwd # Specify the password database file.
authz-db = authz # Specify the file that stores the authorization rules for path-based access control.
realm = /var/svn/svnrepos # Specify the authorization realm of the SVN repository.

5

d) Press the Esc key to exit the edit mode and enter :wq to save and close the file.

7.  Run the following command to start the SVN repository:

The absolute path to the SVN repository is specified in the following example command:

svnserve -d -r /var/svn/svnrepos/

Note: You can run the killall svnserve command to stop SVN.

8.  Run the ps -ef |grep svn command to check whether SVN is started.

A command output similar to the following one indicates that SVN is started.Check the status of SVN

6

Step 3: Use a Windows client to test SVN

1.Download and install the TortoiseSVN client on your computer.

  1. Right-click the blank area in the on-premises project folder. In this example, the project folder is C:Test.
  2. Select SVN Checkout... from the shortcut menu.
  3. Configure the following settings and click OK:
  • In the URL of repository: field, enter the URL of the SVN repository from which to check out a working copy. In these examples, SVN is started by using the svnrepos repository and svnserve works only for the svnrepos repository. The URL of the SVN repository is in the format of svn://<Public IP address of the instance>.

Note: If SVN is started in the upper directory of the SVN repository, the name of the SVN repository must be added to the URL that is checked out from SVN.

  • Set the Checkout directory: field. In this example, the C:Test directory is used.

Note: The first time you log on to SVN, you must enter the username and password that you have configured in the passwd file.

0 1 0
Share on

Alibaba Cloud Community

1,050 posts | 257 followers

You may also like

Comments

Alibaba Cloud Community

1,050 posts | 257 followers

Related Products