summaryrefslogtreecommitdiff
blob: 48c5a1ed73bee1f51656241a510ddd618cae10ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
<?xml version='1.0' encoding="UTF-8"?> 
<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/printing-howto.xml,v 1.28 2004/02/07 18:53:26 swift Exp $ -->
<!DOCTYPE guide SYSTEM "/dtd/guide.dtd">

<guide link = "/doc/en/printing-howto.xml"> 

<title>Gentoo Printing Guide</title> 

<author title="Author"><!-- zhen@gentoo.org -->
  John P. Davis
</author>
<author title="Editor">
  <mail link="wleggette@gate.net">Wesley Leggette</mail>
</author>
<author title="Editor">
  <mail link="carl@gentoo.org">Carl Anderson</mail>
</author>
<author title="Editor">
  <mail link="lanius@gentoo.org">Heinrich Wendel</mail>
</author>
<author title="Editor">
  <mail link="swift@gentoo.org">Sven Vermeulen</mail>
</author>
<author title="Copyeditor">
  <mail link="sunflare@gentoo.org">Phil Bordelon</mail>
</author> 

<abstract>
A comprehensive printing guide for Gentoo Linux. 
This document covers both local and network printing.
</abstract> 

<license/>

<version>1.8</version> 
<date>February 7, 2004</date> 

<chapter> 
<title>Installing CUPS and foomatic</title> 
<section>
<body> 

<p>
Setting up printing in Gentoo Linux is a relatively painless task, thanks
to some great programs such as CUPS (the Common Unix Printing System) and 
foomatic. Both of these programs are currently in the Portage tree, and they are
very easy to set up for the end user.
</p> 

<p>
Please be aware the cups is cross-desktop, i.e. you can follow
these directions to get printing working under GNOME or KDE.
There are other options, such as KDE's print setup, but I believe that 
CUPS is the easiest to setup, and the most scalable.
</p>

<p>
Before emerging CUPS, it is a  good idea to add the necessary
USE flags to <path>/etc/make.conf</path>.
</p>

<pre caption = "Editing /etc/make.conf">
<comment>add cups, foomaticdb, ppds and usb (if you are using a USB printer connection) to your existing USE var list. </comment>
USE="cups foomaticdb ppds usb other_var1 other_var2"
</pre>

<p>
For more information on USE variables, please see the 
<uri link = "http://www.gentoo.org/doc/en/use-howto.xml">USE HOWTO</uri>.
</p>

<pre caption = "Emerging necessary packages">
# <i>emerge cups</i>
# <i>emerge foomatic </i>
</pre>

</body>
</section>
</chapter>

<chapter>
<title>Setting up Kernel Modules</title> 
<section>
<title>General</title>
<body>

<p>
Now that the necessary packages are installed, it is time to install the 
printer.
</p>

<p>
Depending on what type of printer connection you will be using, it will
be necessary to enable either parallel port or USB port printer connections
in the kernel.
</p>

<note>
This is only needed for local printing, if you want to print via samba, skip 
this section.
</note>

<note>
If you are not sure on how to compile the kernel, the specific
instructions can be found in the <uri 
link="http://www.tldp.org/HOWTO/Kernel-HOWTO.html">Kernel Howto</uri> (currently
down for review). Make sure you find out how to compile and install new modules 
without having to recompile your kernel or restart your computer. It's a real 
timesaver.
</note>

</body>
</section>
<section>
<title>USB Modules</title>
<body>

<p>
To enable USB printer support, go to <c>USB support</c> and enable <c>Support 
for USB</c> and <c>USB Printer support</c>. Enabling them both as modules will 
install usbcore.o and printer.o in your modules directory. I suggest using 
modules because you won't have to restart your computer. Users of a 2.6 kernel
will find these options under <c>Device Drivers</c>.
</p>

<p>
After the kernel is built, and your computer restarted, it is time to load the 
necessary modules:
</p>

<pre caption = "Loading USB modules">
# <i>modprobe usbcore</i> 

<comment>(For 2.4 kernel users:)</comment>
# <i>modprobe printer</i>
<comment>(For 2.6 kernel users:)</comment>
# <i>modprobe usblp</i>
</pre> 

<p>
After the modules have loaded successfully, plug in the printer, and check
<path>/var/log/messages</path> to see if it was detected.
</p> 

<note>
If you are using something other than sysklogd, your kernel log file will be 
different.
</note>

<pre caption = "Checking Kernel Messages">
# <i>tail /var/log/messages</i>
</pre> 

<p>
You should see something like this:
</p>

<pre caption = "/var/log/messages Output">
hub.c: USB new device connect on bus2/2, assigned device number 2 
printer.c: usblp0: USB bidirectional printer dev 2 if 0 alt 1 proto 2 vid 0x03F0 pid 0x1104
</pre>

</body>
</section> 
<section>
<title>Parallel Port Modules</title>
<body>

<p>
To enable Parallel port support, go to <c>Parallel port support</c> and enable 
<c>Parallel port support</c> and <c>PC-style hardware</c>. Depending on your 
printer you also have to activate <c>Multi-IO cards (parallel and serial)</c>,
<c>Support for foreign hardware</c> and <c>IEEE 1284 transfer mode</c>. Then 
go to <c>Character devices</c> and enable <c>Parallel Printer Support</c>. Users
of 2.6 kernels will find these options under <c>Device Drivers</c>.
</p>

<p>
After the kernel is built, make sure that the printer is plugged in and then 
restart your computer. Now it is time to load the necessary modules:
</p>

<pre caption = "Loading Parallel Port modules">
# <i>modprobe lp</i> <comment>(Only for 2.6 kernel users)</comment>
# <i>modprobe parport</i> 
# <i>modprobe parport_pc</i>
</pre> 

<p>
After the modules have loaded successfully, check
<path>/var/log/messages</path> to see if the printer was detected.
</p> 

<note>
If you are using something other than sysklogd, your kernel log file will be 
different.
</note>

<pre caption = "Checking Kernel Messages">
# <i>tail /var/log/messages</i>
</pre> 

<p>
You should see something like this:
</p>

<pre caption = "/var/log/messages Output">
lp0: using parport0 (polling).
</pre>

</body>
</section>
<section>
<title>Low-level testing</title>
<body>

<p>
Before setting up the printer with CUPS, we can test it with some simple 
low-level commands.
</p> 

<pre caption = "Printer Testing Using cat">
# <i>touch test.txt</i>
# <i>echo "Hello World" > test.txt</i>
# <i>cat test.txt > /dev/usb/lp0 </i>

<comment> Alternatively, for parallel port printers: </comment>
# <i>cat test.txt > /dev/lp0 </i>
</pre>

<note>
Some printers (e.g. several HP LaserJets) need a ^L
(Control-L) at the end of the file to trigger printing.
Without the ^L the cat succeeds, but the printer absorbs
the data, then sits and does nothing.
</note>

</body>
</section>
</chapter>			

<chapter>
<title>Special Printer Drivers</title> 
<section>
<body> 

<p>
Before you use foomatic to generate a PPD file, it may be necessary to locate 
the third party drivers for your printer. For example, Epson provides <uri 
link="http://www.epkowa.co.jp/english/linux_e/linux.html">several printer 
drivers</uri> for open source operating systems. However, as with Epson's, 
many of these special drivers are not open source.
</p>

<p>
The following printing drivers are available as ebuilds in Portage: gimp-print,
omni, hpijs, pnm2ppa.
</p>

<p>
For most printers besides HP Inkjets, you will be able to use the standard 
Linux printer drivers. Visit the <uri 
link="http://www.linuxprinting.org/printer_list.cgi">linuxprinting.org printer 
support database</uri> to find information on your specific printer. Make sure 
you read the documentation provided with any driver you download for 
installation and licensing information.
</p> 

<impo>
If you are using an HP Inkjet printer, it is necessary to emerge the 
<c>hpijs</c> printer driver. This driver handles all of the Postscript 
interpretation necessary to make the HP printer work. The <c>hpijs</c> driver 
is for HP Inkjet printers only, but is available through Portage for
your convenience. The documentation from HP for the <c>hpijs</c> driver will 
be placed in <path>/usr/share/doc/hpijs-&lt;version&gt;</path>. The author 
<i>highly</i> recommends reading this.
</impo>

<pre caption = "Emerging hpijs">
# <i>emerge hpijs</i>
</pre> 

<note>
If you are using a HP Laserjet, support may already be available via the GNOME 
printing system. If you are using a non HP Inkjet printer, you do not need to 
install this special printer driver.
</note>

</body>
</section>
</chapter>

<chapter>
<title>PPD File Configuration</title>
<section>
<body>

<p>
Now it is time to configure the printer and CUPS. In order for your printer to 
interpret Postscipt correctly, CUPS needs a PPD (Printer Postscript Definition)
file. The easiest way to generate a PPD is through foomatic.
</p>

<note>
Another way is to download a PPD file from <uri
link="http://www.linuxprinting.org">LinuxPrinting.org</uri> and place it in
<path>/usr/share/cups/model</path>. If you use this method, you can skip the
rest of this section and continue with <uri link="#doc_chap5">CUPS
Configuration</uri>.
</note>

<p>
Three pieces of information are necessary in order to make the below command 
work; you need your printer ID, printer device, and your print driver (this 
would be hpijs if you needed to install the special driver above). The printer 
ID and driver can be <c>grepped</c> from foomatic's database, and the print 
device is what device node your printer is connected to (i.e. 
<path>file:/dev/lp0</path>, <path>file:/dev/usb/lp0</path> or for samba printers
<path>smb://user:password@server/share</path>).
</p>

<p>
Before using <c>foomatic-configure</c>, please remember to start <i>cupsd</i>.
</p>

<pre caption = "Starting cupsd">
# <i>/etc/init.d/cupsd start</i>
</pre>

<pre caption = "General Usage of foomatic">
<comment>(Fill in your printer model in $printer_model and printer ID in $printer_ID)</comment>
<comment>(Use the output of the first two grep statements to fill in the last foomatic-configure command)</comment>
# <i>grep $printer_model /usr/share/foomatic/db/source/printer/* </i>
# <i>grep $printer_ID /usr/share/foomatic/db/source/driver/* </i>
# <i>foomatic-configure -s cups -p $printer_model_number -c $print_device_path -n queue name -d driver </i>
</pre>

<p>
If grepping for the driver doesn't work, you can search for your printer on <uri
link="http://www.linuxprinting.org">LinuxPrinting.org</uri> and check what
drivers it is known to work with. Then pick one of those drivers and install:
</p>

<pre caption="Installing a PPD driver">
<comment>(If you have multiple printers, use separate queue names. Otherwise an
easy-to-remember queuename, such as "default", suffices)</comment>
# <i>foomatic-configure -s cups -p &lt;printer model&gt; -c &lt;printer device&gt; -n &lt;queue name&gt; -d &lt;driver&gt;</i>
</pre>

<p>
Now, here's a more specific example. The following code assumes that you have 
an Epson Stylus Color 980. Of course, you should replace this with your actual
printer model.
</p>

<pre caption="Specific Usage of foomatic with Stylus Color 980">
# <i>grep "Stylus Color 980" /usr/share/foomatic/db/source/printer/* </i>
<comment> Now look for the line which reads: </comment>
/usr/share/foomatic/db/source/printer/Epson-Stylus_Color_980.xml:   &lt;model>Stylus Color 980&lt;/model>
<comment> Epson-Stylus_Color_980 is your printer ID. </comment>

# <i>grep Epson-Stylus_Color_980 /usr/share/foomatic/db/source/driver/* </i>
/usr/share/foomatic/db/source/driver/gimp-print-ijs.xml:  &lt;printer>&lt;id>printer/Epson-Stylus_Color_980&lt;/id>&lt;/printer>
<comment> Here, your print driver is gimp-print-ijs.</comment>

# <i>foomatic-configure -s cups -p Epson-Stylus_Color_980 -c file:/dev/lp0 -n Epson -d gimp-print-ijs </i>
</pre>

<impo>
If you are having problems, please refer to the foomatic documentation
<uri link="http://www.linuxprinting.org/foomatic/USAGE">here</uri> 
and the <uri link="http://www.linuxprinting.org">linuxprinting.org</uri>
homepage for more information.
</impo>

</body> 
</section>
</chapter> 

<chapter> 
<title>CUPS Configuration</title> 
<section>
<body> 

<p>
Since the printer itself is now configured, now CUPS must be setup
to handle the printer queueing. CUPS can be accessed via web browser on port 631
of the printer server.
</p>

<impo>
CUPS has a built in configuration file for the daemon that should, but does
not have to, be modified. You might want to take a gander at it, it is
<path>/etc/cups/cupsd.conf</path>.
</impo>

<pre caption = "Adding CUPS to default runlevel, and starting CUPS">
# <i>rc-update add cupsd default</i>
# <i>/etc/init.d/cupsd start</i>
</pre>

<p>
The CUPS daemon should now be running, so open up your favorite browser, point
it to <uri link="http://127.0.0.1:631">here</uri> and click on <c>Manage 
Printer</c>. Here you can find your newly installed printer, configure it or 
print a test page.
</p> 

<note>
If the printer does not work for some reason, go to the directory where you
told your CUPS logs to be stored, and look through <c>error_log</c>.
</note>

</body> 
</section>
</chapter>

<chapter>
<title>Configuring programs to print using CUPS.</title>
<section>
<title>General</title>
<body>

<p>
Most programs today have a native cups interface, so you need not change 
anything, just try to print in the program.
</p>

</body>
</section>
<section>
<title>The GIMP</title>
<body>

<p>
Before starting, we have to emerge The Gimp's CUPS printing extentions.
</p>

<pre caption="Emerging gimp-print">
# <i>emerge gimp-print </i>
</pre>

<p>
Now, open up The GIMP, and open an existing picture, or just some blank pic, 
it really doesn't matter because all we are looking for is the <i>File</i> menu.
Right click on the image and go to <i>File/Print</i> The dialog for printing 
should come up, and when it does, click on new printer. 
If your printer is not already listed, type in the name of your printer, then 
select your printer type. Ok, you are now setup to print from The GIMP. Play 
with the settings and have some fun.
</p>

</body>
</section>
</chapter>

<chapter>
<title>Using Linux as a Windows Compatible Print Server</title>
<section>
<body>

<p>
Linux makes a great print server, then again, it makes a great everything 
server. The first thing to do is edit <path>/etc/samba/smb.conf</path> to fit 
your settings. The <path>smb.conf</path> file contains all of the settings that 
will make your Linux box look like a Windows NT server to any Windows machine. 
I have included an very utilitarian example <path>smb.conf</path> below. Edit 
as needed to fit your network environment. 
</p>

<pre caption = "Sample smb.conf">
[global]

workgroup = YOUR_WORKGROUP
server string = Gentoo Linux Server
encrypt passwords = True
security = user
smb passwd file = /etc/samba/private/smbpasswd
log file = /var/log/samba/log.%m
socket options = IPTOS_LOWDELAY TCP_NODELAY
domain master = Yes
local master = Yes
preferred master = Yes
os level = 65
dns proxy = No
name resolve order = lmhosts host bcast
bind interfaces only = True
interfaces = eth0
hosts deny = ALL
hosts allow = 192.168.1.4 127.0.0.1 (list of allow hosts here) 
debug level = 1
create mask = 0644
directory mask = 0755
level2 oplocks = True
read raw = no
write cache size = 262144

[printers]
comment = All Printer
path = /var/spool/samba
browseable = no
</pre>

<p>
Now that the SAMBA is configured, restart samba, go to your Windows machine
and install a network printer. Piece of cake, eh?
</p>

</body>
</section>
</chapter>
</guide>