Description
SVN (subversion) runs in two ways:
One is based on Apache HTTP, HTTPS Web Access form;
There is also a stand-alone server model based on Svnserve.
SVN has two different ways of storing data: One is to store the data in the Berkeley DB Database, and the other is to store the data using a normal file FSFS.
Since the Berkeley DB approach is likely to lock data in use, it is generally recommended that the FSFS approach be more secure.
To achieve the purpose:
In Svnserve standalone server mode, use the FSFS data storage mode source code to compile the installation configuration svn server.
Specific actions:
Operating system: CentOS 6.x
Server ip:192.168.21.134
First, close SELinux
Vi/etc/selinux/config
#SELINUX =enforcing #注释掉
#SELINUXTYPE =targeted #注释掉
selinux=disabled #增加
: wq! #保存退出
Setenforce 0 #使配置立即生效
Second, open the firewall port
Standalone server mode based on Svnserve, default port is 3690
Vi/etc/sysconfig/iptables #编辑防火墙配置文件
# Firewall configuration written by System-config-firewall
# Manual Customization of this file is not recommended.
*filter
: INPUT ACCEPT [0:0]
: FORWARD ACCEPT [0:0]
: OUTPUT ACCEPT [0:0]
-A input-m state--state established,related-j ACCEPT
-A input-p icmp-j ACCEPT
-A input-i lo-j ACCEPT
-A input-m state--state new-m tcp-p TCP--dport 22-j ACCEPT
-A input-m state--state new-m tcp-p TCP--dport 3690-j ACCEPT
-A input-j REJECT--reject-with icmp-host-prohibited
-A forward-j REJECT--reject-with icmp-host-prohibited
COMMIT
: wq! #保存退出
Service iptables restart #最后重启防火墙使配置生效
Third, the installation of the compilation tool kit
Yum install apr* autoconf automake Bison cloog-ppl compat* cpp Curl curl-devel fontconfig fontconfig-devel freetype freety pe* freetype-devel gcc gcc-c++ gtk+-devel gd gettext gettext-devel glibc kernel kernel-headers keyutils keyutils-libs-deve L krb5-devel libcom_err-devel libpng* libjpeg* libsepol-devel libselinux-devel libstdc++-devel libtool libtool* libgomp L IBXML2 libxml2-devel libxpm* libtiff libtiff* libx* make MPFR ncurses* ntp OpenSSL openssl-devel patch pcre-devel perl php -common php-gd policycoreutils ppl telnet t1lib t1lib* nasm nasm* wget zlib-devel zlib unzip perl-extutils-embed
Yum Remove Apr apr-util subversion subversion-libs #删除系统中原有的svn及依赖包
Download the dependency package that SVN needs
Description: Install SVN needed package: Apr apr-util serf scons OpenSSL
Package Storage directory:/USR/LOCAL/SRC
1, Download Apr
Https://dist.apache.org/repos/dist/release/apr/apr-1.5.2.tar.gz
2, download Apr-util
Https://dist.apache.org/repos/dist/release/apr/apr-util-1.5.4.tar.gz
3, download SCons
Http://prdownloads.sourceforge.net/scons/scons-2.3.5.tar.gz
4, download OpenSSL
Http://www.openssl.org/source/openssl-1.0.1o.tar.gz
5, download serf
Http://fossies.org/linux/www/serf-1.3.8.tar.gz
6, Download SVN
Http://www.apache.org/dist/subversion/subversion-1.8.13.tar.gz
7, download sqlite-amalgamation
Http://www.sqlite.org/snapshot/sqlite-amalgamation-201506201411.zip
Five, install SVN
1. Install Apr
CD/USR/LOCAL/SRC #进入软件包存放目录
Tar zxvf apr-1.5.2.tar.gz #解压
CD apr-1.5.2 #进入安装目录
./configure--prefix=/usr/local/apr #配置
Make #编译
Make install #安装
2. Installation Apr-util
Cd/usr/local/src
Tar zxvf apr-util-1.5.4.tar.gz
CD apr-util-1.5.4
./configure--with-apr=/usr/local/apr/bin/apr-1-config
Make
Make install
3. Installation SCons
Cd/usr/local/src
Tar zxvf scons-2.3.5.tar.gz
CD scons-2.3.5
Python setup.py #配置
Install #安装
4. Installation OpenSSL
Cd/usr/local/src
Tar zxvf openssl-1.0.1o.tar.gz
CD openssl-1.0.1o
Cflags=-fpic./config--prefix=/usr/local/openssl enable-shared
Make
Make install
Vi/etc/profile #添加系统环境变量
Export path= $PATH:/usr/local/openssl/bin
: wq! #保存退出
Source/etc/profile #使配置生效
Ln-s/usr/local/openssl/include/openssl/usr/include/openssl #添加系统软连接
5. Installation Serf
Cd/usr/local/src
Tar zxvf serf-1.3.8.tar.gz
CD serf-1.3.8
SCons prefix=/usr/local/serf apr=/usr/local/apr/bin/apr-1-config apu=/usr/local/apr/bin/apu-1-config OPENSSL=/usr/ Local/openssl
SCons Install
Cd/usr/local/serf/lib
CP libserf-1.so*/usr/local/lib/ #拷贝文件到系统目录
6. Install SVN
Cd/usr/local/src
Tar zxvf subversion-1.8.13.tar.gz
CD subversion-1.8.13
Mkdir/usr/local/src/subversion-1.8.13/sqlite-amalgamation #创建sqlite-amalgamation directory
Cd/usr/local/src
Unzip sqlite-amalgamation-201506201411.zip-d/usr/local/src/subversion-1.8.13/sqlite-amalgamation
#解压sqlite-amalgamation package to sqlite-amalgamation directory
./configure--PREFIX=/USR/LOCAL/SVN--with-apr=/usr/local/apr/bin/apr-1-config--with-apr-util=/usr/local/apr/bin /apu-1-config--with-serf=/usr/local/serf--with-openssl=/usr/local/openssl--enable-mod-activation #配置
Make #编译
Make install #安装
Vi/etc/profile #添加系统环境变量, adding to last line
Export path= $PATH:/usr/local/svn/bin
: wq! #保存退出
Source/etc/profile #使配置立刻生效
Whereis libexpat.so.1 #查找文件安装目录, as follows:
Libexpat.so:/lib/libexpat.so.0/usr/local/lib/libexpat.so/usr/local/lib/libexpat.so.1
Directory of vi/etc/ld.so.conf #编辑加入libexpat. So.1
/usr/local/lib/
: wq! #保存退出
Ldconfig #使配置生效
7. Test Installation success:
SVN help #查看svn帮助信息
Svnserve--version #查看svn版本信息
SVN--version
Six, configure SVN
1. Create SVN code base
Mkdir-p/home/svn #创建目录
Svnadmin create/home/svn #创建svn代码库
#上面的命令执行完成之后, will automatically set up SVN library, in the/home/svn folder contains conf,db,format,hooks,locks,readme.txt files.
#说明svn代码库创建成功.
2. Configure SVN code base
cd/home/svn/conf #进入配置文件存放目录
Vi/home/svn/conf/svnserve.conf #配置全局文件, add the following code at the end
[General]
Anon-access=none #禁止匿名访问, set to none. Default to read, parameters: Read,write,none
Auth-access=write #授权用户写权限
PASSWORD-DB=PASSWD #用户账号密码文件路径, can write absolute path
Authz-db=authz #访问控制权限文件路径, can write absolute path
REALM=SVN #每个SVN项目的认证命, will be displayed in the authentication prompt, recommend write project name.
: wq! #保存退出
VI/HOME/SVN/CONF/PASSWD #配置用户密码
[Users]
# Harry = Harryssecret
# sally = Sallyssecret
osyunwei=123456
test=123456
test2=123456
: wq! #保存退出
Vi/home/svn/conf/authz #配置权限控制文件 to set up directories that users can access
[Groups]
admin = Osyunwei
Users = Test,test2
[/]
@admin = RW
* = R
: wq! #保存退出
#[/] represents all resources under the root directory
3, Start SVN
svnserve-d-R/HOME/SVN--listen-port 3690
Ps-ef|grep svn|grep-v grep #查看svn进程
Root 12538 1 0 14:40? 00:00:00 svnserve-d-R/HOME/SVN
Netstat-ln |grep 3690 #检查svn端口
TCP 0 0 0.0.0.0:3690 0.0.0.0:* LISTEN
Killall svnserve #关闭svn服务
4, set up SVN service boot
VI/ETC/INIT.D/SVN #编辑, add the following code
#!/bin/sh #
chkconfig:2345
# processname:svn
svn_port=3690
svn_home=/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--listen-port $svn _ Port
echo "successfully!"
;;
Stop)
echo "stoping svnserve ..."
killall svnserve
echo "successfully!"
;;
Restart)
$ stop
$ start
;;
*)
echo "USAGE:SVN {start | Stop | Restart} "
exit 1
Esac
: wq! #保存退出
chmod +x/etc/init.d/svn #添加执行权限
Chkconfig svn on #开启自启动
5. Test SVN
SVN checkout svn://192.168.21.134/--username=osyunwei--password=123456 #将文件下载到本地目录
SVN update--username=osyunwei--password=123456 #更新上次修改之后的版本库
Vii. using a client to connect to an SVN server
TortoiseSVN is a free open source client for SVN (subversion) under Windows platform.
TortoiseSVN Download Address: http://tortoisesvn.net/downloads.html
The latest version is: TortoiseSVN 1.8.11, differentiate 32-bit and 64-bit operating systems, and provide Chinese-language package.
As shown in the following illustration:
After Setup completes, desktop-right click, select tortoisesvn-Version Library browser
As follows:
URL Input: svn://192.168.21.134/
Enter user name: Osyunwei
Password: 123456
Check: Save authentication
Are you sure
You can see what's on the SVN server, and after you right-click, you can choose to create a folder, and so on.
at this point, the Linux source code compiled installation configuration SVN server tutorial completed.