集成 Apache 和 SVN

来源:https://www.cnblogs.com/abc0012383/archive/2018/05/15/9042398.html
-Advertisement-
Play Games

1.查看系統環境 2.安裝軟體包和Apache SVN模塊 3. 驗證安裝 4.驗證Apache SVN模塊是否安裝成功,需要檢查mod_dav_svn.so和mod_authz_svn.so 5. 使用svnadmin命令創建SVN倉庫repos 6.修改repos目錄屬主和屬組 7. 複製/va ...


本文主要介紹如何在CentOS7環境下集成Apache和SVN,完成後可以通過瀏覽器訪問SVN倉庫.

1.查看系統環境,關閉防火牆和SELinux.

 1 [root@Docker /]# systemctl status firewalld.service
 2 ● firewalld.service - firewalld - dynamic firewall daemon
 3    Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
 4    Active: inactive (dead)
 5      Docs: man:firewalld(1)
 6 [root@Docker /]# getenforce
 7 Disabled
 8 [root@Docker /]# uname -a
 9 Linux Docker 3.10.0-693.21.1.el7.x86_64 #1 SMP Wed Mar 7 19:03:37 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
10 [root@Docker /]# cat /etc/redhat-release 
11 CentOS Linux release 7.4.1708 (Core) 
12 [root@Docker /]# 

2.安裝軟體包和Apache SVN模塊.

1  yum install httpd mod_dav_svn subversion

 3. 驗證安裝結果.

1 [root@Docker /]# httpd -version
2 Server version: Apache/2.4.6 (CentOS)
3 Server built:   Apr 20 2018 18:10:38
4 [root@Docker /]# svnserve --version
5 svnserve, version 1.7.14 (r1542130)
6 compiled Apr 11 2018, 02:40:28

4.驗證Apache SVN模塊是否安裝成功,需要檢查mod_dav_svn.so和mod_authz_svn.so文件.

1 [root@Docker modules]# pwd
2 /etc/httpd/modules
3 [root@Docker modules]# ll | egrep "mod_dav_svn.so|mod_authz_svn.so"
4 -rwxr-xr-x 1 root root  19504 Apr 11 10:44 mod_authz_svn.so
5 -rwxr-xr-x 1 root root 181344 Apr 11 10:44 mod_dav_svn.so

5.使用svnadmin命令創建SVN倉庫repos.

 1 [root@Docker /]# mkdir /var/www/svn
 2 [root@Docker /]# cd /var/www/svn/
 3 [root@Docker svn]# svnadmin create repos
 4 [root@Docker svn]# tree -d repos/
 5 repos/
 6 ├── conf
 7 ├── db
 8 │   ├── revprops
 9 │   │   └── 0
10 │   ├── revs
11 │   │   └── 0
12 │   ├── transactions
13 │   └── txn-protorevs
14 ├── hooks
15 └── locks
16 
17 10 directories

6.修改repos目錄屬主和屬組為apache.

1 [root@Docker svn]# chown -R apache:apache repos/
2 [root@Docker svn]# ll
3 total 4
4 drwxr-xr-x 6 apache apache 4096 May 15 16:57 repos

7.複製/var/www/svn/repos/conf 下的許可權管理文件authz到 /var/www/svn下,並創建用戶認證文件passwd,並且設置隱藏屬性.

1 [root@Docker svn]# cp /var/www/svn/repos/conf/authz /var/www/svn/
2 [root@Docker svn]# cd /var/www/svn/repos
3 [root@Docker repos]# touch .passwd

8.通過htpasswd命令建立SVN用戶svnuser並將用戶信息保存在passwd文件中.

1 [root@Docker repos]# htpasswd ./.passwd svnuser
2 New password: 
3 Re-type new password: 
4 Adding password for user svnuser
5 [root@Docker repos]# cat .passwd 
6 svnuser:$apr1$ThE7aO2O$CQo.OIs.8TOqUFaFr7b3H0

9.修改authz文件並設置相應許可權:

在[groups]下添加組

[/] 相當於/var/www/svn這個目錄,賦予許可權給用戶組

[repos:/] 是指repos庫

[repos:/desgin]是repos下的desgin目錄

rw是指可讀寫許可權

 1 [root@Docker svn]# vim authz 
 2 [root@Docker svn]# grep -v "^#" authz 
 3 
 4 [groups]
 5 admin_group=svnuser,svnuser2
 6 project_group=svnuser3,svnuser4
 7 project2_group=svnuser5,svnuser6
 8 
 9 [/]
10 @admin_group=rw
11 
12 [repos:/]
13 @project_group=rw
14 
15 [repos:/desgin]
16 @project_group=rw
17 
18 [repos2:/]
19 @project2_group=rw

10.關聯Apache與SVN,創建subversion.conf文件.Locaion後的名字可以自定義,不需要與倉庫名一致,這裡我們定義為/documents,這樣後面訪問時直接輸入http://x.x.x.x/documents即可打開倉庫

[root@Docker /]# vim /etc/httpd/conf.d/subversion.conf

LoadModule dav_svn_module modules
/mod_dav_svn.so LoadModule authz_svn_module modules/mod_authz_svn.so <Location /documents> DAV svn SVNParentPath /var/www/svn SVNListParentPath On AuthType Basic AuthName "Project SVN" AuthUserFile /var/www/svn/repos/.passwd Require valid-user AuthzSVNAccessFile /var/www/svn/authz </Location>

11.啟動Apache,在瀏覽器中輸入http://x.x.x.x/documents彈出認證視窗,輸入用戶認證信息即可看到SVN倉庫repos.

1 [root@Docker /]# systemctl start httpd.service

 


您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • 流程圖 我們需要判斷是否存在OPENID 首先我們得先定義一個全局的OPENID 類似於普通賬號密碼登錄系統的 當前登錄用戶ID 因為我是MVC 框架 我這裡定義一個控制器基類 BaseController 然後將OPENID定義在BaseController中 然後定義一個HomeControll ...
  • 為了定製個性化的用戶界面,我們通常會藉助於WPF強大的樣式(style),修改控制項屬性,重寫控制項模板(template),樣式幫助我們構建一致的個性化控制項。通過樣式可以調整界面的顯示效果,這隻是界面構成的一部分,界面有很多功能是與程式功能無關的,比如停靠、拖動、縮放等,這些通用的功能要如何實現呢,所 ...
  • 你新建winform項目的時候,會有一個app.config的配置文件,寫在裡面的<connectionStrings name=" " connectionString=" "></connectionStrings >, connectionString代表資料庫鏈接字元串,name代表你想要引 ...
  • 一、概括 1.通常創建一個對象的方法如圖: 通過 Student tom = new Student(); 創建tom對象,這種創建實例的形式被稱為構造方法。 簡述:用來初始化對象的,為類的成員賦值。 2.構造方法特點 a.方法名與類名相同; b.沒有返回值類型; c.必須要通過new的形式調用; ...
  • Linux桌面發行版 UbuntuCentOSRed heat LinuxOracle Linux 一、系統安裝 1、系統分區 若手動分區swap和根分區必須創建,推薦創建boot分區。 / 根目錄,唯一必須掛載的目錄。(在絕大多數情況下有2G的容量應該是夠用了。當然了,很多東西都是多多益善的)sw ...
  • 下載軟體包: 首先需要安裝apr和apr-util 安裝apr-util: ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr sudo make sudo make install 這兩個必不可少,如果缺少其他的依賴 ...
  • 在上一篇在Docker中體驗資料庫之Mongodb之後,這次記錄一下在docker中安裝mysql。過程要比Mongodb麻煩一點…… 參考網址: https://dev.mysql.com/doc/refman/5.7/en/linux-installation-docker.html https ...
  • 寫在前面 Rocketmq採用apache rockemq 4.2.0release版本。 源碼路徑(http://mirrors.shu.edu.cn/apache/rocketmq/4.2.0/rocketmq-all-4.2.0-source-release.zip) 場景 這裡採用兩台Ubu ...
一周排行
    -Advertisement-
    Play Games
  • 示例項目結構 在 Visual Studio 中創建一個 WinForms 應用程式後,項目結構如下所示: MyWinFormsApp/ │ ├───Properties/ │ └───Settings.settings │ ├───bin/ │ ├───Debug/ │ └───Release/ ...
  • [STAThread] 特性用於需要與 COM 組件交互的應用程式,尤其是依賴單線程模型(如 Windows Forms 應用程式)的組件。在 STA 模式下,線程擁有自己的消息迴圈,這對於處理用戶界面和某些 COM 組件是必要的。 [STAThread] static void Main(stri ...
  • 在WinForm中使用全局異常捕獲處理 在WinForm應用程式中,全局異常捕獲是確保程式穩定性的關鍵。通過在Program類的Main方法中設置全局異常處理,可以有效地捕獲並處理未預見的異常,從而避免程式崩潰。 註冊全局異常事件 [STAThread] static void Main() { / ...
  • 前言 給大家推薦一款開源的 Winform 控制項庫,可以幫助我們開發更加美觀、漂亮的 WinForm 界面。 項目介紹 SunnyUI.NET 是一個基於 .NET Framework 4.0+、.NET 6、.NET 7 和 .NET 8 的 WinForm 開源控制項庫,同時也提供了工具類庫、擴展 ...
  • 說明 該文章是屬於OverallAuth2.0系列文章,每周更新一篇該系列文章(從0到1完成系統開發)。 該系統文章,我會儘量說的非常詳細,做到不管新手、老手都能看懂。 說明:OverallAuth2.0 是一個簡單、易懂、功能強大的許可權+可視化流程管理系統。 有興趣的朋友,請關註我吧(*^▽^*) ...
  • 一、下載安裝 1.下載git 必須先下載並安裝git,再TortoiseGit下載安裝 git安裝參考教程:https://blog.csdn.net/mukes/article/details/115693833 2.TortoiseGit下載與安裝 TortoiseGit,Git客戶端,32/6 ...
  • 前言 在項目開發過程中,理解數據結構和演算法如同掌握蓋房子的秘訣。演算法不僅能幫助我們編寫高效、優質的代碼,還能解決項目中遇到的各種難題。 給大家推薦一個支持C#的開源免費、新手友好的數據結構與演算法入門教程:Hello演算法。 項目介紹 《Hello Algo》是一本開源免費、新手友好的數據結構與演算法入門 ...
  • 1.生成單個Proto.bat內容 @rem Copyright 2016, Google Inc. @rem All rights reserved. @rem @rem Redistribution and use in source and binary forms, with or with ...
  • 一:背景 1. 講故事 前段時間有位朋友找到我,說他的窗體程式在客戶這邊出現了卡死,讓我幫忙看下怎麼回事?dump也生成了,既然有dump了那就上 windbg 分析吧。 二:WinDbg 分析 1. 為什麼會卡死 窗體程式的卡死,入口門檻很低,後續往下分析就不一定了,不管怎麼說先用 !clrsta ...
  • 前言 人工智慧時代,人臉識別技術已成為安全驗證、身份識別和用戶交互的關鍵工具。 給大家推薦一款.NET 開源提供了強大的人臉識別 API,工具不僅易於集成,還具備高效處理能力。 本文將介紹一款如何利用這些API,為我們的項目添加智能識別的亮點。 項目介紹 GitHub 上擁有 1.2k 星標的 C# ...