Linux SVN installation and configuration graphic tutorial

Source: Internet
Author: User
Tags tortoisesvn collabnet

Linux SVN installation and configuration graphic tutorial

Background

I have my own ECs, And I want to manage some of my learning materials through SVN. I have found many tutorials on how to build svn in Linux on the Internet, but none of them is complete, I felt that there was something or something wrong with the overall disadvantages. Later I made a comprehensive comparison and conducted the tests on multiple servers. I did the following tutorials for your reference.

The svn server can run in two ways.

1. independent server (for example, svn: // xxx.com/xxx );
2. Use apache. (For example: http://svn.xxx.com/xxx );
In order not to rely on apache, select the first method-independent svn server.
There are two ways to store version data in svn:
1. bdb;
2. fsfs.
Because the BDB method may lock data when the server is interrupted (it is vulnerable to ldap and cannot be cured), it is safer to use the FSFS method. I also choose this method.
My system environment: CentOS-6.2 + Php-5.4.3 + Nginx-1.3.0 + Mysql-5.5.25 + subversion-1.6.6

Download related software

Wget http://subversion.tigris.org/downloads/subversion-1.6.6.tar.gz
Wget http://subversion.tigris.org/downloads/subversion-deps-1.6.6.tar.gz

Edit

1. Check whether the svn tool is installed.
Command: rpm-qa | grep subversion
If the server has been installed, you do not need to install it. If not, you can perform a new installation.
2. First, check whether the system has installed SSL:
Find/-name opensslv. h
If not, run the following command for installation:
Yum install openssl
Yum install openssl-devel
After installation, run the find/-name opensslv. h command to find the directory where opensslv. h is located, that is, the path following-with-openssl =,
3. decompress the svn Installation File
Subversion-1.6.6.tar.gz
Subversion-deps-1.6.6.tar.gz
The command is as follows:

 

1
2
 
Tar zxvf subversion-1.6.6.tar.gz
Tar zxvf subversion-deps-1.6.6.tar.gz
 

Tar is the extract command, and zxvfis the marker of the tar.gz format, used to decompress files in the tar.gz format.
Decompress the package and generate the subversion-1.6.6 subdirectory. After the two packages are decompressed, they will be automatically placed in this directory without manual modification.
Enter the decompressed subdirectory cd subversion-1.6.6 for compilation.
4. Compile:

./Configure -- prefix =/usr/local/svn -- with-openssl =/usr/include/openssl
-- Without-berkeley-db

Run in svnserve mode. Therefore, apache compilation parameters are not added. Store version libraries in fsfs format without compiling berkeley-db
If the following error is reported during compilation:
No acceptable C compiler found in $ PATH
If there is no gcc library, run the following command to install gcc and then compile it:
Yum-y install gcc
If the following WARNING occurs at the end, we can ignore it directly because the BDB storage is not used.

Configure: WARNING: we have configured without BDB filesystem support
You don't seem to have Berkeley DB version 4.0.14 or newer
Installed and linked to APR-UTIL. We have created Makefiles which
Will build without the Berkeley DB back-end; your repositories will
Use FSFS as the default back-end. You can find the latest version
Berkeley DB here:
Http://www.sleepycat.com/download/index.shtml

Install

Make
Make install
If the following error occurs in make install:
/Home/upload/subversion-1.6.6/subversion/svnversion /. libs/lt-svnversion: error while loading shared libraries: libiconv. so.2: cannot open shared object file: No such file or directory
Make: *** [revision-install] Error 127
Solution:
1. Edit the/etc/ld. so. conf file.
Vi/etc/ld. so. conf
Add the following line of code
/Usr/local/lib
2. Save and run ldconfig:
/Sbin/ldconfig
Note: ld. so. conf and ldconfig are used to maintain the dynamic link library of the system.
3. then install
Make & make install
Test whether the installation is successful

/Usr/local/svn/bin/svnserve -- version

If the following figure is displayed, svn is successfully installed:

Svnserve, version 1.6.6 (r40053)
Compiled Dec 25 2012, 13:14:38
 
Copyright (C) 2000-2009 CollabNet.
Subversion is open source software, see http://subversion.tigris.org/
This product has DES software developed by CollabNet
(Http://www.Collab.Net /).
 
The following repository back-end (FS) modules are available:
 
* Fs_fs: Module for working with a plain file (FSFS) repository.
 
Cyrus SASL authentication is available.

4. To facilitate the following operations, add svn-related commands to environment variables:
Echo "export PATH = $ PATH:/usr/local/svn/bin/">/etc/profile
Source/etc/profile

Configure svn

1. Create the SVN root directory
Mkdir-p/opt/svn/
2. Create a product warehouse
Mkdir-p/opt/svn/tshop/
Svnadmin create/opt/svn/tshop/
If your R & D center has multiple product groups, each product group can create a SVN repository.
3. Modify the version configuration Library File
Vi/opt/svn/tshop/conf/svnserve. conf
The modified file content is as follows:

### This file controls the configuration of the svnserve daemon, if you
### Use it to allow access to this repository. (If you only allow
### Access through http: and/or file: URLs, then this file is
### Irrelevant .)
 
### Visit http://subversion.tigris.org/for more information.
 
[General]
### These options control access to the repository for unauthenticated
### And authenticated users. Valid values are "write", "read ",
### And "none". The sample settings below are the defaults.
Anon-access = none # note that this parameter must be set. Otherwise, all users can access the service without a password.
Auth-access = write
### The password-db option controls the location of the password
### Database file. Unless you specify a path starting with /,
### The file's location is relative to the directory containing
### This configuration file.
### If SASL is enabled (see below), this file will NOT be used.
### Uncomment the line below to use the default password file.
Password-db = passwd
### The authz-db option controls the location of the authorization
### Rules for path-based access control. Unless you specify a path
### Starting with a/, the file's location is relative to
### Directory containing this file. If you don't specify
### Authz-db, no path-based access control is done.
### Uncomment the line below to use the default authorization file.
Authz-db = authz
### This option specifies the authentication realm of the repository.
### If two repositories have the same authentication realm, they shocould
### Have the same password database, and vice versa. The default realm
### Is repository's uuid.
Realm = tshop
 
[Sasl]
### This option specifies whether you want to use the Cyrus SASL
### Library for authentication. Default is false.
### This section will be ignored if svnserve is not built with Cyrus
### SASL support; to check, run 'svnserve -- version' and look for a line
### Reading 'cyrus SASL authentication is available .'
# Use-sasl = true
### These options specify the desired strength of the security layer
### That you want SASL to provide. 0 means no encryption, 1 means
### Integrity-checking only, values larger than 1 are correlated
### To the cipher key length for encryption (e.g. 128 means 128-bit
### Encryption). The values below are the defaults.
# Min-encryption = 0
# Max-encryption = 256

Modifications to user configuration files take effect immediately without restarting svn.
4. Start setting passwd User Account Information

Vi/data/svn/repos/conf/passwd
The modified content is as follows:
### This file is an example password file for svnserve.
### Its format is similar to that of svnserve. conf. As shown in
### Example below it contains one section labeled [users].
### The name and password for each user follow, one account per line.
### Add the user and password below. Each row contains a set of usernames = password
[Users]
# Harry = harryssecret
# Sally = sallyssecret
###========== The following is the user information I have added ====== #######
Iitshare = password1
Itblood = password2

5. Set authz. User access permissions.
Vi/data/svn/repos/conf/authz
The modified content is as follows:

### This file is an example authorization file for svnserve.
### Its format is identical to that of mod_authz_svn authorization
### Files.
### As shown below each section defines authorizations for the path and
### (Optional) repository specified by the section name.
### The authorizations follow. An authorization line can refer:
###-A single user,
###-A group of users defined in a special [groups] section,
###-An alias defined in a special [aliases] section,
###-All authenticated users, using the '$ authenticated' token,
###-Only anonymous users, using the '$ anonymous' token,
###-Anyone, using the '*' wildcard.
###
### A match can be inverted by prefixing the rule '~ '. Rules can
### Grant read ('R') access, read-write ('rw ') access, or no access
###('').
 
[Aliases]
# Joe =/C = XZ/ST = Dessert/L = Snake City/O = Snake Oil,
Ltd./OU = Research Institute/CN = Joe Average
 
# [Groups]
# Harry_and_sally = harry, sally
# Harry_sally_and_joe = harry, sally, & joe
 
# [/Foo/bar]
# Harry = rw
# & Joe = r
# * =
 
# [Repository:/baz/fuz]
# @ Harry_and_sally = rw
# * = R
 
### -------------------- The newly added ------------------------###
### Block the [groups] That has been dropped because
 
[Groups]
Devteam = iitshare, itblood # The devteam project team includes two users: iitshare and itblood.
 
[/]
Iitshare = rw
Itblood =
[Tshop:/tb2c]
@ Devteam = rw
Itblood =
 
[Tshop:/tb2b2c]
@ Devteam = rw
Itblood = r
 

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

Devteam = iitshare, itblood # The devteam project team includes two users: iitshare and itblood.
[/]
Iitshare = rw # iitshare has read and write permissions on the root directory
Itblood = # itblood does not have any permissions on the root directory
#### If you need to configure permissions for tb2c and tb2b2c projects, the prerequisite is that the tshop repository needs to have these two projects
#### If not, tshop cannot be accessed
[Tshop:/tb2c] # permission control for the tb2c project of the tshop warehouse
@ Devteam = rw # control the devteam group to have read and write permissions on the tb2c Project
Itblood = # restrict all itblood permissions. Other users have read and write permissions.
[Tshop:/tb2b2c] # permission control for the tshop: warehouse tb2b2c Project
@ Devteam = rw # Restrict the devteam group to read and write tb2b2c Projects
Itblood = r # Restrict itblood to read only. Other users have read and write permissions.
 

6. Note:
* The user name displayed in the permission configuration file must be defined in the user configuration file.
* Changes to the permission configuration file take effect immediately without restarting svn.
User Group format:

[Groups]
=,
One user group can contain one or more users separated by commas.
Version library directory format:
[<Version library>:/project/directory]
@ <User group name >=< permission>
<User name >=< permission>

The box number can be written in multiple ways:
[/] Indicates the root directory and the following. The root directory is specified when svnserve is started. We specify it as/home/svndata. [/] indicates setting permissions for all vertices.
[Tshop:/] indicates setting permissions for the tshop of the version library;
[Tshop:/abc] indicates setting permissions for the abc Project in the tshop;
[Tshop:/abc/aaa] indicates the permission to set the aaa directory of the abc Project in the tshop;
The permission subject can be a user group, user, or *. The user group is preceded by @, * indicating all users.
The permission can be w, r, wr, or null. If it is null, no permission is granted.
7. Create a user to start svn
Useradd svn
Set a password for user svn as prompted
Allow user svn to access the version Library:
Chown-R svn: svn/opt/svn
8. Start svn:
Method 1: svnserve-d-r/opt/svn/# The default start port number is 3690.
Method 2: su-svn-c "svnserve-d-listen-port 9999-r/opt/svn /"
Where:
Su-svn indicates to start svn as the user svn;
-D Indicates running in daemon mode (running in the background;
-Listen-port 9999 indicates port 9999, which can be replaced with the required port. Note that the root permission is required to use ports lower than 1024;
-R/opt/svn: Specify the root directory as/opt/svn.
9. Check whether startup is enabled.
Netstat-tunlp | grep svn
If the following information is displayed, the startup is successful.
Tcp 0 0 0.0.0.0: 9999 0.0.0.0: * LISTEN 10973/svnserve
10. Add svn to startup
Edit the rc. local file: vi/etc/rc. d/rc. local
Add the following startup command:
/Usr/local/svn/bin/svnserve-d-listen-port 9999-r/opt/svn
11. To stop svn, run the following command:
Killall svnserve
12. If you want to use svn as a service:
Create a file named svn in the/etc/rc. d/init. d/directory.
Set the permission to 755: chmod 755/etc/rc. d/init. d/svn.
Edit the svn file vi/etc/rc. d/init. d/svn and add the following code:

 
#! /Bin/bash
# Build this file in/etc/rc. d/init. d/svn
# Chmod 755/etc/rc. d/init. d/svn
# Run the following command in centos to manage svn: service svn start (restart/stop)
SVN_HOME =/opt/svn
If [! -F "/usr/local/svn/bin/svnserve"]
Then
Echo "svnserver startup: cannot start"
Exit
Fi
Case "$1" in
Start)
Echo "Starting svnserve ..."
/Usr/local/svn/bin/svnserve-d -- listen-port 9999-r $ SVN_HOME
Echo "Finished! "
;;
Stop)
Echo "Stoping svnserve ..."
Killall svnserve
Echo "Finished! "
;;
Restart)
$0 stop
$0 start
;;
*)
Echo "Usage: svn {start | stop | restart }"
Exit 1
Esac
 

Then you can start svn in the service SVN start (restart/stop) mode.
There are many ways to access svn through web. Refer to configuring websvn or bsSvnBrowser.

Client Access

1. Download the Installation File
Windows 64-bit words download: TortoiseSVN-1.7.6.22632-x64-svn-1.7.4.msi
Windows 32-bit words download: TortoiseSVN-1.6.5.16974-win32-svn-1.6.5.msi
You can download a large number of downloaded files online.
2. access through the client
The address is as follows:
Svn: // {your-server-ip}: 9999/tshop/or svn: // {your-server-ip}: 3690/tshop/
Note:
Do not use http in your browser:
Http: // {your-server-ip}: 9999/tshop/or http: // {your-server-ip}: 3690/tshop/
This is definitely not acceptable because you have not configured the http service, and the independent SVN server is installed on it.

So far, the entire process of setting up SVN in Linux has ended. If you are tired of reading it, take a rest. What are the problems during installation and configuration, please leave a message and I will reply in time

Set up SVN server SVN in Ubuntu 14.04 ://

CentOS 6.2 SVN setup (YUM installation)

Deploy Apache + SVN in CentOS 6.5

Build an SVN server using Apache + SVN

Set up and use the SVN server in Windows + reset the password on the client

Install SVN in Ubuntu Server 12.04 and migrate Virtual SVN data

Build SVN service and migration method on Ubuntu Server

Subversion (SVN) Details: click here
Subversion (SVN): click here

This article permanently updates the link address:

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.