Build SVN Service
First, SVN Introduction
svn Yes subversion SVN server has 2 ( For example : SVN://XXX.COM/XXX) and with the help of apache ( Span style= "font-family: Arial" > For example :http://svn.xxx.com/xxx) run. Both ways have pros and cons, users can choose their own.
SVN There are also storage version data 2 type of method: BDB ( a transaction-safe table type ) and the FSFS ( A storage system that does not require a database ) . Because The BDB mode is likely to lock the data when the server is interrupted, it is safer to FSFS the way.
Second, the system environment
1 , the operating system is RHEL6.4 x86_64 , to minimize the installation, turn off the firewall and Sleinux
2 , software download
wget http://mirrors.hust.edu.cn/apache/subversion/subversion-1.9.2.tar.gz
wget http://subversion.tigris.org/downloads/subversion-deps-1.6.9.tar.gz
Third, installation SVN
1 , and see if you have installed SVN Tools
# Rpm-qa | grep subversion
If the server is already installed, you do not need to install it, and if it is not installed you can do a completely new installation, it is decided to install a new installation, uninstall the system
#yum –y Remove SVN
2 , first detection system has not installed SSL
# Find/-name Opensslv.h
If it is not found, execute the following command to install:
# yum-y Install OpenSSL Openssl-devel
after installation, use Find/-name opensslv.h command to find opensslv.h the directory in which the following –with-openssl= the path behind
# Find/-name Opensslv.h
/usr/include/openssl/opensslv.h
3 , installation of dependent packages and decompression SVN installation Files
① # tar XF apr-1.5.1.tar.gz
# CD apr-1.5.1
#./configure--PREFIX=/USR/LOCAL/APR
# make
# make Install
② # tar XF apr-util-1.5.4.tar.gz
# CD apr-util-1.5.4
#./configure--prefix=/usr/local/apr-util--with-apr=/usr/local/apr/
# make
# make Install
③ # tar XF subversion-deps-1.6.9.tar.gz
# Tar XF subversion-1.9.2.tar.gz
# CD subversion-1.9.2
#./configure--PREFIX=/USR/LOCAL/SVN--with-apr=/usr/local/apr--with-apr-util=/usr/local/apr-util/
error prompt to install SQLite , so first install SQLite
# Tar XF sqlite-autoconf-3090100.tar.gz
# CD SQLITE-AUTOCONF-3090100
#./configure--prefix=/usr/local/sqlite
#make
#make Install
Continue compiling Subversion
#./configure--prefix=/usr/local/svn--with-apr=/usr/local/apr--with-apr-util=/usr/local/apr-util/--with-sqlite= /usr/local/sqlite/
#make
#make Install
4 , the SVN related commands to the environment variable
# echo "Export path= $PATH:/uar/local/svn/bin" >>/etc/profile
# Source/etc/profile
5 , Test SVN whether the installation was successful
#svnserve –version
Iv. Configuration SVN
1 , establish SVN the root directory
# MKDIR/SVN
2 , build a product warehouse
# Mkdir/svn/tshop
# svnadmin create/svn/tshop/
If your research and development center has multiple product groups, each product group can create a SVN Warehouse
# cd/svn/tshop/
# mkdir Item1
# mkdir ITEM2
3 , modifying the version configuration library file
# vim/svn/tshop/conf/svnserve.conf
[General]
anon-access = None # Note This must be set, otherwise all users can access it without a password
auth-access = Write
Password-db = passwd
Authz-db = Authz
Realm = Tshop
Other configurations do not need to be modified and remain default
changes to the user profile are effective immediately without restarting SVN
4 , start Setup passwd User account Information
# VIM/SVN/TSHOP/CONF/PASSWD
[Users]
WDD = Wdd
Jack = Jack
Add users and passwords below, one group per line username = password
5 , start Setup Authz. User access Rights
# Vim/svn/tshop/conf/authz
[Groups]
DevTeam = Wdd, Jack
[/]
WDD = RW
Jack =
[Tshop:/item1]
@devteam = RW
Jack =
[TSHOP:/ITEM2]
@devteam = RW
Jack = r
Of these, 1 user groups can contain 1 or more users, separated by commas between users.
Description
DevTeam = Wdd, Jack #devteam The project group consists of two users Wdd,jack
[/]
WDD = RW #wdd Read and write access to the root directory
Jack = #jack does not have any permissions on the root directory
Permissions for #如果需要配置item1, ITEM2 projects, as long as these two items are required under the Tshop warehouse
#如果没有的话, Tshop will not be able to access
[Tshop:/item1] #对tshop仓库item1项目进行权限控制
@devteam = RW #控制 devteam Group has read and write access to the ITEM1 project
Jack = #限制 Jack All rights, other users have read and write privileges
[TSHOP:/ITEM2] Permission control #对 The ITEM2 project of the Tshop warehouse
@devteam = RW #限制 devteam Group has read and write access to the ITEM2 project
Jack = R #限制 Jack has Read permission and other users have read and write access
6 , Attention
* The user name that appears in the permissions profile must already be defined in the user profile.
* Changes to the permissions profile take effect immediately and do not have to restart SVN.
User group format:
/colgroup>
1 2 3 4 5 6 7 |
[groups] =, Where 1 user groups can contain 1 or more users, separated by commas. Repository directory format: [< repository >:/project/directory] @< user Group Name > = < permissions; < user name > = < permissions; |
Where the box number can be written in several ways:
[/], which indicates the root directory and the following, the root directory is specified at svnserve startup, we specify as/SVN,[/] means to set permissions on all repository.
[tshop:/] means setting permissions for the repository tshop;
[TSHOP:/ABC] means setting permissions on the ABC project in the Repository tshop;
[TSHOP:/ABC/AAA] means setting permissions on the AAA directory of the ABC project in the Repository tshop;
A permission principal can be a user group, user, or *, and the user group is preceded by @,* to represent all users.
Permissions can be W, R, WR, and NULL, and NULL indicates no permissions.
7 , establish a startup SVN of users
# useradd SVN # Follow the prompts to set a password for the user svn
# Passwdd SVN
# chown-r svn:svn/svn/# allows user svn access to Repository
8 , start SVN :
Way one: svnserve-d-r/svn/#默认的启动端口号为3690
Way two: Su–svn-c "Svnserve-d–listen-port 9999-r/svn/"
which
SU–SVN means to start svn as the user svn;
-d means running in daemon mode (background run);
–listen-port 9999 means using 9999 ports, which you can replace with the ports you need. Note, however, that using a port under 1024 requires root access;
-R/OPT/SVN specifies that the root directory is/SVN.
9, check whether to start
# NETSTAT-TUNLP | grep SVN
10. Add SVN to boot
# echo "/usr/local/svn/bin/svnserve-d-r/svn" >>/etc/rc.d/rc.local
11. If you want to stop SVN, use the following command:
Killall Svnserve
12. If you want to use SVN as a service:
Create a new file named SVN in the/etc/rc.d/init.d/directory
and set the permissions to 755:chmod 755/ETC/RC.D/INIT.D/SVN
To edit the svn file: VI/ETC/RC.D/INIT.D/SVN, add the following code:
#!/bin/bash
# Build Thisfile IN/ETC/RC.D/INIT.D/SVN
Svn_home=/svn
if [!-F "/usr/local/svn/bin/svnserve"]
Then
echo "Svnserver startup:cannot start"
Exit
Fi
Case "$" in
Start
echo "Starting Svnserve ..."
/usr/local/svn/bin/svnserve-d-R $SVN _home
echo "finished!"
;;
Stop
echo "stoping svnserve ..."
Killall Svnserve
echo "finished!"
;;
Restart
$ stop
$ start
;;
*)
echo "USAGE:SVN {start | Stop | Restart} "
Exit 1
Esac
You can then start SVN with service svn start (restart/stop).
There are many ways to access SVN through the web, see Configuring WEBSVN or configuring Bssvnbrowser methods
5. Client Access
1. Download the installation file
Window 32-bit download: Tortoisesvn-1.9.2.26806-win32-svn-1.9.2.msi
Window 64-bit download: Tortoisesvn-1.9.2.26806-x64-svn-1.9.2.msi
2. Access through the client
The address is as follows:
svn://{your-server-ip}:9999/tshop/or svn://{your-server-ip}:3690/tshop/
Attention:
Do not access in the browser through HTTP, the following address:
http://{your-server-ip}:9999/tshop/or http://{your-server-ip}:3690/tshop/
That's certainly not possible, because there are no HTTP-configured services, with a separate SVN server installed
Build SVN Services