# All the modified or additional information will be updated on this post in order for everyone to get alwasys up-to date information.
# After you've done this, some of you might need tomcat5 + Apache2 set up.
# I also wrote the article here, so please have a look.
Here is the how-to for setting up the subversion client with eclipse and the server. Hope this will help you more productive coding
First of all, regarding "Subversion" For more detail, please refer to http://en.wikipedia.org/wiki/Subversion_(software)
Here is the snipet about the difference between CVS & Subversion.
Subversion was created as a replacement for CVS. Its improvements include:
* Atomic commits. Interrupted commit operations do not cause repository inconsistency or corruption.
* Renamed/copied/moved/removed files retain full revision history.
* Native support for binary files, with space-efficient binary-diff storage.
* Directories are versioned. Entire directory trees can be moved around and/or copied very quickly, and retain full revision history.
* Constant time branching and tagging.
* Optimized repository accesses. This reduces unnecessary network traffic to the repository host.
* Full MIME support - the MIME Type of each file can be viewed or changed, with the software knowing which MIME types can have their differences from previous versions shown.
"Eclipse" is a Integrated Development Environment which provides the platform of developing Java/C++ ..etc. You can add the support language by adding plugin.
Now let's get started to prepare the development environment for Ubuntu (Dapper).
[Client - Eclipse with plugin]
Assume that you have already installed eclipse & j2sdk1.5-sun.
If you face problem starting up the eclipse you can find the answer in this forum. Most likely it is related to "java_home". Just for the instant check
Code:
cd /etc/eclipse
cat java_home
If you don't see /usr/lib/j2sdk1.5-sun/ commented out in the first line, modify it. Mine looks like this..
Code:
ubuntu% cat java_home
# This file determines the search order the Eclipse Platform uses to find a
# compatible JAVA_HOME. This setting may be overridden on a per-user basis by
# altering the JAVA_HOME setting in ~/.eclipse/eclipserc.
/usr/lib/j2sdk1.5-sun/
#/usr/lib/jvm/java-gcj
#/usr/lib/kaffe/pthreads
#/usr/lib/sablevm
#/usr/lib/fjsdk
#/usr/lib/j2se/1.5
#/usr/lib/j2se/1.4
#/usr/lib/j2sdk1.5-ibm
#/usr/lib/j2sdk1.4-ibm
#/usr/lib/j2sdk1.5-sun
#/usr/lib/j2sdk1.4-sun
Ok then , let's get started.
Step1: Installing the plug-in (subclipse)
Launch eclipse and go to :
help->s/w updates ->find and install->search for new features
Then press "new remote site" and add "http://subclipse.tigris.org/update"
Then follow the instraction to install the plugin.
Step2: Install library needed for subversion from eclipse
Code:
sudo apt-get install libsvn-javahl
Step3: Grance at subversion perspective
Follow this then you can see the svn perspective
window->Opne Perspective-> Other->SVN Repository Explorer
If you already have subversion server running, you can access to it by right clicking svn repository explorer then
new -> create remote folder
[Server - Subversion]
There are 2 simple ways to use subversion. One is using subversion function over WebDav and another is subversion server using specific protocol. First I'll explain about the WebDav way.
Step1: Install subversion package [WebDav]
Code:
sudo apt-get install subversion subversion-helper-scripts subversion-tools
sudo apt-get install apache2 libapache2-svn
Step2: Create repository folder & bind it to subversion.
Code:
sudo mkdir -p /var/local/svn
sudo svnadmin create --fs-type fsfs /var/local/svn
sudo chown -R www-data:www-data /var/local/svn
Step3: Set configuration for apache2 subversion module
Code:
sudo vi/etc/apache2/mods-enabled/dav_svn.conf
--
#Comment out the following 2 lines with your repo path
#DAV svn <-Comment out this
DAV svn
#SVNPath /var/lib/svn <-Comment out this
SVNPath /var/local/svn
<LimitExcept GET PROPFIND OPTIONS REPORT>
#Require valid-user <-Comment this if you don't need basic authentication
Options Indexes
Order allow,deny
allow from all
</LimitExcept>
Tip1 - Basic Authentication
In order to use basic authentication for loging on to subversion server, you need to do the followings.
Code:
sudo vi/etc/apache2/mods-enabled/dav_svn.conf
# comment the following 4 lines
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /etc/apache2/dav_svn.passwd
<LimitExcept GET PROPFIND OPTIONS REPORT>
Require valid-user
Options Indexes
Order allow,deny
allow from all
</LimitExcept>
Then create the user account
Code:
#-m option for MD5 encryption of the password
sudo htpasswd2 -cm /etc/apache2/dav_svn.passwd cavalier1
New password: *****
Re-type new password: *****
Adding password for user cavalier1
$ htpasswd -m /etc/apache2/dav_svn.passwd cavalier2
New password: *******
Re-type new password: *******
Adding password for user cavalier2
Now you can access to it with basic authentication.
Tip2 - SSL access
Code:
# Create ssl certificate
# certificate will be stored at /etc/apache2/ssl
sudo apache2-ssl-certificate
# Copy conf file for ssl
sudo cp /usr/share/apache2/config/default-443 /etc/apache2/sites-available
First conf file for port 80
Code:
# Edit conf file
sudo vim /etc/apache2/sites-available/default
--
#Comment following and set proper one
# NameVirtualHost *
NameVirtualHost *:80
# <VirtualHost *>
<VirtualHost *:80>
Ok then conf file for port 443 (ssl)
Code:
sudo vim /etc/apache2/sites-available/default-443
--
# Find the following lines and comment out and set the appropriate ones
# SSLCertificateFile /etc/apache2/sites/::SERVERNAME::-ssl.crt
SSLCertificateFile /etc/apache2/ssl/apache.pem
# SSLCertificateKeyFile /etc/apache2/sites/::SERVERNAME::-ssl.key
SSLCertificateKeyFile /etc/apache2/ssl/apache.pem
# ServerAdmin ::SERVERADMIN::
ServerAdmin Cavalierski
# ServerName ::SERVERNAME::
ServerName www.yourdomain.com
# DocumentRoot /var/vhosts/::VHOSTNAME::/htdocs-443
DocumentRoot /var/www
# <Directory /var/vhosts/::VHOSTNAME::/htdocs-443>
<Directory /var/www>
# ErrorLog /var/vhosts/::VHOSTNAME::/logs/error.log-443
ErrorLog /var/log/apache2/error.log-443
# CustomLog /var/vhosts/::VHOSTNAME::/logs/access.log-443 combined
CustomLog /var/log/apache2/error.log-443 combined
# I deleted the cgi lines as I don't need them. That's all for conf file.
--
# Enable ssl module
sudo a2enmod ssl
# Enable ssl config
sudo a2ensite default-443
# Open the port for ssl
sudo vim /etc/apache2/ports.conf
# Add the following line
Listen 443
Then reload the setting.
Code:
sudo /etc/init.d/apache2 reload
It's done. You can access to it with "http://your server name/svn".
or
If you've done ssl part "https://your server name/svn".
----
Step1: Install subversion package[svn Server]
Code:
sudo apt-get install subversion subversion-helper-scripts subversion-tools
Step2: Create repository folder & bind it to subversion.
# You can deploy your repository folder wherever you want. This is my case.
Code:
sudo mkdir -p /var/local/svn/projectx
sudo svnadmin create /var/local/svn/projectx
sudo chown -R username:usergroup /var/local/svn/projectx
Step3: Set configuration for subversion server
Code:
cd /var/local/svn/projectx/conf
sudo gedit svnserve.conf
--
[general]
anon-access = read
auth-access = write
password-db = passwd # This refer to passwd file in the same folder
realm =Cavalier Repository
--
Ok then set the authentication for the access to the subversion server. In the same folder there is already the file named "passwd", all you need to do is edit this plain text file.
Code:
sudo gedit passwd
--
[users]
username = password #<- you can modify here to whom you want to allow the access
--
Setup for the subversion server is done You can run it as a daemon by:
Code:
sudo /usr/bin/svnserve -d
or with "-r" option you can indicate the path to repos.
# With "-r" option like "svnserve -d -r /var/local/repos", your path to the repos is hidden. If you want to access to "/var/local/repos/xproject/trank" , from the client the address to access is "svn://your.svnserve.address/xproject/trank"
Code:
sudo /usr/bin/svnserve -d -r /root/svn/var/local/svn/your_repos
[Others]
However you most likely want to run automatically at OS start up.
Then let's try to do it by the super server.
Super server is a program which start the service triggered by the client request. Super server watch the specified port and if there is a request listed on the conf file, it automatically start the program. This will reduce the use of CPU and even the service is down , it automatically start the service. (Often TELNET, POP which require stability are using super server)
# However the server such as HTTPD (Apache) which has frequent access BETTER NOT use super server.
Step1: Install xinetd(Super server program) and set it up.
Code:
sudo apt-get install xinetd
sudo gedit /etc/xinetd.d/svnserve
--
service svnserve
{
disable = no
port = 3690
socket_type = stream
protocol = tcp
wait = no
user = root
server = /usr/bin/svnserve
server_args = -i -r /var/local/svn/your_repos
}
--
sudo gedit /etc/services
# modify the port "3690/tcp" line like this below
--
svnserve 3690/tcp # Subversion protocol
--
After the configuration , restart xinetd :
Code:
sudo /etc/init.d/xinetd restart
[Workaround]
Some people might face error such as "Malformed network data". Try following as a temporary solution.
#Before please check if you run svnserve with "-r" option like "svnserve -d -r /var/local/repos", your path to the repos is hidden. If you want to access to "/var/local/repos/xproject/trank" , from the client the address to access is "svn://your.svnserve.address/xproject/trank"
1) Many case svnserve file under xinetd.d is misspelled. Please check it first.
2) If svnserve file seems ok + you are running svnserve locally, change the protocol to "file".
Use:
Code:
file:///localhost/var/local/svn/your_repos
instead of
Code:
svn://localhost/var/local/svn/your_repos
3)If your are runnin svnserve on different machine. Forget about xinetd and run as a daemon.
Code:
sudo rm /etc/xinetd.d/svnserve
sudo /etc/inited.d/xinetd restart
sudo /usr/bin/svnserve -d -r /root/svn/var/local/svn/your_repos
[Tips]
You can alwasy check if the 3690 port is Listen status by
Code:
netstat -n
or
netstat -an|grep 3690
[Infos]
Here you could get the additional good info from the community member.
Originally Posted by
leo_m
Subclipse with javahl has problems...when I try to use file protocol to configure a remote host in subclipse, that url gets appended after the eclipse installation folder, e.g, if I specify file:///subversion_repositories/repository1, subclipse using javahl tries to go to /home/leo/eclipse/file/subversion_repositories/repository1, which is not a valid path, assume eclipse was installed at /home/leo/eclipse.
it is better to use javasvn than the javahl: it can be configured in Windows|Preferences (and then choose settings for subclipse)
OK Done !!
Now I have subversion server & client for the productive open source development.. Enjoy coding