Setting Up Directly Attached Printers by Using LP Print Service Commands
The following table describes each printer attribute to help you determine the information
that is needed to set up a directly attached printer by using the
lpadmin command.
Printer Definition |
LP Print Command Option |
Description |
Example |
Default Setting |
Required/Optional? |
Printer Name |
-p |
Name of printer |
laser1 |
N/A |
Required to install an
attached or network printer and to add access to a printer |
Print server |
|
Name of print
server |
venus |
Use localhost for Printer Server attribute check box selected by default |
Required to install an attached or network
printer and to add access to a printer — This field is filled
in by the tool |
Description |
-d |
User defined string |
laser printer near breakroom |
N/A |
Optional |
Printer Port |
-v |
Device that the printer is attached to |
/dev/term/a |
/dev/term/a |
Required
to install an attached printer |
Printer Type |
-T |
Type of printer |
unknown |
PostScript |
Required to install an attached printer
or a network printer without PPD files |
File Content Type |
-I |
Content to be printed |
any |
PostScript |
Required to install an
attached printer or a network printer without PPD files |
PPD file name |
-n |
Full path to
the PPD file and file name with .ppd extension. |
path/necprinter.ppd |
N/A |
Optional |
Fault Notification |
-A |
Specifies how to notify
user of errors |
-A mail |
Write to superuser |
Optional |
Default Printer |
-d |
Identifies the default printer |
N/A |
N/A |
Optional |
Banner Page control Menu: |
-o |
Select whether
to print banner page |
-o banner=never |
-o banner=optional |
Optional |
How to Add a New Directly Attached Printer by Using LP Print Service Commands
This procedure describes how to add a new attached printer specifying a PPD
file. The -n option to the lpadmin command enables you to specify a
PPD file when adding a new attached printer or modifying an existing attached
printer. Two examples follow this procedure. The first example shows you how to
add a new attached printer with PPD files. The second example shows you
how to add a new attached printer without PPD files.
- Connect the printer to the system, and turn on the power
to the printer.
Consult the printer vendor's installation documentation for information about the hardware switches and
cabling requirements.
- Collect the information that is required to configure an attached printer with PPD
files.
To determine the PPD file that the printer will use, first define
the printer make, model, and driver.
For overview information about using PPD files when adding a new printer or
modifying an existing printer by using LP print service commands, see What's New in Printing?.
- Define the printer name, port device, file content type, and PPD file that
the printer will use.
When using PPD files, the file content type is typically PostScript.
- Specify the printer name and the port device that the printer will use.
# lpadmin -p printer-name -v /dev/printers/0
The device to use is /dev/printers/0.
You can now use the -s option with the lpadmin command to specify
the print service host name as localhost. For more information, see How to Use LP Print Commands to Add a Print Queue With localhost Specified as the Host Name.
- Specify the interface script that the printer will use.
# lpadmin -p printer-name -m standard_foomatic
- Specify the file content type and the PPD file that the printer will
use.
# lpadmin -p printer-name -I content-type -n /path/ppdfile
The PPD file that you supply is located in the /path directory.
Note - If /path is not a PPD file repository on the system, then a
copy of the PPD file is placed in the user label directory in
the user PPD file repository. For more information, see Administering PPD Files by Using the PPD File Management Utility (Task Map).
- Specify the printer description.
# lpadmin -p printer-name -D "printer-description"
For more information, see the lpadmin(1M) man page.
- (Optional) Add filters to the print server.
# cd /etc/lp/fd
# for filter in *.fd;do
> name=`basename $filter .fd`
> lpfilter -f $ name-F $ filter
> done
- Enable the printer to accept print requests and to print those requests.
# accept printer-name
# enable printer-name
- Verify that the printer is correctly configured.
# lpstat -p printer-name -l
The output of the lpstat command will list the PPD file that you
used.
Example 4-1 Adding a New Directly Attached Printer With PPD Files by Using LP Print Service Commands
This example shows how to add a new attached printer with PPD
files. The -n option to the lpadmin command enables you to add a new
print queue by specifying PPD files. The following information is used as an
example.
The information that you provide might vary from the following:
Printer name: paper
Port device: /dev/printers/0
File content type: postscript
PPD file: /path/Lexmark-Optra_E312-Postscript.ppd.gz
# lpadmin -p paper -v /dev/printers/0 (1)
# lpadmin -p paper -I postscript (2)
# lpadmin -p paper -m standard_footmatic (3)
# lpadmin -p paper -n /path/Lexmark-Optra_E312-Postscript.ppd.gz(4)
# lpadmin -p paper -D "Color printer on third floor, rm 3003" (5)
# cd /etc/lp/fd
# accept paper
destination “paper” now accepting requests
# enable paper (6)
printer “paper” now enabled
# lpstat -p paper (7)
printer paper is idle. enabled since Feb 28 11:21 2004...
Defines the printer name and the port device that the printer will use
Sets the file content types to which the printer can print to directly
Specifies the interface script for utilizing PPD files
Note - This command also copies the PPD file to the user label in the user PPD file repository, if /path is not in an existing PPD file repository on the system.
Specifies the path to the PPD file and the PPD file name
Adds a description for the printer
Accepts print requests for the printer and enables the printer
Verifies that the printer is ready for printing
Example 4-2 Adding a New Directly Attached Printer Without PPD Files by Using LP Print Service Commands
This example shows how to add a new attached printer without PPD
files. The commands in this example must be executed on the print server
where the printer is connected. The following information is used as an example.
The information that you provide might vary from the following:
Printer name: luna
Port device: /dev/term/b
Printer type: PS
File content type: postscript
# chown lp /dev/term/b
# chmod 600 /dev/term/b (1)
# lpadmin -p luna -v /dev/term/b (2)
# lpadmin -p luna -T PS (3)
# lpadmin -p luna -I postscript (4)
# lpadmin -p luna -D "Room 1954 ps" (5)
# cd /etc/lp/fd
# accept luna
destination “luna” now accepting requests
# enable luna (6)
printer “luna” now enabled
# lpstat -p luna (7)
printer luna is idle.enabled since Feb 28 11:21 2003.available
Gives lp ownership and sole access to a port device
Defines the printer name and the port device that the printer will use
Sets the printer type of the printer
Specifies the file content types to which the printer can print directly
Adds a description for the printer
Accepts print requests for the printer and enables the printer
Verifies that the printer is ready for printing
See Also
How to Use LP Print Commands to Add a Print Queue With localhost Specified as the Host Name
This procedure shows how to use LP print commands to add a
local print queue with localhost specified as the host name in the
print system databases. This modification was added to enable print servers to maintain the
same print host name, independent of the machine host name. Note that you can
also modify a print queue by using these commands.
- Become superuser or assume an equivalent role.
Roles contain authorizations and privileged commands. For more information about roles, see Configuring RBAC (Task Map) in System Administration Guide: Security Services.
- Set the print host name to localhost.
# lpadmin -p new-print-queue -s localhost -v device
- Check the entry in the /etc/printers.conf file.
% lpget new-print-queue
new-print-queue:
bsdaddr=abc,new-print-queue,Solaris
If the print queue was created or modified successfully, the output of the
lpget command returns the name of the new or modified print queue.
Example 4-3 Adding a Print Queue by Specifying localhost as the Host Name
This example shows how to add a new print queue, paper, by using
the lpadmin command with the -s option to specify localhost as the host
name.
% su - root
# lpadmin -p paper -s localhost -v /dev/ecpp0
% lpget paper
paper:
bsdaddr=localhost,paper,Solaris
Example 4-4 Adding a Print Queue by Using the Default Behavior of lpadmin to Specify the Host Name
This example shows the default behavior of the lpadmin command for using system
host name, abc, when adding a new print queue.
% su - root
# lpadmin -p newspaper -v /dev/printers/0
% lpget newspaper
fargo:
bsdaddr=abc,newspaper,Solaris
Example 4-5 Modifying a Print Queue to Use the Local Host as the Print Server Name
This example shows how to modify an existing print queue, newspaper, and
specify localhost as the new print server name.
% su - root
# lpadmin -p newspaper -s localhost
# lpget newspaper
newspaper:
bsdaddr=localhost,newspaper,Solaris
See Also
For information about specifying localhost as the print server's host name when adding
or modifying a print queue with Solaris Print Manager, see How to Use Solaris Print Manager to Add a Print Queue With the Local Host Specified as the Host Name.