Recently we have been tasked to provide SVN support with Bluehost. Initially I was reading and found it was not possible to complete. After a bit more searching I found that it was possible. The steps here are not as simple as “apt-get install svn”, we actually have to compile it from source. Since I have been extremely busy lately, I tasked my friend Henry for the job and then told him I could provide support when needed.
With the tutorial in hand, he went to work. Here is the steps outlined in the tutorial:
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.5.4.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.5.4.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.5.4
./configure --prefix=$HOME --without-berkeley-db --with-ssl LDFLAGS="-L/lib64"
make
make install
After making it through all of the above configuring and compiling, the binaries are sitting in ~/system/bin ready for use.
Now to add a new repo, type:
svnadmin create /[dir]/[repo name]
Now import files to the repo:
svn import /[dir]/[repo name] [svn string, starting with svn://]
Now the repo is ready to add files or to check them out. But, you will soon learn that you need to add somethings to the path in order to properly execute. Once I added the things to the path, it still didn’t work. I found out that bluehost doesn’t allow execution of the .bashrc if it is a single execution item. I found a work around:
First you will have to add a public key to the .ssh/authorized_keys from your system so that you can login without using a password. If you need help with that, here is an awesome tutorial that works very well! SSH Key Tutorial
Add the following before your rsa key in ~/.ssh/authorized_keys
command="/home/USERNAME/system/bin/svnserve -t" ssh-rsa [KEY REMOVED]
Now you should be able to login using the CLI for the system that you have added the key for and use SVN.
Now that you have everything else setup, it is time to get TurtoiseSVN client up and running.
First install Putty, if you need help with that, click here.
For those that didn’t click the link, click it for fun
.
Next you are going to need to get WinSCP or Filezilla or some other program that can do file transfer over SSH. I prefer Filezilla because it is Filezilla. If you don’t have either of those, simply Google them and you’ll find them.
Ok, now you will need to log in to your Bluehost server with Putty. Once you have logged in, type the following:
ssh-keygen -t rsa
This will create 2 files id_rsa and id_rsa.pub in the .ssh/ directory. First you will want to copy the public key to make it so you can use this key on this server, type the following:
cp .ssh/id_rsa.pub .ssh/authorized_keys
Now I will assume you are using Filezilla. Open Filezilla and then for the hostname, use “sftp://[domainname.com]” and your username and password. Navigate to the ~/.ssh directory and download id_rsa to a directory on your computer of your choosing.
When you downloaded putty, you should have also downloaded PuttyGen. Open PuttyGen and then select the Conversions menu and select Import Key. Find the id_rsa file you just downloaded and import it. After it is imported select the “Save Private Key” button and export the .PPK file to your choosing.
Now we are going to open Putty and save a new session with our newly created key. Once Putty is opened, go to SSH and then to AUTH and then select the private key you exported above. After that go back to the sessions option and type the whole domainname (including .com/.net/.whatever) as the “Saved Session” and push the Save button. It is important to save the session because Tortoise will use this in just a bit.
You can test your SSH login to make sure it doesn’t ask for a password and you will know that you are on the right path.
Next up, we have to make some changes to your Tortoise config file located at C:\Documents and Settings\YOUR_LOCAL_USERNAME\Application Data\Subversion\config
If you have Vista or Win7, it will be located here:
C:\Users\YOUR_LOCAL_USERNAME\AppData\Roaming\Subversion\config
Now find the section called [tunnels] and add the following:
ssh = c:\\Program\ Files\\TortoiseSVN\\bin\\TortoisePlink.exe
Link in Linux, you have to escape the backslashes with a backslash.
Ok, you should be ready to rock at this point. Time to install Tortoise if you haven’t already. Download it here. Follow the installer, should be easy.
Time to check something out. Try to checkout a repo now by right clicking in Windows Explorer and choosing “SVN Checkout.” Use the following string but add your own info:
svn+ssh://youraccount@[domain]/home/[your account]/[repo path]/[Project]
Hopefully everything worked, if it didn’t, hit me up and I’ll help out.
Mike