web commit by JoshTriplett: Do not perform your own edits in ikiwiki's working copy.
[ikiwiki] / doc / setup.mdwn
1 This tutorial will walk you through setting up a wiki with ikiwiki.
2
3 1. [[Install]] ikiwiki. See [[download]] for where to get it.
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
8    directory, and outputs the files to a destination directory.
9
10    For the purposes of this tutorial, we'll set shell variables
11    for these locations, and use those variables in the commands that follow.
12
13                         SRCDIR=~/wikiwc
14                         DESTDIR=~/public_html/wiki/
15
16    Note that ikiwiki owns the working copy directory; do not perform your own
17    edits in ikiwiki's working copy.
18
19 3. Create the beginnings of your wiki.
20
21    This will create a simple main page for the wiki.
22
23                         mkdir $SRCDIR
24                         cd $SRCDIR
25                         $EDITOR index.mdwn
26
27    In the editor, you could start by entering a simple page like 
28    [[toggle id=page text="this one"]].
29    
30    [[toggleable id=page text="""
31                         Welcome to your new wiki.
32                         All wikis are supposed to have a [[SandBox]],
33                         so this one does too.
34                         ----
35                         This wiki is powered by [ikiwiki](http://ikiwiki.kitenet.net).
36    """]]
37    
38    See [[HelpOnFormatting]] for details about the markup language.
39
40    Note that several standard wiki pages will be added to your wiki, from
41    files in `/usr/share/ikiwiki/basewiki/`, so your wiki will automatically
42    get a [[SandBox]], and some other useful pages.
43
44 4. Build your wiki for the first time.
45
46                         ikiwiki --verbose $SRCDIR $DESTDIR --url=http://host/~you/wiki/
47
48    Replace the url with the real url to your wiki. You should now
49    be able to visit the url and see your wiki.
50
51 5. Repeat steps 3 and 4 as desired, editing or adding pages and rebuilding
52    the wiki. 
53    
54    To quickly get started on a common task like blogging with ikiwiki, you
55    can copy in files from the [[examples]]. The examples are located in
56    `doc/examples/` in the ikiwiki source package.
57
58    You can play around with other ikiwiki parameters such as `--wikiname`
59    and `--rebuild` too. Get comfortable with its command line (see
60    [[usage]]).
61
62 6. By now you should be getting tired of typing in all the command line
63    options each time you change something in your wiki's setup. Time to
64    introduce setup files.
65    
66    A sample setup file is [[ikiwiki.setup]]. Download it (or copy it from
67    `doc/ikiwiki.setup` in the ikiwiki sources), and edit it.
68    
69    Most of the options, like `wikiname` in the setup file are the same as
70    ikiwiki's command line options (documented in [[usage]]. `srcdir` and
71    `destdir` are the two directories you specify when running ikiwiki by
72    hand. Make sure that these are pointing to the right directories, and
73    read through and configure the rest of the file to your liking.
74
75    When you're satisfied, run `ikiwiki --setup ikiwiki.setup`, and it
76    will set everything up.
77
78 7. Turn on additional features.
79
80    Now you have a basic wiki with a configuration file. Time to experiment
81    with ikiwiki's many features. 
82    
83    Let's first enable a key wiki feature and set up [[CGI]] to allow
84    editing the wiki from the web. Just edit ikiwiki.setup, uncomment the
85    block for the cgi wrapper, make sure the filename for the cgi wrapper
86    is ok, run `ikiwiki --setup ikiwiki.setup`, and you're done!
87
88    There are lots of other configuration options in ikiwiki.setup that you
89    can uncomment, configure, and enable by re-running
90    `ikiwiki --setup ikiwiki.setup`. Be sure to browse through all the
91    [[plugins]]..
92
93 8. Put your wiki in revision control.
94
95    At this point you might want to check your wiki in to a revision control
96    system you can get history of past changes and revert edits. Depending
97    on the revision control system you choose, the way this is done varies.
98    
99    There's little that's ikiwiki specific about these instructions; this is
100    just how you put a directory under revision control using the various
101    systems that ikiwiki supports. Note that the .ikiwiki subdirectory is
102    where ikiwiki keeps its state, and should be preserved, but not checked
103    into revision control.
104
105    [[toggle id=subversion text="Subversion"]]
106    [[toggleable id=subversion text="""
107                         REPOSITORY=~/wikirepo
108                         svnadmin create $REPOSITORY
109                         svn mkdir file://$REPOSITORY/trunk -m "create trunk"
110                         cd $SRCDIR
111                         svn co file://$REPOSITORY/trunk .
112                         svn add *
113                         svn commit -m "initial import"
114    """]]
115    
116    [[toggle id=git text="Git"]]
117    [[toggleable id=git text="""
118                         REPOSITORY=~/wikirepo
119                         mkdir $REPOSITORY
120                         cd $REPOSITORY
121                         git init-db
122                         cp -a $SRCDIR/* .
123                         git add .
124                         git commit -m "initial import" -a
125                         mv $SRCDIR/.ikiwiki .
126                         rm -rf $SRCDIR
127                         git clone -l -s $REPOSITORY $SRCDIR
128    """]]
129
130    [[toggle id=tla text="TLA"]]
131    [[toggleable id=tla text="""
132                         REPOSITORY=~/wikirepo
133                         tla make-archive me@localhost--wiki $REPOSITORY
134                         tla my-id "<me@localhost>"
135                         cd $SRCDIR
136                         tla archive-setup me@localhost--wiki/wiki--0
137                         tla init-tree me@localhost--wiki/wiki--0
138                         # Edit {arch}/=tagging-method and change the precious
139                         # line to add the .ikiwiki directory to the regexp.
140                         tla add *
141                         tla import
142    """]]
143
144    [[toggle id=mercurial text="Mercurial"]]
145    [[toggleable id=mercurial text="""
146                         REPOSITORY=$SRCDIR
147                         hg init $REPOSITORY
148                         cd $REPOSITORY
149                         hg add *
150                         hg commit -m "initial import"
151    """]]
152
153 9. Configure ikiwiki to use revision control.
154
155    Once your wiki is checked in to the revision control system,
156    you should configure ikiwiki to use revision control. Edit your
157    ikiwiki.setup, and uncomment the lines for the revision control system
158    you chose to use. Be sure to set `svnrepo` to $REPOSITORY, if using
159    subversion. Uncomment the block for the wrapper for your revision
160    control system, and configure the wrapper path in that block
161    appropriately. 
162    
163    Once it's all set up, run `ikiwiki --setup ikiwiki.setup` once more.
164    Now you should be able to edit files in $SRCDIR, and use your revision
165    control system to commit them, and the wiki will automatically update.
166    And in the web interface, RecentChanges should work, and files changed
167    by web users will also be committed using revision control.
168
169 10. Enjoy your new wiki! Add yourself to [[IkiWikiUsers]].