Sunday, 26 November 2006

Subversion on a shared host

I finally got some hosting (bluehost specifically) going for some pet projects of my own. At this point I'm planning to wipe my linux box which has my CVS repository on it, so I thought that I would try out installing subversion on my hosted space. My goal was to be able to access subversion through an eclipse derivative: radrails.

Sorry for all the keywords, but I'm hoping that this will get picked up by google and save someone else a bunch of time. This is an account of what I did to get it working, and some steps may seem obvious to others, but I am a newbie to svn. This was only for me to get access, so tunnelling over ssh was my perfered choice.

1) I followed Matt Harvard's post on HowTo: Install Subversion on a Shared Host Install Subversion on a Shared Host. That was great, but at the end I was like "what now??".

2) Create a repo location: svnadmin create /path/to/repos.

3) While logged in over ssh to your host, run the command:
svn list svn+ssh://youraccount@yourdotcom/home/youraccount/path/to/svn/
It should prompt you for your password. ref

4) I got:
bash: line 1: svnserve: command not found
svn: Connection closed unexpectedly

which means that since the make install that I did in Matt's instructions installed subversion in ~/bin/. When you use the svn then you are not using an "interactive shell", so the path isn't set as it is when you log in. There is a couple of ways around it. Some people put a soft link in their home to the svnserve file, but I decided to just edit the ~/.bashrc file by adding PATH=$PATH:~/bin. Now if you re-run the snv list ... command from step 3, it should work.

5) Then using the subversion book as my guide, I modified config files to allow my user to have read write access.
$REPO_LOCATION/config/authz
[/]
youraccount = rw

This means for the root of the repo, my account has read write access.

$REPO_LOCATION/config/passwd
[users]
youraccount = mysecret

I just gave it a different crappy password since you will authincate against ssh.

$REPO_LOCATION/config/svnserve.conf
[general]
auth-access = write
password-db = passwd
authz-db = authz

This gives autherized people write access, shows where the password and authorization files are located. After the install the files created here have lots of comments explaining what you have to do. You pretty much just have to uncomment lines.

6) Whew. Now We're done setting up svn on the host. However, if you try and connect to svn with svn+ssh://youraccount@yourdotcom/home/youraccount/path/to/svn/ you will get:
The system cannot find the file specified.
svn: Can't create tunnel: The system cannot find the file specified.


Not so good, but fixable. I found a great post on the subclipse mailing list. It's two problems: eclipse not having a ssh program to connect with, and needing a public / private key to make connecting so much easier.

After finding all this, everything was good. ;-)
HTH

5 comments:

  1. Awesome Jim - the only problem I see above is that you've decided to wipe your Linux box! :-)

    ReplyDelete
  2. hahaha... wipe out fedora 2 (?) and install something like ubuntu... I don't use the box that much since I have not figured how to increase the screen to a decent resolution.

    ReplyDelete
  3. After looking over that, I'm happy I chose a hosting company that had subversion already set up for me.

    ReplyDelete
  4. They had CVS setup, but I wanted to try svn for a bit.
    It's awesome to have stuff already setup for you, but I find that I learn / understand less then.

    ReplyDelete
  5. I use CopyPaste 6.1 for versioning. Very simple, you copy your files from your original project in ANY directory (that is a feature CVS and Subversion don't have) you want. All comits are not atomic, but totally molecular, which is even better, because atoms are not visible. Neither are molecules, but they are bigger for sure. And that leads us to another topic. Which is better? Bigger or smaller? Well, depends what you want. If you like bigger women then bigger is better, but if you like smaller women then smaller is better. That does not mean that if you like bigger women you will like molecular commits better. That just doesn't make any sense.

    ReplyDelete