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

According to the URL:

http://www.sun.com/bigadmin/content/submitted/install_cups.html

$ 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://10.1.2.3:9100/
device for Laserjet: http://10.2.1.3:631/printers/HP5200 

Following is the detail from this URL:

Download it from sunfreeware:

ftp://ftp.sunfreeware.com/pub/freeware/companioncd/sparc/9

The file name for cups-x.x.xx-pkg.zip 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 cups-1.1.14-pkg.zip
# 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:

/opt/sfw/cups/bin:/opt/sfw/cups/sbin


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 11.22.33.44:

# lpadmin -p Laserjet -E -v socket://11.22.33.44 -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:

<http://localhost:631> or <http://127.0.0.1:631>

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.


Troubleshooting

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.
#
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值