Ikiwiki_Setup.mdwn 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  1. Install package 'ikiwiki' using your favorite package manager. On the command
  2. line you can run this as root:
  3. # apt-get install ikiwiki
  4. We are going to use a separate system user for the wiki, in a similar manner to
  5. how a separate git user is usually created for git servers. The following
  6. command will create the user:
  7. # adduser \
  8. --system \
  9. --shell /bin/bash \
  10. --gecos 'ikiwiki instance user' \
  11. --group \
  12. --disabled-password \
  13. --home /home/ikiwiki \
  14. ikiwiki
  15. Check `man adduser` for an explanation of this command.
  16. Before we create our wiki, a word about privacy must be said. When you create
  17. the wiki, each page automatically generated (e.g. the initial index page) gets a
  18. timestamp specifying the "last edited" time. The timezone and locale certainly
  19. affect those dates. If you use I2P or Tor, you probably don't want to expose
  20. your timezone and locale. The timezone and locale can both be set in the wiki
  21. setup file, which we will soon edit. I didn't check whether editing them before
  22. the first wiki compilation ensures all pages get the values you set. If they
  23. don't, maybe changing the locale and timezone environment variables before
  24. setting up the wiki will help. Also, you can copy the 'auto.setup' file and
  25. modify it before usage.
  26. Now let's create the wiki. While being root, change user to 'ikiwiki':
  27. # su - ikiwiki
  28. Now create a new wiki. Two automatic setup files come with the package:
  29. - /etc/ikiwiki/auto.setup
  30. - /etc/ikiwiki/auto-blog.setup
  31. You can use those, or set it up by hand. The ikiwiki website explains how. For
  32. our purpose, let's use the auto.setup file:
  33. $ ikiwiki --setup /etc/ikiwiki/auto.setup
  34. It will ask you several questions. You can use any wiki name and any
  35. user/password combination you wish (has nothing to do with Linux users), but
  36. make sure you give 'git' as the RCS to be used. I will assume the wiki name is
  37. "My Wiki" for the rest of this guide. That means the folders created for you in
  38. `/home/ikiwiki` are:
  39. - MyWiki
  40. - MyWiki.git
  41. - public_html/MyWiki
  42. The first one if the "srcdir", which is a clone of the wiki used for building
  43. the HTML pages and for updating the wiki after edits made via the web interface.
  44. The second one if the bare "master" repository, and the third contains the
  45. generated web pages.
  46. Near the end of the long verbose message you probably got on the command line,
  47. there should be a line regarding updating the system wiki-list. It is a list of
  48. all installed ikiwiki instances, used for rebuilding them every time the ikiwiki
  49. package is upgraded. On my system, and possibly on yours too, the list requires
  50. root access, which means the attempt to update it will fail.
  51. If it failed, you can update it manually by appending the line "ikiwiki" (i.e.
  52. the name of the user you created, without quotes) to `/etc/ikiwiki/wikilist`:
  53. $ su
  54. # nano /etc/ikiwiki/wikilist
  55. # su - ikiwiki
  56. There are many many options in the setup file created for your wiki. For now we
  57. will touch just what we need to get the basic wiki working, and gradually make
  58. more changes when we need to. ikiwiki's home folder should look like this:
  59. $ ls
  60. MyWiki MyWiki.setup public_html
  61. Edit the setup file (in this case MyWiki.setup), e.g. using `nano` or `emacs` or
  62. `vim` or any other preferred editor. Here are the things I suggest you change,
  63. in order of appearance. Some are required, others are just my recommendations or
  64. ideas. Below that there is a copy of my own setup.
  65. + __adminemail__: This will probably be `ikiwiki@<domain>`. Change it to a real
  66. email address you use, so people can really contact you.
  67. + __url__: This is probably required for correct links between wiki pages. Set
  68. it to the address people will use to reach your wiki.
  69. + __cgiurl__: This is probably required too. It's the address of the CGI file,
  70. allowing web editing among other things. Set it to be __url__ with
  71. `/ikiwiki.cgi` appended.
  72. + __disable_plugins__: I may not know much about OpenID, but I don't like it. It
  73. is a plugin enabled by default, which allows using web services on which you
  74. already have an account to verify your identity. Its decentralized nature is
  75. good, but in practice AFAIK only big centralized services provide an OpenID,
  76. so you end up trusting G00gle or Fakeb00k to tell you who's a legitimate user
  77. and who's not. Until I investigate further, I prefer to avoid OpenID. Besides,
  78. if everyone used it - who would be providing it? *Someone* has to be the
  79. provider and actually store the passwords. I don't hurry to delegate tasks to
  80. other websites. Anyway it's your choice: If you wish to disable this plugin,
  81. add "openid" (without quotes) between the square brackets.
  82. + __timeformat__: Depending on your personal preference and your privacy
  83. concerns, you may want to change this. See `man strftime` for possible values.
  84. + __locale__: Depending on your personal preference and your privacy concerns,
  85. you may want to change this.
  86. + __timezone__: Depending on your personal preference and your privacy concerns,
  87. you may want to change this. For privacy, setting this to UTC is probably a
  88. good idea.
  89. Here is what my setup looked like at this point (just the relevant part of it).
  90. The arrows point at parts discussed above.
  91. # IkiWiki::Setup::Yaml - YAML formatted setup file
  92. #
  93. # Setup file for ikiwiki.
  94. #
  95. # Passing this to ikiwiki --setup will make ikiwiki generate
  96. # wrappers and build the wiki.
  97. #
  98. # Remember to re-run ikiwiki --setup any time you edit this file.
  99. #
  100. # name of the wiki
  101. wikiname: Partager
  102. # contact email for wiki
  103. __adminemail: fr33domlover@riseup.net__ # <--------
  104. # users who are wiki admins
  105. adminuser:
  106. - fr33domlover
  107. # users who are banned from the wiki
  108. banned_users: []
  109. # where the source of the wiki is located
  110. srcdir: /home/ikiwiki/Partager
  111. # where to build the wiki
  112. destdir: /home/ikiwiki/public_html/Partager
  113. # base url to the wiki
  114. __url: http://partager.i2p__ # <--------
  115. # url to the ikiwiki.cgi
  116. __cgiurl: http://partager.i2p/ikiwiki.cgi__ # <--------
  117. # filename of cgi wrapper to generate
  118. cgi_wrapper: /home/ikiwiki/public_html/Partager/ikiwiki.cgi
  119. # mode for cgi_wrapper (can safely be made suid)
  120. cgi_wrappermode: 06755
  121. # rcs backend to use
  122. rcs: git
  123. # plugins to add to the default configuration
  124. add_plugins:
  125. - goodstuff
  126. - websetup
  127. # plugins to disable
  128. __disable_plugins: [openid]__ # <--------
  129. # additional directory to search for template files
  130. templatedir: /usr/share/ikiwiki/templates
  131. # base wiki source location
  132. underlaydir: /usr/share/ikiwiki/basewiki
  133. # display verbose messages?
  134. #verbose: 1
  135. # log to syslog?
  136. syslog: 1
  137. # create output files named page/index.html?
  138. usedirs: 1
  139. # use '!'-prefixed preprocessor directives?
  140. prefix_directives: 1
  141. # use page/index.mdwn source files
  142. indexpages: 0
  143. # enable Discussion pages?
  144. discussion: 1
  145. # name of Discussion pages
  146. discussionpage: Discussion
  147. # generate HTML5?
  148. html5: 0
  149. # only send cookies over SSL connections?
  150. sslcookie: 0
  151. # extension to use for new pages
  152. default_pageext: mdwn
  153. # extension to use for html files
  154. htmlext: html
  155. # strftime format string to display date
  156. __timeformat: '%c'__ # <--------
  157. # UTF-8 locale to use
  158. __locale: en_US.UTF-8__ # <--------
  159. # put user pages below specified page
  160. userdir: ''
  161. # how many backlinks to show before hiding excess (0 to show all)
  162. numbacklinks: 10
  163. # attempt to hardlink source files? (optimisation for large files)
  164. hardlink: 0
  165. # force ikiwiki to use a particular umask (keywords public, group or
  166. # private, or a number)
  167. #umask: public
  168. # group for wrappers to run in
  169. #wrappergroup: ikiwiki
  170. # extra library and plugin directory
  171. libdir: /home/ikiwiki/.ikiwiki
  172. # environment variables
  173. ENV: {}
  174. # time zone name
  175. __timezone: UTC__ # <--------
  176. # regexp of normally excluded files to include
  177. #include: ^\\.htaccess$
  178. # regexp of files that should be skipped
  179. #exclude: ^(*\\.private|Makefile)$
  180. # specifies the characters that are allowed in source filenames
  181. wiki_file_chars: -\[:alnum:\]+/.:_
  182. # allow symlinks in the path leading to the srcdir (potentially insecure)
  183. allow_symlinks_before_srcdir: 0
  184. Now run ikiwiki to update your wiki after the setup change:
  185. $ ikiwiki --setup MyWiki.setup
  186. Last thing to get the basic wiki running: Configure the web server. You need to
  187. enable lighttpd's CGI module (unless you already did, e.g. if you already use
  188. Gitweb), and update the configuration. Commands:
  189. $ su
  190. # lighty-enable-mod cgi
  191. # nano /etc/lighttpd/lighttpd.conf
  192. # service lighttpd reload
  193. Here's an example lighttpd configuration:
  194. ## core modules used by the server
  195. ## mod_access: deny access to files with specific extensions (e.g. backup files)
  196. ## mod_alias: specify special document root for a url subset
  197. ## mod_compress: compress static content to reduce network load
  198. ## mod_redirect: redirect a set of URLs externally
  199. server.modules = (
  200. "mod_access",
  201. "mod_alias",
  202. "mod_compress",
  203. "mod_redirect",
  204. # "mod_rewrite",
  205. )
  206. ## basic setup
  207. #server.document-root = "/var/www/web"
  208. server.document-root = "/home/ikiwiki/public_html/MyWiki"
  209. server.upload-dirs = ( "/var/cache/lighttpd/uploads" )
  210. server.errorlog = "/var/log/lighttpd/error.log"
  211. server.pid-file = "/var/run/lighttpd.pid"
  212. server.username = "www-data"
  213. server.groupname = "www-data"
  214. server.port = 7658
  215. server.tag = "Be the change"
  216. ## CGI
  217. ## The lighttpd CGI conf looks for CGI files in /cgi-bin, but ikiwiki's
  218. ## file is located somewhere else. The following config allows the ikiwiki
  219. ## CGI to work (still requires the CGI module to be enabled)
  220. $HTTP["url"] =~ "^/ikiwiki.cgi" {
  221. cgi.assign = ( "ikiwiki.cgi" => "" )
  222. }
  223. ## filenames to be used as directory index
  224. index-file.names = ( "index.cgi", "index.html" )
  225. ## deny access to some files by pattern
  226. url.access-deny = ( "~", ".inc" )
  227. ## avoid serving dynamic content generators as static content
  228. static-file.exclude-extensions = ( ".php", ".pl", ".fcgi", ".cgi" )
  229. ## directory to use for caching compressed content
  230. compress.cache-dir = "/var/cache/lighttpd/compress/"
  231. ## which file types to compress
  232. compress.filetype = ( "application/javascript", "text/css", "text/html", "text/plain" )
  233. ## default listening port for IPv6 falls back to the IPv4 port
  234. include_shell "/usr/share/lighttpd/use-ipv6.pl " + server.port
  235. include_shell "/usr/share/lighttpd/create-mime.assign.pl"
  236. include_shell "/usr/share/lighttpd/include-conf-enabled.pl"
  237. The important parts are the `document-root` and the part setting `cgi.assign`.
  238. The wiki should work now. Browse to the IP address / domain name of your
  239. website. You should see the default index page. Try editing it to make sure the
  240. CGI works. Also look at the "last edited" date, before and after the edit, and
  241. make sure it matches your preferred privacy settings.