Subversion is a widely distributed open source version control. Almost all the information is susceptible to being controlled with versions, I will not now make a dissertation on this concept …. Subversion not only efficiently manages the version, but also allows a quick and secure sharing of information between people located in different countries.

I have decided to install Subversion on my commercial Bluehost server, I have it wasted: unlimited hard disk, and monumental bandwidth and I only host a few web pages.

Step 2. Install a Telnet / SSH Client

I have used PuTTY, which allows remote control of machines under Unix platforms. In the case Bluehost machines with Linux operating system are used, therefore PuTTY is still valid, if the operating system of your server is Windows you have to use an alternative.

PuTTY is a free implementation of Telnet and SSH for Win32 and Unix platforms, along with an exterm terminal emulator.

I have installed the version: 2007-04-29 PuTTY 0.60. Open a session with PuTTY, the first window that will appear is the following:

You just have to enter the name of your host and press the Open button.

You have several options for [my_domain].

  • www.mydomain.com
  • mydomain.com
  • box#.bluehost.com

Where # is your box number

The problem in the previous cases is that they will then ask you for a username, to avoid this you have an alternative for [my_domain]

  • username@www.mydomain.com
  • username@mydomain.com
  • username@box#.bluehost.com

Where # is your box number

The PuTTY will ask for your password to the control panel of your server, Bluehost in my case. If everything went well, you now have control of your server by command line.

Step 3. Install Subversion

Taking advantage of the fact that we have already opened an SSH session with PuTTY, we will now install Subversion. I tried to install the latest version 1-6-3, but during the compilation and installation process I received errors, the most recent version that has been successfully installed is described by the following script:

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

have copied this code from a message provided in the Bluehost forum by a disinterested web developer. By the way, this thread in the Bluhost forum is very interesting.

In theory, all you have to do is copy the previous code, paste it into the window of the PuTTY session and hit Enter. Your server will start to compile and make the executable, it takes a while.

If everything went well, in the $/Home/bin folder you should see the following executables: svn, svnadmin, svndumpfilter, etc.

Step 4. Include the Binary svn in your Path

You need to modify the .bashrc file to inform your server where the subversion binary files that we have previously created and that are located in the bin folder are located.

Following the user defined nkohl pattern in the Bluehost forum:

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.

You basically have to include

PATH=$PATH:$HOME/bin

After

# User specific aliases and functions

In the end the .bashrc should look like this:

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

Attention if using a different editor to the vi, as it is my case that I have used the WordPad, this one includes characters that the Bluehost server will not interpret correctly. I recommend you use the vi, or look for the invisible characters, which are denoted by moving forward and backward with the cursor keys.

As you have opened a PuTTY session to control your server, it already has the integrated vi, so you can use the vi to modify the.bashrc file.

Step 5. Create a Subversion Repository

First we need to create a folder where we place the repositories, I have created the svn folder in the root directory. The command line code is as follows:

cd
mkdir svn
cd svn

We are currently ready to create our first repository

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

Replace the name “myproject” with the name of the repository you want.

Step 6. Create SSH Passwords

The objective of creating access codes is fundamentally two:

  1. Prevent Subversion from asking you for the password each time you connect.
  2. Enable a password for each user.

The second point is essential if you want to share your repositories with numerous users, in my case the second point was strictly necessary since the information in the repository was likely to be shared among many users from different countries.

We will create the keys by establishing a trust relationship between the server (bluehost) and the client (myself). For this, a key pair is generated for each user, a public one, which is saved on the server and a private one, which is saved on the user’s PC.

Step 6.1 Download and Install the Software for the Keys

If you have already installed PuTTY as a Telnet / SSH Client server, you will not need anything else, since the installation package has a key generator (I have installed the version: 2007-04-29 PuTTY 0.60).

The bluehost server also has an integrated key generator, but I find a graphic environment more comfortable, I’m not a fan of the command line.

Step 6.2 Generate Key Couples

Run the “PuTTY Key Generator” application, select an SSH-2 DSA key with 1024 bits and then press the “Generate” button. Move the mouse pointer to generate a random plot.

The “Key comment” text box is very important, in this field we must define the name of the user and in which domain of the server where the subversion is installed.

The “Key passphrase” text box, I suggest you leave it empty. Otherwise, every time you import your password, you will be asked for the phrase and in consequence we will not solve point 1 of step 6.

Press the “Load” button to store the private key in a safe place on your PC, we will use it later.

Step 6.2 Include the Public Key in the Server

To include the public key on the server, you must open a Telnet session and through a command line, create the .ssh directory in the root directory if it does not exist and create or modify the “authorized_keys” file with the public key that we just created.

mkdir ~/.ssh
chmod 700 ~/.ssh
cd ~/.ssh

Modify the “authorized_keys” file with the vi editor

vi authorized_keys  

I have included the public key. What I have done is copy and paste from the “PuTTY Key Generator” window, you should look something like this:

command="svnserve -t --tunnel-user=user_name1",no-port-forwarding,no-agent-forwarding,no-X11-forwarding,no-pty ssh-dss  AAAAB3NzaC1kc3MAAAC......  .......BpE6F3slEv16sBo= user_name1@mydomain.com

It is very important to include the part

command="svnserve -t --tunnel-user=user_name1",no-port-forwarding,no-agent-forwarding,no-X11-forwarding,no-pty

Step 6.3 Load the Private Key on your Computer

I use the “Pageant” application that comes with the PuTTY. The application is resident in the toolbar and will provide the password whenever it is needed without the need for user intervention.

Select the private key that you generated in step 6.2

Each time you start the computer, you will have to open the “pageant” and include the private key, to avoid this it is best to create a shortcut in the Windows Startup folder to avoid this.

Select the properties of the shortcut, and in the shortcut tab, the destination text box defines the locations of your ppk key.

Example: “C: \ Program files \ PuTTY \ pageant.exe” C: \ Program files \ PuTTY \ user_namekey1.ppk.

Step 6.4 Multiuser Access to the Repository

To allow multiple users with their own passwords, you must repeat step 6.2 and then apply the “authorized_keys” file with the new users.

You should look something like this:

command="svnserve -t --tunnel-user=user_name1",no-port-forwarding,no-agent-forwarding,no-X11-forwarding,no-pty ssh-dss  AAAAB3NzaC1kc3MAAAC......  .......BpE6F3slEv16sBo= user_name1@mydomain.com
command="svnserve -t --tunnel-user=user_name2",no-port-forwarding,no-agent-forwarding,no-X11-forwarding,no-pty ssh-dss  ADsDs3NasdaSDASdasD......  .......asdaSDASdaSsdSd= user_name2@mydomain.com

Create a password for each user who wants to access the repository.

Leave a Reply