summaryrefslogtreecommitdiff
blob: 46887d4d25c0339f8dc54b7beea66baca65baf6b (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
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
<?xml version='1.0'?>
<guide link="/doc/desktop.html">
<title>Gentoo Linux Desktop Configuration Guide</title>
<author title="Editor"><mail link="g2boojum@gentoo.org">Grant Goodyear</mail></author>

<abstract>
   This guide shows you configure Gentoo Linux to be a full-purpose
   desktop system.  Specifically, we walk through installing and 
   configuring X, KDE, OSS and alsa (sound), postfix (electronic mail), 
   cups (printing),
   and samba (unix/windows interoperability).
</abstract>

<version>0.21</version>
<date>10 Oct 2001</date>

<chapter>
<title>Preliminaries</title>
<section>
<body>
<p>Needless to say, you first need to have Gentoo Linux installed
(<uri>http://www.gentoo.org/index-download.html</uri>).  Having finished
that rather enjoyable process, you also need to download the <e>Portage</e>
tree.  You really should read the Portage User Guide 
(<uri>http://www.gentoo.org/doc/portage-user.html</uri>), but if you're
in a hurry you just need to type:
</p>
<pre># <i>emerge rsync</i></pre>
<p>A quick note is in order about the packages that I have chosen to 
discuss here.  Gentoo Linux has a considerable wealth of window managers,
mail transport agents, etcetera that can easily be installed.  The specific
packages that I have chosen to cover are not preferred by Gentoo Linux, they
are simply packages that the author likes and/or knows how to configure.
In other words, they're the packages on the author's own desktop.</p>
</body>
</section>
</chapter>

<chapter>
<title>X and KDE</title>

<section>
<title>Installation</title>
<body>
<p>
Having installed Gentoo Linux and updated Portage, 
my first task is generally to install X
and KDE.  X takes forever to compile, and KDE takes even longer,
so I highly recommend doing this right before going to bed.
</p>
<p>
It's always useful to use the <c>--pretend</c> flag before doing
an <c>emerge</c> to see what dependencies are going to be installed, and in our
case it's quite a lot.
</p>
<pre>
# <i>emerge --pretend kde-base/kdebase</i>

These are the packages that I would merge, in order.

Calculating dependencies............... done!
[ebuild N  ] media-sound/cdparanoia-3.9.8 to /
[ebuild N  ] media-libs/jpeg-6b-r2 to /
[ebuild N  ] media-libs/tiff-3.5.6_beta to /
[ebuild N  ] x11-base/xfree-4.1.0 to /
[ebuild N  ] x11-libs/openmotif-2.1.30-r1 to /
[ebuild N  ] media-libs/alsa-lib-0.5.10-r1 to /
[ebuild N  ] media-libs/mesa-glu-3.4.2 to /
[ebuild N  ] kde-base/kde-env-2.1 to /
[ebuild N  ] media-libs/lcms-1.06 to /
[ebuild N  ] media-libs/libmng-1.0.1 to /
[ebuild N  ] media-libs/audiofile-0.2.1 to /
[ebuild N  ] media-libs/libpng-1.0.11 to /
[ebuild N  ] x11-libs/qt-x11-2.3.0 to /
[ebuild N  ] app-text/sgml-common-0.6.1 to /
[ebuild N  ] kde-base/kdelibs-2.1.2 to /
[ebuild N  ] kde-base/kdebase-2.1.1-r1 to /
<comment>Your dependencies will probably be different</comment>

# <i>emerge kde-base/kdebase</i>
</pre>
<p>Have a nice nap!</p>
<note>If you have a Gentoo Linux binary CD, then you can install
the packages directly off of the CD.</note>
<pre caption="Installing binary packages from the CD">
# <c>export PKGDIR=/mnt/cdrom/gentoo/packages</c>
<comment>Normally Portage expects packages to be in /usr/portage/packages
</comment>
# <c>emerge --usepkg /mnt/cdrom/gentoo/packages/All/kdebase-x.y.z.tbz2</c>
<comment>The <c>--usepkg</c> flag makes sure that binary packages are used
for the dependencies (if available).</comment>
</pre>
</body>
</section>

<section>
<title>Configuring</title>
<body>
<p>
I like using the console-based <c>xf86config</c> program to configure X.
Before you start, you'll need to know the horizontal and vertical refresh
rates of your monitor (my viewsonic G773 has Horizontal: 30-69 KHz, 
Vertical: 55-90 KHz), the type and amount of ram (in KB) of your video card
(a 32768 KB GeForce card, in my case), and the type and device of your
mouse (an intellimouse plugged into the ps/2 port <path>/dev/psaux</path>).
</p>
<pre># <c>/usr/X11R6/bin/xf86config</c></pre>
<p>Because I have a three-button mouse I choose not to enable 
3-button emulation.  I don't add any additional XKB keyboard options
because I don't know what any of them do.  You'll have to guess at
a screen resolution and pixel depth that you'll like.  I happen
to like 1280x1024 at 24bpp on my viewsonic, but that's only because it
doesn't work at a higher resolution.  If you've never done this before,
don't be surprised if you end up running <c>xf86config</c> multiple
times.</p>

<note>If you don't know the refresh rates of your monitor, try doing a 
google search, <uri>http://www.google.com</uri>, on the model number and
manufacturer of your monitor.  The refresh rates are generally given as
part of the monitor specs.</note>

<warn>If you're an X-configuring veteran, you may be used to making
a symbolic link from your mouse device to <path>/dev/mouse</path>.  If
you are using <c>devfs</c> you may be unpleasantly surprised to discover
that your link is not preserved upon rebooting.  Instructions for registering
<path>/dev/mouse</path> with devfs can be found in the Gentoo faq,
<uri>http://www.gentoo.org/doc/faq.html</uri>. </warn>

<pre># <i>startx</i></pre>
<p>If you configured X properly, running <c>startx</c> should start an
amazingly ugly X window manager (twm, to be specific).  If X comes up,
you're good to go.  Hit <c>&lt;ctrl&gt;&lt;alt&gt;&lt;backspace&gt;</c>
to kill the X server.</p>

<p>If you have a wheel mouse you'll want to edit the XF86Config file
by hand:</p>
<pre>
# <i>cp /etc/X11/XF86Config /etc/X11/XF86Config.working</i>
# <i>nano /etc/X11/XF86Config</i></pre>
<pre caption="Pointer section of XF86Config">
Section "InputDevice"

# Identifier and driver

    Identifier	"Mouse1"
    Driver	"mouse"
    <i>Option "Protocol"    "IMPS/2" </i>
    Option "Device"      "/dev/psaux"
    <i>Option "ZAxisMapping"	"4 5"</i>

</pre>
<p>Because I have an intellimouse I changed the "Protocol" from 
"PS/2" to "IMPS/2".  Getting the wheel to scroll just requires
adding the 'Option "ZAxisMapping" "4 5"' line, where '4' and '5'
correspond to mouse wheel up and mouse wheel down.
</p>
<note>Netscape 4.x won't scroll with the wheel by default; you'll need
to create an .Xdefaults file first.  See 
<uri>http://www-sop.inria.fr/koala/colas/mouse-wheel-scroll/</uri>
for instructions.  Better yet, use <c>konqueror</c>, <c>opera</c>,
<c>mozilla</c>, <c>galeon</c>, or some other real browser.</note>

<p>Run <c>startx</c> again just to make sure that X still comes up.
Assuming that it does, kill X and we'll start a real window manager
instead.  
Thanks to Achim and Danarmak, Gentoo's KDE packagers, the
KDE ebuild configures KDE quite well all by itself.  The KDM display
manager should work just by starting it.</p>
<pre># <i>kdm</i></pre>
<p>You should be able to log in and see KDE in full working order.
Of course sound shouldn't be working yet, so you'll miss the annoying
KDE start-up sound, but we'll fix that in a moment.  Open a 
konsole, type <c>ls /usr/bin</c> (or anything else that more than fills 
the konsole window), and see if the mouse wheel lets
you scroll up and down in the konsole window.  It really should
work!</p>

<p>All that's left is to make sure that X comes up when Gentoo boots.
Edit <path>/etc/rc.conf</path> so that 
<e>DISPLAYMANAGER="kdm"</e>.  
</p>
<pre>
# <i>nano /etc/rc.conf</i>
</pre>
<pre caption="/etc/rc.conf -- setting DISPLAYMANAGER">
<!-- gpm not yet in rc.conf
MOUSE="ms"				# Set to the mouse type as used by gpm (auto, ps2, ms, etc.)

-->
DISPLAYMANAGER="<comment>kdm</comment>"			# Enter your display manager here (xdm,kdm,gdm)
</pre>
<note>Pre-rc6 users need to edit <path>/etc/rc.d/config/basic</path> instead.</note>
<p>
Now we just need to make sure that the
<e>xdm</e> start-up script is read when booting.
</p>
<pre caption="rc6+ users">
# <i>rc-update add xdm default</i>
</pre>
<pre caption="Only for pre-rc6 users">
# <i>rc-update add xdm</i>
# <i>nano /etc/inittab</i>
</pre>
<pre caption="the initdefault line, configured to start kdm (runlevel 4), only for pre-rc6 users">
# Default runlevel.

id:<comment>4</comment>:initdefault:
</pre>
<p>Reboot, and see if X comes up!</p>
<impo>The <c>rc-update</c> command is Gentoo Linux's improved version of
the venerable <c>chkconfig</c> command for managing init scripts.  Type
<c>rc-update</c> by itself for a list of options.
</impo>

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

<chapter>
<title>Sound</title>
<section>
<title>Alsa</title>
<body>

<p>Gentoo Linux supports Alsa for sound using the default kernel.  Alsa can
be run with or without <e>devfs</e>.  One note; if you've installed a new
<path>sys-kernel/linux-sources</path> package, make sure that your Linux kernel
has sound support enabled.</p>

<pre>
# <i>emerge media-sound/alsa-driver</i>
<comment>the Alsa modules will now be installed</comment>
# <i>depmod -a</i>
</pre>
<p>
I am going to assume
here that you have <e>devfs</e> enabled; if you don't then please
see the Gentoo FAQ:
<uri>http://www.gentoo.org/doc/faq.html</uri>.
</p>
<pre>
# <i>nano /etc/modules</i>
</pre>
<pre caption="modules.conf with Alsa modules">
# Put modules to be loaded, with arguments, one per line
# The following lines will be called with "modprobe"
  
snd-card-emu10k1
snd-pcm-oss

</pre>
<note>Pre-rc6 users will need to edit <path>/etc/rc.d/config/modules</path>
instead.</note>
<p>
You'll want to replace <e>snd-card-emu10k1</e> with the
appropriate sound card for your system.  Look in
<path>/lib/modules/[kernel version]/misc/</path>
for a list of modules.  If you'd like to have OSS compatibility, it's
a very good idea to make sure the <e>snd-pcm-oss</e> line is also in there.
</p>
<warn>
Whatever you do, don't add kernel modules to 
<path>/etc/modules.conf</path>.  The <path>/etc/modules.conf</path>
file is autogenerated at boot time, so any changes made there will 
be lost.
</warn>
<p>Now we set up the <e>kerneld</e> aliases.</p>
<pre>
# <i>nano /etc/modules/2.4.4-ac9</i>
</pre>
<pre caption="end of /etc/modules/2.4.4-ac9 with Alsa additions">
depfile=/lib/modules/2.4.4-ac9/modules.dep
persistdir=/var/lib/modules/persist
 
<i># Alsa</i>
<i>alias char-major-116 snd</i>
 
<i># OSS stuff</i>
<i>alias snd-card-0 snd-card-emu10k1</i>
<i>alias char-major-14 soundcore</i>
<i>alias sound-slot-0 snd-card-0</i>
<i>alias sound-service-0-0 snd-mixer-oss</i>
<i>alias sound-service-0-1 snd-seq-oss</i>
<i>alias sound-service-0-3 snd-pcm-oss</i>
<i>alias sound-service-0-12 snd-pcm-oss</i>
</pre>
<p>
Again, you'll want to replace <e>snd-card-emu10k1</e> with
your sound card and kernel version <e>2.4.4-ac9</e> with your kernel
version.
</p>
<p>You should also verify that <path>/etc/devfsd.conf</path>
has the alsa devices and permissions correctly registered.</p>
<pre>
# <i>nano /etc/devfsd.conf</i>
</pre>
<pre caption="end of devfsd.conf file with Alsa additions">
CHANGE          .*              COPY    $devpath /dev-state/$devname
CREATE          .*              COPY    $devpath /dev-state/$devname
 
<i># Alsa stuff</i>
<i>LOOKUP          snd             MODLOAD ACTION snd</i>
<i>REGISTER        sound/.*        PERMISSIONS root.audio 660</i>
<i>REGISTER        snd/.*          PERMISSIONS root.audio 660</i>
</pre>
<note>Notice that devfsd.conf sets <path>/dev/sound</path>
permissions to be <c>root.audio</c>.  Thus, for non-root users to
use audio they will have to be part of the <c>audio</c> group.
</note>
<p>
Reboot, and all of the sound stuff should be loaded.  You won't
hear any sound yet, though, because alsa keeps all sound channels
muted by default.
</p>
<pre>
# <i>emerge media-sound/alsa-utils</i>
# <i>amixer</i>

Group 'Input Gain',0
  Capabilities: volume mute jointly-mute
  Channels: Front-Left Front-Right
  Limits: min = 0, max = 15
  Front-Left: 11 [73%] [mute] [---]
  Front-Right: 11 [73%] [mute] [---]
Group 'Master Mono',0
  Capabilities: volume mute capture exclusive-capture
  Capture exclusive group: 1
  Channels: Front-Left Front-Right
  Limits: min = 0, max = 31
  Front-Left: 23 [74%] [mute] [---]
  Front-Right: 23 [74%] [mute] [---]
Group 'Headphone',0
  Capabilities: volume mute jointly-mute
  Channels: Front-Left Front-Right
  Limits: min = 0, max = 31
  Front-Left: 0 [0%] [mute] [---]
  Front-Right: 0 [0%] [mute] [---]
Group 'Master',0
  Capabilities: volume mute jointly-mute capture exclusive-capture
  Capture exclusive group: 1
  Channels: Front-Left Front-Right
  Limits: min = 0, max = 63
  Front-Left: 50 [79%] [mute] [---]
  Front-Right: 50 [79%] [mute] [---]
<comment>[chopped for brevity]</comment>

# <i>amixer set Master 100 unmute</i>
# <i>amixer set PCM 100 unmute</i>
# <i>aplay /usr/share/sounds/pop.wav</i> <comment>(pop.wav is part of KDE)</comment>
</pre>
<p>
After installing the alsa utilities we use <c>amixer</c> to 
unmute the Master and PCM sound channels and to set their volume
to 100%.  We check to see if sound is working by using the 
<c>aplay</c> (alsa play) command.  If you hear a pop, then sound
is indeed working.  Then, adjust the volume settings to your liking;
the ncurses-based <c>alsamixer</c> is a great way to get them "just so".
</p>
<pre caption="rc6+ users only">
# <i>rc-update add alsa default</i>
</pre>
<note>For pre-rc6 users the alsa-utils ebuild automatically adds the
<e>alsa</e> init script to runlevels 3, 4, and 5.</note>
<p>
When you reboot your system, the <e>alsa</e> init
script will properly save and restore your volume settings.
</p>
</body>
</section>
<section>
<title>Standard Kernel Sound Modules</title>
<body>
<p>Out of the box, Gentoo Linux doesn't support the standard
kernel modules.  You'll have to recompile the kernel. (Generally,
we prefer Alsa over the standard modules since they perform
better and have niftier features, see above.)
For standard kernel sound, install the <path>linux-sources</path>
ebuild:</p>
<pre>
# <i>cd /usr/portage/sys-kernel/linux-sources</i>
# <i>emerge linux-sources-x.y.z.ebuild</i>
</pre>
<p>The linux-sources ebuild installs the sources into /usr/src,
and you can then compile the kernel (and your sound module)
in the usual manner 
(<uri>http://www.linuxdoc.org/HOWTO/Kernel-HOWTO.html</uri>).
If you choose to compile the sound driver as a module (not
compile it directly into the kernel), they you need to add
the module name (without the .o extension) to <path>/etc/modules</path>
(rc6+ users) or
<path>/etc/rc.d/config/modules</path> (pre-rc6 users).</p>
<p>
Reboot the machine.  With any luck the appropriate sound driver 
should now be loaded.  To actually produce sound, a few more steps
are required.
</p>
<pre>
# <i>cd /dev</i>
# <i>/usr/sbin/MAKEDEV audio</i>
#
# <i>cat /usr/share/sounds/pop.wav &gt; /dev/dsp</i>
# <i>emerge media-sound/sox</i>
# <i>play /usr/share/sounds/pop.wav</i>
</pre>
<p>
If any sound at all results from cat'ing the .wav file to 
<path>/dev/dsp</path>, then sound is probably working.
By emerge'ing sox one can use the <c>play</c> command to 
play .wav files (and, unlike using <c>cat</c>, the .wav file
should sound good when using <c>play</c>).
</p>
<!-- 
found that when running <e>devfs</e> the /dev/MAKEDEV script
would be missing.  Help? Well, you shouldn't need to run MAKEDEV if you're
using devfs (maybe to get /dev/dsp created?), but if you need it, its real home is in /usr/sbin (/dev/MAKEDEV is
a symlink.  I changed the text to reflect this. [drobbins]
-->
</body>
</section>
<section>
<title>Sound and KDE</title>
<body>
<p>
KDE has some nice sound utilities, including the KDE sound mixer 
<c>kmix</c>.  
</p>
<pre>
# <i>emerge --pretend kde-base/kdemultimedia</i>
 
These are the packages that I would merge, in order.
 
Calculating dependencies...... done!
[ebuild N  ] media-sound/esound-0.2.22-r2 to /
[ebuild N  ] media-libs/libogg-1.0_beta4 to /
[ebuild N  ] media-libs/libvorbis-1.0_beta4 to /
[ebuild N  ] dev-libs/glib-1.2.10 to /
[ebuild N  ] x11-libs/gtk+-1.2.10-r1 to /
[ebuild N  ] kde-base/kdemultimedia-2.1.1 to /

# <i>emerge kde-base/kdemultimedia</i>
# <i>kmix</i>
</pre>
<note>If kmix cannot find a mixer, then it probably thinks you don't
have sound support.  Log out and remove ~/.kde and ~/Desktop (the latter
may not be necessary), then log in again.  This time it should find 
the sound mixer properly.
</note>
</body>
</section>
</chapter>

<chapter>
<title>Mail</title>
<section>
<title>Postfix -- Install and Configure</title>
<body>
<p>
I happen to like the <c>postfix</c> mail system because it emulates
<c>sendmail</c> without the considerable nightmare of having to 
configure <c>sendmail</c>.  While we're at it we'll also install 
<c>mutt</c>, a mail reader, so that we can test out our 
<c>postfix</c> configuration.
</p>
<pre>
# <i>emerge --pretend net-mail/postfix net-mail/mutt</i>

These are the packages that I would merge, in order.
 
Calculating dependencies... done!
[ebuild N  ] dev-libs/libpcre-3.4-r1 to /
[ebuild N  ] net-mail/mailbase-0.00-r1 to /
[ebuild N  ] net-mail/postfix-20010228.2 to /
[ebuild N  ] net-mail/mutt-1.3.22.1 to /

# <i>emerge net-mail/postfix net-mail/mutt</i>
</pre>
<p>
If you only intend to use your mail server for sending mail,
then postfix is already set up for you.  Otherwise, you'll 
want to edit <path>/etc/postfix/main.cf</path>.  The 
<path>main.cf</path> file is reasonably well documented, and
the defaults are reasonable for a standalone machine.  If
your workstation is directly on the internet (i.e., having
its own non-private IP address and DNS name) then the only
change you will probably have to make is enabling postfix to receive
mail.
</p>
<pre caption="turning on mail reception in main.cf">
# RECEIVING MAIL

# The inet_interfaces parameter specifies the network interface
# addresses that this mail system receives mail on.  By default,
# the software claims all active interfaces on the machine. The
# parameter also controls delivery of mail to user@[ip.address].
#
#inet_interfaces = all
#inet_interfaces = $myhostname
#inet_interfaces = $myhostname, localhost
<i>inet_interfaces = $myhostname, localhost</i>
<i>mydestination = $myhostname, localhost.$mydomain</i>
</pre>


</body>
</section>
<section>
<title>Postfix Testing (with Mutt)</title>
<body>
<p>
Let's see if it works.
</p>
<pre>
# <i>postfix check</i>
postfix-script: warning: creating missing Postfix pid directory
postfix-script: warning: creating missing Postfix incoming directory
postfix-script: warning: creating missing Postfix active directory
postfix-script: warning: creating missing Postfix bounce directory
postfix-script: warning: creating missing Postfix defer directory
postfix-script: warning: creating missing Postfix deferred directory
postfix-script: warning: creating missing Postfix flush directory
postfix-script: warning: creating missing Postfix saved directory
postfix-script: warning: creating missing Postfix corrupt directory
postfix-script: warning: creating missing Postfix public directory
postfix-script: warning: creating missing Postfix private directory
# <i>postfix start</i>
postfix-script: starting the Postfix mail system
# <i>newaliases</i>
# <i>mutt -x root</i>
/root/.maildir does not exist. Create it? ([y]/n): <comment>[answer y]</comment>
To:  &lt;root&gt;
Subject: test
(End message with a . on a line by itself)
test
.

# <i>mutt</i>
<comment>[You should see your message]</comment>
</pre>
<p>
By using <c>postfix check</c> we make sure that <path>main.cf</path>
parses properly and a number of important directories are created.
Running <c>postfix start</c> then starts the mailer, and 
<c>newaliases</c> sets up the system mail aliases.  I then used
<c>mutt</c> (in <c>mailx</c>, or old-fashioned <c>mail</c>, mode)
to send a message to myself on the local machine.  Along the way
<c>mutt</c> creates the user's (root's, in this case) mail spool
directory, <path>~/.maildir</path>.  Running <c>mutt</c> in
full interactive mode then showed me my message, so at least local
sending and delivery is working.  I then sent mail to one of my
non-local email addresses (not shown) and verified that the mail
did, indeed, get there.
</p>
<warn>If you send mail to an account using the default 
<path>main.cf</path> from a machine on a private network, then
it is possible you will never see it.  Many mail servers automatically
reject mail coming from a source that can't be reached by reverse-DNS.
</warn>
<p>
Assuming everything is working, then it's time to set up postfix
so that it starts at boot time (unless you're running rc6+, in which
case it is already set up for you).
</p>
<pre caption="Pre-rc6 users only!">
# <i>postfix stop</i>
postfix-script: starting the Postfix mail system
# <i>rc-update add postfix</i>
Adding postfix to runlevel 2 3 4
# <i>/etc/rc.d/init.d/postfix start</i>
Starting postfix......     [  ok  ]
</pre>
<note>Veteran <c>sendmail</c> or <c>postfix</c> junkies may
be more used to storing mail in 
<path>/var/spool/mail</path> instead of in the user directories,
and that mail is then stored in <e>mbox</e> format instead of
in <e>maildir</e> format.  It is not all that hard to reconfigure
<c>postfix</c> and <c>mutt</c> to use the standard unix mailbox
system (<e>mbox</e>) format instead.  Edit <path>/etc/postfix/main.cf</path>
to comment out <i>home_mailbox</i> and uncomment
<i>mail_spool_directory = /var/spool/mail</i>.
Make the mail spool directory with 
<c>mkdir -p /var/spool/mail</c> and restart <c>postfix</c>.
That will take care of the mailer, for <c>mutt</c> you just
have to edit <path>/etc/mutt/Muttrc</path> to use <e>mbox</e>
with <i>set mbox_type = mbox</i> 
and the <path>/var/spool/mail</path> directory
with <i>set spoolfile=/var/spool/mail</i>.
</note>
</body>
</section>
</chapter>

<chapter>
<title>Printing</title>
<section>
<title>Simple printing -- PDQ</title>
<body>
<p>
For simple systems where you don't need <c>samba</c>
support the PDQ printing system is nice and simple.
</p>
<pre>
# <i>emerge net-print/pdq</i>
# <i>xpdq</i>
</pre>
<p>
Just click on <path>Printer/Add printer</path> and add your
printer.  If your type of printer isn't listed, see
<uri>http://www.linuxprinting.org</uri>, and you can
generate the required files from their web site.  You will
want to click on "Driver options" to further finish configuring
the printer in <c>xpdq</c>.  Any printers set up by running
<c>xpdq</c> as root will be available to all users.  That's all
it takes!
</p>
</body>
</section>
<section>
<title>Full-fledged printing -- CUPS</title>
<body>
<p>
CUPS is a much larger print spooler that is fully suitable for
use as a large-scale print server.  Fortunately it is pretty easy
to set up, since most of the configuration can be done using CUPS'
built-in web server.  Although CUPS is nominally a System V
print spooler (meaning that it uses the <c>lp</c> series of
commands) it emulates all of the <c>lpr</c> commands as
well.
</p>
<pre>
# emerge --pretend net-print/gimp-print-cups
These are the packages that I would merge, in order.
 
Calculating dependencies.. done!
[ebuild N  ] net-print/cups-1.1.10-r6 to /
[binary N  ] net-print/gimp-print-cups-4.1.1 to /
# emerge gimp-print-cups-4.1.1.ebuild
# rc-update add cupsd default
 * cupsd added to runlevel default...
 * Caching service dependencies...                                        [ ok ] 
 * rc-update complete.
# /etc/init.d/cupsd start
Starting Common Unix Printing System...... [  ok  ]
# konqueror localhost:631
</pre>
<note>Pre-rc6 users need to use <c>rc-update add cupsd</c> and
<c>/etc/rc.d/init.d/cupsd start</c> instead of what is given above.</note>
<p>
The <c>gimp-print-cups</c> package is a set of printer drivers for cups,
which is useful because the cups package itself includes drivers only
for HP and Epson printers.
Building <c>gimp-print-cups</c>
builds cups as a dependency.  Once cups is built
we add its init scripts to the default runlevel using 
<c>rc-update</c>, and then we turn on the cups daemon by starting
the init script.
</p>
<p>
Configuring cups simply requires using a web browser to connect to the
web server that cups runs on the localhost network on port 631.
[Note that because the cups web server runs on localhost and <e>not</e>
on any of the ethx interfaces, it is reasonably secure.  Of course, that
also means that it is difficult to administer cups remotely in any
sort of nice fashion (the command-line <c>lpadmin</c> command
would be an option, but it is also a considerable nightmare).  Fortunately,
the cups web server renders quite well in <c>lynx</c>, so it can be 
administered from a terminal window.]  Once you connect to the web
interface, click (or its equivalent if using <c>lynx</c>) on "Do
Administrative Tasks".  You will be asked for the cups account name
(use "root") as well as for the root password.  Again, since the web server
exists only on localhost, you don't have to worry about that information 
being transmitted on the internet.  To add a printer click on "Add Printer",
and follow the directions.  Help may be obtained by clicking on "Help", and
then reading the Software Administrator's Manual.  If you find that you
lack the appropriate printer driver then you can create one by heading
to the rather impressive <uri>http://www.linuxprinting.org</uri> site.
</p>
</body>
</section>
</chapter>

<chapter>
<title>Samba</title>
<section>
<body>
<p>
Samba is a remarkable package that lets your linux box share files
and printers with MS Windows machines.  For more detailed information read
the Samba articles by Daniel Robbins at 
<uri>http://www.ibm.com/developerworks</uri>.
</p>
<pre>
# <i>emerge net-fs/samba</i>
# <i>rc-update add samba default</i>
# <i>cd /etc/smb</i>
# <i>cp /etc/smb/smb.conf.eg /etc/smb/smb.conf</i>
# <i>nano /etc/smb/smb.conf</i>
</pre>
<note>Pre-rc6 users will need to use <c>rc-update add samba</c> (without the "default").</note>
<pre caption="smb.conf -- workgroup">
# workgroup = NT-Domain-Name or Workgroup-Name, eg: REDHAT4
   workgroup = MYGROUP <comment>[change to match your workgroup]</comment>
</pre>
<pre caption="smb.conf -- printing with cups">
# It should not be necessary to specify the print system type unless
# it is non-standard. Currently supported print systems include:
# bsd, sysv, plp, lprng, aix, hpux, qnx
;   printing = bsd
    printing = cups
</pre>
<pre caption="smb.conf -- encryption">
# You may wish to use password encryption. Please read
# ENCRYPTION.txt, Win95.txt and WinNT.txt in the Samba documentation.
# Do not enable this option unless you have read those documents
  encrypt passwords = yes
</pre>
<p>
I have fairly minimal Samba needs.  I just want to be able to share
files between my linux and windows machines, and I want to use my
linux box as a print server (using <c>cups</c>).  After installing,
it suffices to make a few minor edits to the <path>/etc/smb/smb.conf</path>
file.  Specifically, the <e>workgroup</e> variable needs to match the
workgroup for the windows network (I usually use "OLYMPUS", but "WORKGROUP"
is the default on windows if I
remember correctly), <e>printing</e> needs to be <e>cups</e>
instead of <e>bsd</e>, and the <e>encrypt passwords = yes</e> line needs
to be uncommented.  Windows machines use encrypted passwords by default,
so that last change is essential unless you want to hack the Windows 
registry on all of your windows machines <comment>[not recommended]</comment>.
Unfortunately, Windows uses a different encryption method for passwords than
does Linux, so you have to maintain a separate password file for samba.
</p>
<pre>
# <i>smbpasswd -a grant</i> <comment>[Replace "grant" with your user name]</comment>
New SMB password:
Retype new SMB password:
startsmbfilepwent_internal: unable to open file /etc/smb/private/smbpasswd. Error was No such file or directory
Added user grant.
</pre>
<note>
Before adding a user to samba's password list that user must first be
listed in <path>/etc/passwd</path>.
</note>
<p>
For each user that you want to be able to use samba from a windows machine
you need to run the <c>smbpasswd</c> command.  Samba stores passwords in
<path>/etc/smb/private/smbpasswd</path>, which will be created for you 
the first time you run the <c>smbpasswd</c> command, albeit with the 
cosmetic "error" seen above.
</p>
<pre>
# <i>/etc/init.d/samba start</i>
Starting samba...        [  ok  ]
</pre>
<note>Pre-rc6 users will use <c>/etc/rc.d/init.d/samba start</c> instead.</note>
<p>
Start samba, and you should be able to connect to your Gentoo Linux
box from any of your windows machines and see the home directory for
whatever user you connect as and also whatever printers you have set up.
If you can't connect, take a look at 
<path>/usr/share/doc/samba-2.2.0a/textdocs/DIAGNOSIS.txt.gz</path>
for additional help.
</p>
</body>
</section>
</chapter>

</guide>