Multiple instances of cups server
Kurt Pfeifle
kurt.pfeifle at infotec.com
Thu Jul 3 15:04:30 PDT 2008
> Hello everybody!
> I want to start two (or maybe even more) cups servers on one real server. They should be listening on two different ip's (127.0.0.1 and my real ip) and have different printers to manage. Can my goal be reached?
Yes.
I did this for a customer some time ago. Basically, you need two different cupsd.conf files, where cupsd.conf_1 uses
Listen 127.0.0.1:631
Listen /var/run/cups/cups.sock_1
and cupsd.conf_2 uses
Listen 10.162.33.55:631
Listen /var/run/cups/cups.sock_2
(The *.sock* listeners are only for local clients' printing anyway. So in the first one you can even leave away the loopback listener, in case you're sure you don't need it for legacy applications which don't know about or can't handle the unix domain socket listener. In the second one, you can leave away the *.sock* listener too [but the cups commandline tools may then try to use their compiled-in default listener].)
You may want to add security/authorization/authentication stuff like
<Location /printers>
Order Deny,Allow
Deny from all
Allow from 10.162.33.*
Allow from some.domain.com
Require group mygroup
</Location>
to the second cupsd.conf_2 file.
Then, you need to duplicate your original cupsd startup script into two versions so that there is a separate one for each cupsd (or just start them manually like "/usr/sbin/cupsd -c /etc/cups/cupsd.conf_2" and "/usr/sbin/cupsd -c /etc/cups/cupsd.conf_1")
Just make sure that your local CUPS client commands specify which of the two cupsd processes they should connect to. To print to local printers:
CUPS_SERVER=127.0.0.1 lp -d localprinter ... /path/to/printfile
CUPS_SERVER=/var/run/cups/cups.sock_1 lp -d localprinter ...
or
export CUPS_SERVER=127.0.0.1;
lp -d localprinter ... /path/to/printfile
export CUPS_SERVER=/var/run/cups/cups.sock_1;
lp -d localprinter ...
or, to create create local printers:
CUPS_SERVER=127.0.0.1 lpadmin -p localprinter -v [backend] -E [...] -P [ppdfile]
CUPS_SERVER=/var/run/cups/cups.sock_1 lpadmin -p localprinter -v [backend] -E [...] -P [ppdfile]
and to create printers for remote users:
CUPS_SERVER=10.162.33.55 lpadmin -p otherprinter -v [backend] -E [...] -P [ppdfile]
CUPS_SERVER=/var/run/cups/cups.sock_2 lpadmin -p otherprinter -v [backend] -E [...] -P [ppdfile]
More information about the cups
mailing list