https://wiki.alpinelinux.org/w/api.php?action=feedcontributions&user=Jurassic&feedformat=atomAlpine Linux - User contributions [en]2024-03-29T11:34:04ZUser contributionsMediaWiki 1.40.0https://wiki.alpinelinux.org/w/index.php?title=Printer_Setup&diff=15612Printer Setup2018-12-21T12:40:46Z<p>Jurassic: Mention IPP everywhere</p>
<hr />
<div>First, you'll need [https://en.wikipedia.org/wiki/CUPS CUPS]. If you have a ''Hewlett-Packard'' printer (''HP'' brand), add the [https://en.wikipedia.org/wiki/HP_Linux_Imaging_and_Printing HPLIP] package.<br />
<br />
{{cmd|# apk add cups cups-libs cups-pdf cups-client cups-filters hplip}}<br />
<br />
{{Tip|As with all installation processes, Alpine's [[Alpine_Linux_package_management|package management]] can guide you on the need to pull various packages from other repositories (e.g.''@testing'') other than the enabled ''main'' or ''edge'' repositories throughout this wiki page, as long as these other repos have been [https://wiki.alpinelinux.org/wiki/Alpine_Linux_package_management#Repository_pinning pinned]. For example, for Alpine version 3.7.0 on x86_64 systems, '''apk''' would have then guided you to substitute in <code>cups-pdf@testing</code> and <code>hplip@testing</code>.}}<br />
<br />
Then go to http://localhost:631 with your web browser and follow the steps to "Add Printer". It will ask you to log in to add a printer. Log in as root, then finish the steps. Once you're done, you should be able to print.<br />
<br />
If that doesn't work, you may also need to add HPLIP's dependencies separately. There are currently no packages for '''CUPS DDK''', <code>hp-setup</code> or <code>foomatic</code>.<br />
{{cmd|# apk add libusb ghostscript qt py-qt python3 py-reportlab libjpeg libjpeg-turbo net-snmp}}<br />
<br />
<br />
{{Expand|Modifications/sections required e.g. to address container user-case scenarios, etc.}} <br />
<br />
== Desktop Environment ==<br />
Additionally, in a desktop environment you could proceed as follows.<br />
<br />
Check whether ''root'' and the user's username (''yourusername'') are already members of the <code>lp</code> and <code>lpadmin</code> groups. Note: ''yourusername'' can be added to the <code>lpadmin</code> group if he/she will administer the CUPS system.<br />
$ id root<br />
uid=0(root) gid=0(root) groups=0(root),0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel),11(floppy),20(dialout),26(tape),27(video)<br />
$ id ''yourusername''<br />
uid=1000(yourusername) gid=1000(yourusername) groups=1000(yourusername),6(disk),10(wheel),18(audio),19(cdrom),20(dialout),27(video),100(users),1001(plugdev)<br />
<br />
If not, add them:<br />
$ sudo adduser root lp<br />
$ sudo adduser root lpadmin<br />
$ sudo adduser ''yourusername'' lp<br />
$ sudo adduser ''yourusername'' lpadmin<br />
<br />
Start CUPS ('''cupsd''') and make it persist between boots; then reboot:<br />
$ sudo rc-service cupsd start<br />
$ sudo rc-update add cupsd<br />
$ sudo reboot<br />
<br />
Credit to ArchWiki's excellent [https://wiki.archlinux.org/index.php/CUPS CUPS] page for guidance with the following basic steps.<br />
''' Locate your printer '''<br />
<br />
With your printer connected and powered on, determine the ''URI'' for your printer. Depending on whether the connection is via '''usb''' or '''parallel''' ports, the URI will carry a <code>usb://</code> or <code>parallel:/</code> prefix.<br />
<br />
$ lpinfo -v #<br />
network lpd<br />
network socket<br />
network beh<br />
file cups-brf:/<br />
direct usb://HP/LaserJet%202200<br />
network ipp<br />
network ipps<br />
network https<br />
network http<br />
direct hp<br />
<br />
In the example above, the URI is <code>usb://HP/LaserJet%202200</code><br />
<br />
''' Find a .ppd or .ppd.gz ''driver''. '''<br />
<br />
If your printer supports ''IPP Everywhere'' --most recent models do-- see the ''driverless'' command in ''cups-filters'':<br />
<br />
$ driverless ipp_uri > printer.ppd<br />
<br />
or just pass ''-m everywhere'' to ''lpadmin''.}}<br />
<br />
Otherwise, you could list all the drivers available by running <code>lpinfo -m</code> and then searching through the results to find a .ppd or .ppd.gz specific to your printer. A quick solution is to use the <code>--make-and-model</code> flag and the <code>grep</code> function in order to filter the results by plugging in your printer's make, model and series in this fashion:<br />
<br />
$ lpinfo --make-and-model "''make_and_model_names''" -m | grep -i ''printer_series''<br />
<br />
{{Tip|<br />
*Search for the term ''HP'' to find instances of ''Hewlett-Packard''.<br />
*You do not need to state the <code>printer_series</code> in whole if at all e.g. ''2200'' may be preferable to searching for ''2200M'', etc.}}<br />
<br />
For example, type:<br />
<br />
$ lpinfo --make-and-model "HP LaserJet" -m | grep -i 2200<br />
<br />
Out of the results obtained, you might select the following .ppd ''driver'':<br />
drv:///hp/hpcups.drv/hp-laserjet_2200_series.ppd<br />
<br />
If required, further drivers can be obtained by installing [http://gimp-print.sourceforge.net/ gutenprint], and running the <code>lpinfo</code> search again. These may not specify .ppd names.<br />
<br />
$ sudo apk add gutenprint gutenprint-doc<br />
<br />
''' Configure a queue '''<br />
<br />
Create a queue using a ''queue_name'' of your choice. Your selected printer's name is an obvious choice, but do not employ spaces. You will also need to be root or use <code>sudo</code> instead, and you will also need to plug in the ''URI'' and the .ppd ''driver'':<br />
<br />
# lpadmin -p ''queue_name'' -E -v "''uri''" -m ''driver''<br />
<br />
With this example, you could set as follows, but there are other solutions.<br />
<br />
# lpadmin -p HP_LaserJet_2200 -E -v "usb://HP/LaserJet%202200" -m drv:///hp/hpcups.drv/hp-laserjet_2200-pcl3.ppd<br />
<br />
This printer queue could be set as '''default''':<br />
<br />
# lpoptions -d HP_LaserJet_2200<br />
<br />
Printer settings can typically be set in your GUI application's '''Print''' menu or by examining the CUPS [https://www.cups.org/doc/man-lpoptions.html lpoptions] page. If you have a single queue, the setting options available (such as page type, duplex, etc.) for your queue can simply be '''listed''' by using the '''-l''' flag. Asterisks(*) indicate current settings:<br />
<br />
# lpoptions -l<br />
PageSize/Media Size: Card3x5 Hagaki Photo4x6 A6 Photo5x7 Card5x8 Oufuku A5 B5 JB5 Executive 16k Letter *A4 ExecutiveJIS FLSA Legal EnvA2 EnvC6 EnvChou4 EnvMonarch EnvDL Env10 EnvChou3 EnvC5 EnvB5 Custom.WIDTHxHEIGHT<br />
Duplex/Double-Sided Printing: DuplexNoTumble DuplexTumble *None<br />
InputSlot/Media Source: *Auto PhotoTray Upper Lower Envelope LargeCapacity Manual MPTray<br />
ColorModel/Output Mode: *Gray<br />
MediaType/Media Type: *Plain<br />
OutputMode/Print Quality: *Normal Draft Best<br />
OptionDuplex/Duplexer Installed: *False True<br />
<br />
If there is only one queue, '''options''' can be set by simply using '''-o''' flags for each setting:<br />
<br />
# lpoptions -o PageSize=Legal -o Duplex=DuplexNoTumble<br />
<br />
== See also ==<br />
<br />
* [https://www.cups.org/documentation.html CUPS documentation]<br />
<br />
[[Category:Printers]]<br />
[[Category:Installation]]</div>Jurassic