SolarisInstallManagePrinter

How to install and manage printers under Solaris

This is the proper way to create and manage a printer under Solaris.

Due to time constraints, this is going to be rather short, and to the point.

Please note this is for Solaris 10 only. For Solaris 8 and previous version, see the link at the bottom of this page.

1. Create and install a text-only network printer.

Use the following commands:

root@galactus# lpadmin -p devpr -v /dev/null -D "Dev printer" -m netstandard -o dest=10.215.63.140
root@galactus# /usr/bin/enable devpr
root@galactus# /usr/sbin/accept devpr

The three commands shown above create the network printer named devpr at adress 10.215.63.140.

2. Create and install a Postscript network printer.

Use the following commands:

root@galactus# lpadmin -p devpr -v /dev/null -D "Dev printer" -m netstandard -o dest=10.215.63.140 -T PS -I postscript
root@galactus# /usr/bin/enable devpr
root@galactus# /usr/sbin/accept devpr

As in (1), the three commands shown above create the Postscript network printer named devpr at adress 10.215.63.140.

3. Create and install a printer based on PPD configuration files.

Use the following commands :

root@galactus# lpadmin -p devpr -v /dev/null \
-n /usr/lib/lp/model/ppd/system/foomatic/HP/HP-LaserJet_4000-hpijs.ppd.gz \
-i /usr/lib/lp/model/standard_foomatic  -o dest=10.215.63.140 -D "Dev Printer"
root@galactus# /usr/bin/enable devpr
root@galactus# /usr/sbin/accept devpr

Please note that this creates a printer, based on a PPD printer configuration file. These files can be found, as shown above in the /usr/lib/lp/model/ppd/system/foomatic/ directory on your Sun server.

In the example shown above, the PPD is an HP Laserjet 4000, connected to the network.

4. Check the printer has been correctly created.

Three commands for this:

Use lpstat -a:

root@galactus# lpstat -a
DEV3 accepting requests since Dec 15 18:14 2009
dev3 accepting requests since Dec 15 18:14 2009
PR203 accepting requests since Dec 15 18:14 2009
pr203 accepting requests since Dec 15 18:14 2009
_default accepting requests since Dec 15 18:14 2009
devpr accepting requests since Tue 15 Dec 2009 06:13:34 PM MET

Use lpstat -p <PrinterName>:

root@galactus# lpstat -p devpr
printer devpr is idle. enabled since Tue 15 Dec 2009 06:13:27 PM MET. available.

Use lpstat -l -p <PrinterName>:

root@galactus# lpstat -p -l
printer devpr is idle. enabled since Wed 16 Dec 2009 11:57:30 AM MET. available.
        Form mounted:
        Content types: hplaserjet
        Printer types: unknown
        Description: Dev Printer
        Connection: direct
        Interface: /usr/lib/lp/model/netstandard
        PPD: none
        On fault: write to root once
        After fault: continue
        Users allowed:
                (all)
        Forms allowed:
                (none)
        Banner required
        Character sets:
                (none)
        Default pitch:
        Default page size:
        Default port settings:
        Options: protocol=TCP, dest=10.215.63.140

Here is another example of the same, this time with a printer defined through a PPD file:

root@galactus# lpstat -p devpr -l
printer devpr is idle. enabled since Fri 18 Dec 2009 05:38:39 PM MET. available.
        Form mounted:
        Content types: simple
        Printer types: unknown
        Description: Dev Printer
        Connection: direct
        Interface: /usr/lib/lp/model/standard_foomatic
        PPD: /usr/lib/lp/model/ppd/system/foomatic/HP/HP-LaserJet_4000-hpijs.ppd.gz
        On fault: write to root once
        After fault: continue
        Users allowed:
                (all)
        Forms allowed:
                (none)
        Banner required
        Character sets:
                (none)
        Default pitch:
        Default page size:
        Default port settings:
        Options: dest=10.215.63.140

5. Display job currently on printer.

Use lpq -l -P <PrinterName>:

root@galactus#  /usr/ucb/lpq -l -P devpr
no entries

Another example:

root@galactus# /usr/ucb/lpq -l -P devpr
devpr is ready and printing

oracle: 1st                             [job 9 galactus]
        9-1                                     50160 bytes

sysops: 2nd                             [job 10 galactus]
        10-1                                    3454 bytes

6. Testing the new printer.

Use the lptest command and/or the banner command.

For instance:

bash-3.00$ banner PRINTER TEST | /usr/ucb/lpr -Pdevpr && /usr/ucb/lptest 79 500 | /usr/ucb/lpr -Pdevpr

This will print PRINTER TEST in nice, big letter, followed by 500 lines of all the standard ASCII characters, on a 79 column staggered printing.

7. Removing a job from the printer queue.

Display the pending jobs in the printer queue (see above):

root@galactus#  /usr/ucb/lpq -l -P devpr
devpr is ready and printing

sysops: active                         [job 1 galactus]
        1-1                                     3454 bytes

Use the lprm command, as following:

root@galactus# /usr/ucb/lprm -P devpr sysops
devts-1: cancelled

The command shown above would remove all printing jobs, on printer devpr, started by user sysops.

8. Removing a printer completely.

Very useful when your configuration does not work... :-)

Simply use: lpadmin -x <PrinterName>.

For example:

root@galactus# lpstat -a
DEV3 accepting requests since Dec 18 17:31 2009
dev3 accepting requests since Dec 18 17:31 2009
EMEAGVAPR203 accepting requests since Dec 18 17:31 2009
emeagvapr203 accepting requests since Dec 18 17:31 2009
_default accepting requests since Dec 18 17:31 2009
devpr accepting requests since Dec 18 17:31 2009

root@galactus# lpadmin -x devpr

root@galactus# lpstat -a
DEV3 accepting requests since Dec 18 17:31 2009
dev3 accepting requests since Dec 18 17:31 2009
EMEAGVAPR203 accepting requests since Dec 18 17:31 2009
emeagvapr203 accepting requests since Dec 18 17:31 2009
_default accepting requests since Dec 18 17:31 2009

See Also: