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
Line 
1# $Id$
2
3--- TEST ---
4
5PyKota - Print Quotas for CUPS
6
7(c) 2003, 2004, 2005, 2006, 2007, 2008 Jerome Alet <alet@librelogiciel.com>
8This program is free software: you can redistribute it and/or modify
9it under the terms of the GNU General Public License as published by
10the Free Software Foundation, either version 3 of the License, or
11(at your option) any later version.
12
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.
17
18You should have received a copy of the GNU General Public License
19along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
21====================================================================
22
23READ SPECIAL LICENSING AND REDISTRIBUTION TERMS IN THE FILE 'LICENSE'
24
25====================================================================
26
27PyKota features :
28-----------------
29
30        http://www.pykota.com/software/pykota/features/
31
32====================================================================
33       
34Planned features are described in the TODO file.
35
36Actually three (or an infinity of) page accounting methods are
37implemented :
38
39  - The 'hardware' method consists in querying the printer (via SNMP
40    or Netatalk or any other method of your choice) for its internal
41    pages counter.
42    This is done both at the beginning and at the end of a
43    print job. The counters difference is then used to
44    decrease the user's account balance or increase his quota usage.
45   
46  - The 'software' method consists in delegating the computation of the
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
49    output the job's size on its standard output. Changes to the user
50    account are reported immediately. PyKota by default internally
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.
54    Of course this means you have to install pkpgcounter if you want to
55    use the default PDL parser.
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/
60   
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.
72
73============================================================
74
75SUPPORT CONTRACTS:
76==================
77
78  You can now purchase 8x5x365@NextBusinessDay Technical
79  Support Contracts from us. The yearly fee is computed with 
80  the following formula :
81
82  (100.0 * NbPrintServers) + (2.5 * NbPrinters) + (0.04 * NbUsers) EUROS.
83 
84  This fee includes the VAT, and a free subscription to Official
85  PyKota packages.
86
87  Please send an email to alet@librelogiciel.com if you're
88  interested in purchasing such a contract.   
89
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
94============================================================
95
96INSTALLATION:
97=============
98
99NB :
100====
101
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
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.
108 
109  PyKota's collaborative documentation is available from :
110 
111    http://www.pykota.com/wiki/
112   
113  You may learn more about PyKota, if it fits your own organization,
114  its internal working, and some potential performance drawbacks and
115  how to avoid them, in a document created by Ryan Suarez at :
116 
117    http://archive.macosxlabs.org/forum/webcrossing_archive/documentation/Pykota_and_CUPS/Pykota_and_CUPS.html
118
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 
129 
130Prerequisite :
131--------------
132   
133  See :
134 
135    http://www.pykota.com/wiki/Dependencies
136   
137  for an up-to-date list, or see below (maybe not up-to-date) :
138 
139  You need to have the following tools installed on the CUPS Server :
140 
141    - CUPS (http://www.cups.org). PyKota v1.27 requires CUPS v1.3.4 or higher.
142    - Python v2.3 or higher (http://www.python.org)
143    - eGenix' mxDateTime Python extension (http://www.egenix.com)
144    - The pkpgcounter command line tool, version 1.56 or higher. This
145      tool is now mandatory for PyKota to work.
146      (http://www.pykota.com/software/pkpgcounter)
147    - The pkipplib Python library (http://www.pykota.com/software/pkipplib) 
148    - The JAXML Python module to be able to dump datas in the XML format.
149      (http://www.librelogiciel.com/software/)
150    - The Python-PAM module if you need the pknotify command to be able 
151      to check usernames and passwords. (http://www.pangalactic.org/PyPAM)
152    - The Python-SNMP module to query printers for their page counter.
153      (http://pysnmp.sourceforge.net)
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).
156    - The Python-OSD module to use the graphical print quota reminder.
157      (http://repose.cx/pyosd/)
158    - SNMP tools (specifically the snmpget command) if you prefer to
159      use your own script to request query printers instead of PyKota's
160      internal SNMP handling facilities, which is not recommanded...
161      (http://www.net-snmp.org)
162    - Netatalk (specifically the pap command) if you plan to
163      request your printer's lifetime page counter via AppleTalk.
164      (http://netatalk.sourceforge.net)
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.
170    - PostgreSQL's PygreSQL Python extension and the PostgreSQL client
171      libraries if you plan to use PostgreSQL as the database backend.
172      (http://www.postgresql.org and http://www.pygreql.org)
173 or     
174    - python-ldap Python module and the OpenLDAP client libraries 
175      if you plan to use an LDAP server as the database backend.
176      (http://www.openldap.org and http://python-ldap.sourceforge.net)
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)
181 or
182    - The MySQL-python bindings.
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.
185     
186   
187  On Intel i386 architecture, and for performance reasons, it is
188  strongly suggested that you install the Python accelerator Psyco,
189  available at :
190 
191      http://psyco.sourceforge.net
192     
193  Under Debian :   
194 
195      $ apt-get install python-psyco
196     
197  Other architectures may be supported as well in the future, check   
198  this on Psyco's website.
199 
200  Installing Psyco is not mandatory, but it will speedup PCL5 parsing
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
203  is already optimal. For PCL5 this is a completely different matter,
204  and if you install Psyco you will never regret it !
205  Same remark applies for PCL6 (aka PCLXL) : the parser is completely
206  different, but the performance gain with Psyco is impressive.
207 
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   
215  You need to have the following tools installed on the database
216  server :
217 
218    - PostgreSQL (http://www.postgresql.org)
219   
220  or 
221 
222    - OpenLDAP, or any other LDAP server (http://www.openldap.org)
223   
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.
229     
230  or     
231 
232    - MySQL 4.1 or higher. 5.x is recommended.
233   
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 
238  Of course the Print Server and the database server can be the
239  very same machine if you've got a tiny network, or you can have
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)
243 
244Hint : 
245------
246
247  - The Debian GNU/Linux distribution is to our knowledge the
248    easiest distribution to install PyKota on, because almost all
249    of PyKota dependencies are already included, excepted
250    the pkpgcounter utility which for now have to be downloaded
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.
257
258Then :   
259------
260 
261Download the latest PyKota version from the Subversion tree :
262
263    $ svn co svn://svn.librelogiciel.com/pykota/trunk pykota
264
265You can now check if the dependencies are correct by typing :
266
267    $ python checkdeps.py
268   
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   
273To install the software, just type :
274
275    $ python setup.py install
276
277You may need to be logged in with sufficient privileges (e.g. root)
278
279If you use Debian or Ubuntu, and want to use PostgreSQL as the
280database backend, just type :
281
282    $ pksetup debian
283   
284or :   
285
286    $ pksetup ubuntu
287   
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
293Create a system user for PyKota :
294
295    $ adduser --system --group --home /etc/pykota --gecos PyKota pykota
296   
297Put the user your printing system is run as in the pykota system group :
298
299    $ adduser lp pykota
300   
301    NB : on our system, the CUPS printing system runs as system user 'lp'.
302    Please adapt this to your own system.
303
304Go to the initscripts/ subdirectory of PyKota's sources, and choose
305the appropriate storage backend for your configuration. Read carefully
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
309to create an empty PyKota database. Upgrade scripts may be
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
314VALUE. Look at the SECURITY document, PyKota's Official documentation
315and PostgreSQL's documentation for details on this subject.
316
317Copy the conf/pykota.conf.sample and  conf/pykotadmin.conf.sample
318sample configuration files to ~pykota/pykota.conf and
319~pykota/pykotadmin.conf 
320The installation script usually copies these files into /usr/share/pykota
321
322NB : You can move PyKota's configuration files elsewhere, they will
323be searched first in user pykota's home directory, then in /etc/pykota.
324
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
331The rest of the installation depends on your printing system :
332
333  - CUPS Printing System :
334 
335    Once and for all :
336   
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       
341        Create a symbolic link to the cupspykota backend
342        in CUPS's backend directory :
343       
344          $ cd /usr/lib/cups/backend
345          $ ln -s /usr/share/pykota/cupspykota cupspykota
346         
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         
355        Restart CUPS so that the new backend can be detected.
356       
357          $ /etc/init.d/cupsys restart
358         
359          for example under Debian, or any similar command depending
360          on your operating system of choice.
361         
362    For new printers :
363   
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       
369            socket://myprinter.example.com:9100
370           
371        Then choose :   
372       
373            cupspykota:socket://myprinter.example.com:9100
374           
375        Configure your printer as usual.   
376       
377        Now double check /etc/pykota/pykota.conf
378       
379        You should manually create a section named after the
380        printer you've just added, unless you have set
381        all options globally.
382       
383        The new pkturnkey command can help you with correct settings
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 :
387       
388          $ pkturnkey --doconf TheNameOfThePrintQueue
389       
390        pkturnkey will try to tell you what is the best accounting
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       
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       
401        That's all.
402   
403    For existing print queues :
404   
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 :
426   
427            DeviceURI socket://myprinter.example.com:9100
428       
429        with :   
430   
431            DeviceURI cupspykota://socket://myprinter.example.com:9100
432           
433        or :   
434       
435            DeviceURI cupspykota://socket://myprinter.example.com:9100
436       
437        Save the file and restart CUPS for the changes to take effect.
438       
439        Here too, you may find it interesting to use the pkturnkey command as
440        described above to help with manual configuration of the file
441        /etc/pykota/pykota.conf
442
443Now you can begin to populate the PyKota's database with printers,
444users and groups :
445 
446Add printers and users to the quota system and set their quota values :
447
448You can either use pkturnkey, or do the same things manually by
449using the pkprinters, pkusers and edpykota command line tools :
450
451Create printers :
452
453    $ pkprinters --help
454   
455    will tell you how to create, manage or delete printers and
456    printers groups.
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.
462
463Create users :
464
465    $ pkusers --add --limitby balance --balance 10.0 jerome
466   
467    would create user jerome and give him ten credits to spend
468    on any printer.
469   
470Finally create print quota entries :
471
472    $ edpykota --add --printer hp2100 john paul george ringo
473       
474    This will create print quota entries for The Beatles on   
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   
481Your users now should be able to print but not exceed their
482printing quota.
483
484To see printer quota usage on printer hp2100, you can use :
485
486    $ repykota --printer hp2100
487   
488or :
489
490    $ repykota
491   
492    which will print quota usage for all users on all printers,
493    along with totals, if you are a PyKota Administator. If you are
494    a regular user, only your own quota report will be produced.
495   
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   
504Quota reports are also available remotely by using the CGI script
505printquota.cgi provided in the cgi-bin/ subdirectory. You can
506also use the CSS stylesheet present in the stylesheets/ subdirectory
507and put it at your web server's DocumentRoot, to benefit from a nicer
508look, especially quota violations will appear in different colors.
509
510For additionnal security concerns, please give a look at the SECURITY
511file which is part of this software.
512
513To diagnose a problem when something doesn't work as expected,
514please read this FAQ entry :
515
516  http://otrs.librelogiciel.com/otrs/public.pl?ID=2
517           
518============================================================
519
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
527    a web based database independant administrative GUI,
528    written in PHP.
529 
530      http://opensource.psu.ac.th/~kanakorn/mambo/
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.
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.
545 
546Additionnal software will be listed here when they will be 
547ready.
548
549============================================================
550
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   
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   
567IRC :   
568-----
569
570  You can also chat with us :
571 
572        /server irc.freenode.net
573        /join #pykota
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.
581   
582============================================================
583   
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.