Personal tools
You are here: Home WiKi Install Pykota on Ubuntu 10.04
Document Actions

Install Pykota on Ubuntu 10.04

by Peter Peroša last modified 2012-02-02 19:36

How to install Pykota on Ubuntu 10.04 x86 and x64*

*python-psyco, a package required for Pykota to work faster, is not available for the amd64 platform,
however "with recent machines I don't even think it's necessary." (http://permalink.gmane.org/gmane.comp.printing.pykota.user/6292)

####################################################################################

Introduction:

The dollar sign ($) at the beginning of a line, means that you are logged in as a normal user.
The pound sign (#) at the beginning of a line, means that you are logged in as a super user.

I am using "gedit" as the default file editor, but you are free to use any editor.
(e.g. kate, mousepad, nano, vim ...)

The ampersand (&) sign at the end of a command lets you run one or more tasks in the background,
so you can still use the terminal after launching for example gedit.
It's practical, but not necessary. You can omit it.

####################################################################################

1. Change to root :
$ sudo su

2. Put your system up-to-date :
# apt-get update; apt-get -y dist-upgrade

3. Install dependencies:
# apt-get install wget bzip2 subversion postgresql postgresql-client pkpgcounter cupsys cupsys-client python-dev python-jaxml python-reportlab python-reportlab-accel python-pygresql python-osd python-egenix-mxdatetime python-imaging python-pysnmp4 python-chardet python-pam

3a. Install python psyco (only for x86 users, x64 users should skip this step):
# apt-get install python-psyco

4. Download and install pkipplib (a dependencie not available in the repository) :
# cd /tmp
# wget "http://www.pykota.com/software/pkipplib/download/tarballs/pkipplib-0.07.tar.gz"
# tar -zxf pkipplib-0.07.tar.gz && cd pkipplib-0.07 && python setup.py install

5. Download PyKota 1.26_fixes (latest stable, but unofficial) and subpackages :
# cd /tmp
# svn export http://svn.pykota.com/pykota/branches/1.26_fixes pykota
# cd /tmp/pykota

6. Check for any left dependencies and install :
(We are using postgresql as database, so we do not need to satisfy the dependencies for other databases.)
(x64 users - do not worry about the missing python-psyco)
# python checkdeps.py
# python setup.py install

7. Create PyKota's database in PostgreSQL :
# su - postgres -c "psql -f /usr/local/share/pykota/postgresql/pykota-postgresql.sql template1"

8. Make PyKota known to CUPS :
# cp /usr/local/share/pykota/cupspykota /usr/lib/cups/backend/cupspykota

9. Restart CUPS for the changes to take effect :
# /etc/init.d/cups restart

10. Create a system user named 'pykota' :
# adduser --system --group --home /etc/pykota --gecos PyKota pykota

11. Copy PyKota's default main configuration file to the proper place :
# cp /usr/local/share/pykota/conf/pykota.conf.sample /etc/pykota/pykota.conf

12. Copy PyKota's default administrators configuration file to the proper place :
# cp /usr/local/share/pykota/conf/pykotadmin.conf.sample /etc/pykota/pykotadmin.conf

13. Change permissions on PyKota's main configuration file :
# chmod 644 /etc/pykota/pykota.conf

14. Change permissions on PyKota's administrators configuration file :
# chmod 640 /etc/pykota/pykotadmin.conf

15. Change ownership of PyKota's configuration files :
# chown pykota.pykota /etc/pykota/pykota.conf /etc/pykota/pykotadmin.conf


####################################################################################

In order to have the official and stable version of Pykota, you must donate at least 25 EUR
(http://www.pykota.com/purchase).
After the donation, you are given a username and password that enable you to download the tarballs.
To install the official Pykota, replace the 5th step from the above tutorial with the following :

5a. Download the latest stable PyKota :
Visit the following link with a browser, login and download the file :
http://www.pykota.com/software/pykota/download/tarballs/pykota-1.26_fixes_official.tar.gz

5b. Change to normal-user :
# exit

5c. Move the downloaded file to /tmp :
$ mv ~/Downloads/pykota-1.26_fixes_official.tar.gz /tmp

5d. Extract the previously downloaded and moved Pykota :
$ cd /tmp
$ tar -zxf pykota-1.26_fixes_official.tar.gz
$ cd /tmp/pykota-1.26_fixes_official

5e. Change back to root :
$ sudo su

####################################################################################

If you want to install the latest (developing) version of Pykota, replace the 5th step
from the above tutorial with the following :

5. Download PyKota and subpackages :
# cd /tmp
# svn co http://svn.pykota.com/pykota/trunk pykota
# cd /tmp/pykota

####################################################################################

Now Pykota is installed.

To test it try:
# pkusers

it should return something like (without ERRORS) :

In the latest svn version:
"Extracting datas...
/usr/local/bin/pkusers : There's no user matching *"

In the latest stable version:
"pkusers v1.26_fixes_official (c) 2003, 2004, 2005, 2006, 2007 Jerome Alet - alet@librelogiciel.com

An Users and Groups Manager for PyKota..."


Please edit PyKota's main and administrators configuration files to suit your needs:
# gedit /etc/pykota/pykota.conf &
# gedit /etc/pykota/pykotadmin.conf &


####################################################################################

Hints:

You can tighten up or loose the rules to access the database by editing pg_hba.conf :
# gedit /etc/postgresql/8.4/main/pg_hba.conf &

To enable database connections from other places than 127.0.0.1 edit the "listen_addresses" line from postgresql.conf :
# gedit /etc/postgresql/8.4/main/postgresql.conf &

####################################################################################

Editing pykota.conf

The file pykota.conf needs special attention because is the main configuration file.
Also take note that the paths in the file may not be right.

>To enhance the compatibility with ubuntu 10.04 do a search and replace all :

/usr/bin/

with

/usr/local/bin/



>Mine setting usualy include :

debug : No

overwrite_jobticket : /usr/local/bin/pknotify --destination $PYKOTAJOBORIGINATINGHOSTNAME:7654 --timeout 60 --denyafter 3 --checkauth --ask "Username:username:$PYKOTAUSERNAME" "Password:password:"

askconfirmation : /usr/local/bin/pknotify --destination $PYKOTAJOBORIGINATINGHOSTNAME:7654 --timeout 60 --confirm "Hello $PYKOTAUSERNAME.\nYour print job send to printer $PYKOTAPRINTERNAME is $PYKOTAPRECOMPUTEDJOBSIZE pages long\nand will cost you $PYKOTAPRECOMPUTEDJOBPRICE credits.\n\nYou currently have $PYKOTABALANCE credits.\n\nDo you really want to print ?"

policy: external(/usr/local/bin/autopykota --initbalance 50.0)

denyduplicates : /usr/local/bin/pknotify --destination $PYKOTAJOBORIGINATINGHOSTNAME:7654 --timeout 180 -c "Are you sure you want to print multiple copies of the same document?"



Hint:
Changes are valid right after saving the changed file. You do not need to restart CUPS.

####################################################################################

Using some PyKota CGI web scripts

>Install Apache :
# apt-get install apache2

>Copy PyKota's cgi-bin files to the proper place :
# mkdir /usr/lib/cgi-bin/pykota/
# cp /usr/local/share/pykota/cgi-bin/* /usr/lib/cgi-bin/pykota/
# cp /usr/local/share/pykota/stylesheets/pykota.css /var/www/

>Prevent users from checking each others quotas :
# apt-get install pwauth
# ln -s /etc/apache2/mods-available/authnz_external.load /etc/apache2/mods-enabled/

>Open /etc/apache2/sites-enabled/000-default file in an editor :
# gedit /etc/apache2/sites-enabled/000-default &

>Insert the following after the <Directory "/usr/lib/cgi-bin"> ... </Directory> group :

<Directory "/usr/lib/cgi-bin/pykota">
AllowOverride None
Options +ExecCGI -Multiviews +SymlinksIfOwnerMatch
Order allow,deny
AuthType Basic
AuthName "Restricted Server"
AuthBasicProvider external
AuthExternal pwauth
Require valid-user
Allow from all
</Directory>

AddExternalAuth pwauth /usr/sbin/pwauth
SetExternalAuthMethod pwauth pipe

>Restart CUPS for the changes to take effect :
# /etc/init.d/apache2 restart

>Now you can access them through the webserver http://machine_ip/cgi-bin/pykota/name_of_the_cgi).
The available cgi-bins are :

http://machine_ip/cgi-bin/pykota/pykotme.cgi
http://machine_ip/cgi-bin/pykota/printquota.cgi
http://machine_ip/cgi-bin/pykota/dumpykota.cgi

####################################################################################

How to add printers to Pykota?

>The first step is to install the printers as usual :
("System -> Administrator-> Printing -> Add..." or visit http://localhost:631/ in your browser)

>After you have successfully installed all the printers run :
# pkturnkey --doconf

it should return something like :

INFO: Please be patient...
INFO: Don't worry, the database WILL NOT BE MODIFIED.
INFO: Extracting all print queues.
INFO: pkprinters --arguments /tmp/pkprinters.args
INFO: Simulation terminated.

--- CUT ---
# Here are some lines that we suggest you add at the end
# of the pykota.conf file. These lines gives possible
# values for the way print jobs' size will be computed.
# NB : it is possible that a manual configuration gives
# better results for you. As always, your mileage may vary.
#
[FS-2000D]
preaccounter : software()
accounter : hardware(snmp)

--- CUT ---

>Now you have to edit PyKota's main configuration file and attach the lines about your printers at the end :
# gedit /etc/pykota/pykota.conf &

Acording to the previous "pkturnkey --doconf" output, I will attach the folowing :

[FS-2000D]
preaccounter : software()
accounter : hardware(snmp)

>To manage printers from cups with PyKota you need to edit the /etc/cups/printers.conf file and add "cupspykota://" before every DeviceURI found there.
# gedit /etc/cups/printers.conf &

DeviceURI lpd://10.0.0.15/ps
becomes
DeviceURI cupspykota://lpd://10.0.0.15/ps

>Restart CUPS for the changes to take effect :
# /etc/init.d/cups restart

>Add the printer to the pykota database :
# pkprinters --add --cups -D "Printer description" --charge 1 "FS-2000D"

This would add your printer named "FS-2000D" with the description "Printer description" to Pykota and charge anyone using it 1 credit per page.

>Check printers status :
# pkprinters -l

FS-2000D [Printer description] (0.0 + #*1.0)
Passthrough mode : OFF
Maximum job size : Unlimited
Routed through PyKota : YES

####################################################################################

Installing Pykoticon on Ubuntu 10.04 desktop (the machines people print from) :

>Install dependencies :
# apt-get install python-wxgtk2.8

>Install pykoticon from the latest svn :
$ apt-get install subversion
$ cd /tmp
$ svn co http://svn.pykota.com/pykoticon/trunk pykoticon
$ cd pykoticon
$ sudo python setup.py install

>Install pykoticon from the tarball :
Visit the following link with a browser, login and download the file :
http://www.pykota.com/software/pykoticon/download/tarballs/pykoticon-1.02.tar.gz

Extract the tarball and install PykotIcon :
$ cd ~/Downloads/
$ tar -zxf pykoticon-1.02.tar.gz
$ cd /tmp/pykoticon-1.02
$ cd pykoticon-1.02
$ sudo python setup.py install

>Fix some paths :
# mkdir /usr/share/pykoticon
# cp /usr/local/share/pykoticon/* /usr/share/pykoticon/

>Autostart Pykoticon at user-login :
We have to wait "gnome-panel" to load before starting pykoticon, otherwise it does not work properly.
To do this we will write a script.

# gksu gedit /usr/local/bin/pkicon

Paste the following in the editor (without the "CUT" lines)

--- CUT ---
#!/bin/bash
i="0"
while [ $i -lt 1 ]
do
if [ -z "$/pgrep gnome-panel)" ]
then
echo "gnome-panel not yet started"
else
sleep 5
pykoticon $1
i=$[$i+1]
fi
done
--- CUT ---

>Now make the script executable :
# sudo chmod a+x /usr/local/bin/pkicon

>Add the script to the Ubuntu startup list :
System -> Preferences -> Startup Applications
Click on "Add"

Name: PykotIcon
Command: pkicon IP_of_pykota
Comment: Generic dialog box manager

Click on "Add" and you are done.


PS: replace "IP_of_pykota" with the IP of the box hosting Pykota. You can have multiple IPs, but have to put them in quotation marks.
e.g. pkicon "10.0.0.10 192.168.1.1"


Hint :
You can change the icons of the program by replacing the following 2 files:
/usr/share/pykoticon/pykoticon-green.ico
/usr/share/pykoticon/pykoticon-red.ico

I edited the default Ubuntu-One icons in Ubuntu and added a $ in the cloud.
You can download them from here http://www.multiupload.com/N2LJD959M3

####################################################################################

Pykota documentation:

PyKota's reference documentation is http://www.pykota.com/wiki/
PyKota's offline documentation is included in SGML source form (DocBook DTD) in all releases of PyKota. You can compile it into other formats using the appropriate commands.
PDF and HTML versions are only included in OfficialPackages.
There's an online FAQ available as well - http://otrs.librelogiciel.com/otrs/faq.pl

####################################################################################

The tutorial was made with the help
of the original pykota installer for ubuntu ("python setup.py ubuntu" in the 6th step of the installation)
this post by the user "guardiola" on the Zentyal forum: http://forum.zentyal.org/index.php?topic=481.0
and the post about setting up mod_auth_pam by the user "fhendrik" on the UbuntuForums: http://ubuntuforums.org/showpost.php?p=9110715&postcount=3

Client Desktop Notifications

Posted by Alberto Matus at 2013-01-24 01:51
Hi,

First of all, Excellent Tutorial! I've managed to setup a test server with client. So far I've managed to limit users, which is exactly what I need when speaking of a college of roughly to 2000 students. My question is rather simple and perhaps trivial, does the client desktop notify the user on their limits?

I have gotten a dollar sign icon to my far right corner on the panel, but no messages about balances etc. Warnings. Is the client side tutorial all that needs to be done? Or is there more to it?

It's my first try with pykota. Any help appreciated.

Many Thanks!

Powered by Plone CMS, the Open Source Content Management System

This site conforms to the following standards: