Build SVN server under CentOS

Source: Internet
Author: User

Build SVN server under CentOS

Svn can be used not only for program development, but also for many tasks, such as backup documents.

Directory [hide]
  • 1 Installation
  • 2. Create a project
  • 3. Configure SVN
    • 3.1 Add a user
    • 3.2 permission Control
  • 4. Start
  • Test in 5windows
Install

Under CentOS:

yum install -y subversion

Under Ubuntu:

sudo apt-get install subversion

Check whether the installation is successful

svnserve --version
Create a project
Mkdir-p ~ /Svn // create the svn root directory to store multiple projects, where "~" Indicates the home Directory

Create Project proj1

Mkdir-p ~ /Svn/proj1 // Where-p indicates no parent directory, create svnadmin create ~ /Svn/proj1

After the command is complete, the corresponding files and folders will be generated in the proj1 directory:

Create another project proj2

mkdir -p ~/svn/proj2svnadmin create ~/svn/proj2
Configure SVN

Copy authz and passwd under proj1/conf ~ The results in the/svn/root directory are as follows:

Add User

Vi ~ /Svn/passwd: Add an entry, such as "username = password ".

Permission Control

Used to set which users can access which directories

Vi ~ /Svn/authz, add

[Groups] admin = test1devteam1 = test2, test3 // developer group 1 devteam2 = test4 [/] @ admin = rw * = [proj1:/] @ devteam1 = rw [proj2: /] @ devteam2 = rw

Note: The user name must be defined in the "passwd" file.

One user group can contain one or more users separated by commas

* = Indicates that no one except the authorized user can access this directory.

Go to proj1/conf and configure svnserve. conf (spaces are not allowed on the left) to bring the user and permission control policy into effect.

[General] anon-access = none # Make unauthorized users unable to access auth-access = write # Make authorized users have the write permission password-db = ~ /Svn/passwd # Password File authz-db = ~ /Svn/authz # access control file

Other projects created in the future can use this configuration directly, for example:

cp ~/svn/proj1/conf/svnserve.conf  ~/svn/proj2/conf/svnserve.conf
Start
Svnserve-d-r ~ /Svn (note not ~ /Svn/proj1)

-D Indicates running in daemon mode

Svn listens to port 3690 by default. If svn is already running, you can use "-- listen-port =" to specify other ports.

svnserve -d -r ~/svn/ --listen-port 3391

In this way, the same server can run multiple svnservers.

Check Port

netstat -ntlp|grep 3690

Note: If you have modified the svn configuration, You need to restart the svn service.

# Ps-aux | grep svnserve # kill-9 ID No. //-9 indicates forced termination # svnserve-d-r ~ /Svn

Enable port 3690

/Sbin/iptables-I INPUT-p tcp -- dport 3690-j ACCEPT/etc/init. d/iptables save // save service iptables restart // restart the Firewall

You can use cat/etc/sysconfig/iptables to check whether port 3690 is successfully added.

Test in windows

TortoiseSVN needs to be installed

32-bit download: yisearch download

64-bit download: yisearch download

After the installation is complete, right-click the project to be imported. Select SVN> Import

After the import is successful:

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.