【SVN教程】(2)安装WebSVN
安装步骤
1.安装依赖
shell
sudo apt install zip enscript php php-xml php-parsedown
2.下载并解压到www/html目录
shell
cd /var/www/html
sudo wget https://github.com/websvnphp/websvn/archive/refs/tags/2.8.4.zip
sudo unzip 2.8.4.zip
sudo mv websvn-2.8.4 websvn
3.配置websvn
shell
cd /var/www/html/websvn/include
sudo cp distconfig.php config.php
sudo vim config.php
- 修改如下内容
php
$config->setSVNCommandPath('/usr/bin');
$config->setDiffPath('/usr/bin');
$config->setEnscriptPath('/usr/bin');
$config->setSedPath('/bin');
$config->setTarPath('/bin');
$config->setGZipPath('/bin');
// 根目录配置
$config->parentPath('/var/svn/repos/');
// 语法高亮
$config->useEnscript();
$extEnscript[".pl"] = "perl";
$extEnscript[".py"] = "python";
$extEnscript[".sql"] = "sql";
$extEnscript[".java"] = "java";
$extEnscript[".html"] = "html";
$extEnscript[".xml"] = "html";
$extEnscript[".thtml"] = "html";
$extEnscript[".tpl"] = "html";
$extEnscript[".sh"] = "bash";
// README.md 解析
$config->useParsedown();
$config->setParsedownPath('/usr/share/php/Parsedown/');
- 再次更新目录权限
shell
sudo chown -R www-data:www-data /var/svn/repos
sudo chmod -R 755 /var/svn/repos
3.配置到apache2
shell
sudo vim /etc/apache2/mods-available/dav_svn.conf
- 新增websvn的配置
xml
<Location /websvn>
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /var/svn/pwdfile
Require valid-user
</Location>
4.重启apache2
shell
sudo service apache2 restart