Gentoo Linux下Subversion + Websvn安裝配置說明

來源:互聯網
上載者:User

1、環境說明

# uname -a

Linux df53l 2.6.28-gentoo-r5 #1 SMP Tue Jun 16 18:58:24 CST 2009 i686
Intel(R) Pentium(R) Dual CPU E2160 @ 1.80GHz GenuineIntel GNU/Linux

# emerge -pv apache

[ebuild   R   ] www-servers/apache-2.2.11  USE="ssl

-debug -doc -ldap (-selinux) -sni -static -suexec -threads" APACHE2_MODULES="actions
alias auth_basic authn_alias authn_anon authn_dbm authn_default
authn_file authz_dbm authz_default authz_groupfile authz_host
authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir
disk_cache env expires ext_filter file_cache filter headers include
info log_config logio mem_cache mime mime_magic negotiation rewrite
setenvif speling status unique_id userdir usertrack vhost_alias

 

 # emerge -pv dev-util/subversion

[ebuild   R   ] dev-util/subversion-1.6.2  USE="apache2 dso nls perl python webdav-neon

-bash-completion -berkdb -ctypes-python -debug -doc -emacs -extras -gnome-keyring -java -ruby -sasl -test -vim-syntax -webdav-serf"


# emerge -pv www-apps/websvn

[ebuild   R   ] www-apps/websvn-2.1.0  USE="vhosts

-enscript"

 

2、安裝軟體

# echo "www-servers/apache ssl" >> /etc/portage/package.use

#
echo "dev-lang/php apache2 pcre session spl xml mysql and either gd
suhosin cgi for   ce-cgi-redirect" >> /etc/portage/package.use

# echo "dev-util/subversion -berkdb apache2 webdav-neon -nowebdav" >> /etc/portage/package.use

# echo "www-apps/websvn vhosts" >> /etc/portage/package.use

# echo "APACHE2_MPMS="prefork" >> /etc/make.conf

# emerge -av www-servers/apache dev-lang/php dev-util/subversion www-apps/websvn

 

 

 

3、配置Apache

# webapp-config -I -h websvn websvn 2.1.0

提示success後,檢查 /var/www/websvn

目錄是否產生。

#vim /etc/conf.d/apache2

在原來的APACHE2_OPTS後添加以下行

APACHE2_OPTS="$APACHE2_OPTS -D DEFAULT_VHOST -D SVN -D SVN_AUTHZ  -D DAV -D DAV_FS -D SSL -D SSL_DEFAULT_VHOST"


# vim /etc/apache2/httpd.conf

添加以下內容

#For Websvn

Listen 8099

<Directory /var/www/websvn>

    AddHandler php5-cgi .php

    Options +Indexes +ExecCGI +FollowSymLinks

    DirectoryIndex index.php

    AllowOverride Limit

</Directory>


# vim /etc/apache2/vhosts.d/websvn-vhost.conf

添加以下內容

NameVirtualHost *:8099

<VirtualHost *:8099>

  ServerName "myserver.mydomain.com"

  DocumentRoot "/var/www/websvn/htdocs"

      <Directory "/var/www/websvn/htdocs">

          AddHandler php5-cgi .php

          DirectoryIndex index.php

          AllowOverride All

          Order Allow,Deny

          Allow from All

       </Directory>

</VirtualHost>


# vim /etc/apache2/modules.d/php5-cgi.conf

添加以下內容

#handler for PHP 5 scripts

<IfDefine PHP5CGI>

    ScriptAlias /php5-cgi /usr/lib/php5/bin/php-cgi   

    Action php5-cgi /php5-cgi

    AddHandler php5-cgi .php5

</IfDefine>

 

4、配置Subversion

我將/var/svn目錄軟連結至/home/svn,以便儲存空間管理

#mkdir /home/svn

#ln -s /home/svn /var

 

配置subversion

#emerge --config subversion

 

建立SVN使用者組

# groupadd svnusers

 

建立SVN使用者

#adduser -g svnusers -m svn

#passwd svn

 

修改目錄存取權限

# chown -R svn:svnusers /var/svn/repos

# chown -R root:svnusers /var/svn/repos

# chmod -R g-w /var/svn/repos

# chmod -R g+rw /var/svn/repos/db

# chmod -R g+rw /var/svn/repos/locks

# gpasswd -a crob svnusers

 

5、配置Apache續,配置Websvn




# vim /etc/apache2/modules.d/47_mod_dav_svn.conf
若檔案已存在,則刪除原有內容,並改為以下內容
<IfDefine SVN>


<IfModule !mod_dav_svn.c>
LoadModule dav_svn_module modules/mod_dav_svn.so
</IfModule>
<Location /svn/repos>
DAV svn
SVNParentPath /var/svn
#SSLRequireSSL
AuthType Basic
AuthName "Super Duper SVN Repository"
AuthUserFile /var/svn/conf/svnusers
AuthzSVNAccessFile /var/svn/conf/svnpolicy
<LimitExcept GET PROPFIND OPTIONS REPORT>
Require valid-user
</LimitExcept>
SVNIndexXSLT /svnindex.xsl
</Location>
<IfDefine SVN_AUTHZ>
<IfModule !mod_authz_svn.c>
LoadModule authz_svn_module modules/mod_authz_svn.$
</IfModule>
</IfDefine>
</IfDefine>#vim /var/www/websvn/htdocs/include/config.php

添下以下內容

$config->parentPath('/var/svn/');


 

6、重啟

# /etc/init.d/apache2 restart

 

 

7、Subversion Repository建立指令碼

#vim setup-repos.sh

內容如下

#!/bin/bash

#Dependencies:

#app-shells/bash (bash)
#sys-apps/coreutils (mktemp,...)
#dev-util/subversion (svn,svnadmin)
if [ ! -d /var/svn/ ] ;then
echo "Cant find SNV-Directory at /var/svn"

exit 1
fi

if [ -z $1 ] ;then
echo "Usage: $0 <Repository-Name>"
exit 1
fi

if [ -d /var/svn/$1 ] ;then
echo "Repository /var/svn/$1 is already present"
exit 1
fi
echo "Creating Repository..."
svnadmin create /var/svn/$1
echo "Creating default directories..."
TDIR=`mktemp -d`
cd $TDIR
mkdir -p {trunk,tags,branches}
echo "Initial import..."
svn import -q -m "Initial Import" --non-interactive $TDIR file:///var/svn/$
echo "Fixing permissions..."
chown -R apache /var/svn/$1
echo "Cleaning up..."
rmdir $TDIR/{trunk,tags,branches}
rmdir $TDIR
echo "Done!"

# chmod +x ./setup-repos.sh

# ./setup-repos.sh test

 

至此我們建立了一個test專案,並能通過 http://127.0.0.1:8099訪問

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.