In the last two posts on getting started with ikiwiki, I’ve talked about how ikiwiki differs from traditional wiki engines, and how to install ikiwiki if you have root access on ubuntu, but what about if you’re on shared hosting, how do you use ikiwiki then? Install it your self.

All you need is:

  • Linux shared hosting

  • with ssh (shell) access

  • and with perl

Again, I’m using ikiwiki together with git; neither is installed on the web host by default but I do have shell access via ssh, so I can install programs to my home directory that I can use inside the chroot jail. While I’m not sure which version of Linux my hosting provider is using, that’s not too important, just that I can log in via ssh that gives me a shell prompt (in this case bash).

First off, I need to add the path of the directory I’m going to use to add the new programs to into the $PATH variable for my login session. That way I don’t need to type the full path to the program, just typing git or ikiwiki will look at my local install directory first. (see [1])

So add the following line to the end of ~/.bashrc :

PATH="$HOME/bin:$PATH"

and source the file to include the new path (this is automatically done when you log in, but it needs to be called now to include the new change):

$ source ~/.bashrc

I’m using .bashrc instead of .profile so the path is included for non-interactive shells, as well as interactive ones (~/.bashrc is usually called from ~/.profile). This means that when the git hooks run after a push, or when ikiwiki.cgi runs a rebuild, the path to these programs are still included.

So, to begin the acual installation make the directory to hold the downloaded source files:

$ cd $ mkdir ~/src $ cd ~/src/

Installing Git

Get the latest git source (check the latest version at git-scm.com):

$ curl -LO http://kernel.org/pub/software/scm/git/git-1.7.5.4.tar.bz2 $ tar -xjvf git-1.7.5.4.tar.bz2 $ cd git-1.7.5.4

configure to install to your home directory and install:

$ ./configure --prefix=$HOME $ make $ make install

and check that it went ok:

$ git --version

Installing ikiwiki

Install the dependencies in Perl (this is two lines of code):

$ PERL5LIB=pwd/ikiwiki:pwd/ikiwiki/cpan:pwd/lib/perl5 PERL_MM_USE_DEFAULT=1 perl -MCPAN -e 'CPAN::Shell->install("Bundle::IkiWiki")'

$ PERL5LIB=pwd/ikiwiki:pwd/ikiwiki/cpan:pwd/lib/perl5 PERL_MM_USE_DEFAULT=1 perl -MCPAN -e 'CPAN::Shell->force(install => "Bundle::IkiWiki::Extras")'

get the source (I’ve chosen the same version as the Ubuntu 10.04 package as the most up-to date one threw some reg-ex errors.):

$ cd ~/src/ $ wget --no-check-certificate https://github.com/joeyh/ikiwiki/tarball/3.20100122 $ tar zxvf joeyh-ikiwiki-3.20100122-0-gac1b406.tar.gz $ mv joeyh-ikiwiki-842cb0c/ ikiwiki/ $ ls -lah $ cd ikiwiki/

configure to install to your home directory: (see [2])

$ perl Makefile.PL INSTALL_BASE=$HOME PREFIX= $ make $ make install and then check it all worked: $ ikiwiki --version

Notes:

1 I’m installing to /home/username/ instead of /home/username/opt (which is neater) because although git will run fine from ~/opt/bin, ikiwiki gets funny about it. * If you install ikiwiki to /opt/bin, then it doesn’t know its own version number, * and if you install git to ~/opt/bin, ikiwiki won’t rebuild because the PATH variable in perl doesn’t include the ~/opt/bin, only ~/bin, so rebuilds fail unless you add a simlink for git from ~/bin. Although it’s quite possible that this has already been fixed in a later version of ikiwiki.

2 If perl Makefile.PL INSTALL_BASE=$HOME PREFIX= throws any errors, make sure you install any required perl depenencies in cpan and run again until the they are all resolved e.g.: $ cpan cpan1> install CGI::FormBuilder CGI::Session HTML::Scrubber HTML::Template Mail::Sendmail Text::Markdown cpan1> quit then re-run the perl Makefile.PL line until all the perl dependencies are resolved.

Sources:

  • [Joe Maller How to Install git on a shared host](http://joemaller.com/908/how-to-install-git-on-a-shared-host/)
  • [ikiwiki.info install](http://ikiwiki.info/install/)