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