How to build SVN server, Step by step

There are many configurations for svn, here a some short instuctions to get a basic svn repository available over http.

  1. Install required packages:
    apt-get install subversion apache2 libapache2-svn
  2. Create an Directory-Structure:
    mkdir -p /var/svn/repos/
    
  3. Create a Repository:
    cd /var/svn/repos/
    svnadmin create --fs-type fsfs <your-repository>
    
  4. Now Create your Project-Struckture to import in the repository:
    mkdir -p /tmp/myproject/trunk /tmp/myproject/tags /tmp/myproject/branches
    
  5. Import the Project to the Repository:
    svn import /tmp/myproject file:///var/svn/repos/<your-repository> -m "initial import"
    
  6. Make it accesseable over http:
    cd /etc/apache2/sites-available
    touch subversion.conf
    vim subversion.conf
    
  7. Now edit the empty file with this configuration:
    NameVirtualHost *:80
    
    <VirtualHost *:80>   
      <Location /svn>
          ErrorDocument 404 default
          DAV svn
          SVNParentPath /var/svn/repos
          SVNListParentPath off
          Require valid-user
          AuthType Basic
          AuthName "subversion access"
          AuthUserFile /var/svn/.htpasswd
          AuthzSVNAccessFile /var/svn/authz 
      </Location>
    </VirtualHost>
    
  8. enable dav_svn module for apache:
    a2enmod dav_svn
    enable VHost configuration: 
    a2ensite subversion.conf
    
  9. now restart the webserver:
    /etc/init.d/apache2 restart
    
  10. Create an htpasswd:
    htpasswd -c /var/svn/.htpasswd user
    
  11. Create the access control file for the repository:
    touch /var/svn/authz
    
  12. edit the empty authz file:
    vim /var/svn/authz
    
  13. Give read/write rights to for user:
    [your-repository:/]
    user = rw
    Let's try to checkout the the repo over http: 
    svn checkout http://your-server/svn/your-repository
    

How to remove user from being sudoer user in linux

How to remove user from being sudoer user in linux

  • Find out user group identity
    $ #Syntax: id -nG {user-name}
    $ id -nG foo
    $ #OUTPUT: admin foo printer audio

    by default admin and sudo groups are allowed to use sudo command as shown in /etc/sudoers file

  • Now to remove a user from group, you have to user usermod command
    $ #Syntax: usermod -G {groupname1,groupname2,...} {username}
    $ #For example, to keep membership of foo in printer and foo groups only 
    $ #(and remove him from admin and audio groups) run this:
    $ usermod -G foo, printer foo
    $ id -nG foo
    $ #OUTPUT: foo printer
    
  • finally restart sudo service
    $ service sudo restart