Kali Linux Printer Setup: Difference between revisions

From WikiMLT
Spas (talk | contribs)
Стадий: 1 [Фаза:Идентифициране, Статус:Създаване]; Категория:Linux Desktop; { The page is created via DevStage }
 
Spas (talk | contribs)
m Text replacement - "mlw-continue" to "code-continue"
 
(12 intermediate revisions by the same user not shown)
Line 1: Line 1:
<noinclude><!--[[Category:Linux_Desktop|?]]-->{{ContentArticleHeader/Linux_Desktop}}</noinclude>
<noinclude><!--[[Category:Linux_Desktop|?]]-->{{ContentArticleHeader/Linux_Desktop}}</noinclude>
In my case I was in need to setup my [https://support.hp.com/us-en/document/c00310427 HP 1022 printer] to work with Kali Linux. After the following setup it works great. In this guide are used the tools <code>cups</code>, <code>cups-client</code> and <code>foomatic-db</code>, which are not installed and enabled by default in Kali Linux.
[https://openprinting.github.io/cups/ CUPS] provides the System V ("lp") and Berkeley ("lpr") command-line interfaces, a configurable web interface, a C API, and common print filters, drivers, and backends for printing. The [https://github.com/openprinting/cups-filters cups-filters] project provides additional filters and drivers.
[https://github.com/OpenPrinting/foomatic-db Foomatic Database] is a collected knowledge about printers, drivers, and driver options in XML files, used by foomatic-db-engine to generate PPD files.
== Install the required Packages and Deal with the Permissions ==
Install the requited packages.<syntaxhighlight lang="shell" line="1">
sudo apt update
sudo apt install cups cups-client "foomatic-db"
</syntaxhighlight>The users will be added to the <code>lpadmin</code> group automatically after installing the above packages, but we will do that manually  just in case.<syntaxhighlight lang="shell" line="1">
sudo adduser root lpadmin
sudo adduser $USER lpadmin
</syntaxhighlight>Enable and start CUPS service.<syntaxhighlight lang="shell" line="1">
sudo systemctl enable --now cups.socket
sudo systemctl enable --now cups.service
</syntaxhighlight>Restart CUPS and Samba services.<syntaxhighlight lang="shell" line="1">
sudo systemctl restart cups.service
sudo systemctl restart smbd.service
</syntaxhighlight>
== Find USB Printer ==
<syntaxhighlight lang="shell" line="1">
lsusb | grep 'HP'
</syntaxhighlight>
<syntaxhighlight lang="shell-session" class="code-continue">
Bus 001 Device 003: ID 03f0:2c17 HP, Inc LaserJet 1022
</syntaxhighlight>
<syntaxhighlight lang="shell" line="1">
sudo netstat -pnat | grep 631
</syntaxhighlight>
<syntaxhighlight lang="shell-session">
tcp      0    0 127.0.0.1:631    0.0.0.0:*  LISTEN      1217/cupsd         
tcp6    0    0 ::1:631          :::*        LISTEN      1217/cupsd
</syntaxhighlight>
{{Media
| n = 1
| img = Gnome Settings Add a Printer.png
| sz = 360
}}
== Configure the Printer ==
There are two possible ways to configure the printer - via the web interface of CUPS or via the Gnome settings. I prefer the second method, illustrated at {{Media-cite|f|1}}. In both cases you need to use your user's credentials to administrate the printers.
To configure a printer via  the web interface of CUPS navigate to the address [http://127.0.0.1:631/admin http://127.0.0.1:631] within your browser, then go to the Administration section and click at the button Add Printer.
== References ==
== References ==


* ...
* BlackMoreOps.com: [https://www.blackmoreops.com/2013/11/15/install-configure-printers-linux-cups-foomatic-db/ How to install and configure printers on Linux (cups and foomatic-db)?]
 
* ...


== Section 1 ==
* Local copy of the above resource: [[:File:How to install and configure printers on Linux (cups and foomatic-db) by BlackMoreOps.pdf|How to install and configure printers on Linux (cups and foomatic-db).pdf]]
...
* OpenPrinting CUPS: [https://openprinting.github.io/cups/ CUPS Home Page]


<noinclude>
<noinclude>
Line 13: Line 58:
{{devStage  
{{devStage  
  | Прндл  = Linux Desktop
  | Прндл  = Linux Desktop
  | Стадий = 1
  | Стадий = 6
  | Фаза  = Идентифициране
  | Фаза  = Утвърждаване
  | Статус = Създаване
  | Статус = Утвърден
  | ИдтПт  = {{REVISIONUSER}}
  | ИдтПт = Spas
  | ИдтДт  = {{Today}}
| РзбПт  = Spas
  | ИдтРв  = {{REVISIONID}}
| АвтПт  = Spas
| УтвПт = {{REVISIONUSER}}
  | ИдтДт = 19.08.2022
| РзбДт  = 19.08.2022
| АвтДт  = 19.08.2022
| УтвДт = {{Today}}
  | ИдтРв = [[Special:Permalink/30399|30399]]
| РзбРв  = [[Special:Permalink/30410|30410]]
| АвтРв  = [[Special:Permalink/30411|30411]]
| УтвРв = {{REVISIONID}}
}}
}}
</div>
</div>
</noinclude>
</noinclude>

Latest revision as of 07:28, 26 September 2022

In my case I was in need to set­up my HP 1022 print­er to work with Kali Lin­ux. Af­ter the fol­low­ing set­up it works great. In this guide are used the tools cups, cups-client and foomat­ic-db, which are not in­stalled and en­abled by de­fault in Kali Lin­ux.

CUPS pro­vides the Sys­tem V ("lp") and Berke­ley ("lpr") com­mand-line in­ter­faces, a con­fig­urable web in­ter­face, a C API, and com­mon print fil­ters, dri­vers, and back­ends for print­ing. The cups-fil­ters project pro­vides ad­di­tion­al fil­ters and dri­vers.

Foomat­ic Data­base is a col­lect­ed knowl­edge about print­ers, dri­vers, and dri­ver op­tions in XML files, used by foomat­ic-db-en­gine to gen­er­ate PPD files.

In­stall the re­quired Pack­ages and Deal with the Per­mis­sions

In­stall the re­quit­ed pack­ages.

sudo apt update
sudo apt install cups cups-client "foomatic-db"

The users will be added to the lpad­min group au­to­mat­i­cal­ly af­ter in­stalling the above pack­ages, but we will do that man­u­al­ly just in case.

sudo adduser root lpadmin
sudo adduser $USER lpadmin

En­able and start CUPS ser­vice.

sudo systemctl enable --now cups.socket
sudo systemctl enable --now cups.service

Restart CUPS and Sam­ba ser­vices.

sudo systemctl restart cups.service
sudo systemctl restart smbd.service

Find USB Print­er

lsusb | grep 'HP'
Bus 001 Device 003: ID 03f0:2c17 HP, Inc LaserJet 1022
sudo netstat -pnat | grep 631
tcp      0    0 127.0.0.1:631    0.0.0.0:*   LISTEN      1217/cupsd          
tcp6     0    0 ::1:631          :::*        LISTEN      1217/cupsd
Figure 1. Add a print­er via Gnome Con­trol Cen­ter.

Con­fig­ure the Print­er

There are two pos­si­ble ways to con­fig­ure the print­er – via the web in­ter­face of CUPS or via the Gnome set­tings. I pre­fer the sec­ond method, il­lus­trat­ed at Fig­ure 1. In both cas­es you need to use your user's cre­den­tials to ad­min­is­trate the print­ers.

To con­fig­ure a print­er via the web in­ter­face of CUPS nav­i­gate to the ad­dress http://127.0.0.1:631 with­in your brows­er, then go to the Ad­min­is­tra­tion sec­tion and click at the but­ton Add Print­er.

Ref­er­ences