Volodymyr Osypov blog

June 3, 2008

SVN - quick start tutorial

Filed under: Soft and Programming — Tags: , , , — admin @ 12:02 pm

Recently I’ve decided finally to learn to work with version control systems and selected SVN (Subversion). It was actually installed already on my Linux Fedora, but you can easily install it to your Fedora system using yum install subversion or just find RPM or DEB of subversion package.

Now I want to share with youthis little quick start guide and won’t tell you what SVN is and it’s whole description.
I have a PHP project in /var/www/html/docs/haibuy. And Apache has Virtualhost haibuy. My IP in LAN is 192.168.1.7.

So now we need to create ‘repository’ where our projects will ‘live’. We can create just one repository for all projects. So I’ve created /svn directory. And then run a command:

svnadmin create /svn/repository

And got repository subdirectory in /svn with its subdirectories structer.

Now we need to import a project to our repository. To use all the features of SVN including branches, merging branches we should create our project directories structure like this:

/path/to/project
          |- trunk
          |- branches
          |- tags

trunk must have you project files.
Now we need to import our project to repository:

svn import /path/to/project file:///path/to/repos/project -m "Comment"

In my case it was:

svn import /var/www/html/docs/haibuy file:///svn/repository/haibuy -m "Comment: initial import"

Now we can delete our project from /var/www/html/docs/haibuy (or if you’re afraid just rename it).
To work with SVN as client I use Eclipse with Subclipse plugin.
I also use PHP nightly plugin for it. To install them both run Eclipse. Then go to “Help->Software Apdates->Find and install”, select “Search for new freatures to install” add “New remote site…” “PHPEclipse Nightly” with URL:
http://update.phpeclipse.net/update/nightly and “Subclipse” with URL:
http://subclipse.tigris.org/update_1.2.x. After that Subclipse and PHP Eclipse will be installed. Reopen your Eclipse and go to Window->Open Perspective->Other… select PHP. Now you have nice PHP environment. Let’s create new project ‘haibuy’: New->Project->SVN->Checkout Projects from SVN. Create a new repository location. As our repository is on the same machine we can add it using such repository location: file:///svn/repository/haibuy/trunk. Then “Next”, select the top folder againt “Next”, and select where to save your work copy. I typed in: /var/www/html/docs/haibuy, so my working copy is on “web-server”.
Now you can use Team submenu in context menu (right mouse click on project or project files) to work with SVN. To get the latest version from repository use Team->Update. To confirm your changes and upload them to the repository use Team->Commit…

Now we need to make our repository reachable from other machines. We need to open Firewall and add 3690 port TCP protocol in ‘Other Ports’ section. Also we can check 80 port in ‘Trusted Services’ to make our http://haibuy available over the LAN.
After that we have to start demon, which will listen to the 3690 port and allow to work remotly with SVN.

svnserve -d

Now you can work with repository from other machines. path in my case: svn://192.168.1.7/svn/repository/haibuy/trunk

Other developer is working under Windows XP and he uses TortoiseVPN client. Everything works fine.

P.S.: to check if your 3690 port is open and svnserve demon started run shell command “telnet 192.168.1.7 3690″ from other machine.

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress