Allow dots in parameter key names
[ikiwiki] / doc / tips / nearlyfreespeech.mdwn
1 [NearlyFreeSpeech.net](http://NearlyFreeSpeech.net) is a shared hosting
2 provider with very cheap pay as you go pricing. Here's how to install ikiwiki
3 there if you don't have a dedicated server.
4
5 Note that you can also follow these instructions, get your wiki set up on
6 NearlyFreeSpeech, and then use the [[plugins/Amazon_S3]] plugin to inject
7 the static web pages into Amazon S3. Then NearlyFreeSpeech will handle the
8 CGI, and S3 will handle the web serving. This might be a more cost effective,
9 scalable, or robust solution than using NearlyFreeSpeech alone.
10
11 ## Register for an account and set up a site
12
13 After you [get an account](https://www.nearlyfreespeech.net/about/start.php),
14 create a site using their web interface. 
15
16 Mine is named `ikiwiki-test` and I used their DNS instead of getting my
17 own, resulting in <http://ikiwiki-test.nfshost.com/>. (Not being kept up
18 anymore.)
19
20 They gave me 2 cents free funding for signing up, which is enough to pay
21 for 10 megabytes of bandwidth, or about a thousand typical page views, at
22 their current rates. Plenty to decide if this is right for you. If it is,
23 $5 might be a good starting amount of money to put in your account.
24
25 ## ssh in and configure the environment
26
27 ssh into their server using the ssh hostname and username displayed on
28 the site's information page. For me this was:
29
30         ssh joeyh_ikiwiki-test@ssh.phx.nearlyfreespeech.net
31
32 Now set up .profile to run programs from ~/bin.
33
34         cd $HOME
35         echo "PATH=$PATH:$HOME/bin" > .profile
36         . .profile
37
38 ## Download an unpack ikiwiki
39
40 Use `wget` to [[download]] the ikiwiki tarball. Then unpack it:
41
42         tar zxvf ikiwiki*.tar.gz
43
44 ## Install perl modules
45
46 As an optional step, you can use CPAN to install the perl modules ikiwiki
47 uses into your home directory. This should not be necessary, mostly,
48 because the system has most modules installed already.
49
50 So, you might want to skip this step and come back to it later if ikiwiki
51 doesn't work.
52
53         PERL5LIB=`pwd`/ikiwiki:`pwd`/ikiwiki/cpan:`pwd`/lib/perl5 PERL_MM_USE_DEFAULT=1 perl -MCPAN -e 'CPAN::Shell->install("Bundle::IkiWiki")'
54         
55         PERL5LIB=`pwd`/ikiwiki:`pwd`/ikiwiki/cpan:`pwd`/lib/perl5 PERL_MM_USE_DEFAULT=1 perl -MCPAN -e 'CPAN::Shell->force(install => "Bundle::IkiWiki::Extras")'
56
57 This will take a while. As long as the first command succeeds, ikiwiki will be
58 usable. The second command adds extra modules that some plugins use, so it's
59 ok if installation of some of them fail.
60
61 ## Build and install ikiwiki
62
63         cd ikiwiki
64         export MAKE=gmake
65         perl Makefile.PL INSTALL_BASE=$HOME PREFIX=
66         $MAKE
67         $MAKE install
68
69 ## Set up a wiki in the usual way
70
71 With ikiwiki installed, you can follow the regular [[setup]] tutorial for
72 settng up your wiki. Make sure to set `destdir` to `/home/htdocs/` so that
73 the wiki is published on the web site. I recommend using git for revision
74 control; you can then clone your wiki's git repository as an offsite backup.
75
76 Here is an example of how I set up a wiki:
77
78         mkdir ~/wiki
79         cd ~/wiki
80         cp -r ~/ikiwiki/doc/examples/blog/* .
81         ikiwiki -dumpsetup ikiwiki.setup
82         nano ikiwiki.setup
83         # Set destdir to /home/htdocs
84         # Set srcdir to /home/private/wiki
85         # Set url to http://yoursite.nfshost.com/
86         # Set cgiurl to http://yoursite.nfshost.com/ikiwiki.cgi
87         # Uncomment the `rcs => "git"` line.
88         # Set the cgi_wrapper path to /home/htdocs/ikiwiki.cgi
89         # Set the git_wrapper path to /home/private/wiki.git/hooks/post-update
90         # Configure the rest to your liking and save the file.
91         ikiwiki-makerepo git . ../wiki.git
92         ikiwiki -setup ikiwiki.setup
93
94 ## Clean up
95
96 Finally, you can save a _lot_ of disk space by cleaning up the ikiwiki
97 tarball and .cpan directory and a few other peices of cruft. Since you'll be
98 charged one cent per month per megabyte, this is a quick way to save several
99 dollars.
100
101 rm -rf ~/ikiwiki*.tar.gz ~/.cpan ~/ikiwiki ~/man ~/lib/perl5/5.8.8
102
103 That should cut things down to less than 2 megabytes. If you want to save
104 even more space, delete unused perl modules from ~/lib/perl5
105
106 ## Enjoy!
107
108 Have fun and do good things. --[[Joey]]