Bug 20428: Make upload_tmp a more general tmp directory
[koha.git] / debian / docs / koha-create.xml
1 <article xmlns='http://docbook.org/ns/docbook'>
2 <title>koha-create</title>
3 <info>
4 <productname>Koha</productname> is the first free software library automation package.
5 <author>
6   <orgname>The Koha Community</orgname>
7   <uri>http://koha-community.org/</uri>
8 </author>
9 </info>
10
11 <refentry xml:id="koha-create">
12
13   <refmeta>
14     <refentrytitle>koha-create</refentrytitle>
15     <manvolnum>8</manvolnum>
16   </refmeta>
17
18   <refnamediv>
19     <refname>koha-create</refname>
20     <refpurpose>Create a new Koha instance.</refpurpose>
21     <refclass>UNIX/Linux</refclass>
22   </refnamediv>
23
24   <refsynopsisdiv>
25     <cmdsynopsis>
26       <command>koha-create</command>
27       <arg choice="req"><option>--create-db</option>|<option>--request-db</option>|<option>--populate-db</option>|<option>--use-db</option></arg>
28       <arg><option>--marcflavor</option> marc21|normarc|unimarc</arg>
29       <arg><option>--zebralang</option> en|es|fr|gr|nb|ru|uk</arg>
30       <arg><option>--auth-idx</option> dom|grs1</arg>
31       <arg><option>--biblio-idx</option> dom|grs1</arg>
32       <arg><option>--memcached-servers</option> server:port</arg>
33       <arg><option>--memcached-prefix</option> namespace_prefix</arg>
34       <arg><option>--defaultsql</option> /path/to/some.sql</arg>
35       <arg><option>--configfile</option> /path/to/config</arg>
36       <arg><option>--passwdfile</option> /path/to/passwd</arg>
37       <arg><option>--dbhost</option> host</arg>
38       <arg><option>--database</option> database</arg>
39       <arg><option>--adminuser</option> n</arg>
40       <arg><option>--enable-sru</option></arg>
41       <arg><option>--sru-port</option> port</arg>
42       <arg><option>--template-cache-dir</option> directory</arg>
43       <arg><option>--timezone</option> time/zone</arg>
44       <arg><option>--upload-path</option> directory</arg>
45       <arg><option>--tmp-path</option> directory</arg>
46       <arg><option>--letsencrypt</option></arg>
47       <arg><option>--help</option>|<option>-h</option></arg>
48
49       <arg choice="req" rep="norepeat"><replaceable>instancename</replaceable></arg>
50     </cmdsynopsis>
51   </refsynopsisdiv>
52   
53   <refsect1><title>Options</title>
54   <variablelist>
55     
56     <varlistentry>
57       <term><option>--create-db</option></term>
58       <listitem>
59         <para>Create a new database on localhost. If the database you want to use does not reside on localhost, you can use <option>--request-db</option> and <option>--populate-db</option>, see below. If the database already exists, you can use <option>--use-db</option>, see below.</para>
60       </listitem>
61     </varlistentry>
62     
63     <varlistentry>
64       <term><option>--request-db</option></term>
65       <listitem>
66         <para>This  option will create a file called <filename>instancename-db-request.txt</filename> in your current directory that contains information about how the database needs to be set up.</para>
67       </listitem>
68     </varlistentry>
69     
70     <varlistentry>
71       <term><option>--populate-db</option></term>
72       <listitem>
73         <para>When you have run koha-create with the <option>--request-db</option> option, and a database has been set up, you can finish your installation by running <command>koha-create</command> with this option.</para>
74       </listitem>
75     </varlistentry>
76
77     <varlistentry>
78       <term><option>--use-db</option></term>
79       <listitem>
80         <para>When the database you want to use has already been populated, you can run <command>koha-create</command> with this option to take care of all the other set-up configuration.</para>
81       </listitem>
82     </varlistentry>
83
84     <varlistentry>
85       <term><option>--configfile</option></term>
86       <listitem>
87         <para>Path to an alternative config file. This file can hold the same variables as the default config file, see below for details.</para>
88       </listitem>
89     </varlistentry>
90
91     <varlistentry>
92       <term><option>--database</option></term>
93       <listitem>
94         <para>MySQL database to use.</para>
95       </listitem>
96     </varlistentry>
97
98     <varlistentry>
99       <term><option>--dbhost</option></term>
100       <listitem>
101         <para>Database server hostname/IP to use.</para>
102       </listitem>
103     </varlistentry>
104
105     <varlistentry>
106       <term><option>--defaultsql</option></term>
107       <listitem>
108         <para>Path to an SQL-file other than the one pointed to in the default or alternative config file. Corresponds to the DEFAULTSQL config file variable.</para>
109       </listitem>
110     </varlistentry>
111
112     <varlistentry>
113       <term><option>--adminuser</option></term>
114       <listitem>
115         <para>Specify the borrowernumber of the user that should have a new, random password set as part of setting up the new instance. The password will be reported as part of the output of the current script. If --adminuser is not specified, the user with borrowernumber = 1 will be updated. If an SQL file is not used to populate the database of the newly created instance, no admin user will be created.</para>
116       </listitem>
117     </varlistentry>
118
119     <varlistentry>
120       <term><option>--marcflavor</option></term>
121       <listitem>
122         <para>Specifies format of MARC records to be indexed by Zebra. Corresponds to the ZEBRA_MARC_FORMAT config file variable.</para>
123       </listitem>
124     </varlistentry>
125
126     <varlistentry>
127       <term><option>--passwdfile</option></term>
128       <listitem>
129         <para>Path to an alternative passwd file. This file is in the same format as the default (Koha) passwd file, see below for details.</para>
130       </listitem>
131     </varlistentry>
132
133     <varlistentry>
134       <term><option>--zebralang</option></term>
135       <listitem>
136         <para>Primary language for Zebra indexing. Corresponds to the ZEBRA_LANGUAGE config file variable.</para>
137       </listitem>
138     </varlistentry>
139
140     <varlistentry>
141       <term><option>--auth-idx</option></term>
142       <listitem>
143         <para>Specified the desired indexing mode for authority records. Valid options are <option>dom</option> (default) and <option>grs1</option>.</para>
144       </listitem>
145     </varlistentry>
146
147     <varlistentry>
148       <term><option>--biblio-idx</option></term>
149       <listitem>
150         <para>Specified the desired indexing mode for bibliographic records. Valid options are <option>dom</option> (default) and <option>grs1</option>.</para>
151       </listitem>
152     </varlistentry>
153
154     <varlistentry>
155       <term><option>--memcached-servers</option></term>
156       <listitem>
157         <para>Specify a comma-separated list of host:port memcached servers for using with the created Koha instance. Defaults to <option>127.0.0.1:11211</option>, the needed configuration for a locally installed memcached server.</para>
158       </listitem>
159     </varlistentry>
160
161     <varlistentry>
162       <term><option>--memcached-prefix</option></term>
163       <listitem>
164         <para>Specifiy a <option>namespace prefix</option> for memcached. You usually leave this option alone to avoid namespace collisions. It defaults to <option>koha_</option>.</para>
165       </listitem>
166     </varlistentry>
167
168     <varlistentry>
169       <term><option>--enable-sru</option></term>
170       <listitem>
171         <para>Enable the Z39.50/SRU server for the created instance.</para>
172       </listitem>
173     </varlistentry>
174
175     <varlistentry>
176       <term><option>--sru-port</option></term>
177       <listitem>
178         <para>Specifiy a <option> TCP port number</option> for the Z39.50/SRU server to listen on.</para>
179       </listitem>
180     </varlistentry>
181
182     <varlistentry>
183       <term><option>--template-cache-dir</option></term>
184       <listitem>
185         <para>Specify a <option>directory</option> for storing the template cache files of the instance.
186               It defaults to <filename>/var/cache/koha/instance/templates</filename>.</para>
187       </listitem>
188     </varlistentry>
189
190     <varlistentry>
191       <term><option>--timezone</option></term>
192       <listitem>
193         <para>Specify a <option>timezone</option> for the created instance. e.g. America/Argentina</para>
194       </listitem>
195     </varlistentry>
196
197     <varlistentry>
198       <term><option>--upload-path</option></term>
199       <listitem>
200         <para>Specify a <option>directory</option> for storing the permanently uploaded files of the instance.
201               It defaults to <filename>/var/lib/koha/instance/uploads</filename>.</para>
202       </listitem>
203     </varlistentry>
204
205     <varlistentry>
206       <term><option>--tmp-path</option></term>
207       <listitem>
208         <para>Specify a <option>directory</option> for storing the temporary files. For example temporarily
209               uploaded files of the instance. It defaults to <filename>/var/lib/koha/instance/tmp</filename>.</para>
210       </listitem>
211     </varlistentry>
212
213     <varlistentry>
214       <term><option>--letsencrypt</option></term>
215       <listitem>
216         <para>Set up a https-only website with letsencrypt certificates</para>
217       </listitem>
218     </varlistentry>
219
220     <varlistentry>
221       <term><option>--help</option>,<option>-h</option></term>
222       <listitem>
223         <para>Print usage information.</para>
224       </listitem>
225     </varlistentry>
226
227
228   </variablelist>
229   </refsect1>
230
231   <refsect1><title>Description</title>
232     <para><command>koha-create</command>  creates  a new Koha instance.  It is meant for a site that provides Koha hosting, and serves several sites from the same host.</para>
233     <para>The name of the instance is used as the domain name  for  Apache,  Unix user and group names, and MySQL username and database names are derived from it.  Unix user and group are named instance-koha. MySQL username is koha_instance, and database is koha_instance.</para>
234     <para>The Unix user has logins disabled.  The password for MySQL is generated randomly, and printed to the terminal.</para>
235     <para>The instance name is used as the domain name (ServerName)  for  Apache. The public catalogue (OPAC), for library customers, is on port 80.  The staff client interface is configured similarly, depending on the settings in <filename>/etc/koha/koha-sites.conf</filename> or alternate config file.</para>
236     <para>After  the  Koha  instance  is created, it is ready to be used, but the librarian needs to log in via the intranet and configure things.</para>
237     <para>Several configuration variables are available for adjusting this behavior. The variables are put into <filename>/etc/koha/koha-sites.conf</filename>. The following variables are obeyed:</para>
238     
239     <variablelist>
240     
241       <varlistentry>
242         <term><option>DOMAIN</option></term>
243         <listitem>
244           <para>The domain to append to the instance name, for Apache ServerName. Default is empty. The value must begin with a period.</para>
245         </listitem>
246       </varlistentry>
247     
248       <varlistentry>
249         <term><option>OPACPORT</option></term>
250         <listitem>
251           <para>The port for the OPAC.</para>
252         </listitem>
253       </varlistentry>
254
255       <varlistentry>
256         <term><option>OPACPREFIX</option></term>
257         <listitem>
258           <para>This is inserted before the instance name  when  forming  Apache ServerName.  For subdomains, make sure it ends with a period.</para>
259         </listitem>
260       </varlistentry>
261
262       <varlistentry>
263         <term><option>OPACSUFFIX</option></term>
264         <listitem>
265           <para>This  is inserted after the instance name, but before the domain name, when forming Apache ServerName.</para>
266         </listitem>
267       </varlistentry>
268
269       <varlistentry>
270         <term><option>INTRAPORT</option></term>
271         <listitem>
272           <para>The port for the intranet.  If you set this to empty or 80, then you must also define INTRAPREFIX or INTRASUFFIX.</para>
273         </listitem>
274       </varlistentry>
275
276       <varlistentry>
277         <term><option>INTRAPREFIX</option></term>
278         <listitem>
279           <para>This is inserted before the instance name  when  forming  Apache ServerName.  For subdomains, make sure it ends with a period.</para>
280         </listitem>
281       </varlistentry>
282
283       <varlistentry>
284         <term><option>INTRASUFFIX</option></term>
285         <listitem>
286           <para>This  is inserted after the instance name, but before the domain name, when forming Apache ServerName.</para>
287         </listitem>
288       </varlistentry>
289
290       <varlistentry>
291         <term><option>DEFAULTSQL</option></term>
292         <listitem>
293           <para>An SQL file (compressed with gzip) that can be fed  to  mysql(1) to  initialize the database after it has been created.  Might be created using koha-dump-defaults(8).</para>
294           <para>If the SQL file contains users, the user with borrowernumber = 1 will have a new, random password set. This password will be reported in the output of the script. If another user than borrowernumber 1 should have its password set, the borrowernumber of this user can be set with the --adminuser command line option.</para>
295         </listitem>
296       </varlistentry>
297
298       <varlistentry>
299         <term><option>MEMCACHED_SERVERS</option></term>
300         <listitem>
301           <para>A comma-separated list of valid memcached servers. Usually in the form of <option>host:port</option>. If not present koha-create will default to <option>127.0.0.1:11211</option>. Also, this will be overriden by the arguments of the <option>--memcached-servers</option> switch.</para>
302         </listitem>
303       </varlistentry>
304
305       <varlistentry>
306         <term><option>MEMCACHED_PREFIX</option></term>
307         <listitem>
308           <para>A prefix for all new Koha instances to use in memcached. If not present koha-create will default to <option>koha_</option>. Also, this will be overriden by the arguments of the <option>--memcached-prefix</option> switch.</para>
309         </listitem>
310       </varlistentry>
311
312
313       <varlistentry>
314         <term><option>ZEBRA_MARC_FORMAT</option></term>
315         <listitem>
316           <para>Specifies format of MARC records to be indexed by Zebra.  Possible values are 'marc21', 'normarc' and 'unimarc'.</para>
317         </listitem>
318       </varlistentry>
319               
320       <varlistentry>
321         <term><option>ZEBRA_LANGUAGE</option></term>
322         <listitem>
323           <para>Primary  language  for Zebra indexing. Possible values are 'en', 'es', 'fr', 'nb', 'ru' and 'uk'.</para>
324         </listitem>
325       </varlistentry>
326
327     </variablelist>
328
329     <para>Order of precedence for config options, from lowest to highest:</para>
330        
331     <orderedlist>
332       <listitem><para>The defaults set in the code of <command>koha-create</command></para></listitem>
333       <listitem><para><filename>/etc/koha/koha-sites.conf</filename></para></listitem>
334       <listitem><para>Config file specified with <option>--configfile</option></para></listitem>
335       <listitem><para>Individual command line options</para></listitem>
336     </orderedlist>
337     
338   </refsect1>
339
340   <refsect1><title>Files</title>
341   <variablelist>
342     <varlistentry>
343       <term><option><filename>/etc/koha/koha-sites.conf</filename></option></term>
344       <listitem>
345         <para>Configuration variables are read from this file, if it exists.</para>
346       </listitem>
347     </varlistentry>
348
349     <varlistentry>
350       <term><option><filename>/etc/koha/passwd</filename></option></term>
351       <listitem>
352         <para>Pre-selected database credentials are read from this file, if it exists. The format for this file is instancename:username:passwd:database:dbhost. Database is optional, but the other three are required if you want to use pre-determined database user credentials.</para>
353       </listitem>
354     </varlistentry>
355   </variablelist>
356   </refsect1>
357
358   <refsect1><title>Bugs</title>
359   <para>The program is a bit fragile. If something goes wrong, it does not clean up after itself.</para>
360   <para>Bugs can be reported here: <uri>http://bugs.koha-community.org/bugzilla3/</uri></para>
361   </refsect1>
362   
363   <refsect1><title>Example</title>
364   
365     <para>To create a new Koha instance:</para>
366
367     <para><command>koha-create --create-db hslibrary</command></para>
368
369     <para>The public catalog is now at <uri>http://hslibrary/</uri> and the librarian interface at <uri>http://hslibrary:8080/</uri>.</para>
370
371     <para>To use full domain names, and have the intranet interface on port  80, but on a different domain name, add the following variables to the configuration file:</para>
372
373     <itemizedlist spacing="compact">
374       <listitem><para>DOMAIN=".example.com"</para></listitem>
375       <listitem><para>INTRAPORT=""</para></listitem>
376       <listitem><para>INTRASUFFIX="-intra"</para></listitem>
377     </itemizedlist>
378
379     <para>This will result in the addresses for the public and intranet interfaces becoming these:</para>
380
381     <itemizedlist spacing="compact">
382       <listitem><para><uri>http://hslibrary.example.com/</uri></para></listitem>
383       <listitem><para><uri>http://hslibrary-intra.example.com/</uri></para></listitem>
384     </itemizedlist>
385     <para>Configuration changes only apply to instances created afterwards.</para>
386
387   </refsect1>
388   
389   <refsect1><title>See also</title>
390
391   <simplelist type="inline">
392     <member><command>koha-remove(8)</command></member>
393   </simplelist>
394
395   </refsect1>
396
397 </refentry>
398
399 </article>