HOWTO: Subversion with Bluehost
Update 2010-09-07: Bluehost upgraded their SSH which broke this original HOWTO. The new upgrade ignores user set Env Vars in a non-interactive SSH session so if you try to connect with svn+ssh it will fail because the $HOME/bin/svnserve command can’t be found. I have added a few more steps to the end of this HOWTO to include my work around for the issue. You can still use SVN with bluehost!
This blog and my entire fouzi.com domain is hosted by bluehost.com. So far I’ve been pretty satisfied with them. One thing which I was hoping for though was support for Version Control. Bluehost has CVS support, but they don’t support Pserver. You have to do it over ssh. If you are going to run your Source Control over SSH you might as well use Subversion which has some nice improvements over CVS. Only problem is, is that Bluehost does not install svn on your hosted Linux box. That’s not such a problem though because you can install it yourself. I found a bunch of HOWTOs online but they were either outdated or required some confusing patching which didn’t work for me. Here’s how I got it working on my bluehost account.
Get SSH Access to your Bluehost Box:
Before doing anything you have to follow Bluehost’s instructions on getting SSH Access to your box. Here’s what they want:
“For security reasons, shell access is not enabled by
default. In order to activate shell access on your account, you will
need to fax or mail a copy of your driver’s license, passport or other
photo id to customer service. You can fax it to +1 (801) 765-1992 or
you can submit your scanned photo ID directly to our helpdesk in the
following form”
Install Subversion:
- SSH into your box
ssh <username>@<your domain>
- Create the src and bin directories:
- Download the subversion source code
- Unpack the source
- Build and install the Apache Portable Runtime Libraries
- Build and install NEON
- Build and Install Subversion. Exclude Web access since we are exclusively using it over ssh
cd ..
./configure --prefix=$HOME --without-berkeley-db --with-apr=$HOME \ --with-apr-util=$HOME --with-neon=$HOME -without-apxs --without-apache
.make && make install
- Add $HOME/bin to your path
vi $HOME/.bashrc
PATH=$PATH:$HOME/bin
- Create an SVN Repository
mkdir $HOME/svnrepo
cd $HOME/svnrepo
svnadmin <your_project_name>
- Access your SVN Repository over SSH from a remote host:
svn list svn+ssh://<username>@<your domain>/<your home directory path>/svnrepo
- All Done! Update 2010-09-07: Nope! Not all done! Bluehost upgraded SSH. This caused a problem where the PATH env var set in the users .bashrc file is not honored during an interactive shell. The following steps are now necessary additional steps to get around this problem
bash: svnserve: command not found
- Follow these steps from my blog entry on creating SSH keys that don’t require password authentication between your svn client machine and your bluehost account.
- Now that you are able to ssh into your bluehost account without a password you will need to create a wrapper script that will invoke svnserve if you are running an svn+ssh command or just default to a shell if you are trying to make a normal ssh connection. Here is the script that I wrote. It’s very basic but gets the job done. Place this script in ~/bin/ssh_command_wrapper.sh
#!/bin/sh if [ "$SSH_ORIGINAL_COMMAND" = "svnserve -t" ] then # this is an svn+ssh command ~/bin/svnserve -t $* else # this is a normal ssh connection /bin/bash fi
- Make the script executable
chmod 700 ~/bin/ssh_command_wrapper.sh
- Edit your authorized_keys2 file to run this shell script whenever connecting using the SSH Keys. Prepend the line you added to the authorized_keys2 file with the following string:
command="~/bin/ssh_command_wrapper.sh"
The entry in your file should look something like:
command="~/bin/ssh_command_wrapper.sh" ssh-rsa WOGE3i... username@yoursvnclient
- Now you are all done! You should be able to still make a normal ssh connection to your Bluehost account but also use svn+ssh. This will work for Subclipse too if you are an eclipse user because you can configure Subclipse to use svn+ssh. It’s what I use! Enjoy!
mkdir src; mkdir bin
cd src; wget http://subversion.tigris.org/downloads/subversion-1.6.2.tar.bz2
wget http://subversion.tigris.org/downloads/subversion-deps-1.6.2.tar.bz2
tar -jxvf subversion-1.6.2.tar.bz2
tar -jxvf subversion-deps-1.6.2.tar.bz2
cd subversion-1.6.2/apr
./configure --enable-shared --prefix=$HOME LDFLAGS="-L/lib64"
make && make install
cd ../apr-util
./configure --enable-shared --prefix=$HOME
make && make install
cd ../neon
EXTRA_CFLAGS="-L/lib64 -fPIC"
CFLAGS="-L/lib64 -fPIC"
./configure --prefix=$HOME --enable-shared LDFLAGS="-L/lib64" --with-libs=$HOME
.make && make install
3 Comments
That is extremely useful and welcome for bluehost users. Perhaps you could send it to them so they could post it on their wiki?
I have updated this blog post to include my workaround for the problem created by the Bluehost SSH upgrade which does not honor the .bashrc file in the users home directory making it impossible to set the PATH env variable. This creates the problem of svn+ssh being unable to invoke the svnserve binary and results in a command-not-found.
Hi, i follow the steps of the post but still have the same problem: bash: svnserve: command not found. Please help me!