Вы находитесь на странице: 1из 846

Gentoo Linux

1.3 01.11.2007

2007 .


Gentoo Linux..........................................................................................................................1
(changelog)......................................................................................18
: .....................................................................................................................20
.....................................................................................................20
.........................................................................................................21
Linux...........................................................................................22
UNIX.................................................................................................................................22
.......................................................................................................................22
..................................................................................................................28
UNIX....................................................................................29
GNU/Linux............................................................................................................................30
Linux ().........................................................................................................................33
...........................................................................................................................33
.............................................................................................................................34
......................................................................................................................35
.......................................................................................................35
....................................................................................................................36
...............................................................................................................37
.........................................................................................................................38
............................................................................................................................38
BSD......................................................................................................................................38
BSD...................................................................................................................38
GNU General Public License...............................................................................................40
..........................................................................................................................40
...........................................................................................................................40
GPL v3.............................................................................................................................41
GNU GPL.............................................................................................................42
Linux : ....................................................43
..................................................................................................................43
................................................................................................................43
..................................................................................46
......................................................................................................47
System V shared memory...............................................................................................48
.........................................................................................................49
................................................................................................................52
...........................................................................53
...................................................................................53
................................................................................54
........................................................................................55
.........................................................................................55
sysctl............................................................................................................56
....................................................56
GNU libc..................................................................................57
LD, Shared Library, SO ...........................................................58
/proc..................................................60
......................................................................................................60
/dev...................................................................................................................61
/dev......................................................................62
DevFS.............................................................................................................63
UDEV.............................................................................................................64
2

......................................................................................................65
IDE ....................................................67
SCSI-..........................................68
SATA IDE PATA............................................................69
Logical Volume Manager.............................................................................................70
Sotware RAID..............................................................................................................74
Device mapper............................................................................................................77
Host-RAID, RAID- ......................................77
......................................................................................................78
IP .................................................................................80
............................................................................................................82
.............................................................................82
...........................................83
.............................................................................................84
..........................................................................................................84
iptables...............................................................................85
, NSS PAM..................................................................87
X11 --...........................................................................................................89
- X11.........................................................................89
...........................................................................90
X11. ...............................................................................90
X11. ..............................................91
X11. FreeType XFT.....................................................................................92
X11. ..........................................................................................92
X11. ...............................................................................93
X11. .....................................................................................93
...................................................................................................................93
Linux...................................................................................................96
.........................................................................................96
.............................................................................................96
Unix-.......................................................98
Linux..........................................................................................99
Ext2fs...........................................................................................................................99
...................................................................99
ReiserFS....................................................................................................................100
Ext3fs.........................................................................................................................101
XFS............................................................................................................................102
.....................................................................................................102
.............................................................................................103
...............................................................................................105
Linux : ...........................................106
Gentoo Linux..................................................................................................................109
?......................................................................................................109
Gentoo Linux..................................................................................................................110
Gentoo............................................................................................................110
Gentoo......................................................................................................111
Gentoo ......................................................................................113
X.org..................................................................................................................114
Portage................................................................................................................114
Portage..............................................................................115
?.........................................................................115
?...................................................................................116
...............................................................................................116
....................................................................................117
3

Gentoo Linux: ..............................................................................117


Gentoo Linux.....................................................................................................117
............................................................................................118
- .............................................................................................123
- ....................................................................125
- Gentoo.......................................................................................126
: ....................................................................................128
Gentoo Linux x86....................................................138
......................................................................................................138
.............................................................................................................138
.......................................................................................................138
.........................................................................................................139
Gentoo...........................................................................139
............................................................................................................140
......................................................................................................140
......................................................................................141
..................................................................................................141
grub................................................................................................................................141
# genkernel..............................................................................141
# ( initrd)..........................................................141
# ..........................................................141
lilo...................................................................................................................................142
# , genkernel..............................................142
# genkernel..............................................................................142
# ...........................................................................................142
...................................................................................................142
Gentoo Linux.....................................143
1. ..................................................................................................143
2. Smart BootManager......................143
3. Knoppix..............................................................................144
4. Stage 1 ...............................................................145
5. PXE.....................................................146
6. Gentoo Linux-............................................150
Gentoo/x86...................................................................153
1. ...............................................................................................................153
2. ..........................................................................................153
3. ..............................................................................................156
4. /......................................................................................157
......................................................................157
Gentoo Linux x86................................................................................159
A. Gentoo...................................................................................................162
1. Gentoo Linux......................................................................................162
1.a. ...........................................................................................................162
2. .....................................................164
2.a. ..................................................................................164
2.b. - Gentoo.............................................................164
2.c. , Gentoo....................166
3. .........................................................................................................170
3.a. .............................................................170
3.b. .............................................................171
3.c. .....................................................................................173
DHCP.............................................................................................174
.......................................................................175
...........................................................................176
4

ifconfig route................................................................................177
4. ...................................................................................................178
4.a. .......................................................178
4.b. ...............................................................179
4.c. fdisk .................................................180
4.d. ............................................................................184
( !)...........................................................................184
4.e. ...................................................................................................185
5. Gentoo..............................................................186
5.a. .................................................................................186
5.b. : .......................187
5.c. : .........188
5.d. ............................................................................189
5.e. ...............................................................190
6. Gentoo.......................................................................192
6.a. .......................................................................192
6.b. Portage............................................................................................194
USE...................................................................................196
7. ........................................................................................................197
7.a. .....................................................................................................197
7.b. .....................................................................198
7.c. : ...................................................................198
7.d. : genkernel.......................................................202
7.e. ......................................................................................................203
8. .............................................................................204
8.a. .........................................................................204
(JohnBat26): /etc/fstab:...............................................205
8.b. ................................................................................................205
8.c. .........................................................................................208
9. ..................................................................209
9.a. ........................................................................................209
9.b. .............................................................209
9.c. : cron.............................................................................210
9.d. : ..............................................................210
9.e. .............................................210
9.f. .............................................................................................211
10. ........................................................................212
10.a. ............................................................................................212
10.b. : GRUB..........................................................213
10.c. : LILO..............................................................217
10.d. ...................................................................................219
11. Gentoo.............................................................................219
11.a. ...................................................................219
12. ?..........................................................................................220
12.a. ..................................................................................................220
12.b. Gentoo ........................................................................................221
B. Gentoo...........................................................................................................221
1. Portage..................................................................................................221
1.a. Portage...........................................................................221
1.b. ..............................................................................................222
1.c. ...................................................222
1.d. Portage ....................................................................................226
2. USE-................................................................................................................230
2.a. USE-?.....................................................................................230
5

2.b. USE-............................................................................231
2.c. USE- .......................................................................233
3. Portage...............................................................................................234
3.a. Portage.......................................................................................234
3.b. ..........................................................................235
3.c. ................................................................................236
3.d. .........................................................................237
4. .......................................................................................238
4.a. ..................................................................................................238
4.b. rc-update.................................................................................241
4.c. ...............................................................................................242
4.d. ...........................................................242
4.e. .........................................................245
5. ..................................................................................................247
5.a. ..........................................................................................247
5.b. ..........................................................248
5.c. ............................................................250
C. Portage..........................................................................................................251
1. .....................................................................................................251
1.a. Portage...................................................................................................251
1.b. .............................................................................................252
1.c. ................................................................253
1.d. ..............................................................................................254
2. .......................................................................254
2.a. Portage............................................................................................254
2.b. ............................................................................................254
2.c. ...............................................................255
2.d. ....................................................................................255
2.e. Gentoo.............................................................................................256
2.f. Portage............................................................................................257
3. .....................................................257
3.a. ............................................................................257
3.b. .................258
3.c. .....................................................258
4. Portage........................................................................259
4.a. etc-update...........................................................................................................259
4.b. dispatch-conf......................................................................................................261
4.c. quickpkg..............................................................................................................261
5. ..................................................................261
5.a. Portage...............................................261
5.b. ebuild..............................262
5.c. , Portage......................................................263
6. ebuild..............................................................................................263
6.a. Emerge Ebuild.................................................................................................263
6.b. ............................................................................263
6.c. Ebuild.............................................................265
6.d. .........................................................................266
D. Gentoo........................................................................................266
1. ..............................................................................................266
1.a. ...................................................................................266
2. ..........................................................................................268
2.a. ..................................................................................268
2.b. ......................................................................................270
2.c. .......................................................................270
6

3. ...................................................................................271
3.a. ...............................................................................................271
3.b. ................................................................................272
3.c. DHCP..................................................................................................................272
3.d. ADSL......................................................................................................274
3.e. APIPA ( IP-)............................................274
3.f. ..............................................................................275
3.g. ( 802.1d)........................................................275
3.h. MAC-.........................................................................................................276
3.i. ........................................................................................276
3.j. ( 802.1q)............................................................276
4. ..................................................................................................277
4.a. ...........................................................................................................277
4.b. WPA.................................................................................................277
4.c. Wireless tools......................................................................................279
4.d. ESSID............................................................283
5. ...............................................................................283
5.a. -...............................................................283
5.b. - wireless tools................................................................285
6. ....................................................................................................286
6.a. ............................................................................................286
6.b. ifplugd.................................................................................................................286
Gentoo...................................................................287
.......................................................................................................................287
A. ............................................................................................287
1. ...........................................................287
1.a. ............................................................................287
1.b. /....................................................................287
1.c. ...........................................................................288
1.d. root........................................................................................288
1.e. .................................................................................289
2. ...............................................................................................290
2.a. USE-....................................................................................................290
2.b. GRUB ...............................................................................290
2.c. LILO ..................................................................................291
2.d. ..................................................................291
3. .................................................................................................292
3.a. .......................................................................................................292
3.b. : Syslogd...........................................................................292
3.c. Metalog...........................................................................................................294
3.d. Syslog-ng.......................................................................................................294
3.e. Logcheck.....................................................296
4. .....................................................................................296
4.a. ..............................................................................296
5. /....................................................................297
5.a. /etc/security/limits.conf...................................................................................297
5.b. /etc/limits........................................................................................................297
5.c. .............................................................................................................298
5.d. /etc/login.defs.................................................................................................299
5.e. /etc/login.access.............................................................................................299
6. ....................................................................................300
6.a. , ......................................................300
6.b. , ...........................300
6.c. SUID/SGID.........................................................................................300
7

6.d. SUID/SGID- .........................................................301


7. PAM.......................................................................................................................302
7.a. PAM................................................................................................................302
8. TCP..................................................................................................303
8.a. TCP...........................................................................................303
9. ..............................................................................................303
9.a. ......................................................................303
9.b. proc................................................................................304
9.c. Grsecurity.......................................................................................................305
9.d. Kerneli............................................................................................................306
9.e. ................................................................................306
10. ..........................................................................................306
10.a. Apache.........................................................................................................306
10.b. Bind..............................................................................................................306
10.c. Djbdns..........................................................................................................307
10.d. FTP...............................................................................................................307
10.e. Mysql............................................................................................................307
10.f. Proftpd...........................................................................................................308
10.g. Pure-ftpd.......................................................................................................308
10.h. Vsftpd...........................................................................................................309
10.i. Netqmail........................................................................................................309
10.j. Samba...........................................................................................................309
10.k. ssh................................................................................................................310
10.l. xinetd..................................................................................311
10.m. X..................................................................................................................312
11. ..............................313
11.a. .................................................................313
11.b. Linux................................................................314
12. ..........................................................................................315
12.a. ......................................................................................315
12.b. ...............................................................................315
12.c. ..........................................................................................................316
12.d. ...................................................................................316
12.e. Iptables.........................................................................................................317
12.f. Squid.............................................................................................................324
12.g. .......................................................................................................328
13. ..................................................................................328
13.a. AIDE (Advanced Intrusion Detection Environment).....................................328
13.b. Snort.............................................................................................................331
13.c. chkrootkit.................333
14. ...................................................................................333
14.a. ............................................................................333
Gentoo Linux................................................................................................336
Gentoo..........................................................................336
1. Gentoo ...........................................................................................336
2. ...............................................................................337
3. ..............................................................338
HOWTO .......................................................................340
/var/lib/portage/world .........................................................340
profile ..................................................................................................340
USE- ..............................................................................................................340
( toolchain) ....................340
emerge -U -u ...............................341
toolchain .........................................341
8

. ....................................................................................342
. ....................................................................342
. ..........................................................................................343
Gentoo Linux GCC.......................................................344
1. ..............................................................................................................344
2. ........................................................................344
3. GCC-3.3 3.4 .....................................................345
4. GCC ...............................................................347
5. ..................................................................................................349
Gentoo X.Org.................................................................................................................350
X- 6.X.................................350
1. X Window Server?...............................................................................350
2. Xorg.....................................................................................................351
3. Xorg....................................................................................................352
4. xorg.conf.............................................................................................354
5. ................................................................................................................356
X- 7.X (.).......................357
Introduction................................................................................................................357
Preparation ...............................................................................................................357
Nvidia Drivers .......................................................................................................357
Masking Xorg 7.1 (optional)..................................................................................357
Backup .................................................................................................................358
Restoring the backup ...........................................................................................358
Uninstall old X.org ................................................................................................358
Emerge Modular X.org .............................................................................................359
Device Drivers ......................................................................................................359
Installation ................................................................................................................359
GL Issues...................................................................................................................360
Configuration file locations have changed ...............................................................362
Other problems and solutions ..................................................................................362
XkbOptions....................................................................................................................363
"XkbOptions" ............................................................................................363
.........................................................................................................................363
HOWTO Xorg and Fonts (.).....................................................................................364
HOWTO.....................................................................................364
.....................................................................................................364
DPI.......................................................................................364
Windows/Mac Linux.................365
..........................................................................365
(Hinting)...........................................................................366
......................................................................................................................................367
................................................................367
/etc/X11/xorg.conf......................................................................................................370
: /etc/X11/xorg.conf ( ).............................................372
.................................................................................................373
Mozilla Firefox and Thunderbird................................................................................373
Mozilla Firefox 1.0+...............................................................................................373
Mozilla Thunderbird 0.7, 1.0.2 ................................................................374
..........................................................................375
, Linux Konsole ........................................376
, .............................376
startx.......................................................................................377
XEmacs.....................................................................................................................377
...................................................................................................377
9

........................................................................................................377
( JohnBat26), : ~/.fonts.conf:...........................................378
nVidia Gentoo Linux.....................................................380
1. ...................................................................................................................380
2. ......................................................................................................380
.........................................................................................380
...............................................................................381
........................................................................383
X-...............................................................................................383
video...........................................................384
................................................................................................384
nvidia..................................................................................385
nVidia Settings.........................................................385
3. .................................................................................................................385
2D 4 ...................................................385
, no such device .............386
4. ..........................................................................................386
...........................................................................................................386
.........................................................................................386
X-.......................................................................386
ATI Gentoo Linux......................................................388
1. ..............................................................................................388
2. ..................................................................................................................389
3. ................................................................................390
HOWTO fbsplash...............................................................................................................391
......................................................................................................................391
gensplash?...............................................................................................391
fbsplash (framebuffer splash)?................................................................391
frame buffer?........................................................................391
fbsplash splashutils....................................................................................392
............................................................................................392
.................................................................................................392
()...................................................................................392
/ ( genkernel)....................393
splashutils...............................................................................................393
/ ( )..............................................393
initramfs ..........................................................................................393
initramfs?..................................................................................................393
initramfs ........................................394
initramfs ..................................................................394
gensplash............................................................395
bootsplash gensplash............................................................396
gensplash.........................................................396
.................................................................................................397
......................................................................................................397
Grub....................................................................................397
Lilo......................................................................................398
.............................................................................398
Gensplash .......................................................................398
.............................................................................................399
3......................................................................399
.......................................................................................................399
/usr ............................................................................399
........................................................................399
10

..........................................................................................................................400
Hardware 3D Acceleration Guide (.)..........................................................................401
1. Introduction................................................................................................................401
2. Install Xorg and configure your kernel.......................................................................402
3. Install X11-DRM and configure direct rendering.......................................................403
4. Test 3D acceleration..................................................................................................404
5. Using the CVS sources..............................................................................................404
6. Tweak your performance...........................................................................................405
7. Troubleshooting.........................................................................................................406
8. Acknowledgments......................................................................................................407
9. References.................................................................................................................407
HOWTO KDE..............................................................................................408
1. K Desktop Environment?....................................................................408
2. KDE.........................................................................................................408
3. KDE.........................................................................................................411
GNOME................................................................................413
1. GNOME?..............................................................................................413
2. GNOME...............................................................................................413
UTF-8 Gentoo......................................................................................415
1. ...................................................415
2. .................................................................................................................415
3. UTF-8 Gentoo Linux...........................................................................417
4. ......................................................................................419
Gentoo Linux......................................................426
1. ...................................................................................................................426
2. ..............................................................................427
3. locale.........................................................................................430
4. .......................................................................................432
5. X............................................................................433
5.1: /................434
Gentoo Linux ALSA.....................................................................................437
1. ...................................................................................................................437
2. ALSA.......................................................................................................437
3. / ALSA...............................................................................442
ALSA USE..............................................................................................................445
4. ALSA......................................................................................447
Java Gentoo......................................................................451
1. JDK/JRE..................................................................................................451
2. JDK/JRE.......................................................................451
3. .......................................................................................453
4. ....................................................................................................453
Gentoo GPRS.................................................................................................................454
GPRS USB ().................................................................................454
GPRS Linux.............................................................................................457
..................................................................................................................457
................................................................................................................457
........................................................................................................457
.................................................................................................................459
............................................................................................460
................................................................460
..............................................................................................................461
, Toonel. (Linux)..........................................................461
....................................................................462
GPRS KPPP........................................................................................................463
11

GPRS Bluetooth.................................................................................................465
HOWTO Internet.......................................................................................466
VPN.............................................................................................................466
...................................................................................466
..................................................................................................466
...................................................................................................467
pptpconfig...........................................................................467
..........................................................................................468
pppoe..................................................................................................................469
DIAL-UP..............................................................................470
..............................................................................................470
.....................................................................................470
USB....................................................................................470
Win ..........................................................................................................470
.....................................................................................470
, ..........................................471
.................................................................471
PPP ....................................................................471
.......................................................................471
chat-script..................................................471
....................................................................................................472
chestnut-dialer.......................................................................................................472
Call back.................................................................................................473
GPRS..................................................................................473
............................................................................................473
USB-..................................................................473
COM-.................................................................474
Bluetooth.................................................................................474
IrDA.........................................................................................475
CDMA (SKYLINK)...............................................................476
.......................................................................................476
.................................................................476
Power Management Guide (.)....................................................................................477
1. Introduction................................................................................................................477
2. Prerequisites..............................................................................................................478
3. CPU Power Management..........................................................................................482
4. LCD Power Management..........................................................................................485
5. Disk Power Management...........................................................................................487
6. Power Management For Other Devices....................................................................489
7. Sleep States: sleep, standby, and suspend to disk...................................................491
8. Troubleshooting.........................................................................................................494
udev Gentoo........................................................................................497
1. udev?........................................................................................................497
2. udev Gentoo.............................................................................499
3. ..............................................................................................500
4. .....................................................................502
Gentoo LDAP-DNS Guide (.)....................................................................................503
1. Introduction................................................................................................................503
2. Configuring LDAP-DNS.............................................................................................503
3. Configuring OpenLDAP.............................................................................................504
4. Testing the Installation...............................................................................................505
Samba PDC LDAP..............506
..........................................................................................506
OpenLDAP.....................................................................................................................506
12

OpenLDAP...............................................................................506
OpenLDAP....................................................................................507
SAMBA..........................................................................................................................508
OpenLDAP...............................................................................................508
SAMBA.............................................................................................509
LDAP............................................................512
......................................................................................514
..........................................................................................514
..................................................................................................515
...................................................................................515
..........................................................................................516
..............................................................516
......................................................................................................................516
....................................................................517
1. ...................................................................................................................517
2. postfix...................................................................................518
3. Courier-imap..............................................................................................................519
4. Cyrus-sasl..................................................................................................................520
5. SSL- Postfix Apache.................................................................520
6. SSL SASL Postfix.............................................................521
7. MySQL.......................................................................................................................522
8. Apache phpMyAdmin..............................................................................................523
9. Vmail-.................................................................................................524
10. MySQL ..................................525
11. Squirrelmail..............................................................................................................528
12. Mailman...................................................................................................................528
13. Anti-Virus.................................................................530
14. ...............................................................................................................530
15. Troubleshooting.......................................................................................................531
qmail/vpopmail...........................................533
1. ...................................................................................................................533
2. qmail (" ")...............................................................................533
3. vpopmail.....................................................................................................................535
4. Courier POP/IMAP.....................................................................................................536
5. qmail ( ).................................................................................537
6. Horde / IMP............................................................................................538
7. .........................................................................................539
8. .................................................................................541
Mutt........................................542
1. E-Mail....................................................................................................542
2. Fetchmail...................................................................................................................542
3. Procmail.....................................................................................................................543
4. Mutt..............................................................................................545
5. SMTP.........................................................................................................................547
Gentoo Linux.................................549
1. ...................................................................................................................549
(Prelink)
? .....................................................................................................................549
.................................................................................................................549
2. ...................................................550
................................................................................................550
.................................................................................................................551
3. ................................................................................551
....................................................551
13

4. .........................................................552
5. ..............................................................................................................554
.......................................................555
1. devfs?.......................................................................................................555
.................................................................................................................556
...................................................................................................................556
2. .......................................................................557
3. .................................................................558
4. , .............................................................559
WIKI.....................................................................................................................562
H ...............................................................................562
IDE hdparm....................................................577
CD/DVD.........................................................................................................581
DVD..............................................................................................................585
Portage...........................................................................................................592
Portage NFS...................................................................................................592
Portage...................................................................................................596
Portage Overlay.........................................................................................................600
deltup....................................................................603
. 604
....605
.................................................................................607
...............................................................................611
...........................................................................................................................612
MS Windows -............................................................................612
Udev..........................................................................................................................615
CFLAGS ......................617
nano..........................................................................................................620
Udev ....................................................................621
glibc...................................................................................................624
USB-flash..........................................................................................629
- NTFS ntfs-3g..................................632
.........................................................................................................634
Apache2..................................................................................................634
iptables ......................................................................639
iptables................................................................................645
.................................................................................667
vsftpd......................................................................................................675
Jabber Server...........................................................................................................678
Counter-Strike........................................................................679
Samba Win2k.....................................................................681
Samba PDC LDAP......685
..................................................................................701
X..................................................................................................................723
X............................................................................723
X...........................................................................728
Xorg X11 .........................................................................................730
Xorg. ..............................................................................734
Xgl...........................................................................................................735
XGL............................................................................................................................737
...........................................................762
Cedega 5.1................................................................................................................763
Windows-.............................................................................................764
.......................................................................................769
14

.........................................................................................773
ccache emerge..............................................................................781
Keymap..........................................................................................................................781
............................................................................................783
2. ...................................................................................................................783
Gentoo, ?.........................................783
Gentoo ?.............................................................................783
3. ..................................................................................................................783
, "-O9 -ffast-math
-fomit-frame-pointer". ? .................................................................783
root ( )?.........................784
?.................................................................784
root su?..................784
devfs?...............................................................................................785
Gentoo ? .................................................785
(), ?...............................785
- , ?................................786
ISO -?.............................................................786
/ ?............................787
. ? .....787
Windows GRUB LILO, .
? ....................................................................................................................788
Gentoo, Stage1 Stage2?.............................789
4. ..............................................................................................789
?......................................................................789
./configure . ?.........................790
emerge, ?..............................790
, rsync ?.............................................................790
.
, ? .......................................790
/usr/portage/distfiles. ? ....791
/var/tmp/portage?
/var/tmp/portage? .................................................................................................791
5. .........................................................................................................791
?....................................791
crontab?...........792
numlock ?......................................................................792
?.......................................................792
X - root' ( su).............................793
6. ........................................................................................................793
ReiserFS - , ...................................793
7. ................................................................................................................793
?................................................................793
?............................................793
. ? .....794
8. .....................................................................................................................794
Gentoo Linux?...............................................................794
CD Gentoo Linux?.....................................................................794
. ?........................................795
............................................................................795
...................................................................................................................795
? ........................................................................................795
? ..............................................................................................796
root ?..............................................................................797
15

......................................................................................................798
man............................................................................................................798
cd...............................................................................................................798
ls................................................................................................................799
cp...............................................................................................................799
rm...............................................................................................................799
df................................................................................................................800
?.............................................800

?.................................................................................................................800
?.....................................................................................801
?......................................................801
............................................................................................................................802
(WiKi) ( : ) .....................................................................802
ALSA, Advanced Linux Sound Architecture .....................................................802
X ( ) - ................................................................................................802
ebuild- ...........................................................................................................................803
- .....................................................................................................................803
MAN ( )............................................................................................814
Emerge..........................................................................................................................814
............................................................................830
1. make.conf...........................................................................................................830
2. xorg.conf NVIDIA Geforce........................................................................832
3. xorg.conf ATI radeon:..............................................................................836
4. /etc/fstab..........................................................................................................842
Gentoo Linux.......................................................................................843
Gentoo Linux.....................................................................................844
...............................................................................................846
........................................................................846
IRC (freenode.net)...............................................................................................846

16

17

(changelog)
1.1 15.07.2007
1. Mati_maniak (linuxforum.ru):
a) emerge --depclean world - emerge --depclean;
b) --oneshot (-i) --oneshot.
2. .
3. : Linux , : (no-dashi, dalth & viking).
4. : IRC .
5. : .
1.2 01.09.2007

1. Gentoo.
2. .

3. : Gentoo Linux
4. Handbook !
5. inhab (linuxforum.ru):
: Samba PDC LDAP.

6. : GNOME.
7. : HOWTO fbsplash
1.3 01.11.2007
1. .
2. . :)
3. MAA (http://linuxforum.ru) Linux .
4. "Linux " !

5. Wiki-: HOWTO Xorg and Fonts.


6. : "Gentoo GPRS". :
- Nikoli (Linuxforum.ru).
- a.k.a. doc (http://doc.3dn.ru).
- .
7. XkbOptions.
8. : "Gentoo X.Org"
9. : " Linux", :
-
- Linux :
(alv@linux-online.ru)
10. : " Gentoo" ..
. .
11. : " "
12. : "HOWTO Internet"

18

13. .

19

.. a.k.a. JohnBat26 (ICQ(198710313)/Jabber.ru/Yahoo/AIM/Google/GG)


e-mail: JohnBat26@gmail.com, JohnBat26@yandex.ru
occupation: JEE developer
:

http://picasaweb.google.ru/JohnBat26
http://www.odnoklassniki.ru/user/182870623
http://evgeniy-batogov.moikrug.ru/

.. a.k.a. BadEd (ICQ(757727756) BadEd)


e-mail: baded@mail.ru

.. a.k.a. Kismih05 (ICQ(77833996 Mishel)/Yahoo/AIM)


e-mail: kismih05@yahoo.com

Dmeshr
e-mail: dmeshr@gmail.com

http://gentoo.ru

http://gentoo.org

http://ru.gentoo-wiki.com

http://linuxforum.ru

http://www.rugentoo.org

http://myfotomx.com/dalth/linuxbook.odt

http://linuxshop.ru

http://citkit.ru
: 1.3

: 01.11.2007
: GPL v2
OpenOffice Writer 2.3.0. (Infra)


Linux Gentoo .

Gentoo Linux .

Gentoo Linux .

, . :)
,
:
1. .
2. (. ).
: !!!
20


: .. a.k.a JohnBat26

,
Linux ( Gentoo ). , ,
, .
: " , 5 !"
Linux.
3 Windows
, . - ,
Windows, , 5 .
,
, 200 ,
Windows
( Gentoo
> 1000 :)). , Windows,
. ...
SuSE Linux. ,
, , ,
, ( Smart , ).
RPM ,
. .... :((
, , ,
, , -, Gentoo.
Gentoo 9 , (Dell, Asus, Acer, Sony
VAIO)! ,
, .
Gentoo
:

IMHO, portage;

, ;

, , gcc, glibc ..;

.
,
.
, .. (
GPRS ).
Gentoo Linux.
: " !" !!!

21

Linux
UNIX
: http://ru.wikipedia.org/wiki/UNIX
C : 1.3
UNIX ( ) ,
.
UNIX 1960- 1970-
Bell Labs AT&T.
UNIX-.
UNIX; ,
, UNIX- (. Unix-like).
UNIX-
UNIX, UNIX- .
UNIX- :

,
.
UNIX ,
.
UNIX ,
Microsoft Windows. UNIX-
,
.

1957 Bell Labs


. (
) BESYS.
Multics, Bell Labs.

22

1. UNIX-.

23

1964 ,
BESYS .
,
General Electric
Multics. AT&T, Bell Labs,
, 1969 ,
.
UNIX
UNIX 1960- Bell
Labs, 1969 , ,
MULTICS, (DEC
PDP-7), ,
UNICS (UNIplexed Information and Computing System)
MULTICS (MULTIplexed Information and Computing Service).
UNIX. 1971 PDP-11,
1970- ( ).
(Edition 1)
. UNIX 1
1970.
UNIX
. 1969
(B),
( )
1966 BCPL. , BCPL, . 19691973
,
(C).
1973 UNIX, . 15
,
( Multics,
(/1)), 1975 , . 1974
UNIX
. 1975 ,
Bell Labs, .
1975 ,
(Lions' Commentary on UNIX 6th Edition, with Source
Code, [1], [2]). 1978 . 600 ,
, .
UNIX.
Bourne shell. ,
.

1978 BSD UNIX, .


, . 1979
, 3BSD, . BSD
, .
BSD .
1980- AT&T, Bell Labs,
UNIX UNIX. ,
24

1982 , UNIX System III


.
UNIX 1980 . TCP/IP.
UNIX
UUCP (
UNIX- ,
).
: Berkley
sockets TLI (. Transport Layer Interface).
Berkley sockets
TCP/IP, . TLI AT&T
OSI
System V 3. TLI ,
TCP/IP ,
. TCP/IP
System V 4. ,
( , ),
UNIX BSD ( ) System V
( AT&T). , ,
System V AT&T, UNIX,
, AIX, HP-UX, IRIX, Solaris.
1983 4.2BSD,
Ethernet Arpanet. . 1983 1990
BSD , ,
NFS, VFS,
.
AT&T , System V.
1983 1 (SVR1 System V Release 1),
vi, curses, , inode. 2 (SVR2), 1984,
(file locking),
(demand paging), (copy-on-write). 3 1987
, , TLI,
RFS. 4 (SVR4),
Sun 18 1988, BSD,
TCP/IP, , csh. ,
, ,
ksh, NFS ( SunOS) .
.
UNIX, , V BSD
. System V, BSD.
UNIX-
1983 GNU
UNIX- ,
.
, , , GNU toolchain,
Glibc ( ) Coreutils
.
UNIX, GNU,
. GNU Hurd
Mach .
25

1991 , Linux ,
, GNU,
. GNU Linux
, , GNU/Linux. ( Red Hat
Debian), , GNU
,
.
, UNIX Systems
Laboratories Berkeley Software Design Inc.,
, BSD UNIX,
. , BSD UNIX. BSD
, ,
FreeBSD, NetBSD, OpenBSD, TrustedBSD DragonFlyBSD.
GNU/Linux BSD
UNIX-
,
. ,
, Apple ,
NEXTSTEP
, NeXT Darwin
Apple. BSD
Mach. Darwin BSD UNIX Mac OS X
UNIX.

AT&T, UNIX
, ,
Novell.
1993 Novell
X/Open,
Open Software Foundation, The
Open Group.
, IBM, Hewlett-Packard, Sun, NASA .

, Single UNIX Specification,
POSIX. The Open Group, UNIX
, Single UNIX
Specification.
1995 Novell
System V Santa Cruz Operation. 2000 Santa Cruz
Operation UNIX- Caldera,
SCO Group. SCO,
Santa Cruz Operation, .
SCO Group , UNIX
UNIX , . Novell
, Santa Cruz Operation ,
, SCO Group, Novell,
.
UNIX
26

, UNIX,
. UNIX-
.
Multics, UNIX ,
( ).
,
, .
, ( , )
,
( IOCTL )
.
UNIX Multics
.
,
, ,
.
, Multics.
, ,
,
Multics, UNIX.
UNIX ,
, , ,
, JCL IBM.
,
, .
, .
, UNIX,
,

.
UNIX , .
UNIX
.
- ,
- UNIX - ,
.
, , . . (.
pipelines). UNIX
, .
, ,
, Telnet, FTP, SMTP, HTTP .
UNIX ,
ed UNIX. ,
UNIX-,
(POSIX).
,
UNIX, UNIX .
,

,
, ,
, , . . ,

27

, gets scanf.
, , , .
UNIX
.
UNIX TCP/IP
, . ,
,
, UNIX.
UNIX
, ,
UNIX (. UNIX).

UNIX
,
UNIX.
1980 /usr/group.
19841985 .
:

POSIX 1003.1-1988, (API,


Application Programming Interface). UNIX,
. 1990 IEEE
IEEE 1003.1-1990.

POSIX 1003.2-1992, ,
.

POSIX 1003.1b-1993, POSIX 1003.1-1988.


.

POSIX 1003.1c-1995, POSIX 1003.1-1988.


(threads), pthreads.
POSIX IEEE 1003.
1990- The Open Group , POSIX
Common API Specification, Spec 1170.
, POSIX, , IEEE
.
1998 .
.
Single UNIX Specification Version 3
[3].
UNIX-
ELF- SVR4 .

.
, , GNU/Linux,
Filesystem Hierarchy Standard.
, , GNU/Linux,
.

28

UNIX

: ls, mv, rm, cp, ln, CD, pwd,


mkdir, rmdir, find, du, df.
: touch, more, less, ed, ex, vi, emacs.
: echo, cat, grep, sort, uniq, sed, awk, tee, head, tail, cut, tr, split,
printf.
: comm, cmp, diff, patch.
: yes, test, xargs, expr.
: chmod, chown, ps, su, w, who, df, mount,
umount.
: mail, telnet, ftp, finger, ssh.
: sh, bash, csh, ksh, tcsh, zsh.
: cc, gcc, ld, nm, yacc, bison, lex,
flex, ar, ranlib, make.
: compress, uncompress, gzip, gunzip, tar.
: od, strings.

60 1 UNIX:
ar, as, b, bas, bcd, boot, cat, chdir, check, chmod, chown, cmp, cp, date, db, dbppt, dc, df,
dsw, dtf, du, ed, find, for, form, hup, lbppt, ld, ln, ls, mail, mesg, mkdir, mkfs, mount, mv,
nm, od, pr, rew, rkd, rkf, rkl, rm, rmdir, roff, sdate, sh, stat, strip, su, sum, tap, tm, tty, type,
un, wc, who, write

29

GNU/Linux
: http://ru.wikipedia.org/wiki/
C : 1.3
GNU/Linux ( ) UNIX-
. ,
GNU, Linux. ,
, Linux.
GNU/Linux PC- Intel x86,
IA-64, AMD64, PowerPC, ARM .
GNU/Linux ,
, ,
.
, GNU/Linux
. GNU/Linux
, GNU
Linux .
GNU/Linux Slackware, Red Hat, Fedora, Mandriva, SuSE, Debian, Gentoo,
Ubuntu. ALT Linux
ASPLinux.
Microsoft Windows, Mac OS (Mac OS X) UNIX-
, GNU/Linux . ,
; .
GNU/Linux .
, ,
, .
,
, .
,
,
.
,
,
GNU/Linux. ,
, ,
, GPL
. [1]
,
, . Mozilla
(Netscape, AOL), OpenOffice.org (Sun), Interbase (Borland) Firebird,
SAP DB (SAP). IBM GNU/Linux .
,
GNU/Linux
. GNU/Linux ,
, Oracle Database, DB2, Informix, SyBase, SAP R3, Domino.
30

GNU/Linux Linux.
,
,
GNU/Linux. ,
, ,
, GPL
. [1]
,
, . Mozilla
(Netscape, AOL), OpenOffice.org (Sun), Interbase (Borland) Firebird,
SAP DB (SAP). IBM GNU/Linux .
,
GNU/Linux
. GNU/Linux ,
, Oracle Database, DB2, Informix, SyBase, SAP R3, Domino.
GNU/Linux Linux.

31

. 2 GNU/Linux
32

Linux ()
: http://ru.wikipedia.org/wiki/Linux_()
C : 1.3
Linux () ,
1991 .
GNU C
( GNU Assembler AT&T).
GNU General Public License.
Linux .

1991
Usenet comp.os.minix] [1]:
, ()
( , gnu)
386 (486) AT
GNU
, GNU Hurd . BSD-
,
.
Linux , ,
.
Linux , . ,
Linux, Linux,
GNU/Linux, Linux
, GNU.

* 1991 21-
.
.
* 25 1991 (
[1] ):
From: torvalds@klaava.Helsinki.Fi ( )
Newsgroups: comp.os.minix
Subject:
Message-ID:<1991Aug25.205708.9541@klaava.Helsinki.Fi>
Date: 25 Aug 91 20:57:08 GMT
Organization:
, - ()
33

( , gnu)
386 (486) AT. , .
, / ,
( ( )
).
bash (1.08) gcc (1.40), . , , ,
. , , :-)
(torvalds@kruuna.helsinki.fi)
PS. , , .
( 386-, .),
AT-, , :-(

17 1991 Linux 0.01. (10 239 );


5 1991 Linux 0.02 [1](.);
1991 Linux 0.11. Linux,
Linux ;
19 1992 alt.os.linux(.);
31 1992 comp.os.linux(.);
1992 Linux 0.96,
X Window System;
1993 1994 15 0.99.* ( 1993
BogoMips);
14 1994 Linux 1.0.0 (176 250 );
1995 Linux 1.2.0 (310 950 );
9 1996 Linux Tux;
9 1996 Linux 2.0.0 (777 956 );
25 1999 Linux 2.2.0,
(1 800 847 );
4 2001 Linux 2.4.0 (3 377 902 );
18 2003 Linux 2.6.0 (5 929 913 ).

, ,
, .
,
. , GNU/Linux
Linux, ,
, .

Linux ,
,
. ,
34

: A.B.C[.D] ( 2.2.1, 2.4.13 2.6.12.3).


* A .
, .
: 1994 ( 1.0) 1996 ( 2.0).
* B .
, ,
, 1.2, 2.4 2.6.
, 1.1 2.5.
,
, .
* C .
, ,
, , .
, , ,
;
D.
* D , ,
, 2.6.8,
NFS. , ,
(
2.6.9). 2.6.8.1
. 2.6.11,
.
,

( C).

,
:

2.0

2.2
- ( )
2.4

2.6
/
Linux . (.
Linux (.)).


* 1.0 1994 i38635

.
* 1.2 1995 Alpha, SPARC
MIPS.
* 2.0 1996 ,
.
* 2.2 1999 [2](.).
* 2.4 2001 ISA Plug and Play,
PA-RISC, USB PC-Card (PCMCIA).
Axis Communications ETRAX CRIS InterMezzo
. [3](.)
* 2.6 17 2003:
o uClinux ( );
o Hitachi H8/300, NEC v850,
Motorola m68k,
NUMA, NCR Voyager, Intel hyperthreading PAE;
o :
+ XFS SGI;
+ APIC;
+ 65 000
4 ;
+ 32 000 1 ;
+ (major device) 255
4095 (minor device) 255
;
+ 64-
16 ;
+ ;
+ Native POSIX Thread
Library (NPTL);
+ ;
+ sysfs;
+ User-mode Linux;
+ .

Linux , ,
, ,
.
Linux
.
0, . ,

.
, Linux ,

comp.os.minix(.) 1992 .

36


, Linux
,

iPAQ
(
)

IBM
S/390
( ). Linux
Blue Gene (.) IBM.
Linux 32- x86- ;
Linux :
* ARM
o Acorn: Archimedes, A5000, RiscPC
o StrongARM, Intel XScale . .
o HP iPAQ
* Axis Communications CRIS
* DEC Alpha
* HP PA-RISC
* Hitachi: SuperH (SEGA Dreamcast), H8/300
* IBM S/390
* IBM zSeries-
* Intel 80386 : IBM PC :
o 80386, 80486, AMD, Cyrix, TI IBM-;
o Pentium;
o Core, Core2 Duo 32 64- .
o AMD Am5x86, K5, K6, Athlon ( 32- ), Duron;
o AMD64: 64- AMD ( x86-64);
o Cyrix 5x86, 6x86 (M1), 6x86MX MediaGX (National/AMD Geode) ;
o VIA C3 (.) ;
o Intel 8086, 8088, 80186, 80188 80286
(. ELKS(.));
o Microsoft Xbox (Pentium III).
* Intel IA-64
* MIPS
o Silicon Graphics, Inc.;
o Cobalt Qube, Cobalt Raq;
o Sony PlayStation 2, PlayStation 3;
o DECstation;
o .
* Motorola 68020 :
o Amiga: A1200, A2500, A3000, A4000
o Apple Macintosh II, LC, Quadra, Centris Performa
o Sun Microsystems 3 (,
Sun-3 MMU)
* NEC v850e
* Renesas M32R
* PowerPC IBM POWER:
o Apple ( PCI Power Macintoshes,
NuBus Power Macs)
o PCI Power Mac, Power Computing, UMAX Motorola
o IBM RS/6000, iSeries- pSeries-
o Pegasos I II
o PowerPC
* SPARC UltraSparc: Sun 4-series, SPARCstation/SPARCserver, Ultra-, Blade-
37

Fire-

Linux GNU General Public License,


. ,
, .
Linux ,
GPL .

c Linux Tux,
.

BSD
: http://ru.wikipedia.org/wiki/BSD
C : 1.3
BSD (. Berkeley Software Distribution)
,
. BSD
BSD, :
BSD, .
BSD BSD-UNIX
UNIX,
.
BSD : NetBSD, FreeBSD, OpenBSD, DragonFly BSD, PC-BSD,
DesktopBSD, Darwin ( Mac OS X).
UNIX
, , .
.

BSD
1978 UCB (Bill Joy)
(Berkeley Software Distribution BSD). (360,
$50) Pascal UNIX ex;
30 . 1978 2BSD, 75 .
Interactive Systems
UNIX, Whitesmiths UNIX
Idris.

38

UNIX 7 .
, .
1982 2.8.1BSD.
:
* 4BSD 1980
* 4.1BSD 1981
* 4.1a, 4.1b 4.1c (19821983)
* 4.2 1983 ,
( TCP/IP,
.
4.4BSD( 1993).
BSD BSDI (Berkeley Software Design, Inc).
BSD-UNIX
:
* NetBSD
* FreeBSD
* OpenBSD
* DragonFlyBSD
* PC-BSD
* DesktopBSD

39

GNU General Public License


: http://ru.wikipedia.org/wiki/GNU_General_Public_License
C : 1.3
GNU General Public License ( GNU
GNU) ,
, GNU
1988 . GNU GPL GPL,
, (
, general public license ).
1991 , ,
2007 . GNU Lesser General
Public License (LGPL) GPL,
.
GNU GPL ,
(
), ,
.
( copyleft)
. GPL,
, , , ,
.

GPL ,
:

, ;

, ,
( );

,
( ).

GPL
GNU. ,
GNU Emacs, GDB ( GNU) GNU
(GCC), .
- , GPL,
.
, ,

. GNU GPL,
1989 .
1990 , ,
; 2 GPL
40

1991 , GNU
Library General Public License, 2, ,
.
1999 , LGPL 2.1,
Lesser General Public License GNU.

GPL v3
2005 GPL 3.
7 2005 ,
, DRM.
2006 Free Software Foundation
GPL.
,
.

,
.
16 2006 .
, 25 2006 ,
Linux, , - GPL
2. ( GPL-, Linux
GPL, 2 ).
Linux- ,
Linux, , Solaris Linux
GNU GPLv3.
Sun OpenSolaris GPLv3,
Linux ,
.[1]
, GPLv3 , GPLv2,
, , ,
, ,
, GPLv3,
Linux-.
GNU
GPL, GPLv3
. ,
GPLv2.
, GPLv3-,
GPLv3-.
GPLv3 29 2007.
.
41

GNU GPL
GNU GPL .
2.0 .
.
0.
* ( )
* ( )
1.
2.
* ( ) :
o a) ;
o b) GNU GPL;
o c)
.
* ( 24)
3.
* ( ) :
o a) ,
o b) ,
o c) ( )
, .
* ( )
* ( )

4.
5. ,
6.
7.
8.
9. GNU GPL
10.
11.
12.

42

Linux :
: http://myfotomx.com/dalth/linuxbook.odt
: (no-dashi, dalth & viking).
http://myfotomx.com/dalth: 15.07.07
C : 1.1

Linux, , ,
: .
,
,
GNOME KDE, ,
, .
, (
, ),
Linux
, , .

() ,
,
ls/ps/exit. ,
, , ,
.
dalt74@gmail.com,
.
.
, (no-dashi, dalth & viking)
P.S. ,
, ?
P.P.S. to-do list: DNS,
.
.


Linux ,

. Linux :
; ; VFS
43

.

, ,
(
), VFS .

.
; ,
,
.
, ,
. , 2.6
.
,
, ,
.
uname:
[dalth@inferno dalth]$ uname -r
2.6.8.1

,
,
,
(kernel panic)
, .
/boot,
/lib/modules/<_>,
,
(, SCSI SCSI ,
- ,
).
2.6:

44

[root@viking dev]# ls -l /lib/modules/2.6.8.1/


total 616
lrwxrwxrwx
1 root root
18 27 15:36 build -> /usr/src/linux
drwxr-xr-x 10 root root
4096 1 13:55 kernel
-rw-r--r-1 root root 108680 1 13:56 modules.alias
-rw-r--r-1 root root
69 1 13:56 modules.ccwmap
-rw-r--r-1 root root 153967 1 13:56 modules.dep
-rw-r--r-1 root root
73 1 13:56 modules.ieee1394map
-rw-r--r-1 root root
357 1 13:56 modules.inputmap
-rw-r--r-1 root root 16658 1 13:56 modules.isapnpmap
-rw-r--r-1 root root 85093 1 13:56 modules.pcimap
-rw-r--r-1 root root 68078 1 13:56 modules.symbols
-rw-r--r-1 root root 150781 1 13:56 modules.usbmap
lrwxrwxrwx
1 root root
18 1 13:22 source -> /usr/src/linux
[root@viking dev]# find /lib/modules/2.6.8.1/kernel -type f | head
-20
/lib/modules/2.6.8.1/kernel/arch/i386/kernel/cpuid.ko
/lib/modules/2.6.8.1/kernel/arch/i386/kernel/microcode.ko
/lib/modules/2.6.8.1/kernel/arch/i386/kernel/msr.ko
/lib/modules/2.6.8.1/kernel/crypto/blowfish.ko
/lib/modules/2.6.8.1/kernel/crypto/deflate.ko
/lib/modules/2.6.8.1/kernel/crypto/md5.ko
/lib/modules/2.6.8.1/kernel/crypto/twofish.ko
/lib/modules/2.6.8.1/kernel/drivers/acpi/fan.ko
/lib/modules/2.6.8.1/kernel/drivers/acpi/processor.ko
/lib/modules/2.6.8.1/kernel/drivers/acpi/thermal.ko
/lib/modules/2.6.8.1/kernel/drivers/base/firmware_class.ko
/lib/modules/2.6.8.1/kernel/drivers/block/cryptoloop.ko
/lib/modules/2.6.8.1/kernel/drivers/block/loop.ko
/lib/modules/2.6.8.1/kernel/drivers/block/nbd.ko
/lib/modules/2.6.8.1/kernel/drivers/block/paride/epat.ko
/lib/modules/2.6.8.1/kernel/drivers/block/paride/paride.ko
/lib/modules/2.6.8.1/kernel/drivers/block/paride/pd.ko
/lib/modules/2.6.8.1/kernel/drivers/block/paride/pg.ko
/lib/modules/2.6.8.1/kernel/drivers/bluetooth/bcm203x.ko
/lib/modules/2.6.8.1/kernel/drivers/bluetooth/bfusb.ko
[root@viking dev]#

kernel,
.o 2.4 .ko 2.6.
modules.***map ( ),
.
,
(
source build, ). , ,
, ,
(,
nvidia).

-
.
, . ,
0. 2.6
,
,
.
,
, , -
, .
,
45

, .

, ,
.
modprobe, insmod
rmmod. modinfo depmod
.
/etc/modprobe.conf ( 2.6.X)
modules.conf ( 2.4.X).


x86
, - .
BIOS.
. BIOS
(MBR),
, .
,
.

,
,
, .
, , ,
, (
) /sbin/init. init
.
Linux GRUB.
,
, - ,

. .
:
0 GRUB.
, MBR. stage_0
( -
),
.
1
, - ,
, . ,
-,
. , -
, ,
. , Linux
GRUB
.
GRUB MBR,
-
( NTLOADER).

,
, ,
.
,
,
. , Linux initrd
INITial RamDisk.
46

Initial ramdisk ,
. ,
, ,
.
, initrd
,
.
/boot vmlinuz<>, initrd-<>.img,
initrd. initrd,
. initrd
,
make
install, , initrd
(, SCSI-),
mkinitrd,
initrd:
[root@viking dalth]# mkinitrd /tmp/initrd-2.4.8.1.img 2.6.8.1
[root@viking dalth]# cp /tmp/initrd-2.4.8.1.img /boot
[root@viking dalth]# reboot

Linux LILO GRUB.


, LILO
(,
), ,
LILO .
(man grub, man lilo).
GRUB LILO ,
,
, /sbin/init,
,
initrd.



(). ,
,
( x86 4GB).
,
( ),
,
.
,
. , ..
, .
. ,

,
.
,
.
, ,
, ,
.
47

,
.
, x86 4096 .
, ,
,
,
. ,
RAM, :
, -
( ) ,
.
,
MMU Memory Management Unit,
(/
SWAP-), .

4GB ,
. x86 Linux
64GB, 4GB
.

System V shared memory


Linux UNIX-
.
,
. ,
, ,
, .
c 1

SHM - c 2

SHM - c 1

c 1

c 2

c 2


, ,
,

.
System V IPC Linux IPC,
. System V IPC
. IPC ipcs.
ipcrm IPC, -

,
Oracle, Informix DB2.
,
ipcrm IPC,

.
48

IPC ,
(.. IPC ugo/rwx,
IPC-
,
.
[dalth@viking dalth]$ ipcs
------ Shared Memory Segments -------key
shmid
owner
perms
bytes
status
0x00000000 0
oracle
640
4194304
10
0x00000000 32769
oracle
640
20971520
10
0x00000000 65538
oracle
640
29360128
10
0x0d3c24a0 98307
oracle
640
29360128
50
0x00000000 13697028
root
777
49152
1
0x00000000 13729797
root
777
16384
1
0x000004d2 13795334
dalth
666
1008
2
0x00000000 14286866
root
644
790528
2
0x00000000 21823507
dalth
600
393216
2
0x00000000 21921814
root
644
122880
2
0x00000000 14516249
root
644
151552
1
------ Semaphore Arrays -------key
semid
owner
perms
0x0b4f657c 262147
oracle
640
0x000004d2 458756
dalth
666
------ Message Queues -------key
msqid
owner

perms

nattch

dest
dest
dest
dest

nsems
154
1
used-bytes

messages

[dalth@viking dalth]$

System V IPC Linux


, UNIX-.


VFS
. , , -
, ,
, .
:
, , ,
, ..
, ,
VFS.
VFS
,
. VFS
, .

/proc/filesystems:

49

[dalth@viking proc]$ cat /proc/filesystems


nodev
sysfs
nodev
rootfs
nodev
bdev
nodev
proc
nodev
sockfs
nodev
usbfs
nodev
usbdevfs
nodev
futexfs
nodev
tmpfs
nodev
pipefs
nodev
eventpollfs
nodev
devpts
ext2
nodev
ramfs
nodev
hugetlbfs
iso9660
nodev
devfs
nodev
mqueue
ext3
nodev
rpc_pipefs
nodev
nfsd
nodev
smbfs

,
, - .
,
( )
.
, ,
,
, ,
,
.
,
, procfs,

.

.
, ,

,
, ,
ACL ..

/proc/mounts:

50

[dalth@viking proc]$ cat /proc/mounts


rootfs / rootfs rw 0 0
/dev/root / ext3 rw 0 0
none /dev devfs rw 0 0
/proc /proc proc rw,nodiratime 0 0
/sys /sys sysfs rw 0 0
none /dev/pts devpts rw 0 0
usbdevfs /proc/bus/usb usbdevfs rw 0 0
/dev/chimera/var /var ext3 rw 0 0
/dev/chimera/temp /tmp ext3 rw 0 0
/dev/chimera/usr /usr ext3 rw 0 0
/dev/chimera/home /home ext3 rw 0 0
/dev/chimera/opt /opt ext3 rw 0 0
none /dev/shm tmpfs rw 0 0

Linux : ,
, , ,
.
:
, ,
.
,
,
, .

, ,
.
,
,
,
,

,

, +
,
.
/dev
,
,
/
, ,
Windows (shortcuts), (symbolic links)
(
, )
, ,
..
, UNIX ,
. , .
.
- , VFS ,
.
. ,
sync
(,
sync ).
51

,
,

.
:
[root@viking dalth]# umount /home/ftp/pub/linux/fedora/cd1
umount: /home/ftp/pub/linux/fedora/cd1: device is busy
umount: /home/ftp/pub/linux/fedora/cd1: device is busy
[root@viking dalth]#

,

. , ,
sync,

:
[root@viking dalth]# mount -t ext3 -o sync,dirsync /dev/hda9 /home

,
,
, .



Linux .. POSIX ACL POSIX.
,
ugo/rwx. ,
POSIX ACL, acl:
[root@inferno root]# mount -t ext3 -o acl /dev/inferno/opt /opt

,
POSIX ACL :
[root@inferno root]# tune2fs -o acl /dev/inferno/opt

POSIX ACL.
: getfacl
, setfacl
. ls +
, ,
:
[root@inferno root]# ls -l /home/dalth/.bash_???????
-rw-r-----+
1
dalth
dalth
20034
22:48 /home/dalth/.bash_history
-rw-r--r-1
dalth
dalth
191
21:51 /home/dalth/.bash_profile
[root@inferno root]#

11
23


getfacl. ,
kiki .bash_history:
[root@inferno dalth]# getfacl .bash_history
# file: .bash_history
# owner: dalth
# group: dalth
user::rwuser:kiki:r-group::--mask::r-other::---

52

oracle .bash_history
setfacl,
kiki:
[root@inferno dalth]# setfacl -m u:oracle:rw .bash_history
[root@inferno dalth]# setfacl -x u:kiki .bash_history
[root@inferno dalth]# getfacl .bash_history
# file: .bash_history
# owner: dalth
# group: dalth
user::rwuser:oracle:rwgroup::--mask::rwother::---


.bash_history:

[root@inferno dalth]# setfacl -b .bash_history


[root@inferno dalth]# ls -l .bash_history
-rw------- 1 dalth dalth 20034 11 22:48 .bash_history


, ugo/rwx UNIX.
,
.
, ACL,


.



.
, ,
. ,
, ,
.

( ,
,
).
, ,
,
,
..
,

, sync
.
, , , EXT3,
ReiserFS, XFS, JFS .



, . ,
,
53

,
, ,
. ,
, . ,

.
1

, -
, ,
, (
).

. ,
.

,


:
[dalth@viking dalth]$ cat /proc/1/maps
08048000-08050000 r-xp 00000000 03:01 75813
08050000-08051000 rw-p 00008000 03:01 75813
08051000-08072000 rw-p 08051000 00:00 0
40015000-40016000 rw-p 40015000 00:00 0
4c8ee000-4c903000 r-xp 00000000 03:01 92869
4c903000-4c904000 r--p 00014000 03:01 92869
4c904000-4c905000 rw-p 00015000 03:01 92869
4c907000-4ca1c000
r-xp
92857
/lib/tls/libc-2.3.3.so
4ca1c000-4ca1e000
r--p
92857
/lib/tls/libc-2.3.3.so
4ca1e000-4ca20000
rw-p
92857
/lib/tls/libc-2.3.3.so
4ca20000-4ca22000 rw-p 4ca20000 00:00 0
4d201000-4d20f000 r-xp 00000000 03:01 92965
4d20f000-4d211000 rw-p 0000d000 03:01 92965
bfffd000-c0000000 rw-p bfffd000 00:00 0
ffffe000-fffff000 ---p 00000000 00:00 0

/sbin/init
/sbin/init
/lib/ld-2.3.3.so
/lib/ld-2.3.3.so
/lib/ld-2.3.3.so
00000000
03:01
00115000

03:01

00117000

03:01

/lib/libselinux.so.1
/lib/libselinux.so.1

, mmap,
VFS.



.
procfs sysfs,
, .
54

sysfs
. procfs
,
ps sysctl.
sysfs , procfs .
ramfs, tmpfs shmfs ,
,

(, , ramfs ,
swap- shmfs tmpfs). 2.6 shmfs tmpfs.



.
NCPFS (
Novell NetWare), SMBFS ( Windows) NFS (
UNIX-).
,

, ,
, .
, SMB NFS:
# mount -t smbfs -o username=usr,workgroup=tst //server/share_name /mnt/smb_target
Password: ********
# mount -t nfs -o timeout=4 server:/export/home /mnt/nfs_target

-t mount ,
-o SMB
, , ,
, NFS
, / .
,
, .
.


Linux mkfs:
[root@inefrno root]# mkfs -t ext3 /dev/hda6

, mkfs
, mkfs.<_>,
mksf.ext2 mkfs.reiserfs.
mkfs
, .

(, ,
, ..)
(
)
. ,
( , FAT
) , ,
.

55

sysctl
,
. ,
, UNIX
sysctl.
procfs sys
. , ,
cat, echo:
[root@inferno
33554432
[root@inferno
[root@inferno
67108864
[root@inferno

root]# cat /proc/sys/kernel/shmmax


root]# echo 67108864 >/proc/sys/kernel/shmmax
root]# cat /proc/sys/kernel/shmmax
root]#

sysctl ,
,
.
, sysctl
/proc/sys, ..
sysctl ,
.
, :
sysctl -a, ,
,
:
[root@inferno root]# sysctl -a | grep mem
net.ipv4.tcp_rmem = 4096
87380
174760
net.ipv4.tcp_wmem = 4096
16384
131072
net.ipv4.tcp_mem = 24576
32768
49152
net.ipv4.igmp_max_memberships = 20
net.core.optmem_max = 10240
net.core.rmem_default = 108544
net.core.wmem_default = 108544

( /),
/proc/sys/ - ,
.

sysctl,
/etc/sysctl.conf,
.


Linux ,
, , ,
.
, .
,
,
, ,
,
(
).
,
,
56

, ZIP,
,
, (, ,
).
,
, .

/ ,

,
, .
,
,

.
Linux
. (
) , , ldd:
[dalth@viking dalth]$ ldd /bin/su
linux-gate.so.1 => (0xffffe000)
libpam.so.0 => /lib/libpam.so.0 (0x4ce08000)
libpam_misc.so.0 => /lib/libpam_misc.so.0 (0x4cb3c000)
libcrypt.so.1 => /lib/libcrypt.so.1 (0x4e3a2000)
libdl.so.2 => /lib/libdl.so.2 (0x4ca49000)
libc.so.6 => /lib/tls/libc.so.6 (0x4c907000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x4c8ee000)
[dalth@viking dalth]$ ldd /sbin/devlabel
not a dynamic executable
[dalth@viking dalth]$

, /bin/su
, /sbin/devlabel .

GNU libc
,
, glibc (GNU libc). glibc

, .

(syscall). syscall
80h ,
. glibc, ,

int80h.
glibc,
,
, libc,
, ,
, .
,
initrd , insmod, lvm devlabel,

sash standalone shell,
nash,
initrd, ,
57

glibc .

LD, Shared Library, SO


,
, .
,
- -
. , ,
.
Linux ELF (Executable Linked
Format).
ELF , ,
. ,
[man elf].
: ,
()
, ,
.
( ) .
ELF,
,
. ELF ( dl, dynamic linker dynamic loader)
ELF-,

.
,
ELF. ,
.
(
) ,
. ,

, ,
.
.
, .
dl
( , ).
, ,
. /lib, /usr/lib ,
/etc/ld.so.conf. ,
ldconfig,
- /etc/ld.so.cache. -
ldconfig . ,
, ldconfig.
ld.so.conf
. ld.so.conf
:
include ld.so.conf.d/*.conf

, , conf,

/etc/ld.so.conf.d
:

58

[root@viking dalth]# cat /etc/ld.so.conf


include ld.so.conf.d/*.conf
/usr/lib/mysql
/usr/X11R6/lib
/usr/lib/qt-3.3/lib
[root@viking dalth]# ls /etc/ld.so.conf.d/
oracle
[root@viking dalth]# cat /etc/ld.so.conf.d/oracle
/opt/oracle/9i/lib
[root@viking dalth]#

, -
, , /etc/ld.so.conf.

dl : ,
ld.so.cache
,
LD_LIBRARY_PATH.
ld:
LD_PRELOAD,

,
, ld ELF.
dl:
,
(,
, Borland Kylix).
, , /opt/program,
/opt/program/bin /opt/program/lib, ,
, , .
, , ld
. ,
ld .

(ld ,
):
$
export
$ /opt/program/bin/filename

LD_LIBRARY_PATH=/opt/program/lib

/opt/program/lib /etc/ld.so.conf
ldconfig,
:
$ su #
echo
/opt/program/lib
#
#
$ /opr/program/bin/filename

>>/etc/ld.so.conf
ldconfig
exit


, :
$
export
$ /opr/program/bin/filename

LD_PRELOAD=/opt/program/lib/*


.
,
.

59

/proc
,
, ()
. Linux
procfs,
/proc.
/proc ,
PID .
.
:

cmdline

,
\0

,
.
\0

environ

,
\0

exe

maps

mem

stat

statm

cwd

fd/*

fd
.

root

mounts

status

,
ps, , ,
ps
/proc.


Linux
fork+exec. ,
, fork,
,
, PID (Process ID) PPID (Parent
Process ID) exec ,
60

.
, ,
( init,
).
,
. ,
,
. ( ,
) (zombie process).
zombie process , .
,
, .
.
, , ,
init,
-, .. ,
.

/dev
Linux .
,
(),
.
Linux ,
/dev. ,
,
.
(character block),
(major number) (minor number). ,
/dev:
[dalth@viking
brw------- 1
brw------- 1
brw------- 1
brw------- 1
crw------- 1
crw------- 1
crw------- 1

proc]$ ls -lL /dev/hd*


root root 3, 0
root root 3, 1
root root 3, 2
dalth disk 22, 0
root root 4, 64
root root 4, 65
root root 4, 66

/dev/ttyS*
1 20:16 /dev/hda
1 20:16 /dev/hda1
1 20:16 /dev/hda2
1 1970 /dev/hdc
1 1970 /dev/ttyS0
1 1970 /dev/ttyS1
1 1970 /dev/ttyS2

, ,
. (
), -, -, major number, minor
number, .
,
, .
-
,
: COM-, LPT-, PS/2-, USB- ..,
SCSI-, IDE-, SCSI-CD-,
RAID- ..

. ,
(
) ,
.
61

...

63

4
6

LPT1

64

65

66

...

COM1

COM2

COM3

175

...

LPT2
PS/2

10

14

195


NVidia


LVM

AGP

IDE
Primary
Master

1
IDE Primary
Master

2
IDE Primary
Master

13

SCSI
1

1
SCSI- 1

2
SCSI- 1

...

16

...

64

65

16
IDE Primary
Master

IDE
Primary
Slave

1
IDE Primary
Slave

SCSI 2

SCSI
4

1
SCSI- 4

...


,
,
,
major number, minor number.
, , /dev/ttyS1,
4
65 COM2,
/dev/hda2 ( 3 2)
2- IDE, primary
master.

/dev
/dev
. /dev

, .
/dev
,
.
/dev

mknod MAKEDEV. , -
, ( ,
),
.
, 8
33 (,
,
, ):

62

[root@viking root]# cd /dev


[root@viking dev]# ls -l /dev/hda33
ls: /dev/hda33: No such file or directory
[root@viking dev]#
[root@viking dev]# mknod hda33 b 8 33
[root@viking dev]#
[root@viking dev]# ls -l hda33
brw-r--r-- 1 root root 8, 33 11 09:27 hda33
[root@viking dev]#
[root@viking dev]# dd if=hda33 of=/dev/null
dd: opening `hda33': No such device or address
[root@viking dev]#

No such device or address ,


.
Linux
, .
, -
, ,
.
/etc/modules.conf
(alias) .
-
/etc/modules.conf :
alias char-major-X-Y _

:
alias block-major-X-Y _

X Y major minor ,
.
nVidia
nVidia modules.conf
, .
X Y * ,
. , modules.conf :
alias char-major-81-* bttv

major number 81
,
bttv ( TV- bt848).
Linux
,
. ,
/dev.

DevFS
,
/dev
/dev
. :
/dev , devfs

. -
,
devfs. devfs ,
.
devfs ,
63

, devfs
devfs.
devfs ,
, scsi-
: /dev/scsi/host1/bus1/target3/lun4/partition2
devfs,

SCSI- (
).
,
, devfsd.
devfs
/dev/disks/disc0 /dev/hda1.
, /dev
/dev, UNIX (, Solaris), /devices,
/dev, Linux cfgadm
devfsd, /dev .
devfsd devfs
,
type/major/minor,
, devfs
devfsd, ,
modules.devfs:
alias /dev/nvidia* nvidia

, ,
/dev/nvidia,
nvidia.o ( 2.6 nvidia.ko)
, ,
/dev, .
, Mandrake Linux devfs, RedHat, Fedora SUSE
/dev ,
/dev .

UDEV
devfs/devfsd ,
, udev.
devsfd, , udev
.
sysfs, udevd, ,
/dev
, .

, .
,
,
udev,
,
data- Nokia,
firmware,
.
, /dev,
devfs udev, /dev,
64


, , ,
.
Linux?
-, .
: () (loop, software RAID-, Volume Management,
), - (SCSI
CD-ROM', IDE-, USB-storage, RAM-).
,
.
,
.
,

,
,
.
,
.

, DOS partition table, BSD disklabels, UnixWare slices .
,

, .
.
, IDE-
hd /dev/hd<N>[<M>] N ,
IDE, ,
(master/slave). M 1 63 (
). , . SCSI /dev sda, sdb, sdc ..
IDE-:

master

primary master

hda

slave

primary slave

hdb

master

secondary master

hdc

slave

secondary slave

hdd

master

tertiary master

hde

slave

tertiary slave

hdf

master

quaternary master

hdg

slave

quaternary slave

hdh

, ,
,
65

,
, . ,
-
, ,
,
/.
(extended)
DOS. DOS
, LVM Linux
63 IDE- 15 SCSI-.
.

DOS, , 4
. ,
4 ,
.
DOS 1 4, 5,
.
.
fdisk, Linux
:
[root@stend root]# fdisk /dev/hda -l
Disk /dev/hda: 6442 MB, 6442450944 bytes
16 heads, 63 sectors/track, 12483 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Device Boot
/dev/hda1
*
/dev/hda2
/dev/hda3
/dev/hda4
/dev/hda5
/dev/hda6

Start
1
204
2033
3073
3073
4089

End
203
2032
3072
12483
4088
12483

Blocks
102280+
921816
524160
4743144
512032+
4231048+

Id
83
83
82
f
83
83

System
Linux
Linux
Linux swap
W95 Ext'd (LBA)
Linux
Linux

[root@stend root]#

, IDE 6 , 4 (
1 4) 5 6,
extended- hda4.
, -
.
( ),
.
fdisk,
,
,
/proc:

66

[dalth@viking dalth]$ cat /proc/partitions


major minor #blocks name
3
3
3
253
253
253
253
253
253
253
253
253
253
253
7
7
7
7

0
1
2
0
1
2
3
4
5
6
7
8
9
10
0
1
2
3

78150744
1084356
77063805
1048576
1048576
10485760
10485760
1048576
41943040
360448
258048
258048
258048
53248
651884
650198
653336
198962

hda
hda1
hda2
dm-0
dm-1
dm-2
dm-3
dm-4
dm-5
dm-6
dm-7
dm-8
dm-9
dm-10
loop0
loop1
loop2
loop3

,
, .
,
. ,
- -
..
, .

IDE
IDE-
,
. IDE-
,
,
, ( ) 2 .
, IDE, .
Linux 64 ,
, 63
. , IDE-
, (
master/slave) .
:

67

IDE-

Major number

Minor number

/dev

/dev/hda

/dev/hda1

/dev/hda2

/dev/hda3

/dev/hda4

63

/dev/hda63

64

/dev/hdb

65

/dev/hdb1

66

/dev/hdb2

67

/dev/hdb3

63

127

/dev/hdb63

...
1

63

2
...

/dev/hdc

1-63

/dev/hdc[1..63]

22

64

65-127

/dev/hdd

2
/dev/hdd[1..63]

, 64-
. IDE Linux
IDE .. 8 , ..
, IDE:
.
, ,
.

SCSI-
SCSI IDE,
15 ( 16,
), SCSI ,
SCSI-
, SCSI
. SCSI-
(.. major number ). SCSI- 16 ,
,
IDE- 16-
(.. SCSI- 1 15).
/dev:
68

SCSI-

Major number

Minor number

sda

sda1

sda2

sda3

sda4

sda5

15

sda15

16

sdb

17

sdb1

18

sdb2

19

sdb3

20

sdb4

21

sdb5

sdb15

...

...
31

Linux 4096 SCSI-


.
SCSI- , ,
, . ,
3 SCSI, sda, sdb sdc,
,
( sdb) sda, (
sdc) sdb, SCSI-
devfs (
),
,
- , md
(software RAID) LVM. , devfs
, LVM .

SATA IDE PATA


SATA, IDE,
SCSI. -
Linux SATA SCSI.,
SATA- ( ) SCSI-.
2.6 IDE-
SCSI., , Fedora 7,
69

Parallel ATA ( IDE) SCSI-,


-,
CD/DVD /dev/sdX /dev/scdX.
IDE, ,
pata, : pata_via IDE-
VIA, pata_piix - IDE- Intel,
SCSI.
,
SATA-, SCSI.

Logical Volume Manager



. ,
,
,
.. LVM (Logical Volume Manager).
LVM : -
, LVM.
( , physical volumes)
(logical volume groups).

(logical volumes).
.
(extents) .
LVM ,
.
,
. LVM ,
, .
device mapper
lvm2.
,
,

,
. device mapper
,
,

, (
, , )
.
LVM
,
.
, LVM
LVM: LVM,
,
,
. , .
,
.
70

LVM. LVM
: fdisk
LVM.
,
:
[root@inferno dalth]# fdisk /dev/hdb
The number of cylinders for this disk is set to 79408.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): p
Disk /dev/hdb: 40.9 GB, 40982151168 bytes
16 heads, 63 sectors/track, 79408 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Device Boot
/dev/hdb1

Start
1

End
79408

Blocks
40021600+

Id
8e

System
Linux LVM

Command (m for help): w


The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@inferno dalth]#

fdisk , IDE- primary slave


LVM ( 0x8E).
aurora,
pvcreate /dev/hdb1:
[root@inferno dalth]# pvcreate /dev/hdb1
No physical volume label read from /dev/hdb1
Physical volume "/dev/hdb1" successfully created
[root@inferno dalth]# vgcreate aurora /dev/hdb1
Volume group "aurora" successfully created
[root@inferno dalth]#


, LVM.
20GB, 30GB,
, .

71

[root@inferno dalth]#
[root@inferno dalth]# lvcreate -L 20G -n ftpdata aurora
Logical volume "ftpdata" created
[root@inferno dalth]#
[root@inferno dalth]# lvscan
ACTIVE
'/dev/aurora/ftpdata' [20,00 GB] next free
(default)
[root@inferno dalth]#
[root@inferno dalth]# lvresize -L +10G /dev/aurora/ftpdata
Extending logical volume ftpdata to 30,00 GB
Logical volume ftpdata successfully resized
[root@inferno dalth]#
[root@inferno dalth]# lvscan
ACTIVE
'/dev/aurora/ftpdata' [30,00 GB] next free
(default)
[root@inferno dalth]# lvcreate -L 8G -n home_dirs aurora
Logical volume "home_dirs" created
[root@inferno dalth]#
[root@inferno dalth]# lvscan
ACTIVE
'/dev/aurora/ftpdata' [30,00 GB] next free
(default)
ACTIVE
'/dev/aurora/home_dirs' [8,00 GB] next free
(default)
[root@inferno dalth]#
[root@inferno dalth]# lvremove /dev/aurora/ftpdata
Do you really want to remove active logical volume "ftpdata"? [y/n]:
y
Logical volume "ftpdata" successfully removed
[root@inferno dalth]#
[root@inferno dalth]# lvremove /dev/aurora/home_dirs
Do you really want to remove active logical volume "home_dirs"?
[y/n]: y
Logical volume "home_dirs" successfully removed
[root@inferno dalth]#


:
[root@inferno dalth]# vgremove aurora
Volume group "aurora" successfully removed
[root@inferno dalth]# pvremove /dev/hdb1
Labels on physical volume "/dev/hdb1" successfully wiped
[root@inferno dalth]#

LVM minor number, major number


LVM 253. LVM
mknod, ,
devlabel.
/dev, /dev
,
,
device mapper, LVM :
/dev/<_>/<_>. ,
LVM:

72

[root@viking root]#
[root@viking root]# ls -la /dev/chimera
lr-xr-xr-x 1 root root 23 8 13:53 opt -> /dev/mapper/chimeraopt
lr-xr-xr-x 1 root root 24 8 13:53 swap -> /dev/mapper/chimeraswap
lr-xr-xr-x 1 root root 24 8 13:53 temp -> /dev/mapper/chimeratemp
lr-xr-xr-x 1 root root 23 8 13:53 usr -> /dev/mapper/chimerausr
lr-xr-xr-x 1 root root 23 8 13:53 var -> /dev/mapper/chimeravar
[root@viking root]#
[root@viking root]# lvscan
ACTIVE
'/dev/chimera/swap' [1,00 GB] next free (default)
ACTIVE
'/dev/chimera/temp' [1,00 GB] next free (default)
ACTIVE
'/dev/chimera/usr' [10,00 GB] next free (default)
ACTIVE
'/dev/chimera/opt' [10,00 GB] next free (default)
ACTIVE
'/dev/chimera/var' [1,00 GB] next free (default)
[root@viking root]#
[root@viking root]# mount | grep chimera
/dev/mapper/chimera-var on /var type ext3 (rw)
/dev/mapper/chimera-temp on /tmp type ext3 (rw)
/dev/mapper/chimera-usr on /usr type ext3 (rw)
/dev/mapper/chimera-opt on /opt type ext3 (rw)
[root@viking root]#

, LVM
,
.
LVM multipath I/O.
device mapper ,
UUID ,
-
. ,
(snapshot) :
,
, :
#
#
#
#
#

xfs_freeze /home
lvcreate -s -L 10G -n home_snapshot /dev/chimera/home
xfs_freeze -u /home
dd if=/dev/chimera/home_snapshot of=/dev/st0
lvremove /dev/chimera/home_snapshot


XFS, XFS
, ,
.
home chimera,
/home, home_snapshot,
10 .
/home , ,
- home,
10GB ,
,
home_snapshot , . ,
,
(home), ,
,
. lvremove.
73

Sotware RAID
Linux software raid ( RAID). md.
device mapper, md ,
,
, RAID-.
md 254 0 16383.
LVM,
(
), RAID
.
, ,
. (
array superblocks) . ,
, ,
.
RAID- (..
),
, .
, ,
, SCSI-,
, .
,
,

.
md ,
md- ,
, IDE, .
RAID- 63 .
, RAID-,
: 64 * N + M, N ( RAID) 0 ... 255, M 1 ... 63.
,
md- ,
mknod. , ,
LVM md,
md,
LVM.
md RAID- 0, 1 0+1,
, RAID
5 (
),
. ,
RAID - ,
HP NetRaid ( AMI MegaRAID) Compaq Smart Array (
HP Smart Array).
,
RAID- 0 1 md
mdadm. mdadm
/etc/mdadm.conf, ,
.
, hdb ,
74

.
md-. ,
RAID-, md-,
, ,
:
[root@inferno dalth]#
[root@inferno dalth]# mdadm --create \
>
/dev/md0 --level=0 \
>
--raid-devices=2 /dev/hdb1 /dev/hdb2
mdadm: array /dev/md0 started.
[root@inferno dalth]#
[root@inferno dalth]# mdadm -Q /dev/md0
/dev/md/d0: 983.25MiB raid0 2 devices, 0 spares.
[root@inferno dalth]#
[root@inferno dalth]# mdadm S /dev/md0
[root@inferno dalth]#
[root@inferno dalth]# mdadm --create \
>
/dev/md0 --level=1 \
>
--raid-devices=2 /dev/hdb1 /dev/hdb2
mdadm: array /dev/md0 started.
[root@inferno dalth]#
[root@inferno dalth]# mdadm -Q /dev/md0
/dev/md0: 491.63MiB raid1 2 devices, 0 spares.
[root@inferno dalth]#
[root@inferno dalth]# mdadm S /dev/md0
[root@inferno dalth]#
[root@inferno dalth]# mdadm assemble /dev/md0 /dev/hdb1 /dev/hdb2
mdadm: /dev/md0 has been started with 2 drives.
[root@inferno dalth]#

md , .
( , RAID ..) mdadm
. ,


- .
mdadm,
, , UID :

75

[root@viking root]# mdadm -Q -D /dev/md0


/dev/md0:
Version : 00.90.01
Creation Time : Fri Oct 8 14:29:21 2004
Raid Level : raid1
Array Size : 102336 (99.94 MiB 104.79 MB)
Device Size : 102336 (99.94 MiB 104.79 MB)
Raid Devices : 2
Total Devices : 2
Preferred Minor : 0
Persistence : Superblock is persistent
Update Time
State
Active Devices
Working Devices
Failed Devices
Spare Devices

:
:
:
:
:
:

Fri Oct 8 14:32:22 2004


clean, no-errors
2
2
0
0

Number
0
1

Major
Minor
RaidDevice State
253
24
0
active sync
/dev/hdb1
253
25
1
active sync
/dev/hdb2
UUID : 8696ffc0:52547452:ba369881:d1b252d0
Events : 0.3
[root@viking root]#


mdadm. /etc/mdadm.conf
, md
:
[root@viking root]# cat /etc/mdadm.conf
MAILADDR root
ARRAY /dev/md0 UUID=8696ffc0:52547452:ba369881:d1b252d0
DEVICE /dev/hdb*
[root@viking root]#

, md0 ,
,
hdb. mdadm
assemble /dev/md0, mdadm ,
/dev/hdb* md0 ,
,
ARRAY /dev/md0.
,
md-,
md-,
.
:
linux md0=0,/dev/hdb1,/dev/hdb2 root=/dev/md0

,
, RAID-,
, .
md-
,
initrd.
,
. , RAID boot-, Linux
76

md, BIOS,
RAID- , .
, RAID-,
,
:
linux md0=d0,/dev/hda,/dev/hdb root=/dev/md_d0p1

md hotswap-
, .. ,
.
software RAID Linux
.

Device mapper
2.6
MD, device-mapper.
,
,
,
.
LVM device mapper,
LVM
LVM device mapper,
, LVM
, ,
device mapper, .

,

,
.

Host-RAID, RAID-
-
RAID
, Linux RAID?!

RAID-
.
RAID
BIOS 32/64-
, RAID
. Windows , Linux .
-RAID (
fake-RAID) dmraid.
(
md-),
fake-RAID ,
, dmraid device-mapper ,
.
device-mapper ,
,
.
77


( ) Linux
. Linux ,

( ) . ,
.
, eth0,
Ethernet-,
. ppp0
- . lo
(
) .

.
lo, ethX,
pppY, -
API , .
, ,
ifconfig:
$ ifconfig -a
eth0
Link encap:Ethernet HWaddr 00:11:2F:A8:DE:A4
inet addr:172.23.2.114
Bcast:172.23.2.255
255.255.255.0
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
Interrupt:11 Base address:0x4000
lo

Mask:

Link encap:Local Loopback


inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:60 errors:0 dropped:0 overruns:0 frame:0
TX packets:60 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:4707 (4.5 KiB) TX bytes:4707 (4.5 KiB)

, eth0 lo,
,
eth0. , Link encap
, HWAddr (, MAC-
Ethernet), MTU .
,
.
:
eth (Ethernet)
ppp (Point-To-Point) -,
, VPN
slip (Serial Line IP) -,
wl
(Wireless)


lo (Loopback) -, ,

78

ifconfig
, , IP:
#
#
#
#

ifconfig
ifconfig
ifconfig
ifconfig

eth0
eth0
eth0
eth0

down
up
inet 192.168.2.210 netmask 255.255.255.0
mtu 296


, ipx_config , IPX.
,
:

socket, send, recv

lo

eth0

ppp0

COM-

/dev/ttyS0

PPP
, .
socket (bind, connect .)
.
.
? ,
.
,
(, ,
).
, . ,
loopback ,
( ).
eth0 Ethernet
,
, ( ).
PPP, ppp0,
pppd. ,
/dev/ttyS0 COM-,
. ,
79

IP
IP- ( ),
IP-, IP- Linux.
,
,
. IP-
net.ipv4.ip_forward sysctl. 0,
, 0,
:
[dalth@viking dalth]$ sysctl net.ipv4.ip_forward
net.ipv4.ip_forward = 0
[dalth@viking dalth]$

,
:
[dalth@viking dalth]$ sysctl -a | grep forward | grep v4
net.ipv4.conf.vmnet1.mc_forwarding = 0
net.ipv4.conf.vmnet1.forwarding = 0
net.ipv4.conf.eth0.mc_forwarding = 0
net.ipv4.conf.eth0.forwarding = 0
net.ipv4.conf.lo.mc_forwarding = 0
net.ipv4.conf.lo.forwarding = 0
net.ipv4.conf.default.mc_forwarding = 0
net.ipv4.conf.default.forwarding = 0
net.ipv4.conf.all.mc_forwarding = 0
net.ipv4.conf.all.forwarding = 0
net.ipv4.ip_forward = 0
[dalth@viking dalth]$


,
.
,
sysctl.
sysctl:
[root@viking dalth]# sysctl -w net.ipv4.ip_forward=1
net.ipv4.ip_forward = 1
[root@viking dalth]# sysctl -a | grep forward | sort
net.ipv4.conf.all.forwarding = 1
net.ipv4.conf.all.mc_forwarding = 0
net.ipv4.conf.default.forwarding = 1
net.ipv4.conf.default.mc_forwarding = 0
net.ipv4.conf.eth0.forwarding = 1
net.ipv4.conf.eth0.mc_forwarding = 0
net.ipv4.conf.lo.forwarding = 1
net.ipv4.conf.lo.mc_forwarding = 0
net.ipv4.conf.vmnet1.forwarding = 1
net.ipv4.conf.vmnet1.mc_forwarding = 0
net.ipv4.ip_forward = 1
[root@viking dalth]#


(next hop) .
,
. , :
, , IP-
, (, ).
IP-,
80

IP- ,
.
0.0.0.0 0.0.0.0
, default route. , gateway
, , default gateway
default router.
, .
route.
, .
[root@inferno dalth]# route -n
Kernel IP routing table
Destination
Gateway
Genmask
Flags Metric Ref
Use
Iface
10.80.1.113
0.0.0.0
255.255.255.255 UH
0
0
0 ppp0
127.0.0.0
0.0.0.0
255.0.0.0
U
0
0
0 lo
0.0.0.0
10.80.1.113 0.0.0.0
UG
0
0
0 ppp0
[root@inferno dalth]# route del default
[root@inferno dalth]# route -n
Kernel IP routing table
Destination
Gateway
Genmask
Flags Metric Ref
Use
Iface
10.80.1.113
0.0.0.0
255.255.255.255 UH
0
0
0 ppp0
127.0.0.0
0.0.0.0
255.0.0.0
U
0
0
0 lo
[root@inferno dalth]# route add default dev ppp0
[root@inferno dalth]#

,
. Destination Genmask
, Metric
( ), Gateway IP . (
, -, point-to-point) ,
,
IP- .
, ppp0
-. , -
.
, PPP-:
[root@inferno dalth]# route -n
Kernel IP routing table
Destination
Gateway
Genmask
Flags Metric Ref
Iface
10.80.1.113
0.0.0.0
255.255.255.255 UH
0
0
ppp0
127.0.0.0
0.0.0.0
255.0.0.0
U
0
0
0.0.0.0
0.0.0.0
0.0.0.0
U
0
0
ppp0

Use
0
0 lo
0

PPP (
) , PPP- , PPP Point-to-Point Protocol.
- SLIP (Serial Line IP)
.

, Iface
.
,
.

81

, ( ,
)
route,
.
:

, ( )
.
, route
,
, /proc/net/route,
, .



, TCP/IP Linux.
, IP- Linux
(hooks) . ,
, , .
, , , -
, ,
,
, ,
.

iptables. iptables ,
NETFILTER Linux,
, , IP-.
iptables (chain).
(condition matches) (action).
(tables).
,
DROP ACCEPT,
, LOG MARK.

,
, ,
. ,
, ,
.

, (chain policy). ,
, ,
.


,
( ). ,
.
:

82

mangle

PREROUTING

INPUT

FORWARD

(
)

OUTPUT

POSTROUTING

filter

INPUT

OUTPUT
)

nat

FORWARD

()

PREROUTING

FORWARD

POSTROUTING

nat , ..
,
, . mangle nat , mangle
, .. .


, iptables.
( ,
iptables) :
1.
2.
3.
4.

mangle.PREROUTING
nat.PREROUTING
mangle.INPUT
filter.INPUT

, ,
:

83

1.
2.
3.
4.

filter.OUTPUT
mangle.OUTPUT
nat.POSTROUTING
mangle.POSTROUTING

, (), ..
,
:
1.
2.
3.
4.
5.
6.
7.

mangle.PREROUTING
nat.PREROUTING
mangle.FORWARD
filter.FORWARD
nat.FORWARD
nat.POSTROUTING
mangle.POSTROUTING



, - .
,
,

. :
ACCEPT


DROP

RETURN


,
, ,
(chain policy)

QUEUE

, target
extensions,
. , ,
, LOG ,
MASQUERADE IP- , MARK
. ,
.

. ,
, ,
. ,
.


,
, , match extensions.
,
, UDP
, ICMP
ICMP-.

84

iptables
,
. ,
(,
) ,
,
.
1: iptables ,
Internet.
, UDP ,
Internet PPP-.
,
TCP-, TCP
, UDP-
DNS PPP (
DHCP). , ICMP
PING:
# iptables
# iptables
# iptables
# iptables
# iptables
# iptables
# iptables
# iptables
# iptables
# iptables
# iptables
# iptables
# iptables
68
# iptables

-P INPUT DROP
-A INPUT -j ACCEPT -i lo
-A INPUT -j ACCEP -p tcp ! --syn
-A INPUT -j ACCEPT -p udp --source-port 53
-A INPUT -j ACCEPT -p udp --source-port 67 --destination-port 68
-A INPUT -j ACCEPT -p icmp --icmp-type destination-unreachable
-A INPUT -j ACCEPT -p icmp --icmp-type time-exceeded
-A INPUT -j ACCEPT -p icmp --icmp-type parameter-problem
-A INPUT -j ACCEPT -p icmp --icmp-type echo-reply
-P OUTPUT DROP
-A OUTPUT -j ACCEPT -p tcp
-A OUTPUT -j ACCEPT -p udp --destination-port 53
-A OUTPUT -j ACCEPT -p udp --destination-port 67 --source-port
-A OUTPUT -j ACCEPT -p icmp --icmp-type echo-request

2: , 1, .
, , ,
. KILLER
, ? ,
, ,
KILLER, ( ,
) LOG,
DROP. LOG ,
:

85

# iptables
# iptables
# iptables
# iptables
# iptables
# iptables
# iptables
# iptables
# iptables
# iptables
# iptables
# iptables
# iptables
# iptables
# iptables
# iptables
68
# iptables

-N KILLER
-A KILLER -j LOG
-A KILLER -j DROP
-P INPUT KILLER
-A INPUT -j ACCEPT -i lo
-A INPUT -j ACCEP -p tcp ! --syn
-A INPUT -j ACCEPT -p udp --source-port 53
-A INPUT -j ACCEPT -p udp --source-port 67 --destination-port 68
-A INPUT -j ACCEPT -p icmp --icmp-type destination-unreachable
-A INPUT -j ACCEPT -p icmp --icmp-type time-exceeded
-A INPUT -j ACCEPT -p icmp --icmp-type parameter-problem
-A INPUT -j ACCEPT -p icmp --icmp-type echo-reply
-P OUTPUT KILLER
-A OUTPUT -j ACCEPT -p tcp
-A OUTPUT -j ACCEPT -p udp --destination-port 53
-A OUTPUT -j ACCEPT -p udp --destination-port 67 --source-port
-A OUTPUT -j ACCEPT -p icmp --icmp-type echo-request

3: . IP-
, , - .
IP- (, , ) .
SNAT
, DNAT , MASQUERADE
SNAT, IP- (IP IP- ,
, IP-
).
, 193.267.14.6,
192.168.0.0/24. ,
TCP ,
:
# iptables -A POSTROUTING -t nat -j SNAT -o ppp0 \
>
--to-source 193.267.14.6 -p tcp \
>
--source 192.168.0.0/24 \
>
--destination ! 192.168.0.0/24

, ( dialup
),
,
:
# iptables -A POSTROUTING -t nat -j MASQUERADE -o ppp0 \
>
--source 192.168.0.0/24 \
>
--destination ! 192.168.0.0/24

SNAT , MASQUERADE ,
( ,
,
).
-o ppp0, ,
ppp0. ,
, -
connection tracking ( ),

.
4: . ,
, , -
(,
86

WWW-). DNAT
(destination NAT). TCP-,
ppp0 80, 85
192.168.0.6:
# iptables -A PREROUTING -t nat -j DNAT -i ppp0 \
>
--to-destination 192.168.0.6:85 -p tcp --destination-ports 80

, iptables ,
, .
,
iptables .
, RedHat Linux ,
, iptables.
/etc/rc.d/init.d/. ,
, iptables.

iptables, /sbin/iptables,
/etc/rc.d/init.d/iptables save,
/etc/sysconfig/iptables.
iptables,
, - ,
iptables.

, NSS PAM
Linux . ,

: /etc/passwd, /etc/group, /etc/shadow, /etc/gshadow.
,
Linux ,
,
, NSS Name Service Switch. NSS
.
. NSS
libc, libc
NSS:

NSS (libc.so)
files
(libnss_files.so)

DNS
(libnss_dns.so)

LDAP
(libnss_ldap.so)

/etc/passwd

DNS

LDAP

, NSS,

libc.so,

/etc/nsswitch.conf, NSS,
.
,
, glibc
NSS ,
87

nsswitch.conf.
, NSS ()
, (),
, IP- .
nsswitch.conf:
[viking@alpha etc]$ cat /etc/nsswitch.conf
passwd:
files ldap
shadow:
files ldap
group:
files ldap
hosts:
files dns
bootparams: nisplus [NOTFOUND=return] files
ethers:
files
netmasks:
files
networks:
files
protocols: files
rpc:
files
services:
files
netgroup:
nisplus
publickey: nisplus
automount: files nisplus
aliases:
files nisplus
[viking@alpha etc]$

,
LDAP,
IP- DNS,

NIS+.
NSS libnss_XXX.so, XXX
. libnss_files.so NSS
, libnss_db.so
BerkleyDB, libnss_ldap.so LDAP.
, .
, Linux-
,
NSS
, Solaris,
NIS/NIS+, ActiveDirectory LDAP.
NSS
, DNS
, NIS ,
LDAP .
PAM (Pluggable Authentification Modules) NSS,
. PAM
( , , ).
NSS, PAM ,
,
PAM, /etc/pam.d.
PAM NSS ( ) ,
PAM libc,
.
UNIX
, Linux
, NSS PAM.
passwd, chsh, chfn, id, who . NSS
ls, find, ps ,
. ,
88

NSS, PAM ( XDM


GDM).
NSS. , NSS
PAM
Linux-.

X11 --

X11 (X11 Windows System),
. X11?
, X11 ,
: X- X-.

- X11
X- , /,
,
( -) X. X- ( ,
), ..
, X- .

X-.

X- Xorg. xorg.conf
/etc/X11. ,
X-, , .
[man Xorg, man xorg.conf].

X- ,
, , , ,
..
, X X11, X-
,
. , X-

X-,

X-

.
X11
( X- X- ),
X- X- .
X- X-
, , X ,
,
X-,
X-.
, ,
X-. (
Nautilus GNOME):
X-:
nautilus ( ,
, , ). X-
(window manager) metacity
89

. , ,
metacity,
, , ,
nautilus.


,
.
X- ,
, ,
.
:
1)

2) -
3)

4)
- ,
, , IM-
5) ,
,
,

6)

,

.

, GNOME
KDE, ,
X- ...
.
Linux GNOME KDE.

( GNOME GTK, KDE Qt),
, , -,
, (
),
-,
, ,
.
X- - ,
Firefox Opera, Mplayer,
OpenOffice.Org. ,
,
--, ,
, .

X11.
X11 , .
:
90

( : Qt, GTK, etc.)

X11 (libX11)

X-

-,
, (
) libX11, X11 Core Protocol
X-. X-
.
X- , X11 Core Protocol
X-, libX11
,
.
, ,
-.
, Qt GTK,
,

-
.
X11 (libX11, Xlib)
X11,
X11,
X-, ,
.

X11.
X11 X-.
, ,
X-
. X-
, ,
,
().
, X Core Fonts, X11 ,

fixed, hevetica, times, courier.
,
, ,
( 8 18), ( )
( ), 40
, .
91

,
X-, X11
(font server).
,
X- ,


, .
Linux X11 ,
xfs. /etc/X11/fs.
,
X- ,
, .


,
, 90
, ,
(LCD-)
, ,
.
, X Core Fonts
xterm,
, XDM.

X11. FreeType XFT



XFT FreeType,
,
(
).
X11,
X-.
: X- X-
,
FreeType XFT, X , X- .
, X-
( )
PostScript
TrueType.
GTK QT ,
, Motif Xview (OpenLook)
,

XFT FreeType,
- X11 .

X11.
X11 ,
,
. ,
XShape,
XVideo,
OpenGL GLX .
92

X11.
X11 ,
X11.
:
xterm
xfontsel
xdpyinfo X11

xwininfo (, ,
..)
xwd
xwud xwd
xhost X- X-

X11.
X-, .
,
, ,
,
Z- . ,
.
GNOME KDE metacity kwin.

, .
( UNIX) twm. ,

.

UNIX-

, , ,
.
Linux i18n.
,
.
,
locale:
$ locale
LANG=ru_RU.UTF-8
LC_CTYPE="ru_RU.UTF-8"
LC_NUMERIC="ru_RU.UTF-8"
LC_TIME="ru_RU.UTF-8"
LC_COLLATE="ru_RU.UTF-8"
LC_MONETARY="ru_RU.UTF-8"
LC_MESSAGES=en_US
LC_PAPER="ru_RU.UTF-8"
LC_NAME="ru_RU.UTF-8"
LC_ADDRESS="ru_RU.UTF-8"
LC_TELEPHONE="ru_RU.UTF-8"
LC_MEASUREMENT="ru_RU.UTF-8"
LC_IDENTIFICATION="ru_RU.UTF-8"

, locale
93

.
, :
LANG ,

LC_CTYPE
LC_NUMERIC
LC_TIME
LC_COLLATE ,

LC_MONETARY
LC_MESSAGES
LANG
ru_RU.UTF-8 ( , ,
UTF-8),
.
, , ,
.
Windows,
, , UNIX Linux


LANG LC_MESSAGES.
,
,
.
Linux
,
,

, , ..



, :
[viking@alpha ~]$
[viking@alpha ~]$ LC_MESSAGES=ru_RU.UTF-8 ls -l something
ls: something:

[viking@alpha ~]$
[viking@alpha ~]$ LC_MESSAGES=en_US.UTF-8 ls -l something
ls: cannot access something: No such file or directory
[viking@alpha ~]$
[viking@alpha ~]$ LC_MESSAGES=fr_CA.UTF-8 ls -l something
[viking@alpha ~]$
ls: ne peut accder something: Aucun fichier ou rpertoire de ce type
[viking@alpha ~]$

, Linux-
,
. RedHat/Fedora
/etc/sysconfig/i18n,

~/.i18n:
[viking@alpha ~]$
[viking@alpha ~]$ cat /etc/sysconfig/i18n
LANG="ru_RU.UTF-8"

94

SYSFONT="latarcyrheb-sun16"
[viking@alpha ~]$ cat /homed/viking/.i18n
LC_MESSAGES="en_US"
[viking@alpha ~]$

ru_RU.UTF-8, viking
,
.

95

Linux

: http://linuxshop.ru/unix4all/?cid=&id=160
: (alv@linux-online.ru)
C : 1.3
(,
DOS/Windows, ) -
Linux. - ,
.


" " -
, , Unix ( Linux
) - : , ,
"". ,
.
, , - .
-, , , , ,
:

/. ,
.
-, Unix Unix- , , ,
, -
. ,
Unix.
-, -
( - ).
" ",
. ,
: DOS-, (Extended) DOS, Linux
native .
""
. Linux "" (native)
,
- Linux native Extended DOS,
(LVM) ,
RAID-.
, (
96

,
- disk based file system),
.
- devfs, - tmpfs,
procfs - , (
) .
, , (RAM-). tpmfs,
, ,
disk-based.
,
, , , ,
, . , ,
, FAT16 ( VFAT FAT32)
DOS, UFS FreeBSD Ext2fs - Linux. -
,
Unix- Unix- .
, FAT, .
, Linux
- Ext3fs,
Ext2fs, XFS JFS, Unix
SGI IBM, , ReiserFS.
Linux' FAT ( - ).
,
, Linux,
. -
Linux' ,
(, NTFS HPFS) - .
, , Unix -
, ,
(,
Ext2fs FAT16, procfs, devfs tmpfs),
, . - ,
, ,
, ,
, ,
.
, Linux
,
.
, Red Hat Debian. ,

Linux. , ,
. ,
, , Linux Standard Base
Filesystem Hierarchy Standard, -
), ,
Linux, , BSD.

, ,
(, ).
97

Unix-
, Unix.
Unix ,
,
, .
- .. ,
( ), (,
, ..), ,
( - )
- ,
ASCII-
.
,
, .. inodes ( information nodes - ).
inode,
. inodes,
,
, ,
.
, (,
DOS/Windows, ) -
(, , ), inodes
( ,
),
.
- (
) ( /lost+found,
).
, , , ,
, , , , .
: Unix , (
, , ).
- ( Unix ,
, ).

. MacOS Windows
- Unix :
.
, Unix
: ,
( ),
, -
. ( ) ,
(, ,
inode , ,
, )
, ,
inode .
98


Commander.

rm

Midnoght

, , -
. ,
(, inode, )
- ,
. .
- , (
) - (mount point),
.
- ,
. , inode
.. (clean bit).
,
. ,
Linux'.

Linux
Ext2fs
(native) Linux
- ext2fs (, Linux
FAT-, ).
" "; ""
- minix, Linux,
"" - Linux Extfs
.
Ext2fs (. ).
, -
Unix. , .
,
, -
. , ,
- (
),
inodes
.
, , Linux-
, .

, "
". (,
fsck)
, .




Unix. ..
99

. -- log- ,
,
,
.
,
,
. ,
,
, .
,
.
, ,
,
.
. , ,
.
Linux
: ReiserFS Ext3fs, ,
XFS JFS - Linux ,
Irix (SGI) AIX (IBM), .
, , JFS
.

ReiserFS
ReiserFS Linux
- c http://www.kernel.org,
2.4.x ( ,
2.2.xx). ,
" "
Namesys. , ReiserFS
. ,
, :
,
Ext2fs. , , ,
, .
, ReiserFS ( )
, ,
, ( , Unix-
): inode,
-
, , ( ReiserFS - statdata)
/.
ReiserFS - , .. ,
, , , .
(tailing) ReiserFS,
5% . , ,
,
.
- , ,
.
100

ReiserFS Ext2fs .
, reiserfsprogs,
(,
, Namesys).
- ,
Linux ( Lilo, GRUB - )
Linux ReiserFS, .
, , ,
,
. ,
/boot .

Ext3fs
ReiserFS, Ext3fs -
Ext2fs, Red Hat
Linux, 2.4.16.
, ,
( 1.21
e2fsprogs). ext2fs ext3fs
, ,
.
ext3fs,
. - :
ext3fs ,
, .
Ext3fs - (full data
journaling), (writeback),
(ordered).
,
,
, .
.
,
.
, .
, ,
,
. ,
( Ext3fs) .

,
, (transaction).
, ,
, . -
,
.
, Ext3fs
.
,
.

101

XFS
XFS, ReiserFS ext3fs,
SGI - Irix
5.3, 1994 . Linux (

1.1,

SGI's
XFS
page
http://oss.sgi.com/projects/xfs) .
XFS - 64- .
- . XFS :

allocation group,
, inodes
, ;
, -
;
delayed allocation -
, ,
,

;
(ACL, Access Control List)
(extended attributes),
.

XFS :
, Ext3fs, ReiserFS
. ()
XFS - : ,
. .
, XFS -
Linux. : ReiserFS ext2fs,
Linux, XFS ( - 2.4.19)
(,
http://www.kernel.org).
( 2.5.X) ,
.
XFS (xfs-2.4.1X-all-i386.bz2),
SGI
: e2fsprogs, XFS .
XFS ,
xfsprogs.
.


,
( Ext2fs - ,
),
(, , ).

.
102

, , LVM,
, ,
.

.
, , Ext2fs -
( GRUB -
). , Ext2fs ,
/tmp /var. , , .
(, Source
Based Gentoo /var
,
). , Ext2fs
-
.
, -
.
Ext3fs, . ,
Ext2fs. /usr
/usr/local Ext3fs .

- , , , /home (
, ).
- ,
. Ext3fs - ()
/home, -
"" , ReiserFS XFS.
( ,
, JFS,
, ).
, XFS ()
, ,
, ..
ReiserFS ()
( ),
.
- XFS.
ReiserFS , LVM. XFS ,
, .
- :

Ext3fs - (/) /usr ( /usr/local


/usr/X11R6, );
Ext2fs - /boot, /tmp /var;
XFS - (/home).

, ,
Linux - .


,
, .
103

, .
Linux -
, .
,
. ,
,
(, , ). SB
, Gentoo, , - .
Ext2fs
- /sbin/mke2fs, /sbin/mkfs, /sbin/mkfs.ext2
, :
$ /sbin/mke2fs /dev/hd?#

( /sbin/mkfs.ext2 -
/sbin/mke2fs) , : -b
( - 1024, 2048 4096 ,
),-c , -N -i
inodes , ;
man-, , man (8) mke2fs.
ext3fs mke2fs
-j, "" .
:
$ /sbin/mke2fs -J _ /dev/hd?#

- size=,
, device=_
, .
/sbin/mkfs.ext3 -
/sbin/mke2fs ( ,
). - ext2fs
ext3fs , ,
( ).
$ tune2fs -j /dev/hd?#

/.journal
( ),
inode (
). , - ,
(
).
ReiserFS
- /sbin/mkreiserfs reiserfsprogs.
(-s , -f
, ..),
man (8) mkreiserfs.
: ReiserFS,
/boot
ext2fs.
XFS mkfs.xfs (
104

xfsprogs). ,
, . :

-b, size=##
,
( i386 - 4 )
512 65536 ( - 4096);
-d, , ,
(Allocation groups,
agcount), , , ( agsize);
-l, , ,
( size).

mkfs.xfs
allocation groups -
, .
- allocation group 4 .
-
32 . 20

$ mkfs.xfs -d agcount=5 -l size=32m /dev/hda1

, mkfs.xfs -f ( force) XFS .


, ext2fs (, , ext3fs,
). XFS ReiserFS -
. ,
( XFS ReiserFS), ,
"" ext2fs.
, XFS
ReiserFS, .

- (
)
$ dd if=/dev/zero of=/dev/hd?#

-
10-20,
Control+D .
, - swap-,
. ,
,
$ mkswap _

-
.



.
. ,
Unix
105

, : . . . UNIX.
ext2fs
", , " ( , 2000, 1 - #2; 2 - #3,).
,
Linux, , ,
,
Linux.

Linux :
: http://citkit.ru/articles/381/
: (alv@linux-online.ru)
: 15.03.2007 .
C : 1.3
... , .
- , .
- , , ...
:
.
,
, .
-
.
"" Linux ( ,
) :
ext2fs, ext3fs, ReiserFS, XFS, JFS.
. ,
Linux FAT/VFAT/FAT32, -
, ,
.
JFS - :

Linux;
( Linux -
AIX );
.


.
-
.
ReiserFS -
: ? ,

.
,
106

, Linux
,
( FS). Unix- . ,
FreeBSD, Gentoo .

inode ( , ),
, ,
. ,
FreeBSD ( , UFS,
, UFS2) .
ReiserFS
-
inode. ,
- FS.
ReiserFS
. , (
) ,
inodes, - .
, inodes ,
. , ext2/ext3
, .
, , . , .
,
.
-, ,
inodes, "".
,
. , , ,
.
Linux.
.
ReiserFS
FS, ext2.

.
ReiserFS .
Windows, , .
BSD (DragonFlyBSD, FreeBSD)
, . ,
Linux LiveCD ReiserFS, .
ext3fs. , ReiserFS. ext3fs
, ReiserFS.
, . ext2 -
, 2.2 ( 2.0).
, ext3fs -
Linux-. , -
LiveCD - , ,
107

. , BSD-
ext3fs ( ). Windows , ,
plug-ins (
Total Commander), ext2fs/ext3fs.
ext3fs .
-, ,
: ,
.

. , ,
, .
, ,
ext2fs - ,
. , ,
-
...
XFS .
, ReiserFS - ,
Linux.
XFS ,
ext3fs.
.
, XFS
, -
DVD .
.
, ,
(
-
). ,
,
.
.
-
, .

...
, .
- ReiserFS. , ,
, ,
ext3fs ReiserFS .
/boot (
GRUB ) -
, ext2fs, , -
. ,
- XFS.
,
.

108

Gentoo Linux
: http://gentoo.ru/about
C : 1.0
Gentoo Pygoscelis papua (
: , ,
). 98
(27/).
Gentoo Linux ,

. ,

Gentoo.
, Gentoo Linux
, ,
, , - ,
. -
, Gentoo Linux
"".

?
Portage Gentoo Linux, .
, portage
Gentoo Linux. , ,
Gentoo Linux : emerge --sync (emerge;
/ (: emerge - , ,
)). Portage
.
,
Gentoo. Portage 10000
, .
Portage .
, : emerge _, Portage
,
,
, .
Portage , .
: emerge -u world ,
.

109

Gentoo Linux
Gentoo Linux
. Gentoo
Gentoo Linux: , Gentoo Linux
, : emerge --sync.
, Gentoo Linux
,
.
, Gentoo Linux -,
.
, Gentoo Linux:

x86, AMD64, PowerPC, UltraSparc, Alpha MIPS

x86, AMD64, PowerPC, UltraSparc Alpha LiveCD

KDE GNOME

Linux

GNU

: ReiserFS, XFS, ext3, EVMS, LVM

: NVIDIA, Creative Labs Live!


Audigy

OpenGL
)

Gentoo

10000

, Gentoo Linux,
. : !

Gentoo
. ,
, ... Gentoo
Linux. Debian Linux, ,
Linux , ,
Linux, ,
Stampede Linux. ,
Stampede, .
, ,
.

110

. ,
,
. #enoch irc.freenode.net 10
, . ,
, , .
Gentoo Linux. , Gentoo 1.0 ,
. , -
Linux , - Gentoo
.
Gentoo... FreeBSD.
. . Linux.
, , Gentoo
.
Portage.
Gentoo ,
. Gentoo
,
.
Gentoo -
, ,
Gentoo. (
) .
,
Gentoo , Gentoo.
2004 Gentoo.
Gentoo, .
Gentoo , :
, ,
. , , Gentoo
Gentoo!

Gentoo
: http://gentoo.ru/philosophy
: 1.0
: Daniel Robbins - Gentoo

:
Gentoo, ,
. Linux-
,

,
,
.
Gentoo (.. Portages),
, , .


.
, ,
111

ebuild.
ebuild - (, emerge build file)
.
, USE. ,
ebuild .
emerge -
,
.
Linux- , Gentoo
. " ",
Gentoo "from source" ( ).
, , , .
,
, .
,
Linux. ( ) ?

Gentoo - ,
.
Gentoo
, ,
.
. , ,
, Gentoo
.
, ..
(, RPM - .
). Gentoo ,
,
, . , ""
.
Gentoo :

Gentoo
.

Gentoo ,

Linux .
, ,
, .

-
-
, . ,
, .
Gentoo.

112

, Gentoo
. ,
, (, ,
Unix - . ). ,
, .
Gentoo ,
- ,
.
, , ?
? -
.

Gentoo
: http://ylsoftware.com/?action=news&na=viewfull&news=130
C : 1.0
: MooSE 2006-11-22 16:35:01
Gentoo - .

. ,
Gentoo.
.
Gentoo Handbook (
Gentoo- . : ).
Gentoo , .
Gentoo "" ,
. Gentoo
.
Handbook Gentoo.
( X ALSA)
Gentoo Wiki.
(WiKi) ( : ) ( -)
( : , ,
(FAQ), -(HOWTO)).
:

. .

- (),
.

, .

, ,
, . .

( ) .
- .
, ,
.

113

. Wiki
, ;
- .
ALSA, Advanced Linux Sound Architecture Linux,
- MIDI- (Musical Instrument Digital Interface
) Linux. ALSA
2.6, OSS (Open Sound System - ),
2.4
X- ( )-
. Gentoo
( Linux ), ? , , :-). Linux
,
.
, :
, .
Linux - . ,
.
, ,
, ,
X Window System, X11 X.
Unix, Linux Unix- .
, Linux
X11, Xorg-X11, XFree86.
XFree86 , , GPL,
Xorg. XFree86
.
X.org
X.org
X11 . , X11.
Xorg
. , Xorg ,
, .

, IRC.

Portage
Gentoo -
, Portage,
.
,

( ,
). Portage
USE- .
KDE GNOME
USE /etc/make.conf "kde -gnome".
USE- Gentoo Handbook.

114

Portage emerge.
moo : emerge moo. Portage
, ,
. ,
ebuild', . ebuild'
/usr/portage.

Portage
Gentoo - USE.
Midnight Commander X.Org -
X. KPDF KDE? - KDE
pdf ( KGhostScript).
emerge --ask --verbose (
emerge -av) USE- .
gentoolkit (emerge gentoolkit) -
euse, USE*.
euse -i flag "flag". man euse ( . :-)).
USE-
USE="some flags" emerge moo. ,
.
USE- /etc/portage/package.use, echo
"category/moo some flags" >> /etc/portage/package.use .

ACCEPT_KEYWORDS

/etc/portage/package.keywords. Portage 2.1


package.use package.keywords .

?
- ebuild', () Portage

, Portage.
, Portage.
ebuild Portage CVS.
, ebuild bugzilla. ,
ebuild.
ebuild
. - ebuild',
() Portage.

ebuild'
(/usr/portage), .
* : ufed (: emerge ufed) USE

115

, ,

/usr/portage.

ebuild.

PORTDIR_OVERLAY="/path/to/local/overlay" /etc/make.conf.
- /usr/local/overlays.
ebuild' /usr/local/overlays/local.
/usr/local/overlays.
, , ,
ebuild', .
xgl-coffee , XGL.
/usr/local/overlays/xgl-coffee
SVN.

Gentoo Wiki.
.

?
. .

packages.gentoo.org gentoo-portage.com ( RSS).

!
, emerge some-package,
/var/lib/portage/world.
emerge --update --deep world - .
.
.
- world.
, , wxWidgets,
world.
-
emerge --update (...) world,
emerge --depclean.
wxWidgets world -
.
, world .
world --oneshot.
- .

116

emerge /var/log/emerge.log.
- tail
/var/log/emerge.log. genlop (emerge genlop)
. genlop -c

.


-
/var/tmp/portage.
- . -
/var/tmp/portage .
/usr/portage/distfiles.
eclean gentoolkit.
. ,
. ( eclean-dist eclean-pkg
). man .
Gentoo .


. .

Gentoo Linux: *
: http://posix.ru/distro/gentoo_old/
: (alv@linux-online.ru)
: 1.0

Gentoo Linux

Gentoo Linux - .. Source Based


. ,
, . Gentoo
, , Red
Hat Debian.
Gentoo 2001 . .
http://www.gentoo.org.(: http://gentoo.ru)
Gentoo Linux
BSD- ( - FreeBSD).
* (.: JohnBat26)

117

, BSD- Linux
, Unix System V (
).
Gentoo FreeBSD. ,
, (.. Distribution)
.
.. . -
( - )
, , ,
. , FreeBSD
(packages),
.
Gentoo ( - Portages)
, FreeBSD.
( - ) ,
, , gcc
glib.
Gentoo :
1. , (
) ;
2.
( , i86, Sparc,
PowerPC Alpha), ;
3. ( packages FreeBSD),
, host-;
4. (,
) .
Gentoo
. Gentoo Handbook
, .
( "-")
. - (
Pygoscelis papua), - (,
, ).
, -
.
Gentoo.


Gentoo
. - http ftp, ,
. , CD-,
.

118

Gentoo ,
() .
iso- CD-
, Gentoo . ,
, -
, , ,
, .
, , -
. - , 200 (
). Live CD -
Linux-, -.
, .
.
-
(*.tar.bz2), ( )
. ( stage1-*, 10 )
(i86, PowerPC, Sparc ..). (stage2-* stage3-*,
50 80 , ), , PC-
,
: i486 Pentium-4 ( Athlon). ,
, .
, - portage-200XXXXX.tar.bz2,
~/gentoo/snapshots (
). ,
( ),
.
,
-
. :
Gentoo
~/gentoo/distfiles ( ~/gentoo/gentoo-sources, ).
, , , .
- ,
. ""
: CD ( , ,
) Zip ( - 250 , ).

- ( ) .
-
stage2-*, stage3-* portage-* - , - .
,
Gentoo (, - ,
). , , -
. .
, ,
119

- .
, , src
- , .

Linux- .
Gentoo - :
, , Reset,
Setup BIOS ,
(,
- dmesg.

(login), root, -
Enter.
- .
.
Gentoo, - -
,

. ( )
.
. -, -
, , . - (
), Gentoo - ,
Live CD. -
Linux- (
).
- Linux,
bash 6 ( ,
- root ). - CD
Linux- ,
( ).
-
. :

- SCSI-, IDE-RAID, Zip (atapi-floppy, Linux), , ,



;

: ,
FATxx (native) Linux, XFS,
);

- , ,
;

ppp -
.
, ( ,
)
,
120

$ modprobe _
,
$ insmod _
(

/lib/modules/2.6.XX.X/kernel/ -
.
- ( ).
IP-,
DHCP- ( ),
,
$ dhcpcd eth0
. IP-
, (
).

. /mnt
, ,
$ mkdir /mnt/zip
Zip-,
$ mkdir /mnt/cd2
CD ( CD - /mnt/cdrom, - ,
). . zip " " :
$ mount /dev/hdd4 -t msdos /mnt/zip
, , ,
- /dev/hdd4: zip-
, , . :
devfs Gentoo, zip-
-
.
CD .
,
( , , ).
, -

- ,
:
$ lynx /mnt/mount_point/build.html
-
, ,
, ,
- Gentoo ,
121

- , . ,
( , , FreeBSD) -
, , , .
wvdial,
Live CD ( /usr/bin).
ppp (, ppp_generic, , ppp_async),

$ wvdialconf /etc/wvdial.conf
, ,
, ,
. ,
:
[Dialer Defaults]
Modem = /dev/ttyS0
Baud = 115200
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
ISDN = 0
Modem Type = Analog Modem
,
. - , , ,
:
Dial Command = ATDP
- :
Phone =

Username =
Password =
, , /etc/hostname

localhost
/etc/resolv.conf: nameserver
IP- DNS- .

$ wvdial
-
.
:
( ,
122

)? Gentoo
nano - ,
.

$ nano -w _
-w - ,
, .
, :
$ alias nano='nano -w'
, ,
bash.

-
-
,
Live CD. -
.
, ( , #11,
2002) .
- fdisk, cfdisk, parted,
Live CD.
: mkefs ext2fs, mkfs.xfs - XFS, mkswap - ,
.
( IDE-) . 1.
1. Gentoo

100
ext2fs ext3fs
128 =<2*RAM=<2 Linux swap
1,5
XFS, ext3

/dev/hda1
/dev/hda2
/dev/hda3

, - . , 1,5
- .
- , .
/usr . , ,
/home .
/var /tmp.
Gentoo
, ,
RAID- (LVM Logical Volumes Manager).
. ,
( - ) .
LVM
123

(
,

). , ,
Live CD
RAID- LVM. ,
, IDE-RAID,
( -
).
-
(, - ). -
:
$ swapon /dev/hda2
,
.
,
:
$ mkdir /mnt/gentoo
:
$ mount /dev/hda3 /mnt/gentoo
/boot, /usr, /home -
,
/mnt/gentoo:
$ mkdir /mnt/gentoo{/boot,/usr,/home}
:
$ mount /dev/hda1 /mnt/gentoo/boot
.
$ cd /mnt/gentoo/
Gentoo
. ,
CD:
$ tar -xvjpf /mnt/cdrom/nocompress/stage1-x86-*.tar.bz2
-p :
,
.
/mnt/gentoo (/mnt/gentoo/etc, /mnt/gentoo/proc ..)
,
, ftp- wget. ,
-
. , ,
, stage2* stage3*.
, ,
,
, :
$ tar -xvjpf /mnt/zip/stage2*.tar.bz2

124

. /mnt/gentoo
, ,
base Linux. , , ,
/mnt/gentoo .

-

-
. , , , -
.
, ,
- :
$ cp /etc/resolv.conf /mnt/gentoo/etc/resolv.conf
$ cp /etc/hostname /mnt/gentoo/etc/hostname
$ cp /etc/wvdial.conf /mnt/gentoo/etc/wvdial.conf
Linux
. (,
, ):
$ mount -o bind /proc /mnt/gentoo/proc
, ,
(
). , (
Live CD ), -
:
$ mount /dev/hdd4 /mnt/gentoo/mnt
,
. , . ,
- , ,
. , , .
,
/mnt/gentoo/usr ( ).
, , :
$ tar -xvjpf /mnt/zip/portage*.tar.bz2
- ,
. -
/mnt/gentoo/usr/portage distfiles
:
$ cp /mnt/zip/src/* /mnt/gentoo/usr/portage/distfiles
, ,
(
). -
.

125

- . ,

$ chroot /mnt/gentoo /bin/bash


/mnt/gentoo ,
( ).

$ env-update

Regenerating /etc/ld.so.cache...
:
$ source /etc/profile
, - Gentoo Linux, ,
, Live CD.
( /usr/portage)
, / - , /mnt/gentoo.

- Gentoo
, Gentoo Linux (
, ). -
-
( )
, , , - .
: )
, ) /usr/portage/distfiles (
- /mnt/gentoo)
, ) - (
). , , -
(
/usr/portage/distfiles) .
? , ,
(, FreeBSD, make world)
. - apt-get,
,
. , - .

/etc/make.conf. nano ( -w,
- ) .
, USE. -
. , --enable/disable
--with/without ./configure,
. , ( ,

USE="gpm"
126


(, , ).

USE="-gpm"
( - ,
).
USE
/usr/portage/profiles/default-x86-XX/make.defaults. (
)
- use-howto.html. ?
? - ...
/etc/make.conf CHOST='i686-pc-linux-gnu'
, .
, , .
, -
Pentium-...
,
CFLAGS="*"
. ,
.
- , , .
, -O3 ( )
, -mcpu=* -march=* ,
. - ,
, -mcpu=i686,
Pentium Pro ( , P-II, P-III,
P-4 ), Pentium-100,
-march=athlon-xp ,
- Athlon' .

CXXFLAGS=
- , , ++.
, CFLAGS=
CXXFLAGS="${CFLAGS}"
example-.
( , ftp- ). , wget,
.
, .

$ cd /usr/portage

127


$ scripts/bootstrap.sh
binutils, gcc, gettext glibc (
), glibc -
binutils, gcc gettext. , , ...
-
-.
, base Linux .

$ emerge -p system
, , -
/usr/portage/distfiles,
$ emerge system


- _
- . ,
, - : (
Live- CD)
wvdial (
Live-), . , ,
- Gentoo' ,
. ,
, emerge system -
distfiles Gentoo, , :-)

:
,
- : . ,
Linux, user-. Source Based
.
Gentoo - .
, ,
. , , ,

.
, .
, stage2-3 .
?
- : .
/usr/portage, syskernel - :
Sparc, PPC, Alpha,
128

. ,
, ,
,

.
, , -
( vanilla-sources) ,
. - , gentoo-sources, -
). ac-sources - ,
.
: usermode-sources - Linux
Linux, .. ( );
openmosix-sources - (openMosix)
, ...
- . -

$ emerge sys-kernel/name-sources
,
, - - ,
/usr/src/linux .
,
- , .
. - , ,
: -
Gentoo- (
-
). : ,
(
lynx - ), (
, , ) .
.
, : ,
V90, .
wget -
.
, , . ,
- (, ). :
/usr/src,
, - ,
. .
- ,
(
/var/db/pkg), - ( -
, - ).
- .
- (
).
129

, , ,
/usr/src/linux ( /usr/src/linux_-_, , -
).
$ make menuconfig
.
make config - .
- .
. -
: Linux
(
).
(procfs), (Virtual Memory
Filesystem) (devfs). , ,
, (, XFS
ext3fs - ext2fs, , ).
- , .
, (
) :
$ make dep
$ make clean
$ make bzImage
$ make modules
$ make modules_install
, , ,
; (, , &&). ,
:
$ make dep && make clean bzImage modules modules_install

$ cp /usr/src/linux/arch/i386/boot/bzImage /boot
. ,
- . ,
, ,
,
$ emerge sys-apps/xfsprogs
XFS. ,
xfsprogs distfiles.
,
, ,
- :
$ emerge sys-libs/gpm
.
PS/2, :
130

$ gpm -t imps2 -m /dev/psaux



, .
:
.
, . - :
Source Based (
make ).
:
$ ln -sf /usr/share/zoneinfo/path/timezonefile /etc/localtime
, path/timezonefile
Europe/Kaliningrad Asia/Kamchatka (
- - , ,
- ). BIOS
,
/etc/rc.conf.
. ? - ,
/etc/fstab. :
$ nano -w /etc/fstab
, , :
/dev/BOOT
/boot
ext2
noauto,noatime
11
/dev/ROOT
/
xfs
noatime
00
/dev/SWAP
none
swap
sw
00
/dev/cdroms/cdrom0
/mnt/cdrom iso9660
noauto,ro
proc
/proc
proc
defaults
00
#tmpfs

/dev/shm

tmpfs

defaults

00

00

,
, : /dev/hda1, /dev/hda3, /dev/hda2.
, , /dev/discs/disc0/part1 ..,
#tmpfs. -
-
mount ,
. (
) /etc/fstab.
( FAT-, -, zip-
) .
- /dev/BOOT
noauto,
.
GRUB - Gentoo .
, . grub
:
grub> root (hd0,0)
grub> setup (hd0)
:
131

grub> quit
, ,
/boot.
- ,
. , ,
, /boot .
GRUB .
:
$ nano -w /boot/grub/menu.lst
. GRUB :
default 0
timeout [__]
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
, ,
. -
. -
( ). -
.
Gentoo.
title=My Love Gentoo Linux
root (hd0,0)
kernel /boot/_ root=/dev/hda3
- .
, . GRUB,
Linux: , GRUB
, .
Linux,
Unix' (, FreeBSD OpenBSD).
, ,
,
. ,
/boot/bzImage, /boot
. , kernel, ,
/boot/linux.
Linux - ,
, /dev/hda?.
, GRUB
,
( ) /boot/grub/menu.lst
.
-

. . ,
( - )
132

DMA -
. /etc/conf.d/local.start.
(
)
hdparm -d 1 /dev/hda
- .
, ,
:
gpm -t imps2 -m /dev/psaux
.
, Gentoo - (
).
, .
.
/etc/rc.conf.
Linux. , Gentoo
BSD ( System V,
Linux, Slackware ).
, - .
- : ,
, /etc/rc.conf.
, .

$ nano -w /etc/rc.conf

KEYMAP="us"
- ,
. - -

$ ls /usr/share/keymaps/i386/qwerty/ru*
:
/usr/share/keymaps/i386/qwerty/ru1.map.gz
/usr/share/keymaps/i386/qwerty/ru2.map.gz
/usr/share/keymaps/i386/qwerty/ru3.map.gz
/usr/share/keymaps/i386/qwerty/ru4.map.gz
/usr/share/keymaps/i386/qwerty/ru-cp1251.map.gz
/usr/share/keymaps/i386/qwerty/ru.map.gz
/usr/share/keymaps/i386/qwerty/ru-ms.map.gz
/usr/share/keymaps/i386/qwerty/ru_win.map.gz
/usr/share/keymaps/i386/qwerty/ru-yawerty.map.gz
,
( , Live CD, ,
). , , ( ,
), ru4: KOI8-R
Windows- ( Windows - , , )
133

CapsLock.
KEYMAP="ru4"
, CONSOLEFONT. ,
. - , ,
/usr/share/consolefonts. ,
alt-*.psf.gz cp866-*.psf.gz. , () -
CP866 ( , DOS IBM). -
KOI8-R , ( koi8r-*.gz),
? , : , .
"" ,
, .

console-tools-cyrillic - , - . , ,
CONSOLEFONT="cp866-8x16"
: , KOI8,
- CP866. ,
. -
/usr/share/consoletrans koi2alt.

CONSOLETRASLATION="koi2alt"
.
, ,
, ( - ) -
. , /etc/rc.conf, ,
( -
) - ,
- /etc/localtime. ,

CLOCK="UTC"
, , (UTC=GMT).
UTC localtime - /etc/rc.conf (
, ).
.
/etc/init.d/local: ,
(
). (
) ( ):
for i in 1 2 3 4 5 6
do
echo -ne '' > /dev/vc/$i
done
i (
) 1 6 (
), - ,
134

. - " " ESC-(K (


)
, i, /dev/vc/1 /dev/vc6. - (devfs),
( tmpfs /etc/fstab)
- /dev/tty0 - /dev/tty5.
( ) CP1251.
. /etc/fstab
(, , )
CP1251->CP866. ( -
)
- Altlinux ASPLinux.
-
DOS. :
VGA- (
VGA, GeForce )
. ,
, , , .
,
. Midnight Commander -
!
.
/etc/init.d/local ( , !):
export LANG="ru_RU.KOI8-R"
- ( ,
, , , , ,
) , . ,
,
export LC_NUMERIC="POSIX"
, ,
, ( ,
).
, ,
- ,
, ( -
) - Altlinux ASPLinux.
,
. , "" ,
- . "
" ( Gentoo) .
, , etcupdate, (, ).
- , ,
. -
.
, Gentoo exit,
135

Live CD,
, ( )
.
- . . - ,
unmount:
$ umount /mnt/gentoo/boot
$ umount /mnt/gentoo
, - reboot ( halt,
-
).
( - -
),
: Live CD (, ,
,
):
$ cp /cdroot/boot/linux /mnt/gentoo/boot/
, , . ,
CD:
cp -R /cdroot/lib/modules /mnt/gentoo/lib/modules
- , . ,
- , , -
. .
, ,
- - .

, ,
: , ,
. .
- , ,
, . -
,
- - . (
) CD .
,
(, ).
- ,
,
. : - , - ,
, ( ,
). Gentoo ,
,
. - ,
, .
. Gentoo ,
,
136

- , , GIS CAD. ,

. , ,
. Linux,
, . , ,
- ...

137

Gentoo Linux x86


: http://www.gentoo.org/doc/ru/gentoo-x86-quickinstall.xml
C : 1.0


- . ISO-
:
releases/<>/<>/-.

;
.
-, . F2,
, .
PCMCIA,
pcmcia.
sshd,
, irssi ( -) lynx links2.


, netsetup.
modprobe. ADSL, adsl-setup
adsl-start. PPTP, /etc/ppp/chap-secrets
/etc/ppp/options.pptp, pptp <ip >.

iwconfig, net-setup, ifconfig, dhcpcd
/ route.
-,
export http_proxy, ftp_proxy RSYNC_PROXY.


fdisk cfdisk.
( 82) Linux ( 83).
Linux- mke2fs,
mke2fs -j, mkreiserfs, mkfs.xfs mkfs.jfs.
mkswap swapon.
/mnt/gentoo.
138

(, /mnt/gentoo/boot), .


, date MMDDhhmmYYYY.

( /mnt/cdrom/stages). /mnt/gentoo
tar -xvjpf < >.
:
/mnt/gentoo/usr tar -xvjf /mnt/cdrom/snapshots/< >.
.
, /mnt/cdrom/distfiles/
/mnt/gentoo/usr/portage/distfiles/.
/mnt/gentoo/etc/make.conf ( USE, CFLAGS
CXXFLAGS). nano.

Gentoo
/proc,
/etc/resolv.conf , (chroot)
Gentoo.
1.1:
# mount -t proc none /mnt/gentoo/proc
# cp /etc/resolv.conf /mnt/gentoo/etc/
# chroot /mnt/gentoo /bin/bash
# env-update && source /etc/profile

, emerge --sync
.
, /etc/make.profile .
;
(, 2.4/ , 2.4).
ln -sfn.
( )
scripts/bootstrap.sh /usr/portage.
( )
emerge -e system ( -N,
CFLAGS/CXXFLAGS ).

139


,
/etc/localtime /usr/share/zoneinfo ln
-sf.
( gentoo-sources
vanilla-sources) make menuconfig, make && make
modules_install

/usr/src/linux.

arch/i386/boot/bzImage /boot, .
emerge genkernel genkernel all.
, Genkernel, emerge coldplug
rc-update add coldplug default.


/etc/fstab; .
1.2: fstab
/dev/hda1

/boot

ext2

defaults,noatime

/dev/hda2

none

swap

/dev/hda3

ext3

noatime

01

none

/proc

proc

defaults

00

none

/dev/shm tmpfs nodev,nosuid,noexec

sw

/dev/cdroms/cdrom0 /mnt/cdrom

12
00

auto

noauto,user

00
00

/etc/conf.d/hostname

/etc/conf.d/domainname, rc-update add domainname default,


/etc/conf.d/net. net.eth0
(default run level). (NIC),
net.eth0,
.
/etc/hosts; :
1.3: /etc/hosts
( IP-)
127.0.0.1

localhost

192.168.0.5 jenny.homenetwork jenny


192.168.0.6 benny.homenetwork benny

192.168.0.7 tux.homenetwork tux


( IP-)
127.0.0.1

localhost.homenetwork tux localhost

140

(emerge) pcmcia-cs
.
root passwd.
: /etc/rc.conf, /etc/conf.d/rc,
/etc/conf.d/keymaps, /etc/conf.d/clock.


2.4 emerge --unmerge udev emerge
devfsd.
, syslog-ng,
. cron, , vixie-cron
( ).
(xfsprogs, reiserfsprogs
jfsutils), (dhcpcd rp-pppoe).


(emerge) grub lilo. /boot/grub/grub.conf
/etc/lilo.conf, . .

grub
1.4: grub.conf
default 0
timeout 30
splashimage=(hd0,0)/grub/splash.xpm.gz
# genkernel
title=Gentoo Linux 2.6.11-r3
root (hd0,0)
kernel /kernel-genkernel-x86-2.6.11-gentoo-r3 root=/dev/ram0 init=/linuxrc ramdisk=8192
real_root=/dev/hda3 udev

initrd /initramfs-genkernel-x86-2.6.11-gentoo-r3
# ( initrd)
title=Gentoo Linux 2.6.11 r3
root (hd0,0)

kernel /kernel-2.6.11-gentoo-r3 root=/dev/hda3


#
title=Windows XP
root (hd0,5)

141

makeactive
chainloader +1
lilo
1.5: lilo.conf
boot=/dev/hda
prompt
timeout=50
default=gentoo

# , genkernel
image=/boot/kernel-2.6.11-gentoo-r3
label=gentoo
read-only
root=/dev/hda3

# genkernel
image=/boot/kernel-genkernel-x86-2.6.11-gentoo-r3
label=gentoo
read-only
root=/dev/ram0
append="init=/linuxrc ramdisk=8192 real_root=/dev/hda3 udev"
initrd=/boot/initramfs-genkernel-x86-2.6.11-gentoo-r3
#
other=/dev/hda6
label=windows

GRUB GRUB
(MBR) grub-install /dev/hda /proc/mounts /etc/mtab.
LILO /sbin/lilo.
,
.


root,
useradd -m -G <> <
>.
, -
/mnt/cdrom export PKGDIR="/mnt/cdrom",
142

, , kde, emerge -k <


>. .
Gentoo!

Gentoo
Linux
: http://www.gentoo.org/doc/ru/altinstall.xml
: 1.0

1.
boot-from-CD (
), .
Gentoo Linux , . , ,
"" . ,
, ,
Bugzilla.

2. Smart BootManager
Smart BootManager http://btmgr.sourceforge.net/download.html.
, Linux,
.exe . -, ,

NASM.
.
, .

2.1: Smart BootManager


sbminst [-t theme] [-d drv] [-b backup_file] [-u backup_file]
-t

-d

, :
us = English
de = German
hu = Hungarian zh = Chinese
ru = Russian
cz = Czech
es = Spanish
fr = French
pt = Portuguese
, Smart BootManager;
Linux:
/dev/fd0 floppy-,
/dev/hda IDE-.
/dev/sda SCSI-.
DOS:

143

0 floppy-
128 ;
-c

CD-ROM;

-b backup_file ( ) ,
;
-u backup_file Smart BootManager,
;
-y

2.2: sbminst
# sbminst -t us -d /dev/fd0

: fd0 floppy- (
-).
,
, .
Smart BootManager. CD-ROM ENTER
. ,
.

http://btmgr.sourceforge.net/

Smart

BootManager

3. Knoppix
: Knoppix x86.
Knoppix LiveCD,
Gentoo. Tux Racer ,
OpenOffice.
: , -
Knoppix, Gentoo,
Gentoo. ,
!
Knoppix CD. Knoppix 3.6-3.8.2,
knoppix26 , 2.6.
, chroot ,
. , Knoppix 3.9+, , 2.6
.
KDE. su -,
. root
Knoppix. , , sshd
.
3.1: /mnt/gentoo

144

# mkdir /mnt/gentoo

,
4. /proc. -:
3.2: - proc
# mount -o bind /proc /mnt/gentoo/proc

, (FEATURES)
knoppix. userpriv usersandbox.
, ,
.

4. Stage 1
- iso-.

snapshot

http://distro.ibiblio.org/pub/linux/distributions/gentoo/snapshots/
(

). tarball ,
, CD.
Gentoo Install Doc chroot /mnt/gentoo 6.
CD-ROM,
docache CD snapshot- .
(Alt-F2), ,
bootstrap.sh.
: -
passwd .
(Alt-F1, without chroot) CD
/mnt/gentoo/mnt/cdrom2. portage tarball cdrom2
/mnt/gentoo/usr.
4.1: snapshot cd
# umount /mnt/cdrom
# mkdir /mnt/gentoo/mnt/cdrom2
# mount /dev/cdroms/cdrom0 /mnt/gentoo/mnt/cdrom2
# cp /mnt/gentoo/mnt/cdrom2/portage-$date.tar.bz2 /mnt/gentoo/usr
# cd /mnt/gentoo/usr
# tar -xvjpf portage-$date.tar.bz2

.
bootstrap.sh, , .
/usr/portage/distfiles (
F2).
Stage1: glibc, baselayout, texinfo, gettext, zlib, binutils,
gcc, ncurses .
145

: , ,
.
4.2:
( 2 >)
# emerge -fp glibc baselayout texinfo gettext zlib binutils gcc ncurses 2> stage1.list
# mount -t vfat /dev/fd0 /mnt/floppy
# cp /mnt/gentoo/stage1.list /mnt/floppy
# umount /mnt/floppy

. stage1.list,
, .
, , .
:
4.3: Stripping URLs
( emerge,
- !)
# cut -f 1 -d ' ' stage1.list > stage1.download

wget :
4.4: wget
# wget -N -i stage1.download

/mnt/gentoo/usr/portage/distfiles.
wget stage2 3.

bootstrap.sh.

5. PXE

,
PXE ( 3com). BIOS
.

: -, ,
. /diskless,
.
'eta'.
5.1:
# mkdir /diskless
# mkdir /diskless/eta
# mkdir /diskless/eta/boot

DHCP TFTP: ,
146

DHCP, TFTP. DHCP


emerge .
/etc/dhcp/dhcpd.conf:
: IP
PXE, pxegrub. MAC-
,
.
DHCPd, emerge dhcp ( DHCP
). , /etc/conf.d/dhcp .
5.2: dhcp.conf
option option-150 code 150 = text ;
ddns-update-style none ;
host eta {
hardware ethernet 00:00:00:00:00:00;
fixed-address ip.add.re.ss;
option option-150 "/eta/boot/grub.lst";
filename "/eta/boot/pxegrub";
}

TFTP,
/etc/conf.d/in.tftpd:

app-admin/tftp-hpa.

5.3: in.tftpd
INTFTPD_PATH="/diskless"
INTFTPD_USER="nobody"
INTFTPD_OPTS="-u ${INTFTPD_USER} -l -vvvvvv -p -c -s ${INTFTPD_PATH}"

GRUB: GRUB PXE-.


PXE, GRUB ...
. -, GRUB (emerge -f grub
tarball /usr/portage/distfiles). tarball /diskless
GRUB, pxe .
boot- . grub.lst:

5.4: grub
# tar zxvf grub-0.92.tar.gz
# cd grub-0.92
# ./configure --help
( .)
( , . $nic)
# ./configure --enable-diskless --enable-$nic
# make
# cd stage2
# cp pxegrub /diskless/eta/boot/pxegrub
# nano -w /diskless/eta/boot/grub.lst

5.5: grub.lst
default 0
timeout 30
title=Diskless Gentoo

147

root (nd)
kernel /eta/bzImage ip=dhcp root=/dev/nfs nfsroot=ip.add.re.ss:/diskless/eta

( nfsroot IP ,)
( .)
NFS: NFS . -
/etc/exports:
5.6: /etc/exports
# nano -w /etc/exports
# /etc/exports: NFS file systems being exported. See exports(5).
/diskless/eta eta(rw,sync,no_root_squash)

hosts: - /etc/hosts.
5.7: /etc/hosts
127.0.0.1 localhost
192.168.1.10 eta.example.com eta
192.168.1.20 sigma.example.com sigma


Gentoo,
, ,
Gentoo .
, Gentoo Install Howto, :
( hdaX - ,
/diskless). ,
/diskless/eta.
5.8:
# mount /dev/hdaX /mnt/gentoo

Stage tarballs chroot: tarball stage3. /proc


chroot ()
. - .
: stage tarball.
.
5.9: stage tarball
# cd /mnt/gentoo/diskless/eta/
# tar -xvjpf /mnt/cdrom/gentoo/stage3-*.tar.bz2
# mount -t proc /proc /mnt/gentoo/diskless/eta/proc
# cp /etc/resolv.conf /mnt/gentoo/diskless/eta/etc/resolv.conf
# chroot /mnt/gentoo/diskless/eta/ /bin/bash
# env-update
# source /etc/profile

: make menuconfig
148

, (
):
5.10: menuconfig
- Your network card device support
( , ** !)
- Under "Networking options" :
[*] TCP/IP networking
[*] IP: kernel level autoconfiguration
[*] IP: DHCP support
[*] IP: BOOTP support
- Under "File systems --> Network File Systems" :
<*> NFS file system support
[*] Provide NFSv3 client support
[*] Root file system on NFS

/ ( /boot),
pxegrub, . /etc/fstab
.
5.11: /etc/fstab
# nano -w /etc/fstab
/dev/cdroms/cdrom0 /mnt/cdrom iso9660 noauto,ro 0 0
proc /proc proc defaults 0 0
tmpfs /dev/shm tmpfs nodev,nosuid,noexec 0 0


:
5.12:
# touch /fastboot
# echo "touch /fastboot" >> /etc/conf.d/local.start

nfs-utils, :
5.13: nfs-utils
# emerge nfs-utils

. , pxegrub. . ,
: DHCP, TFTPD NFS.
5.14:
# /etc/init.d/dhcp start
# /etc/init.d/in.tftpd start
# /etc/init.d/nfs start

149

, bios
PXE - CD-ROM floppy.
website .
IP DHCP PXE- GRUB TFTP.
- GRUB,
, Enter, . ,
, NFS,
. .

6. Gentoo Linux-

Gentoo Linux
chroot, tarball- Gentoo, ISO. , ,
tarball-. ( , tarball - , .tbz
.tar.gz). (.) RedHat Linux 7.3 "" ,
. , !

Gentoo,
Linux, , tarball, chroot , .
, ,
, Gentoo.
Gentoo?
- , /.
mount , . df (disk
free), , . root !
,
, .
6.1:
# mount
/dev/hdb2 on / type ext3 (rw)
none on /proc type proc (rw)
none on /dev/pts type devpts (rw,gid=5,mode=620)
none on /dev/shm type tmpfs (rw,nodev,nosuid,noexec)
# df -h
Filesystem
Size Used Avail Use% Mounted on
/dev/hdb2
4.0G 1.9G 2.4G 82% /
none
38M 0 38M 0% /dev/shm

, , /, /dev/hdb2
2.4 . , , 400
, , Gentoo 2 . ,
, . !
150

parted
Parted - , GNU foundation, , ,
,
. , .

parted,
partition
editor,

http://www.gnu.org/software/parted/
: , ,
/ , PartitionMagic(tm)
, . - .
parted,
, , , parted
. , , . -
-, Gentoo. , ,
. . ,
linux-
parted /.
, Linux,
, . parted
, . ,
.
: , , ,
parted!
/ mininux ( - Linux c
2.4 ) http://mininux.free.fr/uk/, ,
,
.
: , Linux - "
". - parted
.
boot/root , mininux.
, , - ,
Gentoo, ,
parted.
6.2:
# mkfs.minix /dev/fd0
480 inodes
1440 blocks
Firstdatazone=19 (19)
Zonesize=1024
Maxsize=268966912

parted. ,
. , .
.
6.3:
# mkdir /floppy; mount -t minix /dev/fd0 /floppy &&
export CFLAGS="-O3 -pipe -fomit-frame-pointer -static" && ./configure
&& make && cp parted/parted /floppy && umount /floppy

151

, .
parted GNU
website. -
. mininux,
, .
mount /dev/fd0 /floppy parted /floppy. .
parted .
, ,
, Gentoo. , - ,
, . ,
/dev/hda3, , , /dev/hda.
6.4: , , mininux
# mount /dev/fd0 /floppy
# cd /floppy; ./parted [, ]
(parted) print
Disk geometry for /dev/hdb: 0.000-9787.148 megabytes
Disk label type: msdos
Minor Start
End Type
Filesystem Flags
1
0.031 2953.125 primary ntfs
3
2953.125 3133.265 primary linux-swap
2
3133.266 5633.085 primary ext3
4
5633.086 9787.148 extended
5
5633.117 6633.210 logical
6
6633.242 9787.148 logical ext3
(parted) help resize
resize MINOR START END
resize filesystem on partition MINOR
MINOR is the partition number used by Linux. On msdos disk labels, the
primary partitions number from 1-4, and logical partitions are 5
onwards.
START and END are in megabytes
(parted) resize 2 3133.266 4000.000

: ! !
( ), , .
2 30 .
, linux-.
Gentoo:
. chroot,
:
6.5: chroot
# env -i HOME=$HOME TERM=$TERM chroot /mnt/gentoo /bin/bash
# /usr/sbin/env-update
# source /etc/profile

152

Gentoo/x86
: http://www.gentoo.org/doc/ru/gentoo-x86-tipsntricks.xml
: 1.0

1.

Gentoo/x86.
,
, .

2.
RAID
: RAID, ,
Software-RAID-HOWTO (.).
:
RAID LVM2 x86 (.).
CD, RAID.
, RAID-1:
2.1: RAID-1
# modprobe raid1

, , fd (Linux raid
autodetect), 83 (Linux native). , t
fdisk.
, RAID,
:
2.2:
# mkno
# mknod /dev/md2 b 9 2
# mknod /dev/md3 b 9 3d /dev/md1 b 9 1

, /etc/mdadm.conf (, ,
CD), mdadm, RAID.
, (RAID-1) boot, swap root,
/dev/sda /dev/sdb, :
2.3: raid mdadm

153

# mdadm --create --verbose /dev/md1 --level=1 --raid-devices=2 /dev/sda1 /dev/sdb1


# mdadm --create --verbose /dev/md2 --level=1 --raid-devices=2 /dev/sda2 /dev/sdb2
# mdadm --create --verbose /dev/md3 --level=1 --raid-devices=2 /dev/sda3 /dev/sdb3

:
(striping), RAID-0 or RAID-5.

Linux Software RAID .


/proc/mdstat. ,
..
2.4:
# mdadm --detail --scan > /etc/mdadm.conf

/dev/md1 , /dev/md2
/dev/md3 .
(chroot), /etc/mdadm.conf
/mnt/gentoo/etc.
, RAID
, .
, mdadm. ,
CD,
Gentoo raid.
MBR ,
.
ATA RAID c 2.4
, CD doataraid.
, /dev/ataraid.
disc* , ATA RAID.
disc, part*.
/dev/ataraid/disc*/*,
Gentoo.
/dev/hda, .
, /dev :
2.5: /dev
# mount -o bind /dev /mnt/gentoo/dev

ATA RAID
. , ATA RAID Promise
FastTrack built-in RAID Promise FastTrack Options.
GRUB GRUB.
, . GRUB , ,
GRUB MBR, :
154

2.6: GRUB
# cd /boot/grub
# dd if=stage1 of=/dev/fd0 bs=512 count=1
# dd if=stage2 of=/dev/fd0 bs=512 seek=1

grub.conf.
, , root=
ATA RAID.
, GRUB.
GRUB. GRUB
ATA RAID:
2.7: GRUB ATA RAID
grub> root (hd0,x)
grub> setup (hd0)
grub> quit

( GRUB ).
LILO .
CD
,
- .
Gentoo , (AltF2) ROOT, ,
(passwd root).
:
2.8: CD
(${KN} , - 'gentoo' 'smp')
cdimage ~# cp /mnt/cdrom/isolinux/${KN} /mnt/cdrom/isolinux/${KN}.gz /mnt/gentoo/boot
cdimage ~# mkdir -p /mnt/gentoo/lib/modules
cdiamge ~# cp -Rp /lib/modules/`uname -r` /mnt/gentoo/lib/modules

, hotplug (emerge hotplug)


. ( CD)
,
(chroot):
2.9: modules.conf
# cat /proc/modules | cut -d ' ' -f 1 >> \
/etc/modules.autoload.d/kernel-`uname -r | cut -d . -f -2`
# modules-update

155

3.

, .
, ,
.
, .
. screen.
LiveCD, root screen:
: screen LiveCD. ,
, .
3.1: screen
# screen -S gentoo

screen .
, Ctrl-a, d ( control a , d),
screen. .
, root
screen:
3.2: screen
# screen -x gentoo

screen, .
, ,
(, ./scripts/bootstrap.sh),
nohup, ,
. "&",
! , ( pwd
), .

3.3: nohup
# pwd
/usr/portage
# nohup ./scripts/bootstrap.sh &

(exit) CD.
.
, root ( CD)
chroot , :

156

3.4: Chroot
# chroot /mnt/gentoo /bin/bash
# env-update && source /etc/profile
# cd /usr/portage

less nohup.out, .
,
less nohup.out F, .
,
.
, Ctrl-C, q.
less, .

4. /

,
( ..), -c
ext2 ext3 ( mke2fs).
, .
, -c -c, /.
4.1:
# mke2fs -j -c /dev/hda3


- Gentoo ,
.
, , , ( , ,
), .
, Gentoo Linux
chroot. , ,
. ,
/mnt/gentoo. ,
make.conf
, ?
Gentoo Linux, , ,
, -. ,
, , - .
, , grub.conf,
, /boot/grub/grub.conf.
, , ,
, .
157

, .
:
make.conf,
, make.conf
/boot/grub/grub.conf,
, grub.conf
, ,
(,
/boot!),

/etc/fstab,
,
.
.

158

Gentoo Linux x86


: http://www.gentoo.org/doc/ru/handbook/handbook-x86.xml
: 1.0
:

Gentoo

, Gentoo .
Gentoo Linux
.

Gentoo -. , Gentoo
.
.

, .
.

Gentoo, .
, .
Gentoo
Gentoo (stage3).
, Portage.
Gentoo

Gentoo. , .

Linux . ,
.

.
,
.

, Gentoo .
.

x86

159

-.
.
Gentoo
. ( )
. , .

Gentoo. ?
Gentoo
Gentoo: ,
, Portage ..
Portage
,
.
USE-
USE- ( ) Gentoo.
, , USE-
.
Portage

, .

Portage:


Gentoo (initscript),
, , , ,
. , ,
.

Gentoo .
, , .
Portage
Portage,
Gentoo.

Portage, ,
.

Portage ,
.

Gentoo
. ,
,
160

.
Portage
Portage ,
Gentoo.
dispatch-conf .


Portage, , ,
..
ebuild
, Portage
,
ebuild.

Gentoo

Gentoo.


.

,
.

Gentoo :
DHCP, , ,
(VLAN) ..

. ,
.

, .

,
.
A. Gentoo

161

A. Gentoo
1. Gentoo Linux
1.a.
!
, Gentoo!
! Gentoo
. Gentoo :
, Gentoo,
..
Gentoo ,
. Gentoo ,
, . Portage,
Gentoo, Python,
. Gentoo
( ), Gentoo
.
!
, Gentoo .
.
, .
?
Gentoo 10 ,
211. :

1: , Gentoo;

2:
Gentoo;

3:
Gentoo;

4: ,
(chroot) ;

5: , Gentoo;

6: Linux;

7:
Gentoo;

8: (
);

9: ,
Gentoo;

10:
Gentoo Linux!
,
, .
162

: .
: . , .
, .
.
: , Gentoo. ,
.
, ,
.
?
Gentoo .
-, ,
CD (, Knoppix), ,
..
Gentoo, ,
, (netboot). ,
.
, ,
Gentoo 2006.1 (.), .
GRP (Gentoo Reference Platform
Gentoo, ,
Gentoo),
, Gentoo 2006.1 (.).
,
.
Gentoo. ,
, (.
), , , .
,
, Gentoo
. , ,
, .
?
(
), (.) ,
. , ,
. ,
() .
, , , ,
, .
, Gentoo
( , -
). ,
.

163

, (-
, ), (-
, /),
, #gentoo ( #gentoo-amd64, #gentoo-ru,
#rugentoo) irc.freenode.net. ,
:)
, Gentoo,
(FAQ), Gentoo.
FAQ (.) . ,
#gentoo, IRC- irc.freenode.net. -, -
, IRC :-)

2.
2.a.

, ,
Gentoo .
:

i486 ;

64 ;

1.5 ( );

256 .

2.b. - Gentoo

- Gentoo ,
Gentoo. Linux .
. Gentoo.
- , ,
Gentoo .
-,
Gentoo
.
Gentoo ,
, ,
, Gentoo 2006.0
(.).

164

-:
Gentoo, -
, ,
Gentoo.
Gentoo,
Gentoo. ,
, , ,
.
, ,
.
Gentoo
install-x86-minimal-2006.0.iso
49 . Gentoo
.
:

+

stage3, Portage,
,
(live) Gentoo
install-x86-universal-2006.0.iso 697
. Gentoo
, , Gentoo
:)
Gentoo:

+
, ;
;

.
Stage3

stage3 ,
Gentoo,
Gentoo ,
( : ()
.

- Gentoo
.
, Gentoo stage1 stage2,
stage3.
Gentoo stage1 stage2, ,
Gentoo, Gentoo,
Stage1 Stage2?
165

stage3 releases/x86/2007.0/stages/
Gentoo; .

2.c. , Gentoo

, Gentoo.
, -.
, ?
( , )
.
releases/x86/2007.0/installcd.
ISO-. -,
CD-R.
, ,
MD5 (, install-x86-minimal-2007.0.iso.DIGESTS).
MD5 md5sum Linux/Unix,
md5sum (.) Windows.
GnuPG
, (
.asc). , :
1:
$ gpg --keyserver subkeys.pgp.net --recv-keys 17072058

:
2:
$ gpg --verify < > < >

ISO- - .
, .
cdrecord K3B.
.
cdrecord, cdrecord dev=/dev/hdc < iso> (/dev/hdc CD-RW).
K3B, Tools > CD > Burn Image ( > > ). 'Image to Burn' (' ')
ISO-. Start ().
-

166

: , , ,
, ,
.
-, . -
CD, BIOS.
BIOS, DEL, F1 ESC. BIOS
, CD-ROM
. CMOS Setup.
, ,
CD-ROM.
CD-ROM (-!)
. .
ENTER, ,
-: ,
, ENTER.
? , -
. gentoo.
; -nofb .
:

gentoo
2.6 (
)
gentoo-nofb gentoo,
memtest86
,
. ,
F2 .
3: ,
- agpgart
- acpi=on
- ide=nodma
- doscsi
- dopcmcia
- nofirewire
- nokeymap
- docache
- nodetect
- nousb
- nodhcp
- nohotplug
- noapic
- noevms
- nolvm2
- hdx=stroke

agpgart ( , )
ACPI
DMA IDE-
scsi- ( ethernet-)
pcmcia PCMCIA- -
initrd firewire (
- firewire ..)

- ,
/mnt/cdrom
hwsetup/kudzu hotplug
usb initrd, hotplug
dhcp

hotplug
apic (,
scsi, ..)
EVMS2
LVM2
, BIOS

167

- noload=module1,[module2,[...]]

-, (
gentoo) .
, gentoo dopcmcia:
4:
boot: gentoo dopcmcia

. Gentoo
,
ALT+F1, ,
. 10 ,
( ), .
Gentoo Linux
root (). root
(#). , ALT-F2, ALT-F3 ALTF4. ALT-F1.
.

-
.
. ,
. PCI,
.
8139too (
):
5:
# modprobe 8139too

PCMCIA,
pcmcia:
6: PCMCIA
# /etc/init.d/pcmcia start

:
, ,
IDE hdparm. -tT,
(
):
7:
# hdparm -tT /dev/hda

168

(
),
/dev/hda:
8:
DMA:
# hdparm -d 1 /dev/hda
:
# hdparm -d 1 -A 1 -m 16 -u 1 -a 64 /dev/hda

:
,
irssi ( ),

.
passwd:
9:
# passwd
New password: ( )
Re-enter password: ( )

,
. useradd passwd.
john:
10:
# useradd -m -G users john
# passwd john
New password: ( john)
Re-enter password: ( )


(root) su:
11:
# su - john

:
Gentoo
( , -), ,
(. :
). ALT+F2 ,
.
c -, links:

169

12: -
# links /mnt/cdrom/docs/html/index.html

Gentoo ( ,
-). links,
( , ):
13: ,
# links http://www.gentoo.org/doc/ru/handbook/handbook-x86.xml

ALT+F1.
: SSH

Gentoo ( ,
), , ,
( ,
).
SSH, :
14: SSH
# /etc/init.d/sshd start

sshd, .
.

3.
3.a.
, ?
Ethernet, DHCP,
,
. , ,
-, , ssh, scp, ping, irssi, wget
links.
, /sbin/ifconfig
lo, , eth0:
1: /sbin/ifconfig
# /sbin/ifconfig
(...)
eth0 Link encap:Ethernet HWaddr 00:50:BA:8F:61:7A
inet addr:192.168.0.2 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::50:ba8f:617a/10 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1498792 errors:0 dropped:0 overruns:0 frame:0

170

TX packets:1284980 errors:0 dropped:0 overruns:0 carrier:0


collisions:1984 txqueuelen:100
RX bytes:485691215 (463.1 Mb) TX bytes:123951388 (118.2 Mb)
Interrupt:11 Base address:0xe800

: -
-,
. - :
, .
. , , - proxy.gentoo.org,
8080:
2: -
( - HTTP)
# export http_proxy="http://proxy.gentoo.org:8080"
( - FTP)
# export ftp_proxy="ftp://proxy.gentoo.org:8080"
( - RSYNC)
# export RSYNC_PROXY="proxy.gentoo.org:8080"

- ,
:
3: / -
http://_:@proxy.gentoo.org:8080


DNS-
( /etc/resolv.conf), , , ,
DNS ..
4:

# ping -c 3 google.com
? ,
. , , ,
.

3.b.
,
net-setup ( ), pppoe-setup (
ADSL) pptp ( PPTP; x86, amd64, alpha,
171

ppc ppc64).

,
, :

Ethernet :
net-setup;
ADSL :
RP-PPPoE;
PPTP :
PPTP;

: net-setup
,
net-setup:
5: net-setup
# net-setup eth0

net-setup .
.
, . ,
Gentoo.
.
, .
: RP-PPPoE
PPPoE, (
) rp-pppoe. pppoesetup, .
ethernet, adsl-, , , IP DNS. ,
(firewall).
6: rp-pppoe
# pppoe-setup
# pppoe-start

- , ,
, /etc/ppp/pap-secrets /etc/ppp/chap-secrets, ,
ethernet . ,
.
, .
, .

172

: PPTP
: PPTP x86.
PPTP, pptpclient,
.
. /etc/ppp/pap-secrets /etc/ppp/chap-secrets
, .
7: /etc/ppp/chap-secrets
# nano -w /etc/ppp/chap-secrets

, , PPTP /etc/ppp/options.pptp:
8: /etc/ppp/options.pptp
# nano -w /etc/ppp/options.pptp

, pptp ( ,
options.pptp), :
9:
# pptp <server ip>

3.c.


()
.
. ,
.
net-setup pppoe-setup , ,
.
.
, ,
ls:
10:
# ls /lib/modules/`uname -r`/kernel/drivers/net

,
modprobe:
11: modprobe
( pcnet32)
# modprobe pcnet32

173

, , ifconfig.
, :

12: ()
# ifconfig eth0
eth0
Link encap:Ethernet HWaddr FE:FD:00:00:00:00
BROADCAST NOARP MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)

, ,
:
13: ()
# ifconfig eth0
eth0: error fetching interface information: Device not found

,
eth0, eth1 .. , ,
, ,
. , eth0.
, netsetup pppoe-setup ( ), ,
, , .
,
:

DHCP IP-;

, ;

: ,
;

ifconfig route: ;

DHCP
DHCP (Dynamic Host Configuration Protocol
)
(IP-, , , , . .)
, DHCP (
DHCP).
, dhcpcd:
14: dhcpcd
# dhcpcd eth0
,
, DHCP.

174


# dhcpcd -HD eth0

( - ,
, Google), , .
.


: iwconfig
x86, amd64 ppc.
, linux-wlan-ng (.).
(802.11),

.
iwconfig. iwconfig :
15:
# iwconfig eth0
eth0
IEEE 802.11-DS ESSID:"GentooNode"
Mode:Managed Frequency:2.442GHz Access Point: 00:09:5B:11:CC:F2
Bit Rate:11Mb/s Tx-Power=20 dBm Sensitivity=0/65535
Retry limit:16 RTS thr:off Fragment thr:off
Power Management:off
Link Quality:25/10 Signal level:-51 dBm Noise level:-102 dBm
Rx invalid nwid:5901 Rx invalid crypt:0 Rx invalid frag:0 Tx
excessive retries:237 Invalid misc:350282 Missed beacon:84

: wlan0
ra0, eth0. iwconfig
- .

: ESSID ( ) WEP.
ESSID ,
WEP, , .
ESSID WEP,
:
16: ESSID / WEP
( "GentooNode")
# iwconfig eth0 essid GentooNode
( WEP)
# iwconfig eth0 key 1234123412341234abcd
( (ASCII); "s:")
# iwconfig eth0 key s:some-password

, iwconfig.
, ,
175

IP, (
), net-setup, .


: IP-, ,
,
ifconfig route.
, , ,
. . , -
, .
, , , ,
, .
(, ) IP- (
). 0 255. ,
, . , IP- 32
( ). :
17: IP-
IP- ():
192.168.0.2
IP- ():
11000000 10101000 00000000 00000010
-------- -------- -------- -------192
168
0
2

IP- (. . ,
, IP-).
, , IP-
: .
,
. IP-, ,
. , IP.
18: /
IP-:
192
168
0
2
11000000 10101000 00000000 00000010
: 11111111 11111111 11111111 00000000
255
255 255
0
+--------------------------+--------+

, 192.168.0.14 ,
192.168.1.2 .
IP- ,
, .
IP-.
.

176

19:
IP-:
192
168
0
2
11000000 10101000 00000000 00000010
11000000 10101000 00000000 11111111
:
192
168
0
255
+--------------------------+--------+

, ,
. .
, IP- (, 192.168.0.1).
, IP-.
( IP-), ,
(, dev.gentoo.org) IP- (, 64.5.62.82).
. ,
/etc/resolv.conf.
.
, .
, :

IP-

()

192.168.0.2
255.255.255.0
192.168.0.255
192.168.0.1
195.130.130.5, 195.130.130.133

ifconfig route
. IP-
ifconfig. ,
route. IP- /etc/resolv.conf.
IP- IP-,
. , , ${IP_ADDR}
IP-, ${BROADCAST} , ${NETMASK}
:
20: ifconfig
# ifconfig eth0 ${IP_ADDR} broadcast ${BROADCAST} netmask ${NETMASK} up

route. IP-
${GATEWAY}:
21: route
# route add default gw ${GATEWAY}

177

/etc/resolv.conf (
nano):
22: /etc/resolv.conf
# nano -w /etc/resolv.conf

.
${NAMESERVER1} ${NAMESERVER2}
:
23: /etc/resolv.conf
nameserver ${NAMESERVER1}
nameserver ${NAMESERVER2}

. , -
(, Google). , !
Gentoo. .

4.
4.a.

Gentoo Linux
Linux , , . ,
,
Gentoo Linux.
, . ,
, Linux IDE-,
/dev/hda. SCSI SATA,
/dev/sda.
.
,
, : IDE, SCSI - .
, 512-
.

Linux
, .
,
. x86 .
: (primary), (extended)
(logical).
178

, MBR (Master
Boot Record ). MBR (512 ),
(, /dev/hda1
/dev/hda4).
( ,

), .
,
, .
, .
MBR, .

- 86 EVMS LVM2.
EVMS LVM2 .
, , EVMS LVM2
.

4.b.

,
, :

/dev/hda1
/dev/hda2
/dev/hda3

ext2
32
(swap)
512
ext3

, ,
, .
, fdisk
.
?
. ,
, , , /home
.
Gentoo , /var, ..
. , ,
.
/opt, .
, /home: .
179

/usr: ,
, - , Portage,
, 500 .
, .
:


;
- ,

,
.. (

) ;
,
read-only ( ), nosuid ( setuid), noexec
( ) ...

, :
,
, . , SCSI
SATA 15 .
20 ,
( -, , Gnome
..):
1:
$ df -h
Filesystem Type Size Used Avail Use% Mounted on
/dev/hda5
ext3 509M 132M 351M 28%
/
/dev/hda2
ext3 5.0G 3.0G 1.8G 63%
/home
/dev/hda7
ext3 7.9G 6.2G 1.3G 83%
/usr
/dev/hda8
ext3 1011M 483M 477M 51% /opt
/dev/hda9
ext3 2.0G 607M 1.3G 32% /var
/dev/hda1
ext2 51M 17M 31M
36% /boot
/dev/hda6
swap 516M 12M 504M 2%
<not mounted>
( : 2 )

/usr, , ( 83%),
, /usr .
/var , ,
Portage .
/var , , 1,
PORTAGE_TMPDIR /etc/make.conf,
,
, OpenOffice.

4.c. fdisk

180

,
, , :

/dev/hda1
/dev/hda2
/dev/hda3

.

fdisk
. fdisk, (
/dev/hda):
2: fdisk
# fdisk /dev/hda

fdisk :
3: fdisk
Command (m for help):

p, :
4:
Command (m for help): p
Disk /dev/hda: 240 heads, 63 sectors, 2184 cylinders
Units = cylinders of 15120 * 512 bytes
Device Boot
/dev/hda1
/dev/hda2
/dev/hda3
/dev/hda4
/dev/hda5
/dev/hda6
/dev/hda7
/dev/hda8
/dev/hda9

Start
1
15
50
71
71
210
349
627
905

End Blocks Id System


14 105808+ 83 Linux
49 264600 82 Linux swap
70 158760 83 Linux
2184 15981840 5 Extended
209 1050808+ 83 Linux
348 1050808+ 83 Linux
626 2101648+ 83 Linux
904 2101648+ 83 Linux
2184 9676768+ 83 Linux

Command (m for help):

Linux ( System
Linux) ( Linux swap).

.
d. /dev/hda1:
5:

181

Command (m for help): d


Partition number (1-4): 1

.
p, ,
.
, q ENTER;
.
, ,
p , d
, .
:
6:
Disk /dev/hda: 30.0 GB, 30005821440 bytes
240 heads, 63 sectors/track, 3876 cylinders
Units = cylinders of 15120 * 512 = 7741440 bytes
Device Boot

Start

End

Blocks Id System

Command (m for help):

, , ,
. ,
. , ,
, !

. n
, p, , 1
. .
+32M, 32:
7:
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-3876, default 1): ( )
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-3876, default 3876): +32M

, p, :
8:
Command (m for help): p
Disk /dev/hda: 30.0 GB, 30005821440 bytes
240 heads, 63 sectors/track, 3876 cylinders
Units = cylinders of 15120 * 512 = 7741440 bytes
Device Boot

Start

End

Blocks Id System

182

/dev/hda1

14

105808+ 83 Linux

. a
, 1. p, ,
boot *.

. n ( ),
p . 2,
, /dev/hda2.
. +512M,
512. , t , 2,
, 82, Linux Swap.
p ,
:
9:
Command (m for help): p
Disk /dev/hda: 30.0 GB, 30005821440 bytes
240 heads, 63 sectors/track, 3876 cylinders
Units = cylinders of 15120 * 512 = 7741440 bytes
Device Boot
/dev/hda1 *
/dev/hda2

Start
1
15

End Blocks Id System


14 105808+ 83 Linux
81 506520 82 Linux swap


. n ( ),
p ( ). 3
, /dev/hda3.
. ,
. , p
:
10:
Command (m for help): p
Disk /dev/hda: 30.0 GB, 30005821440 bytes
240 heads, 63 sectors/track, 3876 cylinders
Units = cylinders of 15120 * 512 = 7741440 bytes
Device Boot
/dev/hda1 *
/dev/hda2
/dev/hda3

Start
1
15
82

End Blocks Id System


14 105808+ 83 Linux
81 506520 82 Linux swap
3876 28690200 83 Linux


fdisk, w.
11: fdisk

Command (m for help): w

183

, , .

4.d.

, .
, ,
, ,
. , ,
...

( !)
Linux .
: ext2, ext3, ReiserFS, XFS JFS.

ext2 Linux,
.
.
,
, .

, .

ext3 ext2,
, ,
. ext3
.
(b-tree),
.
, mke2fs -O dir_index.
, ext3 .

ReiserFS , B*-.
, ( 10-15 ) ext2 ext3
( 4). ReiserFS
; .
2.4.18, ReiserFS
, ,
,
.

XFS

.
Linux- SCSI
(fibre-channel),
. - , XFS
,
(
184


, ) .

JFS
IBM.
, , -
.



:


ext2
mke2fs
ext3
mke2fs -j
reiserfs
mkreiserfs
xfs
mkfs.xfs
jfs
mkfs.jfs
, (/dev/hda1 )
ext2, (/dev/hda3 ) ext3,
:
12:
# mke2fs /dev/hda1
# mke2fs -j /dev/hda3


( ).

mkswap , :
13:
# mkswap /dev/hda2

swapon:
14:
# swapon /dev/hda2

, ,
.

4.e.
, , ,
( ) .
mount.
. , :
185

15:
# mount /dev/hda3 /mnt/gentoo
# mkdir /mnt/gentoo/boot
# mount /dev/hda1 /mnt/gentoo/boot

: /tmp ,
: chmod 1777
/mnt/gentoo/tmp. /var/tmp.
proc (
) /proc.
.
Gentoo.

5. Gentoo
5.a.

, , ,
. ,
!
, date:
1:
# date
Fri Mar 29 16:21:18 UTC 2007

, date
(: , , , ).
UTC. .
, 29 , 16:21, 2005 , :
2:
# date 032916212007


stage3 .
, ,
Gentoo, .
, ,
, .. .
,
186

uname -m.
:
:

5.b. :

/mnt/gentoo):

Gentoo

3: Gentoo
# cd /mnt/gentoo

,
, . links,
Gentoo .
links , lynx.
-, http_proxy ftp_proxy:
4: - lynx
# export http_proxy="http://proxy.server.com:port"
# export ftp_proxy="http://proxy.server.com:port"

, links.
releases/, ,
(, x86/), Gentoo (2006.1/), , ,
stages/.
(
). D .
Q, .
5: links
# links http://www.gentoo.org/main/ru/mirrors.xml
( links -:)
# links -http-proxy proxy.server.com:8080 http://www.gentoo.org/main/ru/mirrors.xml

, stage3-
stage1 stage2 .
,
md5sum MD5, .
, x86:
6:
# md5sum -c stage3-x86-2007.0.tar.bz2.DIGESTS
stage3-x86-2007.0.tar.bz2: OK

187


. tar, ..
:
7:
# tar xvjpf stage3-*.tar.bz2

,
(xvjpf). :
x ;
v , ,
( );
j bzip2;
p ;
f , , ,
.

: -
(, MIPS) tar BusyBox,
v.
xjpf.
.

5.c. :


: x86 ,
.
.
- /mnt/cdrom/stages.
, ls:
8:
# ls /mnt/cdrom/stages

, , CDROM:
9: CD-ROM
# ls /mnt/cdrom/stages
ls: /mnt/cdrom/stages: No such file or directory
# mount /dev/cdroms/cdrom0 /mnt/cdrom
# ls /mnt/cdrom/stages

188

Gentoo ( /mnt/gentoo):
10: /mnt/gentoo
# cd /mnt/gentoo

tar . ,
(xvjpf)! v
tar.
stage3-<>-2006.1.tar.bz2.
.
11:
# tar xvjpf /mnt/cdrom/stages/stage3-<>-2007.0.tar.bz2

5.d.

,
Portage ,
, ..

( /mnt/gentoo):
12:
# cd /mnt/gentoo

links ( lynx) Gentoo.


snapshots/.
(portage-latest.tar.bz2), D.
13: Gentoo
# links http://www.gentoo.org/main/ru/mirrors.xml

Q. /mnt/gentoo
.
, md5sum,
MD5, .
14: Checking integrity of a Portage snapshot
# md5sum -c portage-latest.tar.bz2.md5sum
portage-latest.tar.bz2: OK

. ,
189

; C, c.
15:
# tar xvjf /mnt/gentoo/portage-latest.tar.bz2 -C /mnt/gentoo/usr

5.e.

Gentoo ,
Portage. (
export), .
Portage, /etc/make.conf.
.
:
/mnt/gentoo/etc/make.conf.example. Gentoo,
, .
( nano)
, .
16: /etc/make.conf
# nano -w /mnt/gentoo/etc/make.conf

, make.conf.example :
#,
="" . make.conf
. .
CHOST
CHOST ,
. .
, .. . CHOST,
-, , , stage3.
CFLAGS CXXFLAGS
CFLAGS CXXFLAGS
gcc C C++, . ,
,
,
. , .
make.conf , ,
, .
;
( , , , ).

190

.
, GNU (.)
gcc (info gcc Linux).
make.conf.example:
.
-march=, .
make.conf.example.
, x86 Athlon XP:
17: -march GCC
# AMD64, 64-
# , -march=k8
# EM64T -march=nocona
-march=athlon-xp

(JohnBat26): 4.2.0 ,
,
( : -march -mtune):
1. generic: ,
, x86;
2. native: .

cpuid ! . nocona ( Core 2 Duo) prescott ( Intel
Pentium 4 .).
-O ( O, ),
gcc. :

s ;

0 , ;

1, 2 3 (
, ).
, 2:
18: -O GCC
-O2

-pipe (
).
, -fomit-frame-pointer (
, )
!
CFLAGS CXXFLAGS,
, :
19: CFLAGS CXXFLAGS (gcc < 4.2.0)
CFLAGS="-march=athlon-xp -pipe -O2" # AMD64: -march=k8
# EM64T: -march=nocona
CXXFLAGS="${CFLAGS}"
#

MAKEOPTS
191

MAKEOPTS ,
. (
) ,
.
20: MAKEOPTS
MAKEOPTS="-j2"

, , !
/mnt/gentoo/etc/make.conf ,
( nano CTRL+X).
Gentoo.

6. Gentoo
6.a.
:

. Portage GENTOO_MIRRORS make.conf
, . ,
, (
),
mirrorselect,
.
1: mirrorselect GENTOO_MIRRORS
# mirrorselect -i -o >>/mnt/gentoo/etc/make.conf

:
IPv6.

IPv6.

SYNC
make.conf. rsync (
), Portage (
ebuild , , Portage
). SYNC
, mirrorselect :
2: rsync mirrorselect
# mirrorselect -i -r -o >> /mnt/gentoo/etc/make.conf

mirrorselect,
/mnt/gentoo/etc/make.conf!

DNS
192

, , :
DNS ( ) /etc/resolv.conf. ,
. /etc/resolv.conf
, .
3: DNS
( -L ,
)
# cp -L /etc/resolv.conf /mnt/gentoo/etc/resolv.conf

/proc /dev
/proc /mnt/gentoo/proc,
,
,
/dev.
4: /proc /dev
# mount -t proc none /mnt/gentoo/proc
# mount -o bind /dev /mnt/gentoo/dev


, , .
, . ,
( - )
( ).
:
1. chroot / (
) /mnt/gentoo (
).
2. , env-update, ,
, .
3. , source.
5:
# chroot /mnt/gentoo /bin/bash
# env-update
>> Regenerating /etc/ld.so.cache...
# source /etc/profile
# export PS1="(chroot) $PS1"

! Gentoo Linux. ,
,
:-)

193

6.b. Portage
Portage
Portage
emerge --sync:
6:
# emerge --sync
( , ,
,
--quiet :)
# emerge --sync --quiet

,
rsync-, emerge-webrsync,
.
, Portage
, emerge portage.

.
Gentoo.
CHOST, CFLAGS ,

. Gentoo.
. , 86, hppa
alpha : 2.4,
2.6. 2.6.
ppc ppc64 .
.
, ,
:
7:
# ls -FGg /etc/make.profile
lrwxrwxrwx 1 48 Apr 8 18:51 /etc/make.profile -> ../usr/portage/profiles/default-linux/x86/2007.0/

,
2.6. ,
.
desktop server.
2007.0/, ,
. , make.defaults desktop,
, .
, , ,
, 2.4. ,
, . x86
194

:
8:
# ls -d /usr/portage/profiles/default-linux/x86/no-nptl/2.4
/usr/portage/profiles/default-linux/x86/no-nptl/2.4

2.4 (..
).
, ,
:
9: 2.4
(, ; - x86)
# ln -snf /usr/portage/profiles/default-linux/x86/no-nptl/2.4 /etc/make.profile
( 2.4)
# ls -FGg /etc/make.profile/
total 12
-rw-r--r-- 1 939 Dec 10 14:06 packages
-rw-r--r-- 1 347 Dec 3 2004 parent
-rw-r--r-- 1 573 Dec 3 2004 virtuals

ppc 2006.1 :
10: PPC
( PPC, PPC-, )
# ln -snf /usr/portage/profiles/default-linux/ppc/ppc32/2006.1 /etc/make.profile
( G3)
# ln -snf /usr/portage/profiles/default-linux/ppc/ppc32/2006.1/G3 /etc/make.profile
( G3 Pegasos)
# ln -snf /usr/portage/profiles/default-linux/ppc/ppc32/2006.1/G3/Pegasos/ /etc/make.profile
( G4 (Altivec))
# ln -snf /usr/portage/profiles/default-linux/ppc/ppc32/2006.1/G4 /etc/make.profile
( G4 (Altivec) Pegasos)
# ln -snf /usr/portage/profiles/default-linux/ppc/ppc32/2006.1/G4/Pegasos/ /etc/make.profile

ppc64 2006.1
:
11: PPC64
( PPC64 64- , PPC64-)
# ln -snf /usr/portage/profiles/default-linux/ppc/ppc64/2006.1/64bit-userland /etc/make.profile
( PPC64 32- , PPC64-)
# ln -snf /usr/portage/profiles/default-linux/ppc/ppc64/2006.1/32bit-userland /etc/make.profile
( , .)
(userland )
( 970 JS20)
# ln -snf /usr/portage/profiles/default-linux/ppc/ppc64/2006.1/(userland)/970 /etc/make.profile
( G5)
# ln -snf /usr/portage/profiles/default-linux/ppc/ppc64/2006.1/(userland)/970/pmac /etc/make.profile
( POWER3)
# ln -snf /usr/portage/profiles/default-linux/ppc/ppc64/2006.1/(userland)/power3 /etc/make.profile
( POWER4)
# ln -snf /usr/portage/profiles/default-linux/ppc/ppc64/2006.1/(userland)/power4 /etc/make.profile
( POWER5)
# ln -snf /usr/portage/profiles/default-linux/ppc/ppc64/2006.1/(userland)/power5 /etc/make.profile

( )

195

USE
USE () ,
Gentoo.
.
, gtk qt
. , SSL.
(svgalib)
X11 (X-).

. ,
. Gentoo ,
. USE.
USE ,
. , ssl
ssl , . -X
X- ( ).
gnome gtk -kde -qt
Gnome gtk, KDE qt,
GNOME.
USE make.defaults .
make.defaults , /etc/make.profile,
. USE
USE make.defaults. ,
/etc/make.conf, .
- USE, .
- ( ),
( ).
/etc/make.profile. , ,
Portage!
USE
Gentoo USE-.
/usr/portage/profiles/use.desc.
12: USE-
# less /usr/portage/profiles/use.desc
( , "q")

, USE , KDE,
DVD, ALSA CD:
13: /etc/make.conf
# nano -w /etc/make.conf
14: USE
USE="-gtk -gnome qt kde dvd alsa cdr"

: GLIBC

196

, -
. /etc/locale.gen.
15: /etc/locale.gen
# nano -w /etc/locale.gen

(),
() (, UTF-8).
16:
en_US/ISO-8859-1
en_US.UTF-8/UTF-8
de_DE/ISO-8859-1
de_DE@euro/ISO-8859-15

locale-gen.
, /etc/locale.gen.
: locale-gen glibc-2.3.6-r4 .
glibc, .
: , ,
.
Gentoo. . .
.

7.
7.a.
(time zone), ,
. /usr/share/zoneinfo,
/etc/localtime. , ,
/usr/share/zoneinfo/Etc/GMT*, . .
. , GMT-8 GMT+8.
1:
# ls /usr/share/zoneinfo
(, GMT)
# cp /usr/share/zoneinfo/GMT /etc/localtime

(JohnBat26): (
), ( ):
1. .
2. /etc/adjtime. , .
3. nano -w /etc/conf.d/clock. UTC Local, !!!

197

7.b.

Linux , .
.
Gentoo .
Gentoo (.).
x86 , , ,

vanilla-sources ( linux );

gentoo-sources ( , ).
emerge . USE="-doc" ,
xorg-x11 .
USE="symlink" ,
/usr/src/linux:
2:
# USE="-doc symlink" emerge gentoo-sources

/usr/src, linux,
. ,
gentoo-sources-2.6.12-r10.
, .
3:
# ls -l /usr/src/linux
lrwxrwxrwx 1 root root
12 Oct 13 11:04 /usr/src/linux -> linux-2.6.12-gentoo-r10

.
genkernel, ,
-.
, .
,
: . genkernel,
: genkernel.

7.c. :


Linux.
, - ;)
: ,
.
, pciutils (emerge pciutils), lspci. lspci
198

, .
, pcilib (: pcilib: cannot
open /sys/bus/pci/devices [pcilib: /sys/bus/pci/devices]),
lspci. lspci .
. lsmod ,
- ( ,
).
make
menuconfig. , ncurses.
4:
# cd /usr/src/linux
# make menuconfig

. ,
( Gentoo ,
).

,
. :
5: /,
Code maturity level options --->
[*] Prompt for development and/or incomplete code/drivers"
General setup --->
[*] Support for hot-pluggable devices

, ,
(, SCSI-), , ,
.
:
6:
Processor type and features --->
( )
(Athlon/Duron/K7) Processor family

File Systems
. , Gentoo
. Virtual memory /proc file system.
2.4, /dev file system, ..
udev.
7:
( 2.4.x)
File systems --->
[*] Virtual memory file system support (former shm fs)
[*] /proc file system support
[*] /dev file system support (EXPERIMENTAL)
[*] automatically mount /dev at boot

199

[ ] /dev/pts file system for Unix98 PTYs


( 2.6.x)
File systems --->
Pseudo Filesystems --->
[*] /proc file system support
[*] Virtual memory file system support (former shm fs)
( )
<*> Reiserfs support
<*> Ext3 journalling file system support
<*> JFS filesystem support
<*> Second extended fs support

<*> XFS filesystem support


BIOS ,
,
:
8:
( 2.4.x)
ATA/IDE/MFM/RLL support --->
IDE, ATA and ATAPI Block devices --->
<*> Include IDE/ATA-2 DISK support
[ ] Use multi-mode by default
[*] Auto-Geometry Resizing support

DMA :
9: DMA
Device Drivers --->
ATA/ATAPI/MFM/RLL support --->
[*] Generic PCI bus-master DMA support
[*] Use PCI DMA by default when available

PPPoE
, :
10: PPPoE
( 2.4.)
Network device support --->
<*> PPP (point-to-point protocol) support
<*> PPP support for async serial ports
<*> PPP support for sync tty ports
( 2.6.x)
Device Drivers --->
Networking support --->
<*> PPP (point-to-point protocol) support
<*> PPP support for async serial ports
<*> PPP support for sync tty ports

, .
PPP over Ethernet rp-pppoe,
PPPoE .

200

, .
Intel HyperTreading
, :
11: SMP
Processor type and features --->
[*] Symmetric multi-processing support

USB, (,
), :
12: USB
USB Support --->
<*> USB Human Interface Device (full HID) support

, PCMCIA,
PCMCIA , 2.4. pcmcia-cs,
, .
2.6 PCMCIA, .
PCMCIA 2.6,
PCMCIA :
13: PCMCIA 2.6
Bus options (PCI, PCMCIA, EISA, MCA, ISA) --->
PCCARD (PCMCIA/CardBus) support --->
<*> PCCard (PCMCIA/CardBus) support
( ( ), 16- PCMCIA)
<*> 16-bit PCMCIA support
[*] 32-bit CardBus support
( )
--- PC-card bridges
<*> CardBus yenta-compatible bridge support (NEW)
<*> Cirrus PD6729 compatible bridge support (NEW)
<*> i82092 compatible bridge support (NEW)
<*> i82365 compatible bridge support (NEW)
<*> Databook TCIC host bridge support (NEW)

, .

, , .
:
14:
( 2.4)
# make dep && make bzImage modules modules_install
( 2.6)
# make && make modules_install

201

, /boot.
, ,
, .
<-> .
15:
# cp arch/i386/boot/bzImage /boot/<->

7.d. : genkernel
, ,
genkernel .
,
, genkernel. genkernel
,
-. , genkernel,
, .
genkernel ,
, , .
, genkernel. :
16: genkernel
# emerge genkernel

, 2.6,
, , , genkernel
:
17:
( 2.6.)
# zcat /proc/config.gz > /usr/share/genkernel/x86/kernel-config-2.6

, genkernel all. ,
, genkernel ,
.
ext2 ext3,
, genkernel --menuconfig all,
(.. ).
EVMS2 LVM2, ,
--evms2 --lvm2.
18: genkernel
# genkernel all

202

genkernel ,
(initrd). initrd
, .
,
. initrd
, ( ,
), .
19: initrd
# ls /boot/kernel* /boot/initramfs*

:
coldplug. initrd ,
, coldplug .
coldplug :
20: coldplug
# emerge coldplug
# rc-update add coldplug boot

7.e.

, ,
/etc/modules.autoload.d/kernel-2.4 ( kernel-2.6). , ,
.
find, <
> :
21:
# find /lib/modules/<kernel version>/ -type f -iname '*.o' -or -iname '*.ko'

, 3c59x.o kernel-2.4
kernel-2.6, .
22: /etc/modules.autoload.d/kernel-2.4
( 2.4.x)
# nano -w /etc/modules.autoload.d/kernel-2.4

23: /etc/modules.autoload.d/kernel-2.4 kernel-2.6


3c59x

203

8.
8.a.
fstab?
Linux , ,
/etc/fstab. (mountpoints,
), ,
( ,
..)
/etc/fstab
/etc/fstab .
, , .
:
1. (partition) ( ).
2. (mountpoint),
.
3. (filesystem),
.
4. (mountoptions),
mount .
,
mount (man mount), .

.
5. dump ,
dump.
0 ().
6. fsck (check)
.
1, 2
( 0, ).
: /etc/fstab , Gentoo,
. /etc/fstab.
1: /etc/fstab
# nano -w /etc/fstab

, ,
/proc, tmpfs, CD-ROM (
, ).

/etc/fstab:
204

auto mount
( ,
), user
- .
,
noatime ,
(
):
/etc/fstab, , ,
.

(JohnBat26): /etc/fstab:
2: /etc/fstab
/dev/sda2
/boot
ext2
defaults,noatime
/dev/sda5
/
xfs
defaults,noatime
/dev/sda3
none
swap
sw
/dev/sda7
/home
xfs
defaults,noatime
/dev/sr0
/mnt/cdrom
auto
noauto,ro,user,iocharset=utf8
# FAT32
/dev/sda1
/windows/c
vfat
auto,iocharset=utf8,quiet,user,umask=000,noatime
# NTFS
/dev/sda6
/windows/d
ntfs
auto,nls=utf8,umask=0,user,noatime
/dev/sda8
/windows/e
vfat
auto,iocharset=utf8,user,quiet,umask=000,noatime
/dev/sda9
/home/media
xfs
defaults,noatime
# NTFS ntfs-3g
/dev/sda10
/mnt/windows/f ntfs-3g
-o silent,umask=0,locale=ru_RU.utf8
# NOTE: The next line is critical for boot!
proc
/proc
proc
defaults
# flash drive
/dev/sdb
/mnt/flash
auto
user,noauto,rw,async,iocharset=utf8
shm
/dev/shm
tmpfs
nodev,nosuid,noexec

12
01
00
01
00
00
00
00
01

00
00
00

8.b.
Hostname, Domainname . .
,
. ,
Linux-. , ,
, . ,
tux, homenetwork.
2:
# nano -w /etc/conf.d/hostname

( HOSTNAME )
HOSTNAME="tux"
-, (domainname) /etc/conf.d/net:
205

3:
# nano -w /etc/conf.d/net
( DNSDOMAIN )
dns_domain_lo="homenetwork"

NIS ( , ,
), :
4: NIS-
# nano -w /etc/conf.d/net
( NIS nis_domain)
nis_domain_lo="my-nisdomain"


, : , ! ,
, ,
Gentoo. .
: , ,
, , (VLAN)
802.1Q , Gentoo.
/etc/conf.d/net.
, , ,
. , . /etc/conf.d/net.example
,
.
DHCP. DHCP ,
DHCP-, .
DHCP-.

DHCP, - , DHCP,
/etc/conf.d/net (
nano):
5: /etc/conf.d/net
# nano -w /etc/conf.d/net

:
6: /etc/conf.d/net
# This blank configuration will automatically use DHCP for any net.*
# scripts in /etc/init.d. To create a more complete configuration,
# please review /etc/conf.d/net.example and save your configuration
# in /etc/conf.d/net (this file :]!).
(#
# DHCP net.* /etc/init.d.
# , , /etc/conf.d/net.example,
# /etc/conf.d/net ( :]!).
)

206

IP, ,
config_eth0, routes_eth0:
7: IP eth0
config_eth0=( "192.168.0.2 netmask 255.255.255.0 brd 192.168.0.255" )
routes_eth0=( "default gw 192.168.0.1" )

DHCP ,
config_eth0 dhcp_eth0:
8: IP eth0
config_eth0=( "dhcp" )
dhcp_eth0="nodns nontp nonis"

/etc/conf.d/net.example.
, config_eth1,
config_eth2 ..
, .


. PCMCIA, ,
PCMCIA PCMCIA.
9: net.eth0 default
# rc-update add net.eth0 default

,
net.eth1, net.eth2 ..
ln:
10:
# cd /etc/init.d
# ln -s net.lo net.eth1
# rc-update add net.eth1 default


Linux .
/etc/hosts, IP- ,
. .
,
DNS.
11: /etc/hosts
# nano -w /etc/hosts

207

12:
( )
127.0.0.1 tux.homenetwork tux localhost

( ,
IP-.)
192.168.0.5 jenny.homenetwork jenny
192.168.0.6 benny.homenetwork benny
, .

8.c.
root
, root (), :
13: root
# passwd

, root
, tts/0 /etc/securetty:
14: tts/0 to /etc/securetty
# echo "tts/0" >> /etc/securetty

Gentoo

/etc/rc.conf.
/etc/rc.conf ,
:)
15: /etc/rc.conf
# nano -w /etc/rc.conf

/etc/rc.conf .
, ,
.
unicode,
(, gdm kdm).
Gentoo /etc/conf.d/keymaps.
.
16: /etc/conf.d/keymaps
# nano -w /etc/conf.d/keymaps

208


(KEYMAP): ,
.
/etc/conf.d/keymaps
.
Gentoo
.

/etc/conf.d/clock.

UTC
(), CLOCK="local".
.
/etc/conf.d/clock
.
.

9.
9.a.
2.4, Gentoo
(stage3), - .
Gentoo udev, 2.4 udev ,
devfsd, udev.
1: devfsd
( , 2.4.x c )
# emerge --unmerge udev
# emerge devfsd

9.b.
stage3,
. ,
.
, ,
. Unix Linux

, .
.
Gentoo . sysklogd,
, syslog-ng,
, metalog
. , Portage
209

: .
sysklogd syslog-ng,
logrotate,
.
, emerge,
rc-update.
syslog-ng.
:
2:
# emerge syslog-ng
# rc-update add syslog-ng default

9.c. : cron
cron. ,
, .
cron? cron . ,
- (, ,
).
Gentoo cron : dcron, fcron vixie-cron.
.
, dcron fcron
, crontab /etc/crontab. ,
, vixie-cron.
vixie-cron.
cron, .
3: cron
# emerge vixie-cron
# rc-update add vixie-cron default
( dcron fcron) # crontab /etc/crontab

9.d. :
,
locate, sys-apps/slocate:
4: slocate
# emerge slocate

9.e.
,
210

, .., ,
.
,
:

XFS
ReiserFS
JFS

xfsprogs
reiserfsprogs
jfsutils


emerge xfsprogs
emerge reiserfsprogs
emerge jfsutils

EVMS, evms:
5: EVMS
# USE="-gtk" emerge evms

USE="-gtk" , .
evms,
evms.
( rp-pppoe
dhcp), .

9.f.
: DHCP
, Gentoo IP-
, dhcpcd (
DHCP, DHCP . ).
,
!
6: dhcpcd
# emerge dhcpcd

: PPPoE
rp-pppoe, .
7: rp-pppoe
# USE="-X" emerge rp-pppoe

USE="-X" xorg-x11 ( rp-pppoe


; , rppppoe , xorg-x11 :
).
: RAID IBM
211

POWER5 RAID- SCSI,


iprutils, , ,
,
.
8: iprutils
# emerge iprutils

10.
10.a.

, ,
, ,
. .
x86 Gentoo Linux GRUB LILO. ,
, ,
(, ).
Linux
(, Gentoo).
:
(
genkernel), ,
vga / video .
, .
, Gentoo ( gentoosources), vesafb-tng VESA
( ).
vesafb-tng vga .
vesafb, vga .
vga ,
vesafb. /usr/src/linux/Documentation/fb/vesafb.txt (
),
VESA,
.
vga,
.
256
32

640x480
0x301
0x310

800x600
0x303
0x313

1024x768
0x305
0x316

1280x1024
0x307
0x319
212

64
16

0x311
0x312

0x314
0x315

0x317
0x318

0x31A
0x31B

video .
(vesafb 2.6 vesa
2.4), , .
/usr/src/linux/Documentation/fb/vesafb.txt,
:
1. ywrap ,
( , );
2. mtrr:n
MTRR; n: 0 1 - 2 - (write-back) 3 (write-combining) 4 - (write-through);
3. mode ( vesafb-tng) ,
. , 1024x768-32@85 1024x768, 32-
85 .
- vga=0x318 video=vesafb:mtrr:3,ywrap
video=vesafb:mtrr:3,ywrap,1024x768-32@85. ( )
, .
GRUB LILO.

10.b. : GRUB
GRUB
GRUB ,
. Linux- /dev/hda1, , GRUB
(hd0,0). hd0,0
.
, , ; c ,
. , hd ,
atapi-ide, -.
SCSI ( ,
IDE, , BIOS
SCSI). BIOS (,
), hd0.
, /dev/hda, CD-ROM /dev/hdb,
CD /dev/hdc, /dev/hdd, SCSI ,
/dev/hdd7 (hd1,6). ,
( ), , , GRUB
tab, ,
, GRUB.

213

, , GRUB.
GRUB
GRUB :
1: GRUB
# emerge grub

GRUB ,
, GRUB MBR, .
nano ( ) /boot/grub/grub.conf:
2: /boot/grub/grub.conf
# nano -w /boot/grub/grub.conf

grub.conf .
grub.conf . grub.conf
. ,
,
(initrd).
grub.conf , genkernel
grub.conf , genkernel
: JFS,
ro kernel, JFS ,
-.
3: grub.conf , genkernel
# : 0 - , 1 - ..
default 0
#
timeout 30
# , :)
# ,
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
title=Gentoo Linux 2.6.12-r10
# ( )
root (hd0,0)
kernel /boot/kernel-2.6.12-gentoo-r10 root=/dev/hda3
# Windows
# Windows /dev/hda6
title=Windows XP
rootnoverify (hd0,5)
makeactive
chainloader +1
4: grub.conf , genkernel
default 0
timeout 30
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
title=Gentoo Linux 2.6.12-r10

214

root (hd0,0)
kernel /boot/kernel-genkernel-x86-2.6.12-gentoo-r10
real_root=/dev/hda3 udev
initrd /boot/initramfs-genkernel-x86-2.6.12-gentoo-r10

root=/dev/ram0

init=/linuxrc

ramdisk=8192

#
title=Windows XP
rootnoverify (hd0,5)
makeactive
chainloader +1

: udev, kernel,
genkernel, udev (
).
: -, ,
. , ,
GRUB ( (hd0,0)),
,

,
(hd0,0)/grub/splash.xpm.gz /boot/grub/splash.xpm.gz, (hd0,0)
/boot.
, , /boot
, /boot, , .
, /boot
, boot. ,
,
/boot .
,
kernel. (root=/dev/hda3
real_root=/dev/hda3); , ,
video / vga , .
2.6.7 ,
- , BIOS
, hdx=stroke.
, genkernel, ,
, -. ,
SCSI, doscsi.
grub.conf . -
GRUB MBR (Master Boot Record), GRUB
.
GRUB grub-install. ,
grub-install GRUB .
: GRUB grub-install
: GRUB .
: GRUB grub-install
GRUB grub-install. , grub-install
215

, ..
. /etc/mtab,
. , :
/proc/mounts /etc/mtab, rootfs,
.
:
5: /etc/mtab
# grep -v rootfs /proc/mounts > /etc/mtab

GRUB, grub-install:
6: grub-install
# grub-install /dev/hda

GRUB, , GRUB FAQ (.)


GRUB (.).
.
: GRUB
, grub. grub>
grub. ,
GRUB .
7: GRUB
# grub

: ,
--no-floppy, grub .
GRUB ,
/dev/hda1, GRUB
MBR (Master Boot Record) , ,
GRUB. ,
,
.
GRUB, TAB.
, root (, TAB, (
hd0). root (hd0, TAB,
( hd0,0).
GRUB .
GRUB.
8: GRUB MBR
grub> root (hd0,0)
( /boot)
grub> setup (hd0)
( GRUB MBR)
grub> quit
( GRUB)

: GRUB
216

MBR, setup ,
. , GRUB /dev/hda3 setup (hd0,2).
, .
GRUB, , GRUB FAQ
(.) GRUB (.).
: ,
. make
install: GRUB
.
.

10.c. : LILO
LILO
LILO ( LInux LOader)
Linux-. ,
GRUB (
GRUB). LILO ,
, GRUB . , ,
LILO . , Gentoo
, , , LILO.
LILO : emerge.
9: LILO
# emerge lilo

LILO
LILO /etc/lilo.conf.
( nano) .
10: /etc/lilo.conf
# nano -w /etc/lilo.conf


.
.
:

, genkernel;

, genkernel;
, ,
(initrd).
217

: JFS,
ro kernel, JFS ,