Linux operating system printer configuration overview (photos)
Developer on Alibaba Coud: Build your first app with APIs, SDKs, and tutorials on the Alibaba Cloud. Read more ＞
Article title: Linux operating system printer configuration Raiders (photos ). Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
I. development roadmap of the Linux printing system
In the Unix world, the PostScript language is mainly used for printing interfaces. All major applications output general-purpose PostScript pages, which are printed by the print system. Printing in the evolution of the Unix world always revolves around the PostScript page description language. This language is developed by Adobe and is a mature programming language used to describe the content of each page of a document. Nowadays, many printers have an embedded PostScript interpreter that uses PostScript to reproduce pages on the printed paper. Currently, all desktop Linux applications have a print option that generates PostScript data to print the entire page of documents. This method is very different from other desktop-oriented operating systems. most Unix systems submit tasks to the queue and want them to be printed correctly. However, there is no uniform way to collect printer information or work status, which seriously affects Linux applications that need to provide print capabilities. In Linux, although PostScript is the de facto standard for generating printed documents, the printer itself does not need to know PostScript, because it requires relatively expensive technology.
In general, especially in low-end printers, PostScript data is translated into the local page description language of the printer. This is done by using a special conversion filter. Generally, a filter is actually a special program that can process input data and output processed data. Currently, Linux printing systems use different filters: conversion filters, I/O processors (responsible for transmitting data to devices), and processing filters (converting document data ). The printing system is based on a Spooler ). It can manage print task queues, while a queue is usually associated with a printer, and the tasks submitted by the user are handled according to the principle of first-in-first-out. When a print task is processed, the data in the task usually passes through a certain number of filters before being delivered to the printer.
The advantage of printing with the PostScript page description language is that it greatly simplifies the design and does not need to install various printer drivers like Windows. But its disadvantage is that many printers (especially low-end printers) cannot parse PostScript output, and the Linux system's solution to this is to call the Ghostscript (http://www.ghostscript.com) package from the printer queue to support your printer. To view the list of printers supported by Ghostscript in your Linux release, enter:
$ Gs -- help
The gs command lists the printers and output devices it supports. The gs command uses the-r option to set the print resolution. Adjust the output result of ghostscript. if the output of gs is not satisfactory, there are some ways: output position and size. The locations, sizes, and visual proportions of images on the page are controlled by the printer driver in ghostscript. if you find that the output is too short, too long, or twice as big, you may want to take a look at the original modules of the driver and adjust any parameters you can think.
The generation of bsd lpd printing system originated from Berkeley's Unix release. bsd lpd is the first printing system for Linux releases (such as Slackware. There are still releases (Debian and Slackware) with this offline print program. The core functions of the BSD printing system are limited to queue tasks. It consists of a background program (lpd) and some configuration files located in the/etc directory. These configuration files contain queue and attribute definitions. There are also a series of basic commands (lpd, lprm, and lpc) used to submit, delete, and process tasks in the corresponding directory ). Bsd lpr is an important part of the BSD printing system because it defines the LPD network protocol, which is used to submit tasks to remote LPD background programs, moreover, it allows Unix workstations to implement a printing server. All network printers now support this protocol. Because of its wide range of use, all other printing systems require at least session with other LPD background programs. The following is an example of how to define a remote queue in the printcap file. In this example, the task will be instantly transmitted to the queue of the remote monitor program and will not be processed on the local machine.
The LPD protocol transmits data in two parts. A control file describing the task is generated and transmitted. The control file contains the source user, file name, and all work-related information. Then the data file is transmitted. the format of the data file depends entirely on the printing language currently in use.
The second widely used and influential BSD-based printing system is LPRng (LPR Next Generation), which actually overwrites the original bsd lpr system, however, the original concepts are retained. The format of the printcap file is retained, but some new attributes are introduced to make the configuration process more flexible. Filter definitions can be independent, and real I/O filters can be defined. You can also write a printcap file in the home directory of the local machine to define your queue. Advantages of the LPRng printing system: 1. the lpr lpc lprm command can be executed without the need for a database environment. 2. the print queue can be automatically redirected. 3. printing can be automatically retained. 4. multiple printers can use the same print queue. 5. clients do not need the SUID root. 6. security check can be greatly improved. 7. You can use the Printconf tool to maintain the configuration file (/etc/printcap ). LPRng also provides printing commands (such as lp and lpstat) that simulate the Unix System V style ). IFHP filters released along with LPRng can be used in queues to automatically convert data formats (such as printing ASC Ⅱ text or images ).
The general Unix Printing System (CUPS) is a relatively new printing system. The CUPS software provides Unix/Linux users with an effective and reliable way to manage printing. It was born to support IPP (internet print protocol). The four main purposes of IPP protocol are: 1. help users find available printers. 2. send a print job. 3. send the printer status information. 4. cancel the print job. It also has LPD, SMB (Server Message blocks, such as printers connected to Microsoft Windows), and JetDirect interfaces. Another standard used by CUPS is the PPD (PostScript Printer Definition) file format, which is another standard used by Adobe for PostScript printers. From the above, we can see that CUPS printing system is the best choice in Linux printing systems. from Red hat Linux 9.0, it replaced LPRng as the Linux printing system installed by default. Linux supports many types of printers, from the vintage dot matrix printer to the latest laser printer. It is very important to understand what printing systems are currently supported by Linux. let's take a look at the printing systems used by mainstream Linux releases. CUPS also uses many filters to transmit data to the printer. Unlike the BSD-type offline program, this is done in a more intelligent way. Below are some filters available in CUPS:
1. backend filter. It can provide endpoints for final data transmission. These filters can be used for InterPort, TCP/IP socket connection, and LPD connection to other endpoints.
2. document conversion filter. This filter is released as a standard configuration for CUPS. It can convert images, ASC Ⅱ text, PDF files, and HP-GL/2 vector documents to PostScript.
3. interface filter. It can convert a document from PostScript to another file format.
Table-1 printing system used by mainstream Linux releases
CUPS is cross-desktop, that is, you can install your printer in GNOME or KDE. CUPS main functions:
Print sends the file to the printer of a specific URI; Validate sets the Print priority.
Creat processes files as print jobs; Cancal cancels print jobs
Pause print job; Resume print job
Purge clear print job
The following describes how to configure a printing system for your Linux system. Use Red Hat Enterprise Linux 4.0. For example.
2. query and install the printer driver
Generally, the CD attached to the general printer we purchased does not contain the Linux driver. if we do not know whether it can be used in Linux. At this point you can view: http://www.linuxprinting.org/site, which contains a lot of information about printing on Linux. Click Printer Listings in the right column of the webpage. Enter the query interface and enter the printer manufacturer and model to query. Generally, four query results are obtained:
1. perfectly (fully supports printing in Linux and supports all printer functions and print resolutions ).
2. mostly (most features support printing in Linux, with some minor defects ).
3. partially (only some functions support printing in Linux, and many functions cannot be implemented. for example, color printers can only print black and white images)
4. paperweight (printing in Linux is not supported at all ). The results of the HP designjet430Cannon query are as follows:
Printer query results
The HP designjet430 query result is: perfectly, which has three penguins. The maximum hardware resolution is 1440*1440 dpi when the image is printed. The suffix of the driver provided by the http://www.linuxprinting.org/website is. the simplest installation method of the PPR file is to use the printer management tool provided by the system. double-click "add printer" to point to the downloaded PPR file when selecting the driver.
3. configure the CUPS printing system
If the system was upgraded from the Red Hat Linux version of the LPRng printing system, CUPS will not be used to replace LPRng during the upgrade process, and LPRng will continue to be used by the system. To use CUPS, stop the original print daemon and start the CUPS service in three steps:
1. stop the original print daemon process:
# Chkconfig? Level 2345 lpd off
2. start the CUPS daemon:
# Chkconfig? Level 2345 cups on
3. switch the printing system and run the following command:
The switch interface is shown in figure-2 (in addition, if you need to restore the LPRng printing system, the above process is reversible.
Figure 2 switch the CUPS and LPRng printing systems
IV. Manage the CUPS printing system:
You can manage the CUPS printing system by editing the/etc/cups. conf (CUPS printer daemon configuration file) and using the Web management interface. The cups. conf configuration file is similar to the complicated/etc/httpd. conf file of Apache. The content of a typical cups. conf configuration file is:
# Printer model
Order Deny, Allow
Deny From All
Allow From 127.0.0.1
Order Deny, Allow
Deny From All
Allow From 127.0.0.1 # Allow Local Configuration
BrowseOrder Deny, Allow
BrowseAllow from @ LOCAL
Listen 127.0.0.1: 631 # printer listening port
In addition to the master configuration file Cups. conf, the directory also contains the classes. conf-CUPS category configuration file, which directs to different print groups. Client. conf-the client configuration file pointing to the default CUPS server. you can specify the encryption requirements. Mine. cons-List filters, images, and text in different file formats. Mine. types-lists the file types that the CUPS printer can process. The configuration file changed by the print. conf-CUPS Web tool. Pstoraster. cons-filter containing the Ghostscript file. GUN processes the PostScript printer in this way. If you feel that the command line File is complex, you can use the Web to manage the CUPS printing system:
1. run the following command to check the RPM Package of the printer:
# Rpm? Qa | grep cups; rpm-qa | grep foo
Cups-libs-1.1.17-13 # CUPS command set
Cups-devel-1.1.17-13 # CUPS development Library
Cups-1.1.17-13 # CUPS main program
Foomatic-2.0.2-15 # A database independent of counterfeit offline printing
Omni-foomatic-0.7.2-4 # Omni database
2. directly connect to the Web control interface of CUPS through a browser: http: // localhost: 631/. for security reasons, enter the account name and password, as shown in figure-3.
Figure-3 Web management page of CUPS printing system
3. Web management table of CUPS printing system
4. add a printer
There are multiple options on this page. Click the first option "Do Administration Tasks" (manage Tasks option). The program will prompt you to log on. the user name must be logged on as root and enter the super user password. To Add a Printer, click "Add Printer". the following information is displayed:
Name: the Name of the printer.
Loaction: specifies the host name of the printer.
Description: brief Description of the printer.
After entering the preceding information, click "Continue. On the following page, ask the printer what type of device is currently used. The only option is Disk File. Therefore, you only need to select "Continue. Then the user needs to provide the device URI. Including: http: // hostname: 631/ipp/port1
Ipp: // hostname/ipp/port1
Ipd: // hostname/queue
After all the above information is filled in, the system will send a message indicating that the printer has been correctly added. After adding the printer correctly, click "Administration" to manage the printer: (see figure-4 ).
Figure-4 printer management Web interface
The operations on this page include testing the printer, starting the printer, and other management tasks. It also displays the print task and printer status.
5. use Redhat Linux's own configuration management tool
Redhat Linux 8.0 and later versions all have built-in configuration management tools that can configure both CUPS and LPRng printing systems. Depending on your system configuration, it will configure an active printing system. To use the printer configuration tool, you must have the root privilege. To start this application, select "main menu"-"system settings"-"print", or type the "redhat-config-printer" command. The command automatically determines whether the program should be run in a graphical X window system or a text-based console based on the environment it runs. The configuration page is shown in figure-5.
Figure-5 use the system configuration tool to add a local printer
If you have not installed the graphic interface, you can add it on the command line and run the following command:
# Redhat-config-printer-tui -- Xadd-local options
-- Device = node: The device node to be used. For example,/dev/lp0.
-- Make = make: IEEE 1284 MANUFACTURER string or the name of the printer manufacturer in the foomatic database (if there is no MANUFACTURER string ).
-- Model = model: the printer MODEL listed in the IEEE 1284 model string or foomatic database (if no model string exists ).
VI. configure and manage network printers
If your local printer cannot be supported by Linux or the printing effect is poor, you can configure a network printer. RHEL 4.0 can be configured with six types of print queues:
1. local connection-directly connect to the printer on the computer through a parallel or USB port.
2. networked CUPS (IPP)-connect to a printer that can enter through a TCP/IP network and use the internet print protocol, also known as IPP (for example, connect to another Red Hat Linux printer running CUPS on the network ). Enter the host name or IP address of the remote machine connected to the printer and the path to the print queue on the remote machine.
3. networked UNIX (LPD)-A printer connected to other UNIX systems that can access through a TCP/IP network (for example, connect to another Red Hat Linux printer running LPD on the network ). You need to add the host name or IP address of the remote machine connected to the printer, and the remote printer queue. The default printer queue is generally lp.
4. networked Windows (SMB)-connect to a printer on another system that shares the printer through the SMB network. The name of the Samba workgroup for which the printer is shared, and the name of the server for which the printer is shared. The name of the shared printer you want to print. This name must be the same as the Samba printer name defined on a remote Windows machine. The password of the user specified in the "user name" field. the name of the user you must log on to access the printer. The user must exist on Windows and have the permission to access the printer. The default username is usually guest (Windows Server) or nobody (Samba Server ).
5. networked Novell (NCP)-connect to printers on other systems using the Novell NetWare network technology. You need to add the host name or IP address of the NCP system connected to the printer. The remote queue of the printer on the NCP system. The username that you need to log on to the printer. The password specified for the above user field.
6. online JetDirect-connects directly to the network printer through HP JetDirect. The host name or IP address of the JetDirect printer. The port on which the JetDirect printer listens to the print job. The default port is 9100.
Manage print jobs
When you send a print job to The printer daemon (for example, printing a text file from Emacs or an image from The GIMP), The print job is added to The print offline queue. The print offline queue is a print job sent to the printer and a list of information about each print request. This information includes printing the request status, the user name for sending the request, the system host name for sending the request, and the job number. To change the printer settings, right-click the printer icon and select "properties ". The printer configuration tool is started. Double-click a configured printer to view the printer, as shown in figure-6.
Figure 6 print the job list
To cancel a job listed in GNOME print manager, select it from the list, and then select edit-cancel document. If an active printer job is printed offline, the printer notification icon may appear in the panel notification area on the desktop panel,
VII. common printer management commands
In Linux, hardware devices are managed as files. Each actual device connected to the Linux system (including a CD drive, display, Nic, display card, scanner, and printer) can be displayed in the file system. In Linux, every device is treated as a file, which is processed like a common file, so that operations on files and devices are as unified as possible. From the user's point of view, the use of devices is the same as that of General files. Linux provides a large number of commands to effectively manage devices. Therefore, the use of printers in Linux is inseparable from the use of system commands. To really understand Linux printing, you must start with the Linux Printing Command. Whether you click a button in the GUI or type a command in the command line, printing is not a very interactive process. The following describes the printing commands.
1. the CUPS printing system commands are shown in Table 4.
Table 4 CUPS printing system commands
2. LPD Printing Command
In Red Hat Linux, CUPS is used by default. However, many old Linux users still prefer to use the line Print Monitoring Program (LPD ). LPD includes four main commands: Line Printer Request (lpr), Line Printer Control (lpc), Line Printer Query (lpq) line Printer Remove, lprm ). The commands of the LPD printing system are shown in Table 5.
Table 5 LPD printing system commands
8. important online materials
To learn more
This article is an English version of an article which is originally in the Chinese language on aliyun.com and is provided for information purposes only. This website makes no representation or warranty of any kind, either expressed or implied, as to the accuracy, completeness ownership or
reliability of the article or any translations thereof. If you have any concerns or complaints relating to the article, please send an email, providing a detailed description of the concern or
complaint, to email@example.com. A staff member will contact you within 5 working days. Once verified, infringing content will be removed immediately.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
and provide relevant evidence. A staff member will contact you within 5 working days.