]> sipb.mit.edu Git - ikiwiki.git/blob - doc/tips/DreamHost.mdwn
despam
[ikiwiki.git] / doc / tips / DreamHost.mdwn
1 # Introduction
2 [Baby Pink](http://www.grosir-kosmetik.com/6-baby-pink-cream-pemutih-kulit) | [Rumah Dijual](http://www.propertykita.com/rumah.html) | [Jasa SEO](http://www.optimaweb.co.id/jasa-seo)
3
4 I had some trouble installing ikiwiki on to a shared hosting service (DreamHost) and figured I'd post the results, since it was pretty rough to get installed.  These instructions should work for Perl generally (some of the docs are borrowed from Catalyst's docs), but are tailored for Ikiwiki.  There are a few items I'll file as bugs, as well, to aid future installation, but frankly the problems appear to be with installing perl as a non-root user, not anything specific to iki.
5
6 **Note: CPAN seems to die without warning, or die after successfully install modules.  It appears to just like dying.  If you encounter this, retry the last command after restarting CPAN.** Unfortunately, this doc can't cover how to fix any other problems with CPAN beyond what you find here.
7
8 # Fixing CPAN
9 [These instructions are paraphrased from Catalyst's documentation](http://dev.catalystframework.org/wiki/Dreamhost) :
10
11 We're going to assume that you're installing CPAN and other Perl modules into ~/site/perl.
12
13 In your .bashrc/.bash_profile/.profile, add:
14
15     export PERL5LIB="$HOME/site/perl/share/perl/5.8:$HOME/site/perl/share/perl/5.8.4:$HOME/site/perl/lib/perl5:$HOME/site/perl/lib/perl/5.8.4"
16
17 These locations may be different on your computer. For example, I use:
18
19     export PERL5LIB="$HOME/site/perl/lib/perl5:$HOME/site/perl/lib/perl5/site_perl/5.8.8:$PERL5LIB"
20
21 You probably want to add *~/site/perl/bin/* to your path, as well, since Ikiwiki's scripts are put in there.
22
23 Make sure to source your modified file (or logout/login).  Next, run :
24
25     perl -MCPAN -e shell 
26
27 and say no to manual configuration.  (Ed : I assume this sets up a basic CPAN with the existing site config.)
28
29 Exit CPAN shell and restart, then run :
30
31     o conf makepl_arg PREFIX=~/site/perl
32     o conf commit
33     install CPAN
34
35 Exit CPAN shell and restart, say no to manual configuration.  Note that I used defaults except for the mbuildpl_arg parameter, which I set to *--install-base=~/site/perl/*.  I believe this obviates the need for the first configuration parameter in the next section, but if you're paranoid, specify both (note added to next section).  My output looked like this :
36
37     user@server:~$ perl -MCPAN -e shell
38     Sorry, we have to rerun the configuration dialog for CPAN.pm due to 
39     some missing parameters...
40
41     Normally CPAN.pm keeps config variables in memory and changes need to
42     be saved in a separate 'o conf commit' command to make them permanent
43     between sessions. If you set the 'auto_commit' option to true, changes
44     to a config variable are always automatically committed to disk.
45
46      <auto_commit>
47     Always commit changes to config variables to disk? [no] 
48
49     A Build.PL is run by perl in a separate process. Likewise we run
50     './Build' and './Build install' in separate processes. If you have any
51     parameters you want to pass to the calls, please specify them here.
52
53     Typical frequently used settings:
54
55         --install_base /home/xxx             # different installation directory
56
57      <mbuildpl_arg>
58     Parameters for the 'perl Build.PL' command? [] --install-base=~/site/perl/
59
60     Parameters for the './Build' command? Setting might be:
61
62         --extra_linker_flags -L/usr/foo/lib  # non-standard library location
63
64      <mbuild_arg>
65     Your choice: [] 
66
67     Do you want to use a different command for './Build install'? Sudo
68     users will probably prefer:
69
70         su root -c ./Build
71      or
72         sudo ./Build
73      or
74         /path1/to/sudo -u admin_account ./Build
75
76      <mbuild_install_build_command>
77     or some such. Your choice: [./Build] 
78
79     Parameters for the './Build install' command? Typical frequently used
80     setting:
81
82         --uninst 1                           # uninstall conflicting files
83
84      <mbuild_install_arg>
85     Your choice: [] 
86
87     Please remember to call 'o conf commit' to make the config permanent!
88
89     cpan shell -- CPAN exploration and modules installation (v1.9205)
90     ReadLine support enabled
91
92 Next, run :
93
94     o conf mbuildpl_arg --install-base=~/site/perl (This may be optional, given the prior step to configure this)
95     o conf prefer_installer MB
96     o conf commit
97     install Module::Build
98
99 After this step, you should have a working CPAN and Module::Build installed.  This is the starting point for being able to successfully install modules via CPAN.
100
101 # Update old modules
102 I updated particular modules out of paranoia.  Either installation errors (during previous installs) or notes on the web led me to install these.  If you know what you're doing, you can skip this, but if you're perl-fu is as weak as mine, you're better off installing them.
103
104     install File::BaseDir
105     install Module::Build
106     install File::Temp
107     install Digest::SHA
108     install YAML
109     install Test::Builder
110     install Test::Pod
111     install Test::Pod::Coverage
112
113 # Install modules for Ikiwiki
114 Install the modules required for Ikiwiki.  I install all of the ones required *and* suggested because most of what I want to do requires most of these modules.
115
116     install Text::Markdown URI HTML::Parser HTML::Template
117     install CGI CGI::Session CGI::FormBuilder
118     install Mail::Sendmail HTML::Scrubber
119     install RPC::XML XML::Simple XML::Feed File::MimeInfo Locale::gettext
120
121 # Changes to Ikiwiki's build/install process
122 An explanation of why each of these changes were made will follow these instructions.  To tell the default install where your libraries are, well modify docwiki.setup (just another ikiwiki setup file) to add the "libdir" configuration, using ${HOME}/site/perl/lib/perl5 as the value (you'll see this again in your final ikiwiki config).
123
124 Next, you'll need to pass the directory where you installed your perl modules (*~/site/perl/ in this example*) into the MakeMaker build script (verbose isn't required, but gives you more feedback since you're following along at home):
125
126     user@server:~/ikiwiki$ perl Makefile.PL PREFIX=${HOME}/site/perl/ NOTAINT=1
127     Using PERL=/usr/bin/perl
128     Writing Makefile for IkiWiki
129
130 The README suggests the NOTAINT for buggy Perl impls, of which mine is one.  So, add NOTAINT=1 after your calls to 'make'.  The NOTAINT=1 doesn't seem to remove the problem below.
131
132 Next, we'll need to [patch the bug described here](http://ikiwiki.info/bugs/Insecure_dependency_in_eval_while_running_with_-T_switch/) (incidentally, this bug isn't on the bugs/ or bugs/done/ page, for some reason.  It's only findable via search).  Edit the Ikiwiki.pm file to look like below (line numbers prefix each line) :
133
134     1202         #my $ret=eval pagespec_translate($spec);
135     1203         my $ret=eval possibly_foolish_untaint(pagespec_translate($spec));
136
137 At this point, you can run *make* and then *make install* (*make test* fails for reasons explained below).
138
139 # Ikiwiki setup
140 You can follow the normal installation process, excepting a few changes in your ikiwiki.setup documents.
141
142 In ikiwiki.setup, you have to make your source and destination folders have your full *unsymlinked* home directory.  The home dir you see (/home/username) is actually a symlink from /home/.yourserver/username.  You need to find what this is and use that directly.  Run *ls -la* on ~ to find it, the output should look like :
143
144     [good]$ ls -la ~
145     lrwxrwxrwx  1 root staff 25 2007-08-03 16:44 /home/user -> /home/.server/user
146
147 So far, it looks like only the source and destination parameters require this unsymlinked path, but for paranoia reasons, you may want to put them everywhere. The changelog for version 2.14 explains why this happens.
148
149 Next, add your installed Perl module directory to the *libdir* parameter.  It should look something like :
150
151         #libdir => "/home/me/.ikiwiki/",
152         libdir => "/home/.server/user/site/perl/lib/perl5/",
153
154 # CGI Wrapper
155 The CGI wrapper file will be created automatically by "ikiwiki --setup path/to/setup", as long as you have inserted a valid filename to be created into the setup file.  On DreamHost, be careful not to put the ikiwiki.cgi file in a directory that has different owner/group than the file itself (such as the main site.domain.tld/ directory): this will cause suexec to fail.
156
157 The wrapper mode of "06755" doesn't seem to work.  "755" appears to.  However, this may be completely insecure and/or buggy, so if you know better than I, edit this doc and add it here.
158
159 # Pre-created SVN repository
160 DreamHost has a pretty installation and management GUI for SVN, but it means your SVN rep is pre-created.  As such, you can't use the installation script they mention in the setup document, because it creates the repository for you.  As such, you simply use the relevant portion of the script, but skip the repository creation.  That part (from the version I installed from, *make sure you check your file as well*) is : 
161
162         cd your/ikiwiki/source/dir/here
163         svn mkdir "file:///home/user/svn/yoursvnrepositoryhere/whereyouwanttoinstallto" -m "create trunk directory"
164         svn co "file:///home/user/svn/yoursvnrepositoryhere/whereyouwanttoinstallto" . # Note the dot, it's important
165         svn propset svn:ignore ".ikiwiki" . # Note the dot, it's important
166         svn add *
167         svn commit -m "initial import"
168
169 # Make installing OpenID not suck
170 If you try to install the Net::OpenID::Consumer module, it takes forever (and for me, fails 90% of the time).  Following the [tip found here](http://www.windley.com/archives/2007/04/speeding_up_cryptdh.shtml), installing the GMP (big math) plugin greatly speeds up the process and makes it, well, work for me.  However, getting this to be used by Perl requires a few more steps.  First, follow the directions [to install GMP](http://gmplib.org/) (grab the package and read the INSTALL doc), but the quick steps are :
171
172     ./configure --prefix=YOUR_INSTALL_PATH_HERE # use something like ${HOME}/usr/local/
173     make
174     make check
175     make install
176
177 Then you'll have to add a few variables to your path [referenced by your compiled](http://www.psc.edu/general/software/packages/gcc/manual/gcc_36.html), namely :
178
179     export C_INCLUDE_PATH=YOUR_INSTALL_PATH_HERE/include/
180     export LIBRARY_PATH=YOUR_INSTALL_PATH_HERE/lib/
181     export LD_LIBRARY_PATH=YOUR_INSTALL_PATH_HERE/lib/
182
183 Then you should be able to install the module, and it'll be faster.
184
185 # Why do I have to do all of this?
186 IANA Perl Expert.  This is just what I found.
187
188 [This appears to be a presentation outlining the problem](http://schwern.org/~schwern/talks/PREFIX/slides/slide001.html) -- Note, this site was up a few days ago, but appears to be down now.  YMMV.
189
190 Part of the problem appears to be where modules decide to install themselves.  Markdown, for example, installs itself to .../lib/perl5, which somehow never makes it's way into any of the INC paths used in the Perl.  Not sure why, really.  The rest of the modules seem to work well with the PREFIX option, but Markdown doesn't install to the path used from the PREFIX (hence the manual modification of Makefile.PL).
191
192 Basically, some stuff obeys the (apparently defunct and never really functional) PREFIX option, while the newer modules that use Module::Build, use the *install-base* option.  It would be nice if Ikiwiki could handle being installed in a non-root situation, but I have no real suggestions on how to make that happen.
193
194 I'm willing to setup an account for committers wanting to try installing this on a DH server.  I know who Joey is, so if he can vouch for you, I'll set up the account ASAP.  You can reach me at mreynolds+dhwikiproblem@loopysoft.com .