Installation of SVN under the Linux system

Source: Internet
Author: User

    1. About SVN

Subversion (SVN) is an open source version control system, which means that subversion manages data that changes over time. This data is placed in a central data archive (repository). This archive is much like an ordinary file server, but it remembers every change in the file. You can then restore the file to the old version, or browse the history of the document.

    1. Some of the concepts in SVN:

(1) Repository (source code base)

Where source code is stored uniformly

(2) Checkout (extract)

When you have no source code on your hands, you need to checkout a copy from Repository.

(3) Commit (Submit)

When you've changed the code, you'll need to commit to repository.

(4) Update (updated)

When you have checkout a source code, update you can be synchronized with the source code on the repository, you will have the latest changes

    1. Client software

(1) Commonly used client software under Windows TORTOISESVN. It is a free open source client. : http://tortoisesvn.net/downloads.html

(2) Like MyEclipse, there are also some SVN plugins.

    1. Server-side Software Installation

The Subversion server does not require Apache, but Apache can be used, depending on the situation.
1, if only through file://or svn://to access, then do not need Apache, only install SVN, use Svnserve as a service.

2. If you want to build a repository server that can be accessed by http://or https://, you will need to use Apache.

(1) Install an SVN server that does not support Apache via Yum

Install SVN software

[[Email protected] ~] #yum-y install Subversion

To verify the installed version:

[[Email protected] ~] #svnserve--version

Svnserve,version 1.6.11 (r934486)

Compiledmar 6 2014, 10:49:10

Create SVN repository Directory

[[email protected]/] #mkdir-P/var/svn/svnrepos

To create a version library

[[email protected]/] #svnadmin Create/var/svn/svnrepos

After executing the above command, the following files are generated in the/var/svn/svnrepos directory:

[[email protected]/] #cd/var/svn/svnrepos/

[[Email protected]svnrepos]# ls-l

Total 24

Drwxr-xr-x. 2root root 4096 Jul 16:39 conf

Drwxr-sr-x. 6root root 4096 Jul 16:52 db

-r--r--r--. 1root root 2 Jul 16:24 format

Drwxr-xr-x. 2root root 4096 Jul 16:24 hooks

Drwxr-xr-x. 2root root 4096 Jul 16:24 locks

-rw-r--r--. 1root Root 229 Jul 16:24 README.txt

[Email protected]conf]# pwd

/var/svn/svnrepos/conf

[Email protected]conf]# ls

Authz passwd svnserve.conf

Where the Conf folder has 3 files, the role is

Svnserve.conf SVN service configuration file

PASSWD User name password file

Authz Permissions Profile

svnserve.conf file, the file configuration entry is divided into the following 5 items:

Anon-access: Controls the permissions of non-authenticated users to access the repository.

Auth-access: Controls the permissions of the authentication user to access the repository.

PASSWORD-DB: Specifies the user name password file name.

AUTHZ-DB: Specifies the permission profile file name through which path-based access control can be implemented.

Realm: Specifies the authentication domain for the repository, which is the name of the authentication domain that is prompted at logon. If the authentication domain of the two repositories is the same, it is recommended to use the same username password data file

VI svnserve.conf

Open a few notes below:

Anon-access = Read #匿名用户可读

auth-access = Write #授权用户可写

Password-db = passwd #使用哪个文件作为账号文件

Authz-db = Authz #使用哪个文件作为权限文件

Realm =/var/svn/svnrepos # certified space name, repository directory

passwd files for setting up accounts and passwords

Add users and passwords to the [users] block in the format: Account number = password, such as Czb=czb

VI passwd

[Users]

# Harry = Harryssecret

# sally = Sallyssecret

Czb=czb

Authz file to set permissions

VI Authz

[/]

Czb=rw

This means that the CZB user has permission to read or write to the root directory.

Start the SVN repository

Svnserve–d–r/var/svn/svnrepos

(2) Install the SVN server that supports Apache through the source code method

This test server system is: CentOS 6.5 x86_64 ip:192.168.137.138

The package is as follows:

Apr-1.5.1.tar.gz

Apr-util-1.5.3.tar.gz

Httpd-2.2.27.tar.gz

Subversion-1.7.17.tar.gz

1. Install the relevant installation package

[Email protected] ~]# yum-y install gcc OpenSSL openssl-devel zlibzlib-devel

2. Installing apr-1.5.1

[Email protected] ~]# tar zxvf apr-1.5.1.tar.gz

[Email protected] ~]# CD apr-1.5.1

[Email protected] apr-1.5.1]#./configure

[[email protected] apr-1.5.1]# make && make install

[Email protected] apr-1.5.1]# CD.

3. Installing apr-util-1.5.3

[Email protected] ~]# tar zxvf apr-util-1.5.3.tar.gz

[Email protected] ~]# CD apr-util-1.5.3

[Email protected] apr-util-1.5.3]#/configure--with-apr=/usr/local/apr/

[[email protected] apr-util-1.5.3]# make && make install

[Email protected] apr-util-1.5.3]# CD.

4. Installing httpd-2.2.27

[Email protected] ~]# tar zxvf httpd-2.2.27.tar.gz

[Email protected] ~]# CD httpd-2.2.27

[Email protected] httpd-2.2.27]#/configure \

--prefix=/usr/local/apache \

--with-apr=/usr/local/apr/bin/apr-1-config \

--with-apr-util=/usr/local/apr/bin/apu-1-config \

--ENABLE-MODULES=SO \

--ENABLE-DAV \

--enable-maintainer-mode \

--enable-rewrite

[[Email protected]httpd-2.2.27]# make && make install

5. Installing subversion-1.7.17

[Email protected] ~]# TARZXVF subversion-1.7.17.tar.gz

[Email protected] ~]# cdsubversion-1.7.17

[email protected]subversion-1.7.17]#./configure \

--prefix=/usr/local/svn\

--with-apxs=/usr/local/apache/bin/apxs\

--with-apr=/usr/local/apr/bin/apr-1-config\

--with-apr-util=/usr/local/apr/bin/apu-1-config\

--WITH-SSL \

--with-zlib \

--enable-maintainer-mode

[[Email protected]subversion-1.7.17]# make && make install

Confirm that the installation is successful

[Email protected]subversion-1.7.17]#/usr/local/svn/bin/svnserve--version

Svnserve,version 1.7.17 (r1591372)

Compiled Jul 252014, 22:49:59

To see if the module was successfully installed

[[Email protected]modules]# ls/usr/local/apache/modules/

Httpd.exp mod_authz_svn.so mod_dav_svn.so mod_dontdothat.so

6. Build the Repository

[[Email protected] ~] #mkdir-P/svn/project/www

[Email protected] ~]#/usr/local/svn/bin/svnadmin create/svn/project/www

See if the build was successful

[Email protected] ~]# ls/svn/project/www/

Conf db format Hooks Locks README.txt

7. Modify/svn/project

[Email protected]~] #chown-R apache:apache/svn/project

8. Configure Apache to support SVN

[Email protected] ~]# vi/usr/local/apache/conf/httpd.conf

Finally add the following code:

<Location/svn>

DAV SVN

Svnparentpath/svn/project

AuthType Basic

AuthName "Hello Welcome to Here"

authuserfile/svn/passwd

Authzsvnaccessfile/svn/auth.conf

Requirevalid-user

</Location>

Loadmoduledav_svn_module modules/mod_dav_svn.so

Loadmoduleauthz_svn_module modules/mod_authz_svn.so

User Daemon

Group Daemon

Revision changed to

User Apache

Group Apache

Add to

#ServerNamewww. example.com:80

Servername192.168.137.138:80 #此ip为服务器IP地址

Launch Apache

[[email protected] ~]#/usr/local/apache/bin/apachectl-k start

Open browser access http://192.168.137.138/svn/www prompt for user name password

9. Configure the SVN permissions configuration (authz.conf configuration)

1) Add User:

[Email protected] ~]#/usr/local/apache/bin/htpasswd-c/svn/passwd CZB

New Password:

Re-type NewPassword:

Adding passwordfor User Czb

This time the establishment of an account for CZB, the password is also CZB account

The second time the user can add no parameter-C

[Email protected] ~]#/USR/LOCAL/APACHE/BIN/HTPASSWD/SVN/PASSWD test

New Password:

Re-type NewPassword:

Adding passwordfor User Test

Set up an account test with a password of test

2) Permission assignment:

[Email protected] ~]# vi/svn/auth.conf

[Groups]/* This indicates group settings

Admin=czb,test/* This represents the members of the admin group Czb,test

DEVELOP=U1,U2/* This represents a member of the Develop group U1,U2

[www:/]/* This indicates that access rights under the root directory of the repository www

CZB = RW/*www Warehouse CZB user has read and write permissions

Test = r/* WWW warehouse test user with Read permission only

@develop =RW/* This means that members of the group develop have read and write access

[/]/* This is indicated in the root directory of all warehouses

* = R/* This indicates that all users have read access

Note: When editing the authz.conf file, all lines must be written to the head, there can be no indentation, or it will be an error: "Accessdenied: ' Czb '", the contents can be added according to their own needs

10. Restart the Apache service and start the SVN service

Restart Apache Service

[Email protected] ~]#/usr/local/apache/bin/apachectl-k restart

Start SVN service

[Email protected] ~]#/usr/local/svn/bin/svnserve-d-r/svn/project/www

Installation of SVN under the Linux system

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.