阿里雲centos安裝svn和submin


概述

沒有找到可以讓團隊方便使用的雲盤,暫時搭建一個svn湊合用一下

svn有三種安裝方式

安裝方式 服務程序 服務協議 用戶和密碼 授權 系統配置
svn獨立安裝 svnserve svn passwd文件(明文密碼) authz文件 svnserve.conf文件
apache+svn安裝 httpd http WebDAV htpasswd命令(密文密碼) authz文件 httpd.conf文件
apache+svn+submin httpd+ pythonCGI http WebDAV WebUI(sqlite3) WebUI(authz文件) submin2-admin命令

一、安裝apache

  1. 檢查apache是否安裝

    rpm -qa|grep httpd 
  2. 使用yum安裝apache

    yum -y install httpd 
  3. 記住安裝的版本號

    httpd.x86_64 0:2.4.6-31.el7.centos 
  4. 啟動apache測試apache是否可用
    注意:在centos7中使用systemctl替換了service

    systemctl start httpd.service systemctl status httpd.service 

  瀏覽器輸入IP查看是否能顯示以下頁面

  5. apache安裝路徑
         /etc/httpd

二、安裝SVN

  1. 檢查svn是否安裝

    rpm -qa|grep subversion 

    阿里雲已經安裝了svn,如果沒有安裝使用 yum install subversion 命令安裝

  2. 使用命令查看版本

    svnserve --version 

    記住版本號svnserve,版本 1.7.14 (r1542130)

  1. 安裝apache對svn的支持模塊

    yum install mod_dav_svn
    
    #安裝完成后apache的modules目錄下會多兩個文件
    mod_authz_svn.so mod_dav_svn.so 
  2. 安裝python對svn的支持

    yum install subversion-python 

三、安裝submin

可以參照 https://ssl.supermind.nl/collab/projects/submin/browser/INSTALL

  1. submin依賴

    1. If you want subversion, you also need apache. If only git is needed, you can also install nginx.
    2. Python 2.x Python 2.7 preferred, but 2.6 should work,使用python —version查看python 版本
    3. Subversion
  2. 下載最新版本 http://supermind.nl/submin/current/submin-2.2.1-1.tar.gz

  3. 上傳到服務器 sftp

  4. 解壓文件

    tar -xzvf submin-2.2.1-1.tar.gz 
  5. 安裝

    cd submin-2.2.1-1/ python setup.py install 
  6. 驗證安裝
    執行 submin2-admin 成功顯示當前版本

  7. 配置submin

    submin2-admin /opt/submin/ initenv your@email.address 

    郵箱很重要, submin會將管理員設置初始口令的鏈接發到這郵箱中
    /opt/submin這個目錄不要提前建,安裝命令的向導一步步設置就可以了,說明很清楚.
    這一步需要注意

Please provide a location for the Subversion repositories. For new Subversion
repositories, the default setting is ok. If the path is not absolute, it will
be relative to the submin environment. If you want to use an existing
repository, please provide the full pathname to the Subversion parent
directory (ie. /var/lib/svn).
Path to the repository? [svn]>

  這個目錄我設置的時 /opt/svn,注意這個目錄apache一定要有寫權限,否則會報以下錯誤

E165002 /opt/svn is an existing repository

  因為submin是用apache用戶啟動的,最簡單的方式是將該目錄所有者設置為apache,執行以下命令

 chown apache:apache /opt/svn/ 
  1. 配置apache
    生成配置文件

    submin2-admin /opt/submin/ apacheconf create all 

    建立軟鏈接配置apache,注意Apache版本

    ln -s /opt/submin/conf/apache-2.4-webui-cgi.conf /etc/httpd/conf.d/ ln -s /opt/submin/conf/apache-2.4-svn.conf /etc/httpd/conf.d/ 
  2. 重啟apache

    systemctl restart httpd.service 

    報錯 Can’t load driver file apr_dbd_sqlite3.so
    submin2默認需要sqlite3做數據庫

    yum -y install apr-util-sqlite apr-util 

    再次重啟OK

四、郵箱設置

  1. 配置 submin時,需要配置管理員郵箱
  2. /usr/lib/python2.7/site-packages/submin/email/fallback.py

    def sendmail(sender, receiver, message): msg_e = message.encode('utf-8') try: smtp.send(sender, receiver, msg_e) except SendEmailError: # this can still raise SendEmailError local.send(sender, receiver, msg_e) 

    優先使用stmp發郵件。 異常時使用本地的sendmail,配置smtp

       submin2-admin /opt/submin config set smtp_hostname smtp.exmail.qq.com submin2-admin /opt/submin config set smtp_port 25 submin2-admin /opt/submin config set smtp_username svn@xxxxx.com submin2-admin /opt/submin config set smtp_password xxxxxx submin2-admin /opt/submin config set smtp_from "svn <svn@xxxx.com>" submin2-admin /opt/submin config set commit_email_from "svn <svn@xxxx.com>" 

五、診斷submin

執行以下命令
submin2-admin /opt/submin/ diagnostics
如果有問題參照說明修改對應錯誤
我設置出現了以下問題:

To disable, run the following command: submin2-admin /opt/submin config set vcs_plugins svn

如果不禁用git,以后的操作都會報git沒有設置的錯誤

 

六、管理員重置密碼

  1. 訪問系統進入登錄界面

  1. 點擊forgot your password

輸入admin,點擊重置,以下命令配置的郵箱將會受到密碼重置郵件

submin2-admin /opt/submin/ initenv your@email.address 
  1. 點擊重置郵件進入系統,點擊admin菜單進入用戶設置界面,修改密碼

七、新建倉庫sharing

  1. 點擊左側菜單右下角的新建倉庫按鈕

  1. 進入新建頁面


輸入名稱,選擇svn創建倉庫

 

八、授權

  1. 點擊左側菜單最下面中間兩個人的按鈕,新建組

  2. 點擊左側菜單最下面的左側一個人的按鈕,新建用戶

  3. 新建完成用戶后,用戶會收到密碼重置郵件,同時系統進入修改用戶信息頁面,可以將用戶添加到developer組

  4. 設置權限,點擊左側需要授權的倉庫按鈕

針對特定的路徑設置組或用戶並設置對應的讀寫權限,這里我給developer設置root的讀寫權限

  1. 使用瀏覽器訪問svn地址測試

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM