红联Linux门户
Linux帮助

Ubuntu安装SVN及SvnManager

发布时间:2014-11-09 09:19:01来源:linux网站作者:kevinwu

之前在linux下多次安装过svn以及svnmanager,把安装步骤记录一下,给自己做个备份,也希望能够帮助到他人。以下是在Ubuntu上安装的步骤,在其他linux版本系统上安装方法也类似。


1.安装Apache2

sudo apt-get install apache2


2.安装SVN

sudo apt-get install subversion


3.配置SVN

创建SVN版本库的父目录

sudo mkdir /var/svn/repos

创建控制用户访问权限的文件

sudo touch /var/svn/repos/accessfile

创建验证用户的密码文件

sudo touch /var/svn/repos/passwdfile

更改文件的读写权限

sudo chmod 666 accessfile passwdfile


4.Apache集成SVN

sudo vi /etc/apache2/httpd.conf

在文件末尾添加以下内容:
<Location /svn>

DAV svn

SVNParentPath /var/svn/repos AuthzSVNAccessFile /var/svn/repos/accessfile

AuthType Basic

AuthName "Subversion repository"

AuthUserFile /var/svn/repos/passwdfile

Require valid-user

</Location>
在这个步骤结束之后,就能通过命令来创建svn的版本库、用户等。并能够通过web访问svn的版本库。


5.安装MySQL

sudo apt-get install mysql-server mysql-client


6.安装PHP

sudo apt-get install php5 php5-mysql php5-sqlite php-pear

sudo pear install -a VersionControl_SVN-0.3.1


7.安装svnmanager

下载svnmanager:

wget http://prdownloads.sourceforge.net/svnmanager/svnmanager-1.08.tar.gz

解压并放置到/var/www/下

tar zxvf svnmanager-1.08.tgz

mv svnmanager-1.08/var/www/svnmanager


8.为svnmanager创建数据库
mysql–uroot –p

Mysql>create database svnmanager;

Mysql>grant all privileges on svnmanager.* to 'svnmanager'@'localhost' identified by '123456';

Mysql>flush prifileges;

Mysql>exit


9.配置svnmanager

将/var/www/svnmanager 目录下的config.php.linux 重命名为 config.php

cd /var/www/svnmanager

sudo cp config.php.linux config.php//复制是为了做备份

配置config.php中的相关信息

$htpassword_cmd = "/usr/bin/htpasswd";

$svn_cmd = "/usr/bin/svn";

$svnadmin_cmd = "/usr/bin/svnadmin";

$svn_config_dir = "/var/svn/svnconfig";

$svn_repos_loc = "/var/svn/repos";

$svn_passwd_file = "/var/svn/repos/passwdfile";

$svn_access_file = "/var/svn/repos/accessfile";

$dsn = "mysql:// svnmanager:123456@localhost/svnmanager";

$admin_name = "admin";

$admin_temp_password = "admin";

 为了加强权限控制也可以在/etc/apache2/httpd.conf中增加如下内容:
<Directory "/var/svn/svnmanager/">

AllowOverride None

Order deny,allow

Deny from all

Allow from all

</Directory>


10.完成安装

启动Apache、Mysql:

sudo service apache2 start

sudo service mysql start


访问 http://127.0.0.1/svnmanager,初始用户名称为admin,密码为admin,创建管理员用户后该帐号失效。至此整个服务部署完毕。