O subversion é um sistema de controle de versão livre/open-source. Isto é, o Subversion gerencia arquivos e diretórios, e as modificações feitas neles ao longo do tempo. Isto permite que você recupere versões antigas de seus dados, ou que examine o histórico de suas alterações. Devido a isso, muitas pessoas tratam um sistema de controle de versão como uma espécie de ‘máquina do tempo’.
O Subversion pode funcionar em rede, o que lhe possibilita ser usado por pessoas em diferentes computadores. Em certo nível, a capacidade de várias pessoas modificarem e gerenciarem o mesmo conjunto de dados de seus próprios locais é o que fomenta a colaboração. Progressos podem ocorrer muito mais rapidamente quando não há um gargalo único por onde todas as modificações devam acontecer. E como o trabalho está versionado, você não precisa ter medo de que seu trabalho perca qualidade por não ter essa via única para modificações os dados sofrerem alguma modificação indevida, apenas desfaça tal codificação.”
Iremos utilizar um senário onde o servidor é um Debian 6 , e o cliente é o Windows 7
1º - instalando os pacotes necessários como : Apache2 , subversion, subversion-tools, libapache2-svn
root# apt-get install Apache2 subversion subversion-tools libapache2-svn
2º - Criando diretório onde será nosso repositório subversion
root# mkdir /usr/local/svn
3º - Criando o repositório e aplicando as permissões necessárias
root# svnadmin creat --fs-type fsfs /usr/local/svn/repositório
root# chown -R www-data.www-data /usr/local/svn/repositorio
root# chown -R 777 /usr/local/svn/repositorio
4º - Configurando o repositório principal.
# vi /etc/apache2/mods-available/dav_svn.conf
Segue o arquivo original:
# dav_svn.conf - Example Subversion/Apache configuration
#
# For details and further options see the Apache user manual and
# the Subversion book.
#
# NOTE: for a setup with multiple vhosts, you will want to do this
# configuration in /etc/apache2/sites-available/*, not here.
#
# For details and further options see the Apache user manual and
# the Subversion book.
#
# NOTE: for a setup with multiple vhosts, you will want to do this
# configuration in /etc/apache2/sites-available/*, not here.
# In this example clients access the repository as http://hostname/svn/
# Uncomment this to enable the repository
#DAV svn
#DAV svn
# Set this to the path to your repository
#SVNPath /var/lib/svn
# Alternatively, use SVNParentPath if you have multiple repositories under
# under a single directory (/var/lib/svn/repo1, /var/lib/svn/repo2, ...).
# You need either SVNPath and SVNParentPath, but not both.
#SVNParentPath /var/lib/svn
#SVNPath /var/lib/svn
# Alternatively, use SVNParentPath if you have multiple repositories under
# under a single directory (/var/lib/svn/repo1, /var/lib/svn/repo2, ...).
# You need either SVNPath and SVNParentPath, but not both.
#SVNParentPath /var/lib/svn
# Access control is done at 3 levels: (1) Apache authentication, via
# any of several methods. A "Basic Auth" section is commented out
# below. (2) Apache <Limit> and <LimitExcept>, also commented out
# below. (3) mod_authz_svn is a svn-specific authorization module
# which offers fine-grained read/write access control for paths
# within a repository. (The first two layers are coarse-grained; you
# can only enable/disable access to an entire repository.) Note that
# mod_authz_svn is noticeably slower than the other two layers, so if
# you don't need the fine-grained control, don't configure it.
# any of several methods. A "Basic Auth" section is commented out
# below. (2) Apache <Limit> and <LimitExcept>, also commented out
# below. (3) mod_authz_svn is a svn-specific authorization module
# which offers fine-grained read/write access control for paths
# within a repository. (The first two layers are coarse-grained; you
# can only enable/disable access to an entire repository.) Note that
# mod_authz_svn is noticeably slower than the other two layers, so if
# you don't need the fine-grained control, don't configure it.
# Basic Authentication is repository-wide. It is not secure unless
# you are using https. See the 'htpasswd' command to create and
# you are using https. See the 'htpasswd' command to create and
# manage the password file - and the documentation for the
# 'auth_basic' and 'authn_file' modules, which you will need for this
# (enable them with 'a2enmod').
#AuthType Basic
#AuthName "Subversion Repository"
# (enable them with 'a2enmod').
#AuthType Basic
#AuthName "Subversion Repository"
#AuthUserFile /etc/apache2/dav_svn.passwd
# To enable authorization via mod_authz_svn
#AuthzSVNAccessFile /etc/apache2/dav_svn.authz
#AuthzSVNAccessFile /etc/apache2/dav_svn.authz
# The following three lines allow anonymous read, but make
# committers authenticate themselves. It requires the 'authz_user'
# module (enable it with 'a2enmod').
#<LimitExcept GET PROPFIND OPTIONS REPORT>
#Require valid-user
#</LimitExcept>
# committers authenticate themselves. It requires the 'authz_user'
# module (enable it with 'a2enmod').
#<LimitExcept GET PROPFIND OPTIONS REPORT>
#Require valid-user
#</LimitExcept>
Ao realizar as configurçoes nescessarias o arquivo fica assim
<Location /svn/repositorio>
DAV svn
SVNPath /usr/local/svn/repositorio
AuthType Basic
AuthName "Acessando repositorio Subversion"
AuthUserFile /etc/apache2/auth
#<LimitExcept GET PROPFIND OPTIONS REPORT>
Require valid-user
#</LimitExcept>
</Location>
DAV svn
SVNPath /usr/local/svn/repositorio
AuthType Basic
AuthName "Acessando repositorio Subversion"
AuthUserFile /etc/apache2/auth
#<LimitExcept GET PROPFIND OPTIONS REPORT>
Require valid-user
#</LimitExcept>
</Location>
5º - Este comando cria os usuários que acessaram o repositório
root# htpasswd -c /etc/apache2/auth augusto
New password:
Re-type new password:
Adding password for user augusto
Re-type new password:
Adding password for user augusto
Para criar novos usuarios tire a oppçao -c do comando. Pois essa opção cria um novo arquivo. O que não é desejado.
Reinicie o Apache:
root# service apache2 reload
Restarting web server: apache2apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
... waiting apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
... waiting apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
Pronto. Agora temos o nosso servidor SVN integrado ao Apache2.
Agora vamos acessas o repositório e verificar se está funcionando normalmente.
para acessar entre pelo seu browser e digite a URL: http://ip-do-servidor/svn/repositório
Comandos em linha de comando
Subir arquivos para o repostório:
# svn ci
Verificar status dos arquivos:
# svn st
Adicionar arquivos ao repositório
# svn add
Comentários
Postar um comentário