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