logo
     
Home Digital TortoiseSVN, Subversion and Bluehost

Wed

14

May

TortoiseSVN, Subversion and Bluehost Print E-mail

subversion_logo.png

I'm a big fan of Subversion, not only for storing pure code, but also for documents, CSS files, photoshop assets and whathaveyounot.

We're already using SVN in the workplace, but I wanted my own repository for my personal stuff. And as there is a whole lot of bandwidth and diskspace going to waste on my ISP service account, I'd thought I'd get my own private SVN up and running, accessible from my Windows machine (using TortoiseSVN).

Here's a short writeup of all the steps I took to get it working. Most is puzzled together from help files and posts on message boards - I copy/pasted and ordered it in a logical fashion here, to get all info together in one place. At least it can serve me in a few months to remember what I did exactly.

Most of this information is exactly tuned to how Bluehost works, but I suspect the process at any other decent ISP should prove out to be quite similar.

Step 1: get the dependencies correct

SSH access

SSH access is not enabled by default. Get your ISP to enable it for you. They require typically a scanned ID card for prove of identity.

sshaccess.jpg Bluehost: Cpanel --> SSH Access will present you with a field to upload a picture in, and takes it from there. SSH enabled after about 5 minutes.

 

Step 2: install Subversion

Once you got SSH access, we need a SSH client. I'm using putty, and I will presume that's what you'll be doing as well.

Download putty.exe from: www.chiark.greenend.org.uk/~sgtatham/putty/download.html

Then use your hostname as the host to contact to:

putty.jpg

As there's no access to write anything to the webserver's /bin directory (luckily), we'd need to create our own $HOME/bin dir. Here's where we'll install SVN.

Note: I tried installing from the latest source tarball that can be found at http://subversion.tigris.org/, but I got errors on missing 'apr' and 'apr-util' (apache portable runtime) packages. Downloading and configuring these got me even further from home. Until I found this post by birdsnare, stickied on the Bluehost support forum.

Just copy and paste this (remember to hit return after the last command), and all will get installed for you:

cd ~
mkdir src
cd ~/src
wget http://www.gtlib.gatech.edu/pub/apache/apr/apr-util-1.2.12.tar.gz
wget http://www.gtlib.gatech.edu/pub/apache/apr/apr-1.2.12.tar.gz
wget http://subversion.tigris.org/downloads/subversion-1.4.6.tar.gz
wget http://www.webdav.org/neon/neon-0.28.0.tar.gz
tar -xzf apr-util-1.2.12.tar.gz
tar -xzf apr-1.2.12.tar.gz
tar -xzf subversion-1.4.6.tar.gz
tar -xzf neon-0.28.0.tar.gz
cd ~/src/apr-1.2.12
./configure --prefix=$HOME LDFLAGS="-L/lib64"
make
make install
cd ~/src/apr-util-1.2.12
./configure --prefix=$HOME --with-apr=$HOME LDFLAGS="-L/lib64"
make
make install
cd ~/src/neon-0.28.0
./configure --enable-shared --prefix=$HOME LDFLAGS="-L/lib64"
make
make install
cd ~/src/subversion-1.4.6
./configure --prefix=$HOME --without-berkeley-db --with-zlib --with-ssl LDFLAGS="-L/lib64"
make
make install

That should have given us a working svn, installed in $HOME/bin.

Step 3: create a /svn dir and a first svn repository

I'm going to have all my svn repositories in one dir, so I created $HOME/svn to store all these:

cd
mkdir svn
cd svn

Then we create a svn repository for our project 'myproject'

svnadmin create --fs-type fsfs myproject
chmod -R 755 myproject

There, that's done.

Step 4: add the svn binaries to your path on the server, and test it

Use a putty SSH session to add the installed svn binaries to your $PATH environment variable. As found in a lifesaving post by bkohl:

There is a way to remotely use a Subversion repository running on your Bluehost account using svn+ssh. It only requires a very simple modification to one file.

The only thing you need to do is to modify your ~/.bashrc script to have the path to the svnserve application, which should be in ~/bin. All I did was copy my $PATH declaration from my ~/.bash_profile into my ~/.bashrc.

My .bash_profile had this line:

PATH=$PATH:$HOME/bin

which I added to my .bashrc file using vi.

Once this is done test access to your repository from within the server by doing the following:

svn list svn+ssh://
 This e-mail address is being protected from spambots. You need JavaScript enabled to view it
 _DOMAIN.com/home/YOUR_HOME_DIR/YOUR_SVN_REPOSITORY _DIR 

Step 4: Create a private/public keypair

If you don't want to be bothered by TortoiseSVN asking you to type your password over and over again, each time you access svn (and believe me, you don't), we need a private/public keypair to install a trusted relationship.

This info is coming directly from our wiki at work. And that on itself is an aggregation of several other websites out there who explain more or less the same.

Step 4.1: Download and install

Step 4.2: create a keypair on the server

Fire up putty.exe again (see above)

cd
ssh-keygen -b 1024 -t dsa -f mykey

make sure to leave the passphrase empty (two times).

mkdir ~/.ssh
chmod 700 ~/.ssh
cp mykey.pub ~/.ssh/authorized_keys

Step 4.3: download the private key file to your computer

Create a directory where you can store your keyfiles in. Should remain on your system, so not /temp or anything like it.

Then use WinSCP to copy the private key file to your computer:

winscp.jpg

You should now cleanup the server and remove your key files

cd
rm mykey mykey.pub

Step 5: Install TortoiseSVN

Step 5.1: Download and Install

Get TortoiseSVN here: tortoisesvn.net

Step 5.2: Convert the key for use in putty

  • open puttygen, open the "conversions" menu and chose "Import Key"
  • browse to your file "mykey" which you got from the server
  • enter the passphrase (empty!) you used when creating the key files on the server
  • click "Save private key" and save the file as "mykey.PPK"

Step 5.3: Test the key

  • open putty and create a new session like this:
    • Session->HostName: www.yourdomain.com
    • Session->Protocol: SSH
    • Session->Saved Sessions: yourdomain
    • SSH->Prefered SSH Protocol version: 2
    • SSH->Auth->Private Key file for auth: browse and select mykey.PKK
  • Go back to Session node and hit "save" button. You will see "yourdomain" in the list of available sessions.
  • Click "open" and you should see a telnet login prompt.
  • Use your username and if everything is ok, you don't have to provide a password to your system.

Step 5.4: setup TortoiseSVN to use the SSH tunnel

On WinXP, look for a file called: C:\Documents and Settings\YOUR_LOCAL_USERNAME\Application Data\Subversion\config

Or on Vista: C:\Users\YOUR_LOCAL_USERNAME\AppData\Roaming\Subversion\config

Make sure you uncomment (remove the '#', if there's any) the #tunnels section and add a line like this:

ssh = c:\\Program\ Files\\TortoiseSVN\\bin\\TortoisePlink.exe

Note the double backslashes and the single backslash to escape the space.

config.jpg

Step 7: checkout the svn repository to a directory on your local harddisk

We're almost there now.

Step 7.1: Retrieving files from the repository

  • Using windows explorer, browse to the folder where you want to store your local working copy (ex. "C:\Projects")
  • Right click and choose "SVN Checkout".
  • URL of repository (using the same - empty - svn repository we created above):
      svn+ssh://youraccount@yourdomain/home/youraccount/svn/myproject
  • Checkout directory: C:\Projects\yourproject (or any other folder of your choice)
  • Click OK

checkout.jpg

Step 7.2: Adding files to the repository

You can now copy / move / create your files and directories in your local folder, and use the standard TortoiseSVN shell commands to commit and update.

Comments
>> Only registered users can write comments! Please Login or Create an account
drewbocz   |2008-06-17 17:52:57
Hi,

Thanks so much for this info. I was able to install SVN on my bluehost account based on this post - http://www.bluehostforum.com/showpost.php?p=514... but I didn't know what to do after that.

Thanks to you, I was able to configure TortoiseSVN and more or less got it up and running.

Just a question though, I still get a password check when I use TortoiseSVN. I think I set up my keys properly because I no longer need to enter my password when using putty. I also double-checked that I had typed the tunnel info correctly. What could be wrong? Also, in 4.1, you mentioned that we had to download plink.exe, but what do we do with that afterwards?
tom   |2008-06-18 02:16:15
On the password check: if your [tunnels] section is uncommented, and the path to Tortoiseplink.exe is correct (the exe exists in that exact location), my best guess is that you didn't name the saved session in putty correctly.

In step 5.3, you need to specify a name for your putty session ('YOURDOMAIN'), and this should be the exact name that is used in the svn+ssh connection string in step 7.1 (svn+ssh://youraccount@YOURDOMAIN/home/youracc ount/svn/myproject).

Anyways, I'd suggest to delete the putty session, and create a new one (maybe use a different name, like 'mysvn'). If you can doubleclick on the 'mysvn' putty session, and it opens without asking for a password, that functions.
Then use '@mysvn' in the svn+ssh connection string. Should do the trick.

And you're right, plink.exe is no longer needed, we're now using the TortoisePlink.exe that comes with the tortoise install. I'll make an edit to the page.

tom
drewbocz   |2008-06-18 19:43:14
That thing about YOURDOMAIN worked perfectly. I wasn't able to connect that step from 5.3 to 7.1 -- I thought I was supposed to use my actual domain in 7.1 and not the alias I used to save the putty session.

Thanks a lot
GordonChil  - svn+ssh   |2008-08-22 13:21:34
I have bluehost as my webhost as well. I have also successfully compiled and installed subversion already just so I can have a subversion client on there.

Before I dive into some of these steps to actually get svn+ssh working... will I need to supply my ssh password to anyone that I point to my repositories? And is there a way to use svn+ssh without them seeing/knowing my ssh login (although it's very easy to guess)? In other words, is there a way to set it up so I could point anyone to something like... svn+ssh://gordonchild.com/svn/myproject

Excellent post by the way.
tom   |2008-08-23 08:39:16
ssh is secure shell, and requires a known/existing user on the hosting system to login. Users can really mess with a system too, that's why Bluehost asks for ID verification before allowing ssh access.

If you're particularly shy about your password, you could hand out the private key you create in step 5.2, but that would be as unsafe as sharing your account name and password. Anyone using that private key to login to the bluehost server with your account, would be undistinguishable from yourself.

In short: bad idea, as far as I'm concerned, and probably against the regulations for ssh access from Bluehost.
Viper  - ssh needed?   |2008-08-27 19:29:19
I have an account at bluehost/hostmonster. I followed the directions here to get the software compiled. Thanks for that!!!

Can't you run this without the SSH running? I added a cron job with the following: "/home/account/bin/svnserve -d -r /home/account/svn" and it works.

I wanted to make sure I wasn't missing out on something as to why you would use SSH.
tom   |2008-08-28 04:38:15
I think you could be right, as we could then use the SVN built-in authentication in the svnserve.conf file to define users and passwords.

However, I tried to run svnserve but I cannot connect to it using TortoiseSVN.

Could you provide some more info? What exactly do you put in your crontab? And what is the svn:// link you use to connect to your repository?
drewbocz  - adding repos to public_html   |2009-02-03 23:42:22
Just wondering, if you create a repository in public_html, then it would be accessible via http:// instead of svn+ssh. Is that right?
ansgar  - re: ssh needed?   |2009-04-14 09:41:46
Viper wrote:

Can't you run this without the SSH running? I added a cron job with the following:  /home/account/bin/svnserve -d -r /home/account/svn and it works.

Did anyone else try this. I do not seem to get this working.
I actually started svnserve in the shell and see it running looking at the process manager but i can't find a way to connect to it using tortoiseSVN.
Viper  - re: re: ssh needed?   |2009-04-14 09:53:00
Here is my cronjob:

Quote:
/home/account/bin/svnserve -d -r /home/account/svn


Let's say you used svnadmin to create a svn called "test1". You would type in your SSH client: svnadmin create test1.

Once you set up the permissions, and the cron job has run, to access your svn you would use the following as your URL in tortoise:

svn://account.com/test1

Viper
jemuhammad   |2010-02-19 04:26:47
Greetings,
I followed intructions up to step 4 but when I try to access my repository using

svn list svn+ssh://account@domain/home2/account/svn/myp roject

I keep getting
mount: No such file or directory

When I look at my server I can clearly see the repository

/home2/account/svn/myproject

also my bashrc looks like this:

# .bashrc
# User specific aliases and functions
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
PATH=$PATH:$HOME/bin
fi

Any clues?
Thanks in advance.
tom  - re:   |2010-02-19 13:01:17
Heh, if svn would be working correctly, you'd get something like

svn: No repository found in '/home2/account/svn/myproject'

but from the error message you get (mount: No such file or directory) I imagine that the svn executable itself can not be found (and it has nothing to do with the svn repository -- yet).

I guess that you put the PATH line in your .bashrc file in the incorrect location, namely inside the IF ... FI loop. It should be outside, so it gets always executed.

So change:

if [ -f /etc/bashrc ]; then
. /etc/bashrc
PATH=$PATH:$HOME/bin
fi


into:

if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
PATH=$PATH:$HOME/bin

and then let me know what happens
jemuhammad   |2010-02-19 17:20:49
Thanks Tom for responding.
I modified my .bashrc file and tried the following: (does any of this mean that svn is 'working'?)

svn list svn+ssh://account@domain/home2/account/svn

I received this:
mount: No such file or directory
svn: No repository found in 'svn+ssh://account@domain/home2/account/svn'

I also tried:
svn list --verbose file:///svn/myproject

and received:
svn: Unable to open an ra_local session to URL
svn: Unable to open repository 'file:///svn/myproject'


also tried:
svn list --verbose http://account@domain/home2/account/svn/myproj ect

and received:
svn: OPTIONS of 'http://account@domain/home2/account/svn/mypro ject': 200 OK (http://domain)

Thanks!
jemuhammad   |2010-02-20 02:40:21
I have done all the steps but still, for step 4 when I enter in putty:

svn list svn+ssh://account@domain/home2/account/svn/myp roject

I get:
mount: No such file or directory

And in step 7.1 for SVN Checkout it says 'Error Network connection closed unexpectedly'. The operation failed.

I don't know what else to do or where to look.
jemuhammad  - re: re:   |2010-02-20 03:10:41
tom wrote:
but from the error message you get (mount: No such file or directory) I imagine that the svn executable itself can not be found (and it has nothing to do with the svn repository -- yet).


I see the file 'svn' in my bin directory (/home2/account/bin) so I don't understand why it cannot be found...
jemuhammad   |2010-02-20 08:00:04
My Subversion is installed, I just cannot seem to access any repositories (either that or they are not being created correctly).

=====

svn, version 1.6.9 (r901367)
compiled Feb 20 2010, 04:52:57

Copyright (C) 2000-2009 CollabNet.
Subversion is open source software, see http://subversion.tigris.org/
This product includes software developed by CollabNet (http://www.Collab.Net/).

The following repository access (RA) modules are available:

* ra_neon : Module for accessing a repository via WebDAV protocol using Neon.
- handles 'http' scheme
- handles 'https' scheme
* ra_svn : Module for accessing a repository using the svn network protocol.
- handles 'svn' scheme
* ra_local : Module for accessing a repository on local disk.
- handles 'file' scheme
* ra_serf : Module for accessing a repository via WebDAV protocol using serf.
- handles 'http' scheme
- handles 'https' scheme

=====

I neglected to say, this is my install script (I used the latest available files as of Fe...
jemuhammad   |2010-02-20 08:02:09
cd ~
mkdir src
cd ~/src

wget http://www.gtlib.gatech.edu/pub/apache/apr/apr-uti l-1.3.9.tar.gz
wget http://www.gtlib.gatech.edu/pub/apache/apr/apr-1.4 .2.tar.gz
wget http://subversion.tigris.org/downloads/subversion- 1.6.9.tar.gz
wget http://www.webdav.org/neon/neon-0.29.3.tar.gz

tar -xzf apr-util-1.3.9.tar.gz
tar -xzf apr-1.4.2.tar.gz
tar -xzf subversion-1.6.9.tar.gz
tar -xzf neon-0.29.3.tar.gz

cd ~/src/apr-1.4.2
./configure --prefix=$HOME LDFLAGS="-L/lib64"
make
make install

cd ~/src/apr-util-1.3.9
./configure --prefix=$HOME --with-apr=$HOME LDFLAGS="-L/lib64"
make
make install

cd ~/src/neon-0.29.3
./configure --enable-shared --prefix=$HOME LDFLAGS="-L/lib64"
make
make install

cd ~/src/subversion-1.6.9
./configure --prefix=$HOME --without-berkeley-db --with-zlib --with-ssl LDFLAGS="-L/lib64"
make
make install

3.25 Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved."

Last Updated on Friday, 20 June 2008 06:46