[753] | 1 | <!-- $Id$ --> |
---|
| 2 | |
---|
| 3 | <chapter> |
---|
[865] | 4 | <title id="installation">Installation</title> |
---|
[860] | 5 | |
---|
| 6 | <para>Last modified on $Date$</para> |
---|
| 7 | |
---|
[753] | 8 | <para> |
---|
[856] | 9 | Before being able to use <application>PyKota</application>, you have of course to |
---|
| 10 | install it first. But before installing, you must carefully plan your installation. |
---|
[753] | 11 | </para> |
---|
[856] | 12 | |
---|
| 13 | <para> |
---|
| 14 | First you have to determine which machine will be the <application>PyKota</application> |
---|
[860] | 15 | <firstterm>Storage Server</firstterm>. The Storage Server is the host responsible |
---|
[856] | 16 | for keeping a centralized database of print usage for all your printers, users and groups. |
---|
| 17 | </para> |
---|
| 18 | |
---|
| 19 | <para> |
---|
[860] | 20 | Then you have to list all the <firstterm>Print Servers</firstterm> for which |
---|
| 21 | you plan to use <firstterm>print quota</firstterm> facilities. |
---|
[856] | 22 | </para> |
---|
| 23 | |
---|
| 24 | <para> |
---|
[861] | 25 | Finally you have to download <application>PyKota</application>'s latest version |
---|
| 26 | or buy an official package, from |
---|
| 27 | <ulink url="http://www.librelogiciel.com/software/">http://www.librelogiciel.com/software/</ulink>. |
---|
| 28 | If you've just bought an official package, then as soon as you've receive it you |
---|
| 29 | have to decompress and visit its archive, to do so just type the following commands : |
---|
| 30 | <screen> |
---|
[2231] | 31 | jerome@nordine:~$ tar -zxf pykota-1.22_official.tar.gz |
---|
| 32 | jerome@nordine:~$ cd pykota-1.22_official |
---|
| 33 | jerome@nordine:~/pykota-1.22_official$ |
---|
[861] | 34 | </screen> |
---|
| 35 | </para> |
---|
| 36 | |
---|
| 37 | <para> |
---|
| 38 | You can see many files in this directory, the first ones to read are <filename>README</filename>, |
---|
| 39 | then <filename>COPYING</filename> and <filename>LICENSE</filename>. They will give you |
---|
| 40 | basic installation instructions and explain the licensing terms under which |
---|
| 41 | <application>PyKota</application> is distributed. Of course they are also mostly |
---|
| 42 | boring to read ! Detailed installation and operating instructions are defined |
---|
| 43 | in the <filename>./docs</filename> directory, in the form of <acronym>SGML</acronym> |
---|
| 44 | documentation in the <ulink url="http://www.docbook.org">DocBook</ulink> format. |
---|
| 45 | You have to compile these files into readable documentation like the <acronym>HTML</acronym> |
---|
| 46 | or <acronym>PDF</acronym> formats, or buy an official <application>PyKota</application> package |
---|
[1168] | 47 | which already contains these compiled forms of the documentation. Of course you already |
---|
| 48 | know this because that's what you are currently reading ! |
---|
[861] | 49 | </para> |
---|
| 50 | |
---|
| 51 | <para> |
---|
| 52 | Now we will see what has to be done on each of the servers we are planning to use. |
---|
[856] | 53 | <note> |
---|
| 54 | <title>Note</title> |
---|
| 55 | <para> |
---|
| 56 | Of course, depending on the size of your network, you may very well |
---|
| 57 | use the same machine as both a Print Server and a Storage Server. |
---|
| 58 | This is especially the case if you've got only one server. |
---|
| 59 | </para> |
---|
| 60 | </note> |
---|
| 61 | </para> |
---|
| 62 | |
---|
| 63 | <sect1> |
---|
| 64 | <title>Storage Server Installation</title> |
---|
| 65 | |
---|
| 66 | <para> |
---|
| 67 | Depending on <application>PyKota</application>'s version number, different |
---|
| 68 | types of storage backends may be supported, so we will see for each one of |
---|
| 69 | them how to configure it. |
---|
| 70 | </para> |
---|
| 71 | |
---|
| 72 | <sect2> |
---|
| 73 | <title>PostgreSQL</title> |
---|
| 74 | |
---|
| 75 | <para> |
---|
[860] | 76 | <application>PostgreSQL</application> is an <firstterm>Object Relationnal DataBase |
---|
| 77 | Management System</firstterm> distributed under a <firstterm>Free Software</firstterm> |
---|
[856] | 78 | license from the |
---|
| 79 | <ulink url="http://www.postgresql.org">http://www.postgresql.org</ulink> |
---|
| 80 | web site. It certainely is the free <acronym>RDBMS</acronym> which has the most advanced |
---|
| 81 | features, and is widely used all over the world. |
---|
| 82 | </para> |
---|
| 83 | |
---|
| 84 | <para> |
---|
| 85 | To configure your Storage Server, you must have PostgreSQL already working. |
---|
| 86 | The complete installation of <application>PostgreSQL</application> is not covered by |
---|
| 87 | the present manual, please refer to your system's documentation or to |
---|
| 88 | <ulink url="http://www.postgresql.org">http://www.postgresql.org</ulink> for |
---|
| 89 | details. |
---|
| 90 | </para> |
---|
| 91 | |
---|
| 92 | <para> |
---|
| 93 | One thing you have to check, though, is that every Print Server on which you |
---|
[863] | 94 | want to install the print quota mechanism, must be able to connect to the |
---|
[856] | 95 | <application>PostgreSQL</application> server. In the default installation of |
---|
| 96 | <application>PostgreSQL</application> this may not be the case for security reasons, except if both |
---|
| 97 | servers are in fact the same machine. In any case, it is recommended that you |
---|
[862] | 98 | check the <filename>/etc/postgresql/pg_hba.conf</filename> file and modify it if |
---|
[856] | 99 | needed. This file is self documented and its modification is straightforward. |
---|
[858] | 100 | You also have to make sure that <application>PostgreSQL</application> accepts <acronym>TCP/IP</acronym> connections. |
---|
| 101 | To do so you either have to launch it with the <option>-i</option> option or |
---|
[862] | 102 | modify the <filename>/etc/postgresql/postgresql.conf</filename> file, which is |
---|
[1168] | 103 | self documented and easy to modify too. Allowing <acronym>TCP/IP</acronym> connections |
---|
| 104 | is not necessary though if your Quota Storage Server and your Print Server are |
---|
| 105 | the very same host. |
---|
[2116] | 106 | </para> |
---|
| 107 | |
---|
| 108 | <para> |
---|
| 109 | Here's an excerpt from a <filename>pg_hba.conf</filename> file. This one rejects all |
---|
| 110 | connections to PyKota's database excepted when made from the same host by <application>PostgreSQL</application> users |
---|
| 111 | <literal>pykotauser</literal> or <literal>pykotaadmin</literal> with the correct password. |
---|
| 112 | <screen> |
---|
| 113 | local all postgres ident sameuser |
---|
| 114 | local all all reject |
---|
| 115 | host pykota pykotauser 127.0.0.1 255.255.255.255 crypt |
---|
| 116 | host pykota pykotaadmin 127.0.0.1 255.255.255.255 crypt |
---|
| 117 | host pykota all 127.0.0.1 255.255.255.255 reject |
---|
| 118 | </screen> |
---|
| 119 | </para> |
---|
| 120 | |
---|
| 121 | <para> |
---|
| 122 | Of course if your print server and your database servers have different <acronym>IP</acronym> |
---|
| 123 | addresses, you have to replace the <literal>127.0.0.1</literal> address above with your print |
---|
[2126] | 124 | server's <acronym>IP</acronym> address. As an alternative, you could still keep these |
---|
[2169] | 125 | lines and add similar lines with other <acronym>IP</acronym> addresses if you have several |
---|
[2126] | 126 | print servers for which you want a single centralized database. |
---|
[856] | 127 | <tip> |
---|
| 128 | <title>Tip</title> |
---|
| 129 | <para> |
---|
| 130 | Don't forget to restart <application>PostgreSQL</application> if you modify |
---|
| 131 | any of its configuration files, in order for the changes to take effect. |
---|
| 132 | </para> |
---|
| 133 | </tip> |
---|
| 134 | </para> |
---|
| 135 | |
---|
| 136 | <para> |
---|
| 137 | Be careful, you may be unable to connect from a Print Server to the <application>PostgreSQL</application> |
---|
| 138 | server even if the configuration is correct. Sometimes your connections may be blocked by |
---|
| 139 | one or more network firewalls along the route from one machine to the other. If this |
---|
[860] | 140 | is the case, then the best thing you can do is to ask your <firstterm>Network Administrator</firstterm> |
---|
[856] | 141 | to not filter the IP port used by <application>PostgreSQL</application>, which is |
---|
[1099] | 142 | usually port <literal>5432/tcp</literal>. |
---|
[860] | 143 | <note> |
---|
| 144 | <title>Note</title> |
---|
[856] | 145 | <para> |
---|
| 146 | The TCP/IP network port used by PostgreSQL may be different. When in doubt, ask your |
---|
[860] | 147 | <firstterm>System Administrator</firstterm> for the correct value. |
---|
[856] | 148 | </para> |
---|
[860] | 149 | </note> |
---|
[856] | 150 | </para> |
---|
| 151 | |
---|
| 152 | <para> |
---|
[860] | 153 | Now that your <application>PostgreSQL</application> server is up and running, and |
---|
| 154 | is waiting for your connections, you have to create the Quota Storage DataBase. |
---|
| 155 | To do so, you'll have to feed <application>PostgreSQL</application> with the |
---|
[2231] | 156 | <filename>pykota-1.22/initscripts/postgresql/pykota-postgresql.sql</filename> file. |
---|
[1021] | 157 | This file will create a Quota DataBase administrator in the <application>PostgreSQL</application> system, then create an empty |
---|
[862] | 158 | Quota DataBase and set some permissions on it. The Quota DataBase administrator |
---|
[1021] | 159 | is the <application>PostgreSQL</application>'s user used to manage the Quota database. |
---|
| 160 | The Quota DataBase Administrator is not present in the Quota Database |
---|
| 161 | itself, he is only defined in <application>PostgreSQL</application> and don't |
---|
[1168] | 162 | have to exist on any system, nor in the Quota DataBase. His default name |
---|
[1021] | 163 | is <literal>pykotaadmin</literal>. |
---|
[1099] | 164 | A Quota Storage read-only user is also created under the name of <literal>pykotauser</literal>. |
---|
| 165 | This read-only user is used by <application>PyKota</application> to connect to the |
---|
[1783] | 166 | Quota Storage when an user who is not a <application>PyKota</application> administrator |
---|
[2116] | 167 | <footnote><para>a <application>PyKota</application> administrator is an user who can read the <filename>~pykota/pykotadmin.conf</filename> file.</para></footnote> |
---|
[1783] | 168 | launches a pykota command. This prevents normal |
---|
[1099] | 169 | users from being able to modify their own, or other users', quota information. |
---|
[1021] | 170 | The database which will be created will be named <literal>pykota</literal> by default. |
---|
[862] | 171 | <note> |
---|
| 172 | <title>Note</title> |
---|
| 173 | <para> |
---|
| 174 | You can choose other names if you want, just modify the |
---|
[1015] | 175 | <filename>initscripts/postgresql/pykota-postgresql.sql</filename> file |
---|
[864] | 176 | accordingly, and report your changes into <application>PyKota</application>'s |
---|
[1600] | 177 | configuration files. |
---|
[862] | 178 | </para> |
---|
| 179 | </note> |
---|
[856] | 180 | </para> |
---|
[860] | 181 | |
---|
| 182 | <para> |
---|
[2115] | 183 | To run this script, you can use the <command>psql</command> frontend to |
---|
[860] | 184 | <application>PostgreSQL</application>, but your priviledges must be sufficient |
---|
[2115] | 185 | to be allowed to create users and databases. You can launch <command>psql</command> |
---|
[860] | 186 | as the <literal>postgres</literal> user which is <application>PostgreSQL</application>'s |
---|
| 187 | default administrator, and connect to the default database named <literal>template1</literal>. |
---|
| 188 | From a command line interpreter (i.e. shell), type the following commands : |
---|
| 189 | <screen> |
---|
[2231] | 190 | jerome@nordine:~$ cd pykota-1.22_official/initscripts/postgresql |
---|
| 191 | jerome@nordine:~/pykota-1.22_official/initscripts$ psql -h localhost -U postgres template1 |
---|
[860] | 192 | Welcome to psql, the PostgreSQL interactive terminal. |
---|
| 193 | |
---|
| 194 | Type: \copyright for distribution terms |
---|
| 195 | \h for help with SQL commands |
---|
| 196 | \? for help on internal slash commands |
---|
| 197 | \g or terminate with semicolon to execute query |
---|
| 198 | \q to quit |
---|
| 199 | |
---|
| 200 | template1=# \i pykota-postgresql.sql |
---|
| 201 | ... a lot of output lines |
---|
[862] | 202 | pykota=# |
---|
[860] | 203 | </screen> |
---|
[1906] | 204 | <note> |
---|
| 205 | <title>Note</title> |
---|
| 206 | <para> |
---|
| 207 | If you use RPM or DEB packages, usually the |
---|
| 208 | <filename>pykota-postgresql.sql</filename> file gets installed into the |
---|
| 209 | <filename>/usr/share/pykota/postgresql</filename> directory, along |
---|
| 210 | with a README file. |
---|
| 211 | </para> |
---|
| 212 | </note> |
---|
[860] | 213 | </para> |
---|
| 214 | |
---|
| 215 | <para> |
---|
[862] | 216 | For security reasons, you may want to set passwords in |
---|
| 217 | <application>PostgreSQL</application> for the |
---|
[1099] | 218 | <literal>pykotaadmin</literal> and <literal>pykotauser</literal> users. |
---|
[1021] | 219 | Otherwise any user able to connect to |
---|
[862] | 220 | <application>PostgreSQL</application> on your Quota Storage Server |
---|
[1099] | 221 | could connect to the quota database, and either see it, or even modify it without problem. |
---|
[862] | 222 | </para> |
---|
| 223 | |
---|
| 224 | <para> |
---|
[2115] | 225 | To do so, just type the following lines while still being at the <command>psql</command> |
---|
[1099] | 226 | prompt (replace the password values by your own, and do the same for the <literal>pykotauser</literal> user) : |
---|
[862] | 227 | <screen> |
---|
| 228 | pykota=# ALTER USER pykotaadmin PASSWORD 'somepassword'; |
---|
| 229 | ALTER USER |
---|
| 230 | pykota=# \q |
---|
[2231] | 231 | jerome@nordine:~/pykota-1.22_official/initscripts/postgresql$ |
---|
[862] | 232 | </screen> |
---|
| 233 | </para> |
---|
| 234 | |
---|
| 235 | <para> |
---|
[2115] | 236 | The <literal>\q</literal> command above will quit the <command>psql</command> |
---|
[862] | 237 | program and return you to the shell's command line prompt. |
---|
| 238 | </para> |
---|
| 239 | |
---|
| 240 | <para> |
---|
| 241 | To improve security further, you could encrypt your database connections, or |
---|
| 242 | take any other step as needed. Please refer to <application>PostgreSQL</application>'s |
---|
[2117] | 243 | documentation for details. |
---|
[862] | 244 | <warning> |
---|
| 245 | <title>Warning</title> |
---|
| 246 | <para> |
---|
| 247 | Defining passwords may not be sufficient if your database access rule is |
---|
| 248 | set to <literal>trust</literal> in the <filename>/etc/postgresql/pg_hba.conf</filename>. |
---|
| 249 | Again, please refer to <application>PostgreSQL</application>'s documentation |
---|
| 250 | for details. Also, passwords will fly unencrypted over the network by default, |
---|
| 251 | so be sure to take any necessary step to secure your database server from |
---|
| 252 | unauthorized use. This has nothing to do with <application>PyKota</application> |
---|
| 253 | though, it is just a general rule to keep in mind. |
---|
| 254 | </para> |
---|
| 255 | </warning> |
---|
| 256 | </para> |
---|
| 257 | |
---|
| 258 | <para> |
---|
[860] | 259 | If no error occured, then your Quota DataBase is ready to be used. |
---|
| 260 | Now you can let the Quota Storage Server alone, the remaining work |
---|
| 261 | will have to be done on each one of the print servers which will |
---|
| 262 | use this particular Quota Storage Server. |
---|
| 263 | <tip> |
---|
| 264 | <title>Tip</title> |
---|
| 265 | <para> |
---|
| 266 | If an error occured, maybe your PostgreSQL version is too old, or |
---|
[1168] | 267 | an unexpected problem (like a bug) happened. Please contact us via email so that we |
---|
[2117] | 268 | can try to fix the problem. Thanks in advance. |
---|
[860] | 269 | </para> |
---|
| 270 | </tip> |
---|
| 271 | </para> |
---|
[862] | 272 | |
---|
[856] | 273 | </sect2> |
---|
| 274 | |
---|
| 275 | <sect2> |
---|
[1906] | 276 | <title>LDAP</title> |
---|
[856] | 277 | |
---|
| 278 | <para> |
---|
[1906] | 279 | Any <acronym>LDAP</acronym> server, and particularly <application>OpenLDAP</application>, can be used |
---|
| 280 | as a Quota Storage Backend. |
---|
[1600] | 281 | Some other LDAP servers can be used, but this is currently untested in production. |
---|
[856] | 282 | </para> |
---|
[1052] | 283 | |
---|
| 284 | <para> |
---|
[1168] | 285 | <application>OpenLDAP</application> is a Lightweight Directory Access Protocol server |
---|
| 286 | implementation published as Free Software. |
---|
| 287 | You can download it from <ulink url="http://www.openldap.org">http://www.openldap.org</ulink>. |
---|
| 288 | </para> |
---|
| 289 | |
---|
| 290 | <para> |
---|
[1052] | 291 | To use <application>OpenLDAP</application> as your Quota Storage Backend, you have to copy the |
---|
[2117] | 292 | <filename>pykota/initscripts/ldap/pykota.schema</filename> into <application>OpenLDAP</application>'s |
---|
[1052] | 293 | schemas directory. |
---|
| 294 | Under Debian GNU/Linux, this is something like : |
---|
| 295 | <screen> |
---|
| 296 | $ cp pykota.schema /etc/ldap/schema |
---|
| 297 | </screen> |
---|
[1906] | 298 | <note> |
---|
| 299 | <title>Note</title> |
---|
| 300 | <para> |
---|
[2126] | 301 | If you use RPM or DEB packages, the |
---|
| 302 | <filename>pykota.schema</filename> file is usually installed into the |
---|
| 303 | <filename>/usr/share/pykota/ldap</filename> directory, along |
---|
| 304 | with a README file, and may also be installed automatically in |
---|
| 305 | your <acronym>LDAP</acronym> server's schemas directory. |
---|
[1906] | 306 | </para> |
---|
| 307 | </note> |
---|
[1052] | 308 | </para> |
---|
| 309 | <para> |
---|
| 310 | Then edit <filename>/etc/ldap/slapd.conf</filename> and add a line to |
---|
| 311 | include the PyKota schema. You should have something |
---|
| 312 | like : |
---|
| 313 | <screen> |
---|
| 314 | # Schema and objectClass definitions |
---|
| 315 | include /etc/ldap/schema/core.schema |
---|
| 316 | include /etc/ldap/schema/cosine.schema |
---|
| 317 | include /etc/ldap/schema/nis.schema |
---|
| 318 | include /etc/ldap/schema/inetorgperson.schema |
---|
| 319 | include /etc/ldap/schema/pykota.schema |
---|
| 320 | </screen> |
---|
| 321 | </para> |
---|
[1168] | 322 | |
---|
[1052] | 323 | <para> |
---|
[1168] | 324 | While this is not mandatory, it is recommended that you setup |
---|
| 325 | some indexes for some often accessed PyKota attributes. |
---|
[1600] | 326 | Here are the minimal indexes |
---|
[1168] | 327 | lines you may want to put in <filename>slapd.conf</filename> : |
---|
| 328 | <screen> |
---|
| 329 | # Indexes for PyKota |
---|
[1600] | 330 | index pykotaUserName pres,eq,sub |
---|
| 331 | index pykotaGroupName pres,eq,sub |
---|
| 332 | index pykotaPrinterName pres,eq,sub |
---|
[2361] | 333 | index pykotaBillingCode pres,eq,sub |
---|
[1168] | 334 | index pykotaLastJobIdent eq |
---|
| 335 | </screen> |
---|
| 336 | </para> |
---|
| 337 | |
---|
| 338 | <para> |
---|
[1600] | 339 | Now you must ensure that the DNs you'll use to bind to |
---|
| 340 | your OpenLDAP server don't have search queries size limits, |
---|
| 341 | which gives for example (OpenLDAP 2.1.x or above) : |
---|
| 342 | |
---|
| 343 | <screen> |
---|
| 344 | # No Limits for PyKota's administrator and read-only user |
---|
| 345 | limits dn="cn=RWadmin,dc=example,dc=com" size.soft=-1 size.hard=soft |
---|
| 346 | limits dn="cn=ROadmin,dc=example,dc=com" size.soft=-1 size.hard=soft |
---|
| 347 | </screen> |
---|
| 348 | |
---|
| 349 | Where RWadmin and ROadmin are the usernames used to bind to your |
---|
| 350 | OpenLDAP server within PyKota, respectively in ReadWrite mode |
---|
| 351 | (as set in pykotadmin.conf) and in ReadOnly mode (as set in pykota.conf). |
---|
| 352 | </para> |
---|
| 353 | |
---|
| 354 | <para> |
---|
[1052] | 355 | Finally, restart the <application>OpenLDAP</application> server : |
---|
| 356 | <screen> |
---|
| 357 | $ /etc/init.d/slapd restart |
---|
| 358 | </screen> |
---|
| 359 | </para> |
---|
| 360 | |
---|
| 361 | <para> |
---|
[1168] | 362 | With an <acronym>LDAP</acronym> backend, PyKota will need some branches |
---|
| 363 | in your <acronym>LDAP</acronym> directory to put its own datas. |
---|
| 364 | You can configure PyKota to either attach its datas to your existing |
---|
| 365 | users and groups, or to put them in their own <literal>ou</literal>. |
---|
| 366 | But some <literal>ou</literal>s dedicated to PyKota are needed in any case, |
---|
| 367 | so the best bet may be to put all PyKota's datas below an <literal>ou=PyKota</literal> |
---|
| 368 | branch. While this will separate these datas from your existing users and groups |
---|
| 369 | entries, this may ease the maintainance. |
---|
| 370 | </para> |
---|
| 371 | |
---|
| 372 | <para> |
---|
| 373 | PyKota needs at least an <literal>ou</literal> for printers, for users quotas, for |
---|
[2361] | 374 | groups quotas, for print jobs, for billing codes, and for pointers to the last job of each printer. |
---|
[1168] | 375 | In the future, this last <literal>ou</literal> may disappear as its content |
---|
| 376 | will probably be attached to each printer. |
---|
| 377 | </para> |
---|
| 378 | |
---|
| 379 | <para> |
---|
| 380 | Actually PyKota doesn't create these <literal>ou</literal>s for you, because it's |
---|
| 381 | difficult to guess what is the best configuration for you. So you have to |
---|
| 382 | create them by yourself, either directly with a text editor and the |
---|
[2115] | 383 | <command>ldapadd</command> command, or with some specialized tool |
---|
| 384 | like <command>gq</command>. You can look at the <filename>initscripts/ldap/pykota-sample.ldif</filename> |
---|
[2126] | 385 | file to see which minimal branches are necessary. |
---|
[1906] | 386 | <note> |
---|
| 387 | <title>Note</title> |
---|
| 388 | <para> |
---|
| 389 | If you use RPM or DEB packages, usually the |
---|
[2126] | 390 | <filename>pykota-sample.ldif</filename> file is installed into the |
---|
[1906] | 391 | <filename>/usr/share/pykota/ldap</filename> directory, along |
---|
| 392 | with a README file. |
---|
| 393 | </para> |
---|
| 394 | </note> |
---|
[1168] | 395 | </para> |
---|
| 396 | |
---|
| 397 | <para> |
---|
[2117] | 398 | If no error occured, then your Quota DataBase is ready to be used. |
---|
| 399 | Now you can let the Quota Storage Server alone, the remaining work |
---|
| 400 | will have to be done on each one of the print servers which will |
---|
| 401 | use this particular Quota Storage Server. |
---|
| 402 | <tip> |
---|
| 403 | <title>Tip</title> |
---|
| 404 | <para> |
---|
| 405 | If an error occured, maybe your OpenLDAP version is too old, or |
---|
| 406 | an unexpected problem (like a bug) happened. Please contact us via email so that we |
---|
| 407 | can try to fix the problem. Thanks in advance. |
---|
| 408 | </para> |
---|
| 409 | </tip> |
---|
[1052] | 410 | </para> |
---|
[856] | 411 | </sect2> |
---|
| 412 | |
---|
| 413 | <sect2> |
---|
[1038] | 414 | <title>MySQL</title> |
---|
[856] | 415 | |
---|
| 416 | <para> |
---|
[1038] | 417 | A <application>MySQL</application> Storage Backend is planned, but it actually |
---|
| 418 | doesn't exist. |
---|
[856] | 419 | </para> |
---|
| 420 | </sect2> |
---|
| 421 | |
---|
| 422 | <sect2> |
---|
| 423 | <title>Berkeley DB</title> |
---|
| 424 | |
---|
| 425 | <para> |
---|
[857] | 426 | A <application>Berkeley DB</application> Storage Backend is planned, but it actually |
---|
| 427 | doesn't exist. It seems that remote storage won't be possible with such a backend, |
---|
| 428 | so in other terms this means that you will have a different quota database on |
---|
| 429 | each print server. This may still prove to be useful for small configurations. |
---|
[856] | 430 | </para> |
---|
| 431 | </sect2> |
---|
| 432 | </sect1> |
---|
| 433 | |
---|
| 434 | <sect1> |
---|
| 435 | <title>Print Server Installation</title> |
---|
| 436 | |
---|
| 437 | <para> |
---|
| 438 | For each Print Server on which you plan to implement the print quota |
---|
| 439 | mechanism, you have, of course, to have an already working printing environment. |
---|
[2478] | 440 | Currently <application>PyKota</application> works with |
---|
[959] | 441 | <ulink url="http://www.cups.org"><application>CUPS</application></ulink> |
---|
[2478] | 442 | but older releases also supported <ulink url="http://lprng.sourceforge.net"><application>LPRng</application></ulink>. |
---|
| 443 | <application>LPRng</application> support might be re-added in the future. |
---|
[856] | 444 | </para> |
---|
| 445 | |
---|
| 446 | <para> |
---|
[959] | 447 | Here's the list of software you have to install on each Print Server, version numbers |
---|
| 448 | are given as an indication of which was successfully tested, but older versions may |
---|
| 449 | work too. |
---|
[862] | 450 | <itemizedlist> |
---|
| 451 | <listitem> |
---|
| 452 | <para> |
---|
[2478] | 453 | <application>CUPS</application> version 1.1.14 or above. |
---|
| 454 | You can download it from <ulink url="http://www.cups.org">http://www.cups.org</ulink> |
---|
[862] | 455 | </para> |
---|
| 456 | </listitem> |
---|
| 457 | <listitem> |
---|
| 458 | <para> |
---|
[2126] | 459 | <application>Python</application> version 2.1 or above. |
---|
[862] | 460 | You can download it from <ulink url="http://www.python.org">http://www.python.org</ulink>. |
---|
[2126] | 461 | While <application>PyKota</application> itself will try to preserve compatibility |
---|
| 462 | with <application>Python</application> version 2.1 for the near future, some <application>Python</application> |
---|
| 463 | modules which are needed by <application>PyKota</application> may mandate the use of a more recent version |
---|
| 464 | of this language. |
---|
[862] | 465 | </para> |
---|
| 466 | </listitem> |
---|
| 467 | <listitem> |
---|
| 468 | <para> |
---|
| 469 | Quota Storage client libraries, depending on your Quota Storage Backend : |
---|
| 470 | <itemizedlist> |
---|
| 471 | <listitem> |
---|
| 472 | <para> |
---|
| 473 | PostgreSQL backend : |
---|
| 474 | <itemizedlist> |
---|
| 475 | <listitem> |
---|
| 476 | <para> |
---|
| 477 | <application>PostgreSQL</application> client libraries. They must match the <application>PostgreSQL</application> |
---|
| 478 | version used on your Quota Storage Server. |
---|
| 479 | </para> |
---|
| 480 | </listitem> |
---|
| 481 | <listitem> |
---|
| 482 | <para> |
---|
| 483 | The <application>PygreSQL</application> python module. |
---|
[1168] | 484 | It must have been compiled against the same |
---|
| 485 | <application>PostgreSQL</application> client libraries. |
---|
| 486 | <application>PygreSQL</application> is normally included in |
---|
| 487 | <application>PostgreSQL</application>, but you may want to |
---|
| 488 | download it from <ulink url="http://www.pygresql.org">http://www.pygresql.org</ulink> |
---|
[862] | 489 | </para> |
---|
| 490 | </listitem> |
---|
| 491 | </itemizedlist> |
---|
| 492 | </para> |
---|
| 493 | </listitem> |
---|
| 494 | <listitem> |
---|
| 495 | <para> |
---|
[1168] | 496 | OpenLDAP backend : |
---|
| 497 | <itemizedlist> |
---|
| 498 | <listitem> |
---|
| 499 | <para> |
---|
| 500 | <application>OpenLDAP</application> client libraries. They must match |
---|
| 501 | the <application>OpenLDAP</application> version used on your Quota Storage Server. |
---|
| 502 | </para> |
---|
| 503 | </listitem> |
---|
| 504 | <listitem> |
---|
| 505 | <para> |
---|
| 506 | The <application>Python-LDAP</application> python module. |
---|
| 507 | It must have been compiled against the same |
---|
| 508 | <application>OpenLDAP</application> client libraries. |
---|
| 509 | You may download this module from <ulink url="http://python-ldap.sourceforge.net">http://python-ldap.sourceforge.net</ulink> |
---|
| 510 | </para> |
---|
| 511 | </listitem> |
---|
| 512 | </itemizedlist> |
---|
[862] | 513 | </para> |
---|
| 514 | </listitem> |
---|
| 515 | <listitem> |
---|
| 516 | <para> |
---|
[2478] | 517 | MySQL backend : Not supported yet. |
---|
[862] | 518 | </para> |
---|
| 519 | </listitem> |
---|
| 520 | <listitem> |
---|
| 521 | <para> |
---|
[2478] | 522 | Berkeley DB backend : Not supported yet. |
---|
[862] | 523 | </para> |
---|
| 524 | </listitem> |
---|
| 525 | </itemizedlist> |
---|
| 526 | </para> |
---|
| 527 | </listitem> |
---|
| 528 | <listitem> |
---|
| 529 | <para> |
---|
| 530 | <application>ucd-snmp</application> or <application>net-snmp</application> tools, version 4.2.5 or above. You only need |
---|
[2115] | 531 | the <command>snmpget</command> command. |
---|
[1168] | 532 | You can download this software from <ulink url="http://www.sourceforge.net/projects/net-snmp/">http://www.sourceforge.net/projects/net-snmp/</ulink>. |
---|
[959] | 533 | You only need this if you plan to query your printers for their internal page counter via SNMP. |
---|
[862] | 534 | </para> |
---|
| 535 | </listitem> |
---|
| 536 | <listitem> |
---|
| 537 | <para> |
---|
[959] | 538 | <application>netatalk</application> version 1.6.1 or above. You only need |
---|
[2115] | 539 | the <command>pap</command> command. |
---|
[1168] | 540 | You can download this software from <ulink url="http://netatalk.sourceforge.net/">http://netatalk.sourceforge.net/</ulink>. |
---|
[959] | 541 | You only need this if you plan to query your printers for their internal page counter via AppleTalk. |
---|
| 542 | </para> |
---|
| 543 | </listitem> |
---|
| 544 | <listitem> |
---|
| 545 | <para> |
---|
| 546 | eGenix' mxDateTime Python module version 2.0.3 or above. It must match your default Python version. |
---|
[862] | 547 | You can download it from <ulink url="http://www.egenix.com">http://www.egenix.com</ulink>. |
---|
| 548 | </para> |
---|
| 549 | </listitem> |
---|
[2117] | 550 | <listitem> |
---|
| 551 | <para> |
---|
| 552 | The Python acccelerator <application>Psyco</application>. It must match your default Python version. |
---|
| 553 | You can download it from <ulink url="http://psyco.sourceforge.net">http://psyco.sourceforge.net</ulink>. |
---|
| 554 | You only need this if you run on the <literal>x86</literal> architecture because |
---|
| 555 | <application>Psyco</application> doesn't yet exist on other architectures. |
---|
| 556 | </para> |
---|
| 557 | </listitem> |
---|
| 558 | <listitem> |
---|
| 559 | <para> |
---|
[2478] | 560 | The <application>pysnmp</application> Python module version 3.4.2, 3.4.3 or 3.4.4 exclusively. |
---|
[2117] | 561 | You can download it from <ulink url="http://pysnmp.sourceforge.net">http://pysnmp.sourceforge.net</ulink>. |
---|
| 562 | </para> |
---|
| 563 | </listitem> |
---|
| 564 | <listitem> |
---|
| 565 | <para> |
---|
| 566 | The <application>JAXML</application> Python module. |
---|
| 567 | You can download it from <ulink url="http://www.librelogiciel.com/software/">http://www.librelogiciel.com/software/</ulink>. |
---|
| 568 | </para> |
---|
| 569 | </listitem> |
---|
| 570 | <listitem> |
---|
| 571 | <para> |
---|
| 572 | The <application>ReportLab</application> Toolkit Python module. |
---|
| 573 | You can download it from <ulink url="http://www.reportlab.org">http://www.reportlab.org</ulink>. |
---|
| 574 | </para> |
---|
| 575 | </listitem> |
---|
| 576 | <listitem> |
---|
| 577 | <para> |
---|
[2126] | 578 | The <application>Python Imaging Library - PIL</application> module. |
---|
| 579 | You can download it from <ulink url="http://www.pythonware.com">http://www.pythonware.com</ulink>. |
---|
| 580 | </para> |
---|
| 581 | </listitem> |
---|
| 582 | <listitem> |
---|
| 583 | <para> |
---|
[2117] | 584 | The <application>PyOSD</application> Python module. |
---|
| 585 | You can download it from <ulink url="http://repose.cx/pyosd/">http://repose.cx/pyosd/</ulink>. |
---|
| 586 | </para> |
---|
| 587 | </listitem> |
---|
[2478] | 588 | <listitem> |
---|
| 589 | <para> |
---|
| 590 | The <application>pkpgcounter</application> Generic Page Description Language parser. |
---|
| 591 | You can download it from <ulink url="http://www.librelogiciel.com/software/">http://www.librelogiciel.com/software/</ulink>. |
---|
| 592 | </para> |
---|
| 593 | </listitem> |
---|
[862] | 594 | </itemizedlist> |
---|
[856] | 595 | </para> |
---|
[1168] | 596 | |
---|
| 597 | <para> |
---|
| 598 | Instead of downloading all these programs' sources and compiling them, which really |
---|
| 599 | is a boring task considering that many software are needed, you may prefer to look |
---|
| 600 | into the packages included with your GNU/Linux distribution of choice (if you use |
---|
| 601 | this operating system of course). Most, if not all, GNU/Linux distributions include |
---|
| 602 | all the software mentionned above, in the form of packages which are easier to |
---|
| 603 | install than sources tarballs. This is probably the same for the many *BSD |
---|
| 604 | distributions. |
---|
| 605 | </para> |
---|
| 606 | |
---|
| 607 | <para> |
---|
[2551] | 608 | You can check that all needed software is installed by launching the <command>checkdeps.py</command> |
---|
[1906] | 609 | command : |
---|
| 610 | <screen> |
---|
| 611 | $ python checkdeps.py |
---|
| 612 | </screen> |
---|
| 613 | </para> |
---|
| 614 | |
---|
| 615 | <para> |
---|
[1168] | 616 | Once all these software are installed, installing PyKota itself is a breeze. |
---|
| 617 | PyKota being written entirely in the Python language, which is interpreted, |
---|
| 618 | there's no need to compile anything. You just have to execute the installation |
---|
| 619 | script : |
---|
| 620 | <screen> |
---|
| 621 | $ python setup.py install |
---|
| 622 | </screen> |
---|
| 623 | </para> |
---|
| 624 | |
---|
| 625 | <para> |
---|
[1906] | 626 | The setup script will automatically create the |
---|
| 627 | <filename>/usr/share/pykota/conf</filename> directory and put the sample |
---|
| 628 | configuration files <filename>conf/pykota.conf.sample</filename> and |
---|
| 629 | <filename>conf/pykotadmin.conf.sample</filename> there, along with |
---|
| 630 | a <filename>README</filename> file explaining their purpose. |
---|
[1168] | 631 | </para> |
---|
[2117] | 632 | |
---|
[1168] | 633 | <para> |
---|
[2117] | 634 | Now you have to create a <literal>pykota</literal> system user and group. The <application>PyKota</application> |
---|
| 635 | software will automatically search its configuration files in user <literal>pykota</literal>'s |
---|
| 636 | home directory. For example we could create the user and group, and set <filename>/etc/pykota</filename> |
---|
| 637 | as the home directory, but any other home directory will do : |
---|
| 638 | <screen> |
---|
| 639 | adduser --system --group --home /etc/pykota --gecos PyKota pykota |
---|
| 640 | </screen> |
---|
| 641 | </para> |
---|
| 642 | |
---|
| 643 | <para> |
---|
| 644 | You now have to copy the sample configuration files into the <filename>~pykota</filename> |
---|
| 645 | directory, under the respective names <filename>pykota.conf</filename> and |
---|
[1168] | 646 | <filename>pykotadmin.conf</filename>. Once copied there, you just |
---|
| 647 | have to modify these files to adapt them to your own setup. |
---|
| 648 | These files are heavily commented, so you should have no problem. |
---|
| 649 | Also their format is quite common, because it's the one used by |
---|
| 650 | <application>Samba</application> for example, or by <literal>.ini</literal> |
---|
| 651 | files under <application>MS-Windows</application>, so you may already |
---|
| 652 | be familiar with this syntax. |
---|
| 653 | In a future release, this documentation will include the complete |
---|
| 654 | reference for all configuration fields available. Keep in mind that |
---|
[2126] | 655 | <application>PyKota</application> can be really heavily customized, and can delegate some work |
---|
[1168] | 656 | to any external command of your choice. |
---|
| 657 | </para> |
---|
| 658 | |
---|
| 659 | <para> |
---|
[2116] | 660 | Please create a backup copy of the <filename>~pykota</filename> |
---|
[1906] | 661 | directory before modifying a working installation. |
---|
[1168] | 662 | </para> |
---|
| 663 | |
---|
| 664 | <para> |
---|
| 665 | PyKota features some interesting possibilities which allow you to |
---|
| 666 | define options either globally so that they apply to all printers, |
---|
| 667 | or on a per printer basis. Please see the sample configuration files |
---|
[2126] | 668 | to see what I mean. In the simplest form, only a <literal>[global]</literal> section is |
---|
[1168] | 669 | needed. In more complex configurations, you will have to create |
---|
| 670 | one section per printer. Each section in the configuration files |
---|
| 671 | begins with a name between square brackets <literal>[]</literal>. |
---|
| 672 | The name to use to define a particular printer section is the name |
---|
| 673 | of the print queue on which you want to set quotas. |
---|
| 674 | </para> |
---|
| 675 | |
---|
| 676 | <para> |
---|
[2126] | 677 | After you have modified <application>PyKota</application>'s configuration files, you have to |
---|
[1168] | 678 | double check their permissions, otherwise your installation may be |
---|
| 679 | insecure or may not work at all. |
---|
[2116] | 680 | The main configuration file <filename>~pykota/pykota.conf</filename> |
---|
[1168] | 681 | doesn't contain much sensitive information, so it can be made |
---|
| 682 | readable by anyone. If normal users read this file, at best they |
---|
| 683 | will learn the username and optional password of the read-only |
---|
[2126] | 684 | database user. This means that beside being allowed to read all the contents of |
---|
| 685 | the quota database, they won't be allowed to modify or delete it. |
---|
[2116] | 686 | On the other hand, the <filename>~pykota/pykotadmin.conf</filename> |
---|
[1168] | 687 | file contains the read-write user's identity and password. You must then |
---|
| 688 | ensure that no normal user can read this file. It should only be readable |
---|
[2117] | 689 | by the <literal>root</literal> user, which is always the case, and by |
---|
[2478] | 690 | <application>PyKota</application> administrators. In addition, |
---|
| 691 | users for which <application>CUPS</application> doesn't run as user <literal>root</literal> will |
---|
[2117] | 692 | have to ensure that the user their printing system is run as |
---|
| 693 | can read both of these files. An easy way to do so is to put the <literal>lp</literal> user |
---|
| 694 | (for example) into the <literal>pykota</literal> system group, then |
---|
| 695 | to give the correct permissions to <application>PyKota</application>'s configuration files : |
---|
[1168] | 696 | <screen> |
---|
[2117] | 697 | $ chown pykota.pykota ~pykota/pykota.conf |
---|
[2116] | 698 | $ chmod 644 ~pykota/pykota.conf |
---|
[2117] | 699 | $ chown pykota.pykota ~pykota/pykotadmin.conf |
---|
[2116] | 700 | $ chmod 640 ~pykota/pykotadmin.conf |
---|
[1168] | 701 | </screen> |
---|
[1783] | 702 | |
---|
| 703 | <warning> |
---|
| 704 | <title>Warning</title> |
---|
| 705 | <para> |
---|
[2116] | 706 | All the users allowed to read the <filename>~pykota/pykotadmin.conf</filename> |
---|
[1783] | 707 | are considered to be <application>PyKota</application> administrators. So be |
---|
| 708 | careful with these files permissions. |
---|
| 709 | </para> |
---|
| 710 | </warning> |
---|
[1168] | 711 | </para> |
---|
| 712 | |
---|
[2126] | 713 | <para> |
---|
[2261] | 714 | On some systems, you may be able to strenghten permissions like this : |
---|
| 715 | <screen> |
---|
| 716 | $ chown pykota.pykota ~pykota/pykota.conf |
---|
| 717 | $ chmod 640 ~pykota/pykota.conf |
---|
| 718 | $ chown pykota.pykota ~pykota/pykotadmin.conf |
---|
| 719 | $ chmod 600 ~pykota/pykotadmin.conf |
---|
| 720 | </screen> |
---|
| 721 | </para> |
---|
| 722 | |
---|
| 723 | <para> |
---|
| 724 | And on other ones, you may need to relax them, and change the files' owner : |
---|
| 725 | <screen> |
---|
| 726 | $ chown lp.pykota ~pykota/pykota.conf |
---|
| 727 | $ chmod 640 ~pykota/pykota.conf |
---|
| 728 | $ chown lp.pykota ~pykota/pykotadmin.conf |
---|
| 729 | $ chmod 640 ~pykota/pykotadmin.conf |
---|
| 730 | </screen> |
---|
| 731 | </para> |
---|
| 732 | |
---|
| 733 | <para> |
---|
| 734 | This all depends on the printing system you are using, and the user the |
---|
| 735 | printing system is usually running as. You need to remember two things : |
---|
| 736 | |
---|
| 737 | <itemizedlist> |
---|
| 738 | <listitem> |
---|
| 739 | <para> |
---|
| 740 | The user your printing system runs as MUST be allowed to read |
---|
| 741 | both <application>PyKota</application>'s configuration files. |
---|
| 742 | </para> |
---|
| 743 | </listitem> |
---|
| 744 | <listitem> |
---|
| 745 | <para> |
---|
| 746 | Any user who can read <filename>pykotadmin.conf</filename> |
---|
| 747 | is a <application>PyKota</application> administrator, and |
---|
| 748 | can do whatever he wants to the print quota database. |
---|
| 749 | </para> |
---|
| 750 | </listitem> |
---|
| 751 | </itemizedlist> |
---|
| 752 | </para> |
---|
| 753 | |
---|
| 754 | <para> |
---|
[2126] | 755 | Don't forget to restart your print server sofware if you changed group membership for the user it runs |
---|
| 756 | as, otherwise your change wouldn't be taken into account. |
---|
| 757 | </para> |
---|
[1783] | 758 | |
---|
[1168] | 759 | <para> |
---|
| 760 | Now depending on your printing system, the configuration to do is particular. |
---|
| 761 | We will now see how to plug PyKota into your printing system. |
---|
| 762 | </para> |
---|
| 763 | |
---|
| 764 | <sect2> |
---|
| 765 | <title>With CUPS</title> |
---|
| 766 | |
---|
| 767 | <para> |
---|
[2126] | 768 | From version 1.16alpha7 on, configuring <application>PyKota</application> to integrate |
---|
| 769 | within <application>CUPS</application> is more than easy. |
---|
[1187] | 770 | </para> |
---|
[1168] | 771 | |
---|
| 772 | <para> |
---|
[2551] | 773 | You just have to create a symbolic link to the <command>cupspykota</command> |
---|
[2126] | 774 | command in <application>CUPS</application>' backend directory : |
---|
[1187] | 775 | <screen> |
---|
| 776 | $ cd /usr/lib/cups/backend |
---|
[1347] | 777 | $ ln -s /usr/share/pykota/cupspykota cupspykota |
---|
[1187] | 778 | </screen> |
---|
[1168] | 779 | </para> |
---|
| 780 | |
---|
| 781 | <para> |
---|
| 782 | You have to restart <application>CUPS</application> for this modification to |
---|
| 783 | take effect : |
---|
| 784 | <screen> |
---|
| 785 | $ /etc/init.d/cupsys restart |
---|
| 786 | </screen> |
---|
| 787 | </para> |
---|
| 788 | |
---|
| 789 | <para> |
---|
[1187] | 790 | Now point your web browser to CUPS configuration page, usually at |
---|
| 791 | <ulink url="http://localhost:631">http://localhost:631</ulink> on |
---|
| 792 | your print server. |
---|
| 793 | </para> |
---|
| 794 | |
---|
| 795 | <para> |
---|
| 796 | Then when creating new printers or reconfiguring existing ones, just |
---|
[1600] | 797 | choose devices which are <literal>PyKota managed</literal> |
---|
| 798 | <footnote> |
---|
| 799 | <para> |
---|
| 800 | Debian 3.0 Woody is known to have problems : CUPS 1.1.14 doesn't automatically |
---|
| 801 | detect <literal>PyKota managed</literal> devices. So you have to manually |
---|
| 802 | modify CUPS' <filename>printers.conf</filename> file as explained in |
---|
| 803 | PyKota's toplevel <filename>README</filename> file. |
---|
| 804 | </para> |
---|
| 805 | </footnote> |
---|
| 806 | instead of |
---|
[1187] | 807 | normal devices. You've got one <literal>PyKota managed</literal> device |
---|
| 808 | for each regular device available from CUPS, so just choose the appropriate |
---|
| 809 | one. |
---|
| 810 | </para> |
---|
| 811 | |
---|
| 812 | <para> |
---|
[1168] | 813 | Repeat the above procedure for each print queue on which you want to use |
---|
| 814 | PyKota. That's all ! |
---|
| 815 | </para> |
---|
| 816 | |
---|
| 817 | <sect3> |
---|
| 818 | <title>Troubleshooting</title> |
---|
| 819 | <para> |
---|
| 820 | In case of problem, the simplest way to solve it is currently |
---|
| 821 | to ask on PyKota's mailing list, describing the symptoms, as |
---|
| 822 | well as the hardware and software you use. |
---|
| 823 | In a future release of this document, a section dedicated to |
---|
| 824 | Frequently Asked Questions will be included. |
---|
| 825 | </para> |
---|
[1187] | 826 | |
---|
| 827 | <para> |
---|
| 828 | You can now also ask us questions on IRC : |
---|
| 829 | <screen> |
---|
| 830 | /server irc.freenode.net |
---|
| 831 | /join #pykota |
---|
| 832 | </screen> |
---|
| 833 | </para> |
---|
[1168] | 834 | </sect3> |
---|
| 835 | |
---|
| 836 | </sect2> |
---|
| 837 | |
---|
[856] | 838 | </sect1> |
---|
[753] | 839 | </chapter> |
---|
| 840 | |
---|