root / pykota / trunk / README @ 3375

Revision 3375, 21.2 kB (checked in by jerome, 16 years ago)

Another test of the new subversion repository...
(please ignore)

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