root / pykota / trunk / README @ 3571

Revision 3571, 18.5 kB (checked in by jerome, 11 years ago)

Removed references to psyco

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