Linux系统安装SVN服务器

下载 [url=http://mirror.bjtu.edu.cn/apache//httpd/httpd-2.2.16.tar.gz]httpd-2.2.16.tar.gz[/url] [url=http://subversion.tigris.org/downloads/subversion-1.6.13.tar.gz]subversion-1.6.13.tar.gz[/url]

//解压apache2安装包
# tar xvzf httpd-2.2.16.tar.gz
//进入解压后的目录
# cd httpd-2.2.16
//配置apache安装,前两个参数是必须要加的,你还可以根据您的需要添加其他的参数。
//后面的参数制定你要把apache安装哪里
# ./configure --enable-dav --enable-so --prefix=/usr/local/apache2/
# make
//安装
# make install
# cd /usr/local/apache2/bin
//启动apache服务
# ./apachectl start
//打开浏览器http://localhost/如果有测试页"It works!"出现则证明已经安装成功。



安装Subversion



//解压SubVersion安装包 (root用户进行下面的操作)
# tar xvzf Subversion-1.3.13.tar.gz
//进入解压后的目录
# cd Subversion-1.3.1
//配置subversion安装
#./configure --with-apxs=/usr/local/apache2/bin/apxs --prefix=/usr/local/subversion
--with-apr=/usr/local/apache2 --with-apr-util=/usr/local/apache2 --with-ssl

/*
(注:以svnserve方式运行。 –without-berkeley-db 以fsfs格式存储版本库,不编译berkeley-db

在编译过程中出现如下错误:
configure: error: Subversion requires SQLite
原因是:1.6.13需要依赖Sqlite. 于是下载Sqlite,下载网址: http://cpan.wenzk.com/authors/id/A/AU/AUDREYT/DBD-SQLite-Amalgamation-3.6.16.tar.gz 可以下载到最新的Sqlite版本sqlite-amalgamation-3.6.16.tar.gz 解压进入文件夹sqlite-amalgamation找到sqlite3.c将其复制到 /home/SVN/subversion-1.6.3/sqlite-amalgamation/sqlite3.c
由于版本1.6.3里没有sqlite-amalgamation 所以你要先创建sqlite-amalgamation 目录然后复制进去。
然后执行#./configure --with-apxs=/usr/local/apache2/bin/apxs --prefix=/usr/local/subversion
--with-apr=/usr/local/apache2 --with-apr-util=/usr/local/apache2 --with-ssl

)
*/


# make

//安装
# make install
//创建库文件所在的目录 (svnroot用户进行下面的操作)
# mkdir /home/svnroot/repository
//进入subversion的bin目录
# cd /usr/local/subversion/bin
//创建仓库"repos"
# ./svnadmin create /home/svnroot/repository/repos
# cd /home/svnroot/repository/repos
//看看是不是多了些文件,如果是则说明Subversion安装成功了
# ls
# cd /usr/local/subversion/bin
//不让其他人有该目录的权限
# chmod 700 /home/svnroot/repository



修改Apache配置文件

# vi /usr/local/apache2/conf/httpd.conf
//找到以后两句,如果没有在最下面添加
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
在这两句下面添加
<Location /svn>
DAV svn
SVNParentPath /home/svnroot/repository/ //svn父目录
AuthzSVNAccessFile /home/svnroot/repository/authz.conf //权限配置文件
AuthType Basic //连接类型设置
AuthName "Subversion.zoneyump" //连接框提示
AuthUserFile /home/svnroot/repository/authfile //用户配置文件
Require valid-user //采用何种认证
</Location>
//其中authfile是通过"htpasswd [–c] /home/svnroot/repository/authfile username password"来创建的
//"Require valid-user"告诉apache在authfile中所有的用户都可以访问。如果没有它,
//则只能第一个用户可以访问新建库

User daemon
Group daemon
改成
User svnroot
Group svn




创建用户,分配权限

htpasswd -c /home/svnroot/repos/authfile 用户名
//第一次设置用户时使用-c表示新建一个用户文件。回车后输入用户密码,完成对用户的增加
htpasswd /home/svnroot/repos/authfile 用户名(加入新的用户,就不用-c了)

# vi /home/svnroot/repository/authz.conf
[repos:/] //这表示,仓库repos的根目录下的访问权限
admin = rw //repos仓库admin用户具有读和写权限
test = r //repos仓库test用户具有读权限
[/] //这个表示在所有仓库的根目录下
* = r //这个表示对所有的用户都具有读权限
#[groups] //这个表示群组设置
#svn1-developers = admin, test//这个表示某群组里的成员
#svn2-developers = admin
#[svn1:/]
#@svn1-developers = rw //如果在前面加上@符号,则表示这是个群组权限设置



将这个设置完成后。重启Apache,就可以通过
http://localhost/svn/test
这个URL来访问仓库了

最后将repository的权限放给所有人
#chmod 777 /home/svnroot/repository



让apache作为服务,随服务器重启


1、将apachectl文件拷贝到/etc/rc.d/init.d 中,然后在/etc/rc.d/rc5.d/下加入链接即可。
命令如下:
cp /usr/local/apache/bin/apachectl /etc/rc.d/init.d/httpd //如果有其他的版本的Apache存在,也可以直接覆盖掉
ln -s /etc/rc.d/init.d/httpd /etc/rc.d/rc5.d/S85httpd //建立链接(85的意义后面介绍)
此时Apache就可以自动启动了。
2、运行chkconfig --list,发现没有linux服务列表中httpd,通过chkconfig --add httpd来添加,但是提示:httpd服务不支持 chkconfig。需要编辑/etc/rc.d/init.d/httpd,添加以下注释信息:
# chkconfig: 345 85 15
# descrīption: Apache
第一行3个数字参数意义分别为:哪些Linux级别需要启动httpd(3,4,5);启动序号(85);关闭序号(15)。
保存后执行:chkconfig --add httpd,成功添加。
在rc3.d、rc4.d、rc5.d路径中会出现S85httpd的链接文件,其他运行级别路径中会出现K61httpd的链接文件。
3、运行chkconfig --list,httpd在其中
4、运行chkconfig httpd on 使之开机启动
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值