萬盛學電腦網

您现在的位置: 萬盛學電腦網 >> 程式設計 >  >> 伺服器教學

CentOS 7 安裝 WebSVN 圖形化管理 Subversion 倉庫完整教學

WebSVN 以 PHP 撰寫,提供 Subversion (SVN) 倉庫的瀏覽、版本比對、日誌查詢、RSS 訂閱等 Web 介面。本文在 CentOS 7.0 示範從下載、解壓、PHP 安裝、配置 config.php 到啟動 Apache 的完整流程。

前置條件

  • 已安裝 Subversion 服務(yum install subversion)。
  • Apache 已啟動並能正常服務。

安裝步驟

1. 下載 WebSVN

sudo -s
cd /var/www/html
wget https://websvn.tigris.org/files/documents/1380/49057/websvn-2.3.3.zip
wget 下載 WebSVN

2. 解壓並重命名

unzip websvn-2.3.3.zip
mv websvn-2.3.3 websvn
解壓完成目錄結構

3. 安裝 PHP

yum install php
yum 安裝 PHP

4. 編輯配置檔 config.php

cd /var/www/html/websvn/include
cp distconfig.php config.php
nano config.php

關鍵修改(依實際路徑調整):

$config->setSVNCommandPath('/usr/bin');
$config->setDiffPath('/usr/bin');
$config->setEnscriptPath('/usr/bin');
$config->setSedPath('/bin');
$config->setTarPath('/bin');
$config->setGZipPath('/bin');
$config->parentPath('/svn/');   # SVN 倉庫根目錄

# 語法高亮副檔名對應
$extEnscript[".pl"] = "perl";
$extEnscript[".py"] = "python";
$extEnscript[".sql"] = "sql";
$extEnscript[".java"] = "java";
$extEnscript[".html"] = "html";
$extEnscript[".xml"] = "html";
$extEnscript[".sh"] = "bash";
config.php 編輯畫面

5. 重啟 Apache 並驗證

systemctl restart httpd.service

瀏覽器開啟 https://<伺服器IP>/websvn 或 https://localhost/websvn,即可看到倉庫列表。

WebSVN 首頁

常見問題排除

錯誤: Unable to find "enscript" tool at location "/usr/bin/enscript"

解決: yum install enscript 後重整頁面。

適用範圍

本教學同樣適用於 RHEL 7、Scientific Linux 7 等相容發行版。

小結

WebSVN 輕量、無資料庫相依、模板可客製,是中小團隊快速上線 SVN 瀏覽介面的最佳選擇。配合 Apache 基礎認證或 LDAP 整合,即可構建安全的版本控管入口。

copyright © 萬盛學電腦網 all rights reserved