]> sipb.mit.edu Git - ikiwiki.git/blob - doc/setup.mdwn
(no commit message)
[ikiwiki.git] / doc / setup.mdwn
1 This tutorial will walk you through setting up a wiki with ikiwiki.
2
3 [[!toc ]]
4
5 ## [[Download]] and [[install]] ikiwiki.
6
7 If you're using Debian or Ubuntu, ikiwiki is an `apt-get install ikiwiki` away.
8 If you're not, see the [[download]] and [[install]] pages.
9
10 ## Quick start
11
12 If you'd like to set up a wiki now, and learn more later, just run this command
13 and answer a couple of questions.
14
15         % ikiwiki -setup /etc/ikiwiki/auto.setup
16         What will the wiki be named? mywiki
17         What revision control system to use? git
18         What wiki user (or openid) will be wiki admin? joey
19
20 Wait for it to tell you an url for your new wiki.. Done!
21
22 (If the CGI doesn't seem to let you edit pages, you might need to
23 [[configure_apache|apache_cgi]]).)
24
25 ## Decide where your wiki's files will go.
26
27 As a wiki compiler, ikiwiki builds a wiki from files in a source directory,
28 and outputs the files to a destination directory.  If you keep your wiki in
29 a version control system, the source directory will contain a working copy
30 checked out from the version control system.
31
32 For the purposes of this tutorial, we'll set shell variables
33 for these locations, and use those variables in the commands that follow.
34
35         SRCDIR=~/wikiwc
36         DESTDIR=~/public_html/wiki/
37
38 Note that ikiwiki owns the working copy directory; do not perform your own
39 edits in ikiwiki's working copy.
40
41 ## Create the beginnings of your wiki.
42
43 This will create a simple main page for the wiki.
44
45         mkdir $SRCDIR
46         cd $SRCDIR
47         $EDITOR index.mdwn
48
49 In the editor, you could start by entering a simple page like
50 [[!toggle id=page text="this one"]].
51 [[!toggleable id=page text="""
52         Welcome to your new wiki.
53
54         All wikis are supposed to have a \[[SandBox]],
55         so this one does too.
56
57         ----
58
59         This wiki is powered by [ikiwiki](http://ikiwiki.info).
60 """]]
61    
62 See [[ikiwiki/formatting]] for details about the markup language.
63
64 Note that several [[standard_wiki_pages|basewiki]] will be added to your
65 wiki, from files in `/usr/share/ikiwiki/basewiki/`, so your wiki will
66 automatically get a [[SandBox]], and some other useful pages.
67
68 ## Build your wiki for the first time.
69
70         ikiwiki --verbose $SRCDIR $DESTDIR --url=http://example.org/~you/wiki/
71
72 Replace the url with the real url to your wiki. You should now
73 be able to visit the url and see your wiki.
74
75 ## Add content to your wiki.
76
77 Continue editing or adding pages and rebuilding the wiki.
78    
79 To quickly get started on a common task like blogging with ikiwiki, you
80 can copy in files from the [[examples]]. The examples are located in
81 `doc/examples/` in the ikiwiki source package.
82
83 You can experiment with other ikiwiki parameters such as `--wikiname`
84 and `--rebuild` too. Get comfortable with its command line (see
85 [[usage]]).
86
87 ## Add a setup file.
88
89 By now you should be getting tired of typing in all the command line
90 options each time you change something in your wiki's setup. Time to
91 introduce setup files.
92
93 To generate a setup file, use `ikiwiki --dumpsetup`. You can pass
94 all the options have you been including at the command line, and they
95 will be stored in the setup file.
96
97         ikiwiki $SRCDIR $DESTDIR --url=http://example.org/~you/wiki/ --dumpsetup ikiwiki.setup
98
99 Note that this file should *not* be put in your wiki's directory with
100 the rest of the files. A good place to put it is in a ~/.ikiwiki/
101 subdirectory.
102    
103 Most of the options, like `wikiname` in the setup file are the same as
104 ikiwiki's command line options (documented in [[usage]]. `srcdir` and
105 `destdir` are the two directories you specify when running ikiwiki by
106 hand. Make sure that these are pointing to the right directories, and
107 read through and configure the rest of the file to your liking.
108
109 When you're satisfied, run `ikiwiki --setup ikiwiki.setup`, and it
110 will set everything up.
111
112 ## Turn on additional features.
113
114 Now you have a basic wiki with a setup file. Time to experiment
115 with ikiwiki's many features. 
116    
117 Let's first enable a key wiki feature and set up [[CGI]] to allow
118 editing the wiki from the web. Just edit ikiwiki.setup, uncomment the
119 settings for the `cgi_wrapper`, make sure the filename for the cgi wrapper
120 is ok, run `ikiwiki --setup ikiwiki.setup`, and you're done!
121
122 There are lots of other configuration options in ikiwiki.setup that you
123 can uncomment, configure, and enable by re-running
124 `ikiwiki --setup ikiwiki.setup`. Be sure to browse through all the
125 [[plugins]]..
126
127 ## Put your wiki in revision control.
128
129 At this point you might want to check your wiki in to a revision control
130 system so you can keep track of changes and revert edits. Depending
131 on the revision control system you choose, the way this is done varies.
132
133 Note that the .ikiwiki subdirectory is where ikiwiki keeps its state, and
134 should be preserved, but not checked into revision control.
135
136 The [[ikiwiki-makerepo]] command automates setting up a wiki in
137 revision control.
138
139 [[!toggle id=subversion text="Subversion"]]
140 [[!toggleable id=subversion text="""
141         REPOSITORY=~/wikirepo
142         ikiwiki-makerepo svn $SRCDIR $REPOSITORY
143 """]]
144
145 [[!toggle id=git text="Git"]]
146 [[!toggleable id=git text="""
147         REPOSITORY=~/wiki.git
148         ikiwiki-makerepo git $SRCDIR $REPOSITORY
149
150 Please see [[rcs/git]] for detailed documentation about how
151 ikiwiki uses git repositories, and some important caveats
152 about using the git repositories.
153 """]]
154
155 [[!toggle id=mercurial text="Mercurial"]]
156 [[!toggleable id=mercurial text="""
157         REPOSITORY=$SRCDIR
158         ikiwiki-makerepo mercurial $SRCDIR
159 """]]
160
161 [[!toggle id=bazaar text="Bazaar"]]
162 [[!toggleable id=bazaar text="""
163         REPOSITORY=$SRCDIR
164         ikiwiki-makerepo bzr $SRCDIR
165 """]]
166
167 [[!toggle id=tla text="TLA"]]
168 [[!toggleable id=tla text="""
169         REPOSITORY=~/wikirepo
170         tla make-archive me@localhost--wiki $REPOSITORY
171         tla my-id "<me@localhost>"
172         cd $SRCDIR
173         tla archive-setup me@localhost--wiki/wiki--0
174         tla init-tree me@localhost--wiki/wiki--0
175         # Edit {arch}/=tagging-method and change the precious
176         # line to add the .ikiwiki directory to the regexp.
177         tla add *
178         tla import
179 """]]
180
181 [[!toggle id=monotone text="Monotone"]]
182 [[!toggleable id=monotone text="""
183         # These instructions are standard instructions to import a directory into monotone
184         # and set it up so that you don't need any passwords to use it
185         REPOSITORY=~/.ikiwiki/mtn.db
186         BRANCH=com.company.wikiname
187         # remember the password you use in the next step and
188         # substitute it for 'wikiKeyPass' in the get_passphrase() hook below
189         # note the you should never generate two monotone keys with the same name
190         mtn genkey web@example.com
191         mtn db init --db=$REPOSITORY
192         mv $SRCDIR $SRCDIR-old
193         cd $SRCDIR-old
194         echo ".ikiwiki" > $SRCDIR-old/.mtn-ignore
195         mtn --db=$REPOSITORY --branch=$BRANCH import . -m "initial import"
196         cd ..
197         mtn --db=$REPOSITORY --branch=$BRANCH checkout $SRCDIR
198         mv $SRCDIR-old/.ikiwiki $SRCDIR
199         cat << EOF > $SRCDIR/_MTN/monotonerc
200         function get_passphrase (branchname)
201             return "wikiKeyPass"
202         end
203         EOF
204         rm -r $SRCDIR-old
205 """]]
206
207 ## Configure ikiwiki to use revision control.
208
209 Once your wiki is checked in to the revision control system,
210 you should configure ikiwiki to use revision control. Edit your
211 ikiwiki.setup, set `rcs` to the the revision control system
212 you chose to use. Be sure to set `svnrepo` to $REPOSITORY, if using
213 subversion. Uncomment the configuration for the wrapper for your revision
214 control system, and configure the wrapper path appropriately
215 (for Git, it should be `$REPOSITORY/hooks/post-update`).
216
217 Once it's all set up, run `ikiwiki --setup ikiwiki.setup` once more.
218 Now you should be able to edit files in $SRCDIR, and use your revision
219 control system to commit them, and the wiki will automatically update.
220 And in the web interface, RecentChanges should work, and files changed
221 by web users will also be committed using revision control.
222
223 ## Enjoy your new wiki!
224
225 Add yourself to [[IkiWikiUsers]]. And check out
226 the [[tips]] to find out how to get more out of ikiwiki.