ear-fung.us I’m a programmer. I’m also pro-grammar.

18Feb/0835

Bluehost + Subversion (SVN) + XCode = Bliss

I just finished setting up Subversion to work on Bluehost. It wasn't too hard but I can tell that this is going to be the start of a beautiful source code repository affair.

I've long understood the benefits of source code repositories and source code management. I use it at work and have never needed it for home/personal use till recently. I'll outline the steps in undertook here.

First, you'll need to enable SSH access for Bluehost. After you do this, make sure it's working by opening up a terminal window and type: ssh user@domain and hit enter. Enter your account password and if it's set up correctly, you should have full SSH access.

Time to set up Subversion!

Create the temporary directory

mkdir ~/srccd ~/src

Download the SVN dependencies:

wget http://subversion.tigris.org/downloads/subversion-deps-1.4.6.tar.gz

And extract them:

tar -xzvf subversion-deps-1.4.6.tar.gz

Traverse into the newly created directory:

cd subversion-deps-1.4.6

Install Apr

cd apr ./configure --prefix=$HOMEmake; make install

Install Apr Util

cd apr-util ./configure --prefix=$HOME --with-apr=$HOMEmake; make install

Install Neon

cd neon ./configure --enable-shared --prefix=$HOME make; make install

Remove the dependencies directory before continuing:

cd ~/srcrm -rf *

[WARNING: Do not execute the "rm -rf" command unless you're SURE you know what it will do and sure that you're in the ~/src directory. I am not responsible for any damage done to your hosting environment from the use of this command.]

Download SVN

wget http://subversion.tigris.org/downloads/subversion-1.4.6.tar.gz

Extract and traverse into the directory

tar -xzvf subversion-1.4.6.tar.gz cd subversion-1.4.6

Build Subversion

./configure --prefix=$HOME --without-berkeley-db --with-zlib --with-ssl --with-neon=$HOMEmake; make install

Make sure that the path is set correctly

vi ~/.bashrc

Navigate to the line that says "fi"

i PATH=$PATH:$HOME/bin

Press enter to get "fi" to the next line.
ESC

:wq

Set up your repository

mkdir ~/repos cd repos svnadmin create project_name

Now to access your new project repository, use this scheme:

svn+ssh://username@hostname/home/username/repos/project_name/

You're done!
Wow, that was a lot.

One thing that threw me for a loop was using the repository in XCode with an existing project.

Here's how I did that:

  1. Open XCode project and go to Preferences -> SCM
  2. Configure a new connection with the previous settings
  3. Quit out of the preferences screen and click SCM->Repositories
  4. Make sure it connected correctly and then click the "Import" button.
  5. Make sure your build directory is not present and import the project into SVN
  6. Go to the folder that contains your project and rename it to project_name.Old
  7. Back to XCode and click the "Check Out" button. It will get the code from SVN and put it where you specify. After it's done checking out the code it will ask if you want to open the project.
  8. After the project is open, select SCM->Configure SCM For This Project...
  9. Select the repository from the drop down menu

You can now use your new SVN repository with your XCode project. All your options can now be found under the SCM menu option.

Comments (35) Trackbacks (2)
  1. Great tutorial. I wonder how easy it would be to make that into a bash script for the Linux n00bs like me?

  2. c’mon, dude. copy+paste.

    …or you can give me ten bucks and I’ll do it for you :)

  3. Thank you!

    that last line
    svn+ssh://username@hostname/home/username/repos/project_name/

    so simple yet nobody post that
    that’s exactly what i was looking for

    now i’ll just figure out how to link the ~/repos to ~/www so i can open the project online

  4. i got an error message at the end:

    /usr/lib/libexpat.so: could not read symbols: File in wrong format

    has anybody seen this one, yet?

    thank you!

  5. Has anyone found a way to have multiple secure user access to the subversion repositories? Bluehost will not provide more than one ssh login per customer account, so the ssh+svn will not work for multiple users. I guess we are stuck with HTTP, but bluehost also doesn’t have the subversion apache modules installed, so that won’t work either. Any suggestions of a work around? Or am I stuck?

  6. John, I am in the same boat… :-(

  7. I follow the steps above on Bluehost and everything seems to work out except when I try to do svnadmin I get an error message:
    -bash: svnadmin: command not found

    Is there anyway I can check the installation?

    Thanks in advance.

  8. @Mike

    Did you add the path to your .bashrc file?

    Open the file with the command: vi ~/.bashrc
    Hit the “i” key to go into insert mode
    then add the line: “PATH=$PATH:$HOME/bin” (don’t forget the linebreak)

    You may need to log out and then log back in for the svnadmin to work.

    Let me know if that helps.

  9. Sorry…I don’t know what it was but I went through the steps again and all the tools are now in the bin directory.

    Thanks Again!

  10. Something I came across that might screw someone up when going through this:
    svn+ssh://username@hostname/home/username/repos/project_name/

    On my hosting site it is actually:
    svn+ssh://username@hostname/home2/username/repos/project_name/

    where the home directory is replaced with “home2″

  11. Thanks, Mike.

    You can find out what your home directory is by typing: pwd
    at the ssh prompt (Print Working Directory).
    That will tell you the current path to where you are at the prompt.

  12. I’m having the same problem as imehesz. I get the error:

    /usr/lib/libexpat.so: could not read symbols: File in wrong format
    collect2: ld returned 1 exit status
    make: *** [subversion/libsvn_subr/libsvn_subr-1.la] Error 1
    cd subversion/libsvn_subr && /bin/sh /home/abbysdad/src/subversion-1.4.6/libtool –tag=CC –silent –mode=link gcc -g -O2 -g -O2 -pthread -rpath /home/abbysdad/lib -o libsvn_subr-1.la auth.lo cmdline.lo compat.lo config.lo config_auth.lo config_file.lo config_win.lo constructors.lo ctype.lo date.lo dso.lo error.lo hash.lo io.lo kitchensink.lo lock.lo md5.lo nls.lo opt.lo path.lo pool.lo prompt.lo quoprint.lo simple_providers.lo sorts.lo ssl_client_cert_providers.lo ssl_client_cert_pw_providers.lo ssl_server_trust_providers.lo stream.lo subst.lo svn_base64.lo svn_string.lo target.lo time.lo user.lo username_providers.lo utf.lo utf_validate.lo validate.lo version.lo xml.lo /home/abbysdad/lib/libaprutil-0.la -lexpat /home/abbysdad/lib/libapr-0.la -lrt -lm -lcrypt -lnsl -lpthread -ldl -lz
    /usr/lib/libexpat.so: could not read symbols: File in wrong format
    collect2: ld returned 1 exit status
    make: *** [subversion/libsvn_subr/libsvn_subr-1.la] Error 1

    Any suggestions?

    Thanks! (Great tutorial by the way)

  13. Ryan,
    Try this: http://www.linuxquestions.org/questions/fedora-35/fedora-7-64bit-usrliblibexpat.so-could-not-read-symbols-file-in-wrong-format-563541/

    I know it’s not specifically about svn, but it might work anyway. Looks like it’s some sory of 32bit vs 64 bit issue.

  14. Mark,

    Thanks for the link. After some digging around I found out that Neon requires extra information in a64-bit environment. I found a short tutorial on the Bluehost forum that can be found here:

    http://www.bluehostforum.com/showpost.php?p=51455&postcount=19

    It worked like a charm for me.

    Thanks again.

  15. Hey Guys,

    For those of you trying to find a work around for multiple users on Bluehost (or any shared hosting) I was able to somewhat successfully follow the instructions from this site:

    http://www.ebswift.com/wiki/wikka.php?wakka=SubversionFTP

    It has you mount your FTP site to a local drive letter and uses TortoiseSVN to connect to the remote repository through this virtual drive.

    I wasn’t able to get NetDrive to work but I did get WebDrive to work, though it is not free and am currently using the trial version.

    Also, I’m not sure if this will allow unique user information from within subversion itself but, at least you can have unique FTP logins :)

    Finally, if anyone finds a free “WebDrive” software that works (I didn’t have any luck with FTPDrive or SFTPDrive) could you post it here?

    -Mike

  16. Hey this is a great tutorial; thanks for posting it.

    I’ve run into the same snag as “Mike”. When I enter the “svnadmin create project_name” command I get this message:
    -bash: svnadmin: command not found

    I’ve been through the steps twice and continue to have the problem. I notice there are not many files in my bin folder, so I think I have the exact same comment mike did. But unfortunately going through the steps again didn’t solve it.

    Any suggestions or ideas why the commands are not getting installed into the bin folder?

  17. nevermind; I got it working I followed the link above that talks about setting up on a 64-bit system. I was able to muddle through to something that worked after following it.

  18. Sweet! I’m glad you were able to get it working!

  19. Agreed and Confirmed.
    I had the same issue related to a 32 bit install guide for a shared box that is 64bit.

    The above link to the bluehost forum is accurate (bar the spelling mistake in berkeley he made), and worked great for me

  20. To use SVN with Bluehost, do you need a dedicated IP address? I just asked for some help on the Bluehost forums and was told I need to purchase a dedicated IP for $30/year in order to use SVN. Just wanted to confirm this is true because this it the first I’ve heard of this. Thanks!

  21. No Luke, you don’t need a dedicated IP address, you just need ssh access.

    If you don’t want to set this up yourself, there are some free SVN repository websites such as google code and http://www.beanstalkapp.com

    You may want to explore these as an alternative.

  22. First of all, great job, works perfectly. One problem, your instructions are missing a [space] in two places after the $HOME variable. I couldn’t get this install to work until a friend pointed out the problem. Would be great if you could change the post;) Thx for the tutorial

    The following lines from ‘Install Apr’ and ‘Install Apr Util’ should be changed from:

    cd apr ./configure –prefix=$HOMEmake; make install
    cd apr-util ./configure –prefix=$HOME –with-apr=$HOMEmake; make install

    to this:

    cd apr ./configure –prefix=$HOME make; make install
    cd apr-util ./configure –prefix=$HOME –with-apr=$HOME make; make install

  23. I’m trying to checkout the repository from a windows machine (I had the same problem also when trying from the linux box). TortoisePlink asks for user and password. I’m giving it my user and password I use when connecting with FTP or putty, but still, I get the “Connection closed unexpectedly” message.

    I have installed svn according to this guide. It all went perfectly good. After the installation, I have created a repository (“~/repos”). I’m stuck now with the checkout.

    Tried to checkout from within my putty session, and still the same error.

    Please help.

  24. Adrian, You don’t use putty to check out the project, just to create the repository.

    You need an svn clinet on your local machine and give it the URL of the repos to check out locally.

  25. I used putty to create a directory and checkout, so I would know I don’t have a firewall problem. I mean, I wanted to test it while doing a local checkout to a svn+ssh://localhost address.

    With TortoiseSVN, I’m using the “svn+ssh://domain/repos” address. It prompts for a username and password, and then fails. I’ve tried also the “svn+ssh://username@domain/repos”, which only asked for the password, but also failed.

  26. Any help?

  27. You can now get SSH access on Bluehost via the cpanel.
    Under the Security section,
    SSH/Shell
    it will ask you to upload a scan/photo of your picture ID.

    (sorry if this was mentioned elsewhere)

  28. Hi, very helpful, but, you really need to but some linebreaks between those commands.

    mkdir ~/srccd ~/src

    is not the same as

    mkdir ~/src

    cd ~/src

  29. Thanks very much! I had to download and build expat (with –prefix=$HOME) due to incompatibilities with the one already there on the host, and then add the –with-expat=$HOME flag to the ones already in your tutorial, configure and build subversion, and after that it worked perfectly. I also had some initial confusion with the missing line breaks, but no harm done. Very helpful, and thanks again.

  30. I got down to the cnofiguation of subvertion and it said

    configure: Apache Portable Runtime (APR) library configuration
    checking for APR… yes
    checking APR version… 0.9.4
    wanted regexes are 0\.9\.[7-9] 0\.9\.1[0-9] 1\.
    configure: error: invalid apr version found
    make: *** No targets specified and no makefile found. Stop.
    make: *** No rule to make target `install’. Stop.

    How can I get the right version of apr?

    - Sam

  31. I found better directions on the forums:

    http://www.bluehostforum.com/showthread.php?t=8191&highlight=install&page=2

    At the bottom. Versions work together and it worked just fine.

    - Sam

  32. Thank you for a great article!

  33. I get the following when i login to my ssh.

    -bash: PATH=/ramdisk/bin:/usr/sec/bin:/usr/kerberos/bin:/usr/lib/courier-imap/bin:/usr/bin:/bin:/home2/amarsibi/bin: No such file or directory
    -bash: /home2/amarsibi/system/bin: is a directory

  34. Thanks for the article. but why you have created those 2 directories in the first place but haven’t used them?

    correct me if I’m wrong. you create 2 dirs then there is no step to cd into them to download or …

    Thanks,
    amit

  35. Yes, I keep getting error at the end of:

    cd apr-util ./configure –prefix=$HOME –with-apr=$HOMEmake; make install

    ./configure –prefix=$HOME –without-berkeley-db –with-zlib –with-ssl –with-neon=$HOMEmake; make install

    anyway still not working ……..

    ak


Leave a comment