Subversion install
一. 软件下载:
1. Apache:http://www.apache.org
2. Subversion: http://www.subversion.com
二. 软件安装:
1. Apache: tar -zxvf httpd-2.2.9.tar.gz
cd httpd-2.2.9
./configure --prefix=/usr/local/apache2--enable-modules=most --enable-so--enable-dav --enable-rewrite--enable-rewrite=shared --enable-ssl --with-apr=/usr/local/apr--with-apr-util=/usr/local/apr-util --enable-proxy --enable-proxy-ajp--enable-proxy-balancer
make && make install
2. Subversion: tar –zxvf subversion-1.6.9.tar.gz subversion-deps-1.6.9.tar.gz
cd subversion-1.6.9
./configure --prefix=/usr/local/svn--with-apxs=/usr/local/apache2/bin/apxs
make && make install
三. 软件配置:
1.配置Apache: vim /usr/local/apache2/conf/httpd.conf
是否加载php模块:LoadModule php5_module modules/libphp5.so
增加:AddType application/x-httpd-php .php .phtml
DirectoryIndex index.html
改成:
DirectoryIndexindex.php index.html index.htm
设置网站主目录:DocumentRoot "/usr/local/apache2/htdocs"
2.配置:subversion:
查看帮助:/usr/local/svn/bin/svnadmin –help
/usr/local/svn/bin/svnadmin create hlep
创建svn目录:/usr/local/svn/svnadmin create /opt/repos
在Apache配置文件中添加: vim /usr/local/apache2/conf/httpd.conf
1.vi /usr/local/apache/conf/httpd.conf 查看是否有如下2行,有就对了
如果没有静态加载,需要动态添加:
LoadModule dav_svn_modulemodules/mod_dav_svn.so
LoadModule authz_svn_modulemodules/mod_authz_svn.so
2.建立版本库
mkdir /code (代码的根目录,根据自己情况)
/usr/local/svn/bin/svnadmin create/code/test (建一个test项目)
ls /code/test 里面多了些文件就对了
//不让其他人有该目录的权限
chown -R daemon /opt/repos
chmod -R 755 /opt/repos
3.配置Apache来支持SVN
vi /usr/local/apache2/conf/httpd.conf
在末尾加上如下内容:
<Location /svn>
DAV svn
SVNParentPath /opt
AuthzSVNAccessFile /opt/authz.conf
AuthType Basic
AuthName "Subversion"
AuthUserFile /opt/authfile
Require valid-user
</Location>
保存退出
4.启动 apache
打开IE,输入:http://IP/svn/repos 或 http://localhost/svn/repos
会弹出一个输用户和密码的框就对了
5.创建用户配置文件
/usr/local/apache2/bin/htpasswd -c /opt/authfile svnuser01 //必须要这样创建.
回车输入密码 (-c是第一次要创建文件)
htpasswd /opt/authfile svnuser02
回车输入密码
6.创建权限配置文件
vi /code/authz.conf
[test:/]
Svnuser01 = rw
Svnuser02 = r
保存退出
注:
[test:/] //这表示,仓库test的根目录下的访问权限
user1 = rw //test仓库user1用户具有读和写权限
user2 = r //test仓库user2用户具有读权限
[test2:/] //test2仓库根目录下的访问权限
user1 = r //user1用户在test2仓库根目录下只有读权限
user2 = //user2用户在 test2仓库根目录下无任何权限
[/] //这个表示在所有仓库的根目录下
*= r //这个表示对所有的用户都具有读权限
#[groups] //这个表示群组设置
#svn1-developers = user1, user2 //这个表示某群组里的成员
#svn2-developers = user1
#[svn1:/]
#@svn1-developers = rw //如果在前面加上@符号,则表示这是个群组权限设置
四. 启动服务:
1. cd /usr/local/apache2/bin/apachectl restart
打开IE,输入:http://IP/svn/test 或 http://localhost/svn/test
会弹出一个输用户和密码的框
输入你的添加的用户和密码就ok了
2.安装客户端软件(这就简单了)。