首页 > Linux操作系统 > Linux操作系统 > How to setup Common Unix Printing Service--CUPS in Solaris

How to setup Common Unix Printing Service--CUPS in Solaris

原创 Linux操作系统 作者:xin2v 时间:2009-03-19 14:27:23 0 删除 编辑

According to the URL:

$ lp -d Laserjet inetd.conf
request id is Laserjet-13 (1 file(s))
$ date
Fri Nov 30 14:16:02 CST 2007
$ lpstat -v
device for HP5200: socket://
device for Laserjet: 

Following is the detail from this URL:

Download it from sunfreeware:

The file name for differs depending on the version of the package. Once you have downloaded the file, unzip the file and install the packages using the pkgadd command. An example follows:

# unzip
# pkgadd -d SFWcups

These packages are installed:

system	SFWcprnt 	cupsprint - CUPS Print Suite Cluster
system	SFWcups		cups - Common UNIX Printing System

The Printing System

CUPS is a complete printing system; therefore, make sure that the Solaris printing system and CUPS are not running at the same time.

Stop the lpd service and rename the file in rc2.d:

# /etc/init.d/lp.stop
# mv /etc/rc2.d/S801p /etc/rc2.d/s801p

Printing Commands

Before you configure the software, make a backup of the Solaris printing commands and link to the CUPS commands, as shown here. The first column includes the Solaris commands, and the second column shows what those commands link to:

/usr/bin/lp 		/opt/sfw/cups/bin/lp
/usr/bin/lpstat 	/opt/sfw/cups/bin/lpstat
/usr/bin/cancel 	/opt/sfw/cups/bin/cancel
/usr/bin/enable 	/opt/sfw/cups/bin/enable
/usr/sbin/lpadmin 	/opt/sfw/cups/sbin/lpadmin
/usr/sbin/lpmove 	/opt/sfw/cups/sbin/lpmove
/usr/sbin/accept 	/opt/sfw/cups/sbin/accept

For example, you might do something like the following to replace the lp command:

# mv /usr/bin/lp /usr/bin/lp.solaris
# ln -s /opt/sfw/cups/bin/lp /usr/bin/lp

Repeat the replacement commands for each command listed above.

To use the CUPS printer admin commands, include the following subdirectories in your path:


Configuring CUPS

The main configuration file for CUPS is: /opt/sfw/cups/etc/cups/cupsd.conf. This file has the same format as many other configuration files, such as those used by the Apache Web server. For CUPS, modify the option relative to the format of the printcap file as follows:

# PrintcapFormat: the format of the printcap file, currently either
# BSD or Solaris. The default is "BSD".
# PrintcapFormat BSD
PrintcapFormat Solaris

Starting CUPS

Copy the start/stop script. and make links to run levels 2 and 1, ensuring that CUPS starts on the next reboot:

# cp /opt/sfw/cups/etc/init.d/cups /etc/init.d
# ln -s /etc/init.d/cups /etc/rc2.d/S99cups
# ln -s /etc/init.d/cups /etc/rc1.d/K99cups


To start the CUPS scheduler, type:

# etc/init.d/cups start

Creating New Printers

Now that CUPS is running, you are able to configure, add, or modify printers using two methods: command line and web interface. Each print queue has a name and a device associated with it. The devices use the Uniform. Resources Identifiers (URI) form. For example, the serial port "a" uses a device URI of serial:/dev/cua/a?baud=115200.

To see a list of supported devices, you can run the following command:

# lpinfo -v

The first word in each line is the type of device (direct, file, network, serial), followed by the device URI.

Finally, printer queues usually have an associated PostScript. Printer Description (PPD) file. These files are used for PostScript. and non-PostScript. printers. CUPS includes PPD files for HP LaserJet, HP DeskJet, Epson, and so on.

To add a printer from the command line, you can use the lpadmin command.

lpadmin -p printer -E -v device -m ppd

Here printer is the name of the printer, device is the path to reach the printer, and ppd is the name of the PostScript. Printer Description file.

For example, you would use this for a networked HP LaserJet printer using a JetDirect network interface at IP address

# lpadmin -p Laserjet -E -v socket:// -m laserjet.ppd

To check, use the lpstat command:

# lpstat -v

To configure, add, or modify printers via the GUI, use a web browser and open the URL:


Select the Do Administration Tasks option.


In the web interface, CUPS provides a user-friendly "wizard" to add a printer. Follow the steps after you click on the Add Printer button.

To test the printer, use the -d option with the lp command to print to a specific printer:

# lp -d printer filename

Or you can select Manage Printers, Print Test Page from the web interface.


To find out what's going wrong, first you should increase the log level. To increase the log level, edit the configuration file /opt/sfw/cups/etc/cups/cupsd.conf and set the LogLevel variable to debug instead of info:

# LogLevel: controls the number of messages logged to the ErrorLog
# file and can be one of the following:
# debug2  	Log everything.
# debug  	Log almost everything.
# info  	Log all requests and state changes.
# warn  	Log errors and warnings.
# error  	Log only errors.
# none  	Log nothing.

来自 “ ITPUB博客 ” ,链接:,如需转载,请注明出处,否则将追究法律责任。

上一篇: ORA-06574
下一篇: 学习笔记之一


  • 博文量
  • 访问量