Difference between revisions of "Subversion"

From gr0x0rd
Jump to navigation Jump to search
(Created page with "== Configuring Software - Subversion == If you do any type of development work, you'll probably want to use some type of version control, especially if you have multiple people …")
 
Line 4: Line 4:
 
  '''$''' sudo emerge -av subversion
 
  '''$''' sudo emerge -av subversion
 
Check that that apache2 USE flag is enabled before performing the emerge. After the emerge has completed, you can create a group for users who will have access to the repositories, including yourself. However, making yourself or any other users members of the apache group should be sufficient if you are wanting to use apache to leverage svn.
 
Check that that apache2 USE flag is enabled before performing the emerge. After the emerge has completed, you can create a group for users who will have access to the repositories, including yourself. However, making yourself or any other users members of the apache group should be sufficient if you are wanting to use apache to leverage svn.
 +
'''$''' sudo groupadd svnusers
 +
'''$''' sudo gpasswd -a <username> svnusers
 
  '''$''' sudo gpasswd -a <username> apache
 
  '''$''' sudo gpasswd -a <username> apache
 
Create a repository. Substitute your repository's name in the place of ''reponame''.
 
Create a repository. Substitute your repository's name in the place of ''reponame''.
Line 12: Line 14:
 
  '''$''' sudo chmod -R g+rw /var/svn/''reponame''/db
 
  '''$''' sudo chmod -R g+rw /var/svn/''reponame''/db
 
  '''$''' sudo chmod -R g+rw /var/svn/''reponame''/locks
 
  '''$''' sudo chmod -R g+rw /var/svn/''reponame''/locks
 +
If desired, edit the subversion server file and ensure the user and group are both set appropriately.
 +
'''$''' sudo nano -w /etc/conf.d/svnserve
 +
When ready, start the server and add it to startup.
 +
'''$''' sudo /etc/init.d/svnserve start
 +
'''$''' sudo rc-update add svnserve default
 +
To get the web-based server going we will need to configure apache.
 +
'''$''' sudo nano -w /etc/conf.d/apache2
 +
Make sure the following exist on the APACHE2_OPTS line:
 +
-D SVN -D SVN_AUTHZ -D DAV -D DAV_FS
 +
Now edit the apache svn config file
 +
'''$''' sudo nano -w /etc/apache2/modules.d/47_mod_dav_svn.conf
 +
Here is an example configuration:
 +
<pre>
 +
<Location /svn/>
 +
        DAV svn
 +
#      SVNPath /var/svn/''reponame''
 +
        SVNParentPath /var/svn
 +
        SVNListParentPath on
 +
        SVNAutoVersioning On
 +
        AuthType Basic
 +
        AuthName "Subversion repository"
 +
        AuthUserFile /var/svn/conf/svnusers
 +
        Require valid-user
 +
        SSLRequireSSL
 +
</Location>
 +
</pre>
 +
 +
Next, navigate to the folder where your code is, and import the initial revision into the repository.
 +
'''$''' sudo svn import . file:///var/svn/''reponame''/ -m 'Initial import'

Revision as of 15:34, 13 March 2011

Configuring Software - Subversion

If you do any type of development work, you'll probably want to use some type of version control, especially if you have multiple people working on the project or if you just want to take advantage of the easy way to deploy code.

$ sudo emerge -av subversion

Check that that apache2 USE flag is enabled before performing the emerge. After the emerge has completed, you can create a group for users who will have access to the repositories, including yourself. However, making yourself or any other users members of the apache group should be sufficient if you are wanting to use apache to leverage svn.

$ sudo groupadd svnusers
$ sudo gpasswd -a <username> svnusers
$ sudo gpasswd -a <username> apache

Create a repository. Substitute your repository's name in the place of reponame.

$ sudo svnadmin create --fs-type fsfs /var/svn/reponame/

Set permissions on the repository and subfolders.

$ sudo chown -R root:apache /var/svn/reponame/
$ sudo chmod -R g-w /var/svn/reponame/
$ sudo chmod -R g+rw /var/svn/reponame/db
$ sudo chmod -R g+rw /var/svn/reponame/locks

If desired, edit the subversion server file and ensure the user and group are both set appropriately.

$ sudo nano -w /etc/conf.d/svnserve

When ready, start the server and add it to startup.

$ sudo /etc/init.d/svnserve start
$ sudo rc-update add svnserve default

To get the web-based server going we will need to configure apache.

$ sudo nano -w /etc/conf.d/apache2

Make sure the following exist on the APACHE2_OPTS line:

-D SVN -D SVN_AUTHZ -D DAV -D DAV_FS

Now edit the apache svn config file

$ sudo nano -w /etc/apache2/modules.d/47_mod_dav_svn.conf

Here is an example configuration:

<Location /svn/>
        DAV svn
#       SVNPath /var/svn/''reponame''
        SVNParentPath /var/svn
        SVNListParentPath on
        SVNAutoVersioning On
        AuthType Basic
        AuthName "Subversion repository"
        AuthUserFile /var/svn/conf/svnusers
        Require valid-user
        SSLRequireSSL
</Location>

Next, navigate to the folder where your code is, and import the initial revision into the repository.

$ sudo svn import . file:///var/svn/reponame/ -m 'Initial import'