环境介绍
[root@localhost ~]# ip a |grep inet |grep eth0 |awk -F "[ /]+" ‘{print $3}‘
192.168.9.33
[root@localhost ~]# cat /etc/redhat-release
CentOS release 6.5 (Final)
[root@localhost ~]# uname -r
2.6.32-431.el6.x86_64
[root@localhost ~]# uname -m
x86_64
JAVA环境配置
[root@localhost soft]# ls
CollabNetSubversionEdge-4.0.11_linux-x86_64.tar.gz jdk-7u65-linux-x64.gz
[root@localhost soft]# tar xf jdk-7u65-linux-x64.gz -C /usr/local/
[root@localhost soft]# cd /usr/local/
[root@localhost local]# mv jdk1.7.0_65/ java/
[root@localhost local]# vim /etc/profile # 末尾添加三行(java环境变量);
export JAVA_HOME=/usr/local/java
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
[root@localhost local]# source /etc/profile # 声明全局变量;
[root@localhost local]# java -version # 查看java版本;
java version "1.7.0_65"
Java(TM) SE Runtime Environment (build 1.7.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)
创建csvn运行用户
[root@localhost ~]# useradd -m csvn
[root@localhost ~]# passwd csvn
附注: CSVN用的是FSFS的形式存储数据...
版本库信息位于/data/csvn/data/repositories下
部署CSVN
[root@localhost soft]# mkdir /data # 创建csvn家目录
[root@localhost soft]# tar xf CollabNetSubversionEdge-4.0.11_linux-x86_64.tar.gz -C /data/ # 解压csvn源码包,
[root@localhost soft]# cd /data/
[root@localhost data]# ls
csvn
[root@localhost data]# chown -R csvn.csvn csvn # *** csvn运行用户不能是root,所以csvn文件夹的属主和属组要修改为csvn;
[root@localhost data]# vim /etc/sudoers # 赋予csvn用户超户的权限,以便创建;
98 root ALL=(ALL) ALL
99 csvn ALL=(ALL) ALL # *****
[root@localhost data]# su csvn
[csvn@localhost ~]$ sudo -E /data/csvn/bin/csvn install
We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:
#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.
[sudo] password for csvn:
Detected RHEL or Fedora:
Installing the CSVN Console daemon..
Setting RUN_AS_USER to: ‘csvn‘. Please edit ‘../data/conf/csvn.conf‘ if this needs to be adjusted
Setting JAVA_HOME to: ‘/usr/local/java‘. Please edit ‘../data/conf/csvn.conf‘ if this needs to be adjusted.
查看生成的文件
[csvn@localhost data]$ vim csvn/data/conf/csvn.conf
9 RUN_AS_USER=csvn # 运行用户 csvn
46 JAVA_REQUIRED=true
47 JAVA_REQUIRED_VERSION=1.6
48 JAVA_HOME=/usr/local/java
启动csvn(csvn用户启动)
[csvn@localhost data]$ csvn/bin/csvn start
Starting CSVN Console...
..
CSVN Console started
Initializing CSVN Console at http://localhost:3343/csvn. Please wait a moment for server to become available.
启动apache
[root@localhost data]# csvn/bin/httpd -f /data/csvn/data/conf/httpd.conf -k start
[root@localhost data]# ps -ef |grep httpd
root 8997 1 0 17:32 ? 00:00:00 csvn/bin/httpd -f /data/csvn/data/conf/httpd.conf -k start
csvn 9001 8997 0 17:32 ? 00:00:00 csvn/bin/httpd -f /data/csvn/data/conf/httpd.conf -k start
csvn 9002 8997 0 17:32 ? 00:00:00 csvn/bin/httpd -f /data/csvn/data/conf/httpd.conf -k start
csvn 9003 8997 0 17:32 ? 00:00:00 csvn/bin/httpd -f /data/csvn/data/conf/httpd.conf -k start
csvn 9004 8997 0 17:32 ? 00:00:00 csvn/bin/httpd -f /data/csvn/data/conf/httpd.conf -k start
csvn 9005 8997 0 17:32 ? 00:00:00 csvn/bin/httpd -f /data/csvn/data/conf/httpd.conf -k start
启动成功后,使用浏览器访问 http://IP:3343/csvn就可以访问,默认admin\admin;
或者使用https://IP:4434/csvn也可以访问,二者为同一网站,只是链接方式不同而已.
配置文件介绍(控制权限可在配置文件中控制,也可以在网页中控制)
[root@localhost soft]# cd /data/csvn/data/conf/
# conf/目录中重要配置文件的介绍
* csvn.conf # csvn配置文件,其中可修改csvn的运行用户,以及访问的url端口,所用的JAVA_HOME;
* svn_auth_file # 掌控svn的登录用户及用户密码的文件
-*- htpasswd -nbm myname mypassword -*- # 生成加密的密码
* svn_access_file # 配置用户组及权限的文件
* csvn_main_httpd.conf # 定义了客户端的域名及端口,如果使用了ldap认证的话,能看到ldap的认证信息;
引入ldap的参考图
- AuthLDAPBindPassword 是 LDAP 给与的认证授权密码
- 如果修改了端口,还需要修改/data/csvn/data/conf/svn_viewvc_httpd.conf,否则客户端无法通过http://IP:port/svn访问数据
网页中引入ldap认证的信息