Bug 9409: (QA followup) Add --dbhost help to koha-create man page
[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>--use-memcached</option></arg>
33       <arg><option>--memcached-servers</option> server:port</arg>
34       <arg><option>--memcached-prefix</option> namespace_prefix</arg>
35       <arg><option>--defaultsql</option> /path/to/some.sql</arg>
36       <arg><option>--configfile</option> /path/to/config</arg>
37       <arg><option>--passwdfile</option> /path/to/passwd</arg>
38       <arg><option>--dbhost</option> host</arg>
39       <arg><option>--database</option> database</arg>
40       <arg><option>--adminuser</option> n</arg>
41       <arg><option>--enable-sru</option></arg>
42       <arg><option>--sru-port</option> port</arg>
43       <arg><option>--upload-path</option> directory</arg>
44       <arg><option>--letsencrypt</option></arg>
45       <arg><option>--help</option>|<option>-h</option></arg>
46
47       <arg choice="req" rep="norepeat"><replaceable>instancename</replaceable></arg>
48     </cmdsynopsis>
49   </refsynopsisdiv>
50   
51   <refsect1><title>Options</title>
52   <variablelist>
53     
54     <varlistentry>
55       <term><option>--create-db</option></term>
56       <listitem>
57         <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>
58       </listitem>
59     </varlistentry>
60     
61     <varlistentry>
62       <term><option>--request-db</option></term>
63       <listitem>
64         <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>
65       </listitem>
66     </varlistentry>
67     
68     <varlistentry>
69       <term><option>--populate-db</option></term>
70       <listitem>
71         <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>
72       </listitem>
73     </varlistentry>
74
75     <varlistentry>
76       <term><option>--use-db</option></term>
77       <listitem>
78         <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>
79       </listitem>
80     </varlistentry>
81
82     <varlistentry>
83       <term><option>--configfile</option></term>
84       <listitem>
85         <para>Path to an alternative config file. This file can hold the same variables as the default config file, see below for details.</para>
86       </listitem>
87     </varlistentry>
88
89     <varlistentry>
90       <term><option>--database</option></term>
91       <listitem>
92         <para>MySQL database to use.</para>
93       </listitem>
94     </varlistentry>
95
96     <varlistentry>
97       <term><option>--dbhost</option></term>
98       <listitem>
99         <para>Database server hostname/IP to use.</para>
100       </listitem>
101     </varlistentry>
102
103     <varlistentry>
104       <term><option>--defaultsql</option></term>
105       <listitem>
106         <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>
107       </listitem>
108     </varlistentry>
109
110     <varlistentry>
111       <term><option>--adminuser</option></term>
112       <listitem>
113         <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>
114       </listitem>
115     </varlistentry>
116
117     <varlistentry>
118       <term><option>--marcflavor</option></term>
119       <listitem>
120         <para>Specifies format of MARC records to be indexed by Zebra. Corresponds to the ZEBRA_MARC_FORMAT config file variable.</para>
121       </listitem>
122     </varlistentry>
123
124     <varlistentry>
125       <term><option>--passwdfile</option></term>
126       <listitem>
127         <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>
128       </listitem>
129     </varlistentry>
130
131     <varlistentry>
132       <term><option>--zebralang</option></term>
133       <listitem>
134         <para>Primary language for Zebra indexing. Corresponds to the ZEBRA_LANGUAGE config file variable.</para>
135       </listitem>
136     </varlistentry>
137
138     <varlistentry>
139       <term><option>--auth-idx</option></term>
140       <listitem>
141         <para>Specified the desired indexing mode for authority records. Valid options are <option>dom</option> (default) and <option>grs1</option>.</para>
142       </listitem>
143     </varlistentry>
144
145     <varlistentry>
146       <term><option>--biblio-idx</option></term>
147       <listitem>
148         <para>Specified the desired indexing mode for bibliographic records. Valid options are <option>dom</option> (default) and <option>grs1</option>.</para>
149       </listitem>
150     </varlistentry>
151
152     <varlistentry>
153       <term><option>--use-memcached</option></term>
154       <listitem>
155         <para>Make the Koha instance use memcached. <option>Disabled by default</option>.</para>
156       </listitem>
157     </varlistentry>
158
159     <varlistentry>
160       <term><option>--memcached-servers</option></term>
161       <listitem>
162         <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>
163       </listitem>
164     </varlistentry>
165
166     <varlistentry>
167       <term><option>--memcached-prefix</option></term>
168       <listitem>
169         <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>
170       </listitem>
171     </varlistentry>
172
173     <varlistentry>
174       <term><option>--enable-sru</option></term>
175       <listitem>
176         <para>Enable the Z39.50/SRU server for the created instance.</para>
177       </listitem>
178     </varlistentry>
179
180     <varlistentry>
181       <term><option>--sru-port</option></term>
182       <listitem>
183         <para>Specifiy a <option> TCP port number</option> for the Z39.50/SRU server to listen on.</para>
184       </listitem>
185     </varlistentry>
186
187     <varlistentry>
188       <term><option>--upload-path</option></term>
189       <listitem>
190         <para>Specify a <option>directory</option> for storing the permanently uploaded files of the instance.
191               It defaults to <filename>/var/lib/koha/instance/uploads</filename>.</para>
192       </listitem>
193     </varlistentry>
194
195     <varlistentry>
196       <term><option>--letsencrypt</option></term>
197       <listitem>
198         <para>Set up a https-only website with letsencrypt certificates</para>
199       </listitem>
200     </varlistentry>
201
202     <varlistentry>
203       <term><option>--help</option>,<option>-h</option></term>
204       <listitem>
205         <para>Print usage information.</para>
206       </listitem>
207     </varlistentry>
208
209
210   </variablelist>
211   </refsect1>
212
213   <refsect1><title>Description</title>
214     <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>
215     <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>
216     <para>The Unix user has logins disabled.  The password for MySQL is generated randomly, and printed to the terminal.</para>
217     <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>
218     <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>
219     <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>
220     
221     <variablelist>
222     
223       <varlistentry>
224         <term><option>DOMAIN</option></term>
225         <listitem>
226           <para>The domain to append to the instance name, for Apache ServerName. Default is empty. The value must begin with a period.</para>
227         </listitem>
228       </varlistentry>
229     
230       <varlistentry>
231         <term><option>OPACPORT</option></term>
232         <listitem>
233           <para>The port for the OPAC.</para>
234         </listitem>
235       </varlistentry>
236
237       <varlistentry>
238         <term><option>OPACPREFIX</option></term>
239         <listitem>
240           <para>This is inserted before the instance name  when  forming  Apache ServerName.  For subdomains, make sure it ends with a period.</para>
241         </listitem>
242       </varlistentry>
243
244       <varlistentry>
245         <term><option>OPACSUFFIX</option></term>
246         <listitem>
247           <para>This  is inserted after the instance name, but before the domain name, when forming Apache ServerName.</para>
248         </listitem>
249       </varlistentry>
250
251       <varlistentry>
252         <term><option>INTRAPORT</option></term>
253         <listitem>
254           <para>The port for the intranet.  If you set this to empty or 80, then you must also define INTRAPREFIX or INTRASUFFIX.</para>
255         </listitem>
256       </varlistentry>
257
258       <varlistentry>
259         <term><option>INTRAPREFIX</option></term>
260         <listitem>
261           <para>This is inserted before the instance name  when  forming  Apache ServerName.  For subdomains, make sure it ends with a period.</para>
262         </listitem>
263       </varlistentry>
264
265       <varlistentry>
266         <term><option>INTRASUFFIX</option></term>
267         <listitem>
268           <para>This  is inserted after the instance name, but before the domain name, when forming Apache ServerName.</para>
269         </listitem>
270       </varlistentry>
271
272       <varlistentry>
273         <term><option>DEFAULTSQL</option></term>
274         <listitem>
275           <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>
276           <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>
277         </listitem>
278       </varlistentry>
279
280       <varlistentry>
281         <term><option>USE_MEMCACHED</option></term>
282         <listitem>
283           <para>Valid values are <option>yes</option> and <option>no</option>. If not present koha-create will default to <option>no</option>. Also, this will be overriden by the <option>--use-memcached</option> switch.</para>
284         </listitem>
285       </varlistentry>
286
287       <varlistentry>
288         <term><option>MEMCACHED_SERVERS</option></term>
289         <listitem>
290           <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>
291         </listitem>
292       </varlistentry>
293
294       <varlistentry>
295         <term><option>MEMCACHED_PREFIX</option></term>
296         <listitem>
297           <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>
298         </listitem>
299       </varlistentry>
300
301
302       <varlistentry>
303         <term><option>ZEBRA_MARC_FORMAT</option></term>
304         <listitem>
305           <para>Specifies format of MARC records to be indexed by Zebra.  Possible values are 'marc21', 'normarc' and 'unimarc'.</para>
306         </listitem>
307       </varlistentry>
308               
309       <varlistentry>
310         <term><option>ZEBRA_LANGUAGE</option></term>
311         <listitem>
312           <para>Primary  language  for Zebra indexing. Possible values are 'en', 'es', 'fr', 'nb', 'ru' and 'uk'.</para>
313         </listitem>
314       </varlistentry>
315
316     </variablelist>
317
318     <para>Order of precedence for config options, from lowest to highest:</para>
319        
320     <orderedlist>
321       <listitem><para>The defaults set in the code of <command>koha-create</command></para></listitem>
322       <listitem><para><filename>/etc/koha/koha-sites.conf</filename></para></listitem>
323       <listitem><para>Config file specified with <option>--configfile</option></para></listitem>
324       <listitem><para>Individual command line options</para></listitem>
325     </orderedlist>
326     
327   </refsect1>
328
329   <refsect1><title>Files</title>
330   <variablelist>
331     <varlistentry>
332       <term><option><filename>/etc/koha/koha-sites.conf</filename></option></term>
333       <listitem>
334         <para>Configuration variables are read from this file, if it exists.</para>
335       </listitem>
336     </varlistentry>
337
338     <varlistentry>
339       <term><option><filename>/etc/koha/passwd</filename></option></term>
340       <listitem>
341         <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>
342       </listitem>
343     </varlistentry>
344   </variablelist>
345   </refsect1>
346
347   <refsect1><title>Bugs</title>
348   <para>The program is a bit fragile. If something goes wrong, it does not clean up after itself.</para>
349   <para>Bugs can be reported here: <uri>http://bugs.koha-community.org/bugzilla3/</uri></para>
350   </refsect1>
351   
352   <refsect1><title>Example</title>
353   
354     <para>To create a new Koha instance:</para>
355
356     <para><command>koha-create --create-db hslibrary</command></para>
357
358     <para>The public catalog is now at <uri>http://hslibrary/</uri> and the librarian interface at <uri>http://hslibrary:8080/</uri>.</para>
359
360     <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>
361
362     <itemizedlist spacing="compact">
363       <listitem><para>DOMAIN=".example.com"</para></listitem>
364       <listitem><para>INTRAPORT=""</para></listitem>
365       <listitem><para>INTRASUFFIX="-intra"</para></listitem>
366     </itemizedlist>
367
368     <para>This will result in the addresses for the public and intranet interfaces becoming these:</para>
369
370     <itemizedlist spacing="compact">
371       <listitem><para><uri>http://hslibrary.example.com/</uri></para></listitem>
372       <listitem><para><uri>http://hslibrary-intra.example.com/</uri></para></listitem>
373     </itemizedlist>
374     <para>Configuration changes only apply to instances created afterwards.</para>
375
376   </refsect1>
377   
378   <refsect1><title>See also</title>
379
380   <simplelist type="inline">
381     <member><command>koha-remove(8)</command></member>
382   </simplelist>
383
384   </refsect1>
385
386 </refentry>
387
388 </article>