root / pykota / trunk / README @ 3413

Revision 3413, 18.9 kB (checked in by jerome, 16 years ago)

Removed unnecessary spaces at EOL.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1# $Id$
2
3PyKota - Print Quotas for CUPS
4
5(c) 2003, 2004, 2005, 2006, 2007, 2008 Jerome Alet <alet@librelogiciel.com>
6This program is free software: you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation, either version 3 of the License, or
9(at your option) any later version.
10
11This program is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
19====================================================================
20
21READ SPECIAL LICENSING AND REDISTRIBUTION TERMS IN THE FILE 'LICENSE'
22
23====================================================================
24
25PyKota features :
26-----------------
27
28        http://www.pykota.com/software/pykota/features/
29
30====================================================================
31
32Planned features are described in the TODO file.
33
34Actually three (or an infinity of) page accounting methods are
35implemented :
36
37  - The 'hardware' method consists in querying the printer (via SNMP
38    or Netatalk or any other method of your choice) for its internal
39    pages counter.
40    This is done both at the beginning and at the end of a
41    print job. The counters difference is then used to
42    decrease the user's account balance or increase his quota usage.
43
44  - The 'software' method consists in delegating the computation of the
45    job's size in number of pages to any external command of your choice.
46    The command can read the job's data from its standard input and MUST
47    output the job's size on its standard output. Changes to the user
48    account are reported immediately. PyKota by default internally
49    uses the code from pkpgcounter which can handle a large number
50    of Page Description Languages, and can parse documents produced
51    either by GhostScript or by a number of native printer drivers.
52    Of course this means you have to install pkpgcounter if you want to
53    use the default PDL parser.
54    An up-to-date list of supported Page Description Languages and their
55    level of support is available from :
56
57      http://www.pykota.com/software/pkpgcounter/
58
59  - The 'ink' method consists in using pkpgcounter's code to compute
60    how much of each page is covered by ink in each color of a particular
61    colorspace chosen between CMYK, CMY, RGB, and BW (grayscale).
62    These values are then summed up together and multiplied by a set
63    of coefficients defined in PyKota's configuration files.
64
65PyKota is known to work with most printers, excepted GDI ones (Windows
66only). At least one of the accounting methods above should work
67for you. If it's not the case, please report the problem : tell us
68the exact brand and model of the printer, if possible the driver used,
69and send some test files.
70
71============================================================
72
73SUPPORT CONTRACTS:
74==================
75
76  You can now purchase 8x5x365@NextBusinessDay Technical
77  Support Contracts from us. The yearly fee is computed with
78  the following formula :
79
80  (100.0 * NbPrintServers) + (2.5 * NbPrinters) + (0.04 * NbUsers) EUROS.
81
82  This fee includes the VAT, and a free subscription to Official
83  PyKota packages.
84
85  Please send an email to alet@librelogiciel.com if you're
86  interested in purchasing such a contract.
87
88  Remember that purchasing a support contract for Free Software like PyKota
89  is a great way to show your appreciation for the work already being done
90  on this project, and will help to improve this software in the future.
91
92============================================================
93
94INSTALLATION:
95=============
96
97NB :
98====
99
100  PyKota's documentation is available as DocBook SGML sources
101  files in the pykota/docs directory. If you obtained an
102  Official package, in the same directory you'll also find
103  the documentation in HTML and PDF formats. Otherwise you
104  have to compile it into HTML or PDF yourself by using
105  the appropriate tools as installed on your system.
106
107  PyKota's collaborative documentation is available from :
108
109    http://www.pykota.com/wiki/
110
111  You may learn more about PyKota, if it fits your own organization,
112  its internal working, and some potential performance drawbacks and
113  how to avoid them, in a document created by Ryan Suarez at :
114
115    http://archive.macosxlabs.org/forum/webcrossing_archive/documentation/Pykota_and_CUPS/Pykota_and_CUPS.html
116
117  You may also find the following document interesting :
118
119    http://es.tldp.org/Tutoriales/doc-openldap-samba-cups-python/
120
121  This document, written in Spanish by Sergio Gonzalez Gonzalez,
122  describes the integration of PyKota into an OpenLDAP + Samba
123  + CUPS installation. Even for people who can't read spanish
124  this document is really interesting, and contains lots of
125  screenshots.
126
127
128Prerequisite :
129--------------
130
131  See :
132
133    http://www.pykota.com/wiki/Dependencies
134
135  for an up-to-date list, or see below (maybe not up-to-date) :
136
137  You need to have the following tools installed on the CUPS Server :
138
139    - CUPS (http://www.cups.org). PyKota v1.27 requires CUPS v1.3.4 or higher.
140    - Python v2.3 or higher (http://www.python.org)
141    - eGenix' mxDateTime Python extension (http://www.egenix.com)
142    - The pkpgcounter command line tool, version 1.56 or higher. This
143      tool is now mandatory for PyKota to work.
144      (http://www.pykota.com/software/pkpgcounter)
145    - The pkipplib Python library (http://www.pykota.com/software/pkipplib)
146    - The JAXML Python module to be able to dump datas in the XML format.
147      (http://www.librelogiciel.com/software/)
148    - The Python-PAM module if you need the pknotify command to be able
149      to check usernames and passwords. (http://www.pangalactic.org/PyPAM)
150    - The Python-SNMP module to query printers for their page counter.
151      (http://pysnmp.sourceforge.net)
152      IMPORTANT : version 3.4.2 or higher is REQUIRED.
153      Versions 2.x won't work. Versions 4.x now work (tested with v4.1.5a).
154    - The Python-OSD module to use the graphical print quota reminder.
155      (http://repose.cx/pyosd/)
156    - SNMP tools (specifically the snmpget command) if you prefer to
157      use your own script to request query printers instead of PyKota's
158      internal SNMP handling facilities, which is not recommanded...
159      (http://www.net-snmp.org)
160    - Netatalk (specifically the pap command) if you plan to
161      request your printer's lifetime page counter via AppleTalk.
162      (http://netatalk.sourceforge.net)
163    - The ReportLab Python module (http://www.reportlab.org) if you want
164      to have PyKota generate nice banners for you.
165    - The Python Imaging Library (aka PIL) module
166      (http://www.pythonware.com/downloads) if you want to have PyKota
167      generate nice banners for you.
168    - PostgreSQL's PygreSQL Python extension and the PostgreSQL client
169      libraries if you plan to use PostgreSQL as the database backend.
170      (http://www.postgresql.org and http://www.pygreql.org)
171 or
172    - python-ldap Python module and the OpenLDAP client libraries
173      if you plan to use an LDAP server as the database backend.
174      (http://www.openldap.org and http://python-ldap.sourceforge.net)
175 or
176    - SQLite v3.2.7 and the SQLite libraries if you plan to use SQLite
177      as the database backend (http://www.sqlite.org). You also need the
178      PySQLite module v2.0.5 or higher (http://www.pysqlite.org)
179 or
180    - The MySQL-python bindings.
181      IMPORTANT: If you are using MySQL 4.1, then MySQL-python must be
182      version 1.2 or greater. Version 1.0 does not work correctly with 4.1.
183
184
185  On Intel i386 architecture, and for performance reasons, it is
186  suggested that you install the Python accelerator Psyco, available from :
187
188      http://psyco.sourceforge.net
189
190  Under Debian :
191
192      $ apt-get install python-psyco
193
194  Other architectures may be supported as well in the future, check
195  this on Psyco's website.
196
197  Installing Psyco is not mandatory, but may really speed the parsing
198  of some print jobs.
199
200  You need to have the following tools installed on the database
201  server :
202
203    - PostgreSQL (http://www.postgresql.org)
204
205  or
206
207    - OpenLDAP, or any other LDAP server (http://www.openldap.org)
208
209  or
210
211    - SQLite, v3.2.7 or higher (http://www.sqlite.org).
212      Beware : with SQLite the database server and the print
213      servers MUST be the very same machine.
214
215  or
216
217    - MySQL 4.1 or higher. 5.x is recommended.
218
219  This list of prerequisite software may change in the future, when
220  PyKota will support more functionnalities you will be given
221  alternatives.
222
223  Of course the Print Server and the database server can be the
224  very same machine if you've got a tiny network, or you can have
225  multiple Print Servers all storing their quotas on the same database
226  server if you've got a bigger network. (NB : with SQLite, the database
227  can't be shared between several print servers)
228
229Hint :
230------
231
232  - The Debian GNU/Linux distribution is to our knowledge the
233    easiest distribution to install PyKota on, because almost all
234    of PyKota dependencies are already included.
235    We recommend you to use Debian's Etch distribution or
236    more recent. PyKota works fine on Sarge, but some additional
237    dependencies are missing in Sarge and have to be installed
238    manually.
239
240Then :
241------
242
243Download the latest PyKota version from the Subversion tree :
244
245    $ svn co http://svn.pykota.com/pykota/trunk pykota
246
247You can now check if the dependencies are correct by typing :
248
249    $ python checkdeps.py
250
251    An availability report for all the software needed by PyKota
252    will be displayed : you'll have to install the missing
253    software if you want PyKota to work correctly.
254
255To install the software, just type :
256
257    $ python setup.py install
258
259You may need to be logged in with sufficient privileges (e.g. root)
260
261If you use Debian or Ubuntu, and want to use PostgreSQL as the
262database backend, just type :
263
264    $ pksetup debian
265
266or :
267
268    $ pksetup ubuntu
269
270and follow the instructions to install PyKota in interactive mode, then
271skip the remaining of the section below.
272
273Otherwise, you have to setup manually :
274
275Create a system user for PyKota :
276
277    $ adduser --system --group --home /etc/pykota --gecos PyKota pykota
278
279Put the user your printing system is run as in the pykota system group :
280
281    $ adduser lp pykota
282
283    NB : on our system, the CUPS printing system runs as system user 'lp'.
284    Please adapt this to your own system.
285
286Go to the initscripts/ subdirectory of PyKota's sources, and choose
287the appropriate storage backend for your configuration. Read carefully
288the associated README file, modify the initialization script to
289change the passwords, or, in the case of the LDAP backend, adapt it
290to your own LDAP DIT, and execute the initialization script
291to create an empty PyKota database. Upgrade scripts may be
292provided as well. NB : if you use PostgreSQL, a good way to
293make PyKota work first time is to modify PostgreSQL's pg_hba.conf
294to allow the 'trust' database connection mode. However once PyKota
295works it is HIGHLY RECOMMENDED TO CHANGE THIS TO A MORE SECURE
296VALUE. Look at the SECURITY document, PyKota's Official documentation
297and PostgreSQL's documentation for details on this subject.
298
299Copy the conf/pykota.conf.sample and  conf/pykotadmin.conf.sample
300sample configuration files to ~pykota/pykota.conf and
301~pykota/pykotadmin.conf
302The installation script usually copies these files into /usr/share/pykota
303
304NB : You can move PyKota's configuration files elsewhere, they will
305be searched first in user pykota's home directory, then in /etc/pykota.
306
307You need to adapt these files to your own needs. Especially you may
308have to create sections named after your own printers, and change
309the administrator's email address which by default is
310root@localhost. Read and try to understand these two very well
311commented files, so that you'll encounter less problems later.
312
313The rest of the installation depends on your printing system :
314
315  - CUPS Printing System :
316
317    Once and for all :
318
319        Modify CUPS' cupsd.conf to make CUPS listen to 127.0.0.1:631
320        INSTEAD OF to an unix domain socket, in addition to any
321        external network interface CUPS might already be listening to.
322
323        Create a symbolic link to the cupspykota backend
324        in CUPS's backend directory :
325
326          $ cd /usr/lib/cups/backend
327          $ ln -s /usr/share/pykota/cupspykota cupspykota
328
329        If you use CUPS v1.2 or higher, please do this as well :
330
331          $ chmod 700 /usr/share/pykota/cupspykota
332
333          This allows the cupspykota backend to support other
334          backends which must be run as user root, like the
335          lpd backend for example.
336
337        Restart CUPS so that the new backend can be detected.
338
339          $ /etc/init.d/cupsys restart
340
341          for example under Debian, or any similar command depending
342          on your operating system of choice.
343
344    For new printers :
345
346        Go to CUPS management interface (http://localhost:631)
347        and choose the appropriate PyKota managed device depending
348        on the type of printer you use. For example, if your
349        printer is waiting on :
350
351            socket://myprinter.example.com:9100
352
353        Then choose :
354
355            cupspykota:socket://myprinter.example.com:9100
356
357        Configure your printer as usual.
358
359        Now double check /etc/pykota/pykota.conf
360
361        You should manually create a section named after the
362        printer you've just added, unless you have set
363        all options globally.
364
365        The new pkturnkey command can help you with correct settings
366        for your printers. To have pkturnkey give you some hints
367        about what to put into pykota.conf for a particular
368        print queue, just use its --doconf command line switch :
369
370          $ pkturnkey --doconf TheNameOfThePrintQueue
371
372        pkturnkey will try to tell you what is the best accounting
373        method for each printer and will print some lines you'll
374        just have to copy&paste in the appropriate sections in
375        /etc/pykota/pykota.conf
376
377        For more informations about what pkturnkey can do for you,
378        see pkturnkey's manual page or use the --help command
379        line switch :
380
381          $ pkturnkey --help | less
382
383        That's all.
384
385    For existing print queues :
386
387        You want to route the print queue through PyKota,
388        and you can do this in several manners.
389
390          $ pkprinters --add --cups TheNameOfThePrintQueue
391
392        or
393
394          if your printer's DeviceURI is something like :
395
396              socket://myprinter.example.com:9100
397
398          then you can do this :
399
400          $ pkprinters --add TheNameOfThePrintQueue
401          $ lpadmin -p TheNameOfThePrintQueue \
402                    -v cupspykota://socket://myprinter.example.com:9100
403
404        Finally, you could do it manually by modifying the
405        the DeviceURI lines in /etc/cups/printers.conf :
406        You would have to preprend 'cupspykota://' in front
407        of what is already on these lines. For example, replace :
408
409            DeviceURI socket://myprinter.example.com:9100
410
411        with :
412
413            DeviceURI cupspykota://socket://myprinter.example.com:9100
414
415        or :
416
417            DeviceURI cupspykota://socket://myprinter.example.com:9100
418
419        Save the file and restart CUPS for the changes to take effect.
420
421        Here too, you may find it interesting to use the pkturnkey command as
422        described above to help with manual configuration of the file
423        /etc/pykota/pykota.conf
424
425Now you can begin to populate the PyKota's database with printers,
426users and groups :
427
428Add printers and users to the quota system and set their quota values :
429
430You can either use pkturnkey, or do the same things manually by
431using the pkprinters, pkusers and edpykota command line tools :
432
433Create printers :
434
435    $ pkprinters --help
436
437    will tell you how to create, manage or delete printers and
438    printers groups.
439
440    $ pkprinters --add --charge 0.05 hp2100
441
442    would add the printer named hp2100 with a price per page
443    of 0.05 unit.
444
445Create users :
446
447    $ pkusers --add --limitby balance --balance 10.0 jerome
448
449    would create user jerome and give him ten credits to spend
450    on any printer.
451
452Finally create print quota entries :
453
454    $ edpykota --add --printer hp2100 john paul george ringo
455
456    This will create print quota entries for The Beatles on
457    printer hp2100. The print quota entry holds the number of
458    pages printed on a particular printer for a particular
459    user, as well as optional page limits to be used instead
460    of balance limits. See pkusers and edpykota's manual
461    pages for details.
462
463Your users now should be able to print but not exceed their
464printing quota.
465
466To see printer quota usage on printer hp2100, you can use :
467
468    $ repykota --printer hp2100
469
470or :
471
472    $ repykota
473
474    which will print quota usage for all users on all printers,
475    along with totals, if you are a PyKota Administator. If you are
476    a regular user, only your own quota report will be produced.
477
478You can also use these commands :
479
480    $ pkusers --list
481    $ edpykota --list
482
483    $ pkusers --list john paul george ringo
484    $ edpykota --list --printer hp2100 john paul george ringo
485
486Quota reports are also available remotely by using the CGI script
487printquota.cgi provided in the cgi-bin/ subdirectory. You can
488also use the CSS stylesheet present in the stylesheets/ subdirectory
489and put it at your web server's DocumentRoot, to benefit from a nicer
490look, especially quota violations will appear in different colors.
491
492For additionnal security concerns, please give a look at the SECURITY
493file which is part of this software.
494
495To diagnose a problem when something doesn't work as expected,
496please read this FAQ entry :
497
498  http://otrs.librelogiciel.com/otrs/public.pl?ID=2
499
500============================================================
501
502Mailing lists :
503---------------
504
505  A mailing list is dedicated to PyKota, you can subscribe to it
506  or consult its archives at :
507
508    http://lists.pykota.com/mailman/listinfo/pykota
509
510  This mailing list is the preferred way to obtain support, because
511  all members can help and can also benefit from the solutions
512  proposed by other members.
513
514  Another mailing list, dedicated to developers, is available from :
515
516    http://lists.pykota.com/mailman/listinfo/pykota-devel
517
518  In this mailing list you can discuss implementation details, bugs,
519  ideas, and so on. All commit messages are also sent to this list.
520
521  Posts by non-members are rejected.
522
523  The mailing lists language is english and only english.
524
525IRC :
526-----
527
528  You can also chat with us :
529
530        /server irc.freenode.net
531        /join #pykota
532
533  Preferred language on this channel is english, but french
534  is also accepted. Try to avoid exposing complex problems
535  in french because english speaking people on the channel
536  wouldn't benefit from the solutions.
537
538  PyKota's main author is known as 'tamere' on IRC.
539
540Bug Tracker :
541-------------
542
543  You can report bugs to our bug tracker on the development website
544  at :
545
546      http://trac.pykota.com
Note: See TracBrowser for help on using the browser.