40,99 €
The industry favorite Linux guide Linux Bible, 10th Edition is the ultimate hands-on Linux user guide, whether you're a true beginner or a more advanced user navigating recent changes. this updated tenth edition covers the latest versions of Red Hat Enterprise Linux (RHEL 8), Fedora 30, and Ubuntu 18.04 LTS. It includes information on cloud computing, with new guidance on containerization, Ansible automation, and Kubernetes and OpenShift. With a focus on RHEL 8, this new edition teaches techniques for managing storage, users, and security, while emphasizing simplified administrative techniques with Cockpit. Written by a Red Hat expert, this book provides the clear explanations and step-by-step instructions that demystify Linux and bring the new features seamlessly into your workflow. This useful guide assumes a base of little or no Linux knowledge, and takes you step by step through what you need to know to get the job done. * Get Linux up and running quickly * Master basic operations and tackle more advanced tasks * Get up to date on the recent changes to Linux server system management * Bring Linux to the cloud using Openstack and Cloudforms * Simplified Linux administration through the Cockpit Web Interface * Automated Linux Deployment with Ansible * Learn to navigate Linux with Amazon (AWS), Google (GCE), and Microsofr Azure Cloud services Linux Bible, 10th Edition is the one resource you need, and provides the hands-on training that gets you on track in a flash.
Sie lesen das E-Book in den Legimi-Apps auf:
Seitenzahl: 1599
Veröffentlichungsjahr: 2020
Cover
Introduction
How This Book Is Organized
Conventions Used in This Book
Jumping into Linux
How to Contact Wiley or the Author
Part I: Getting Started
CHAPTER 1: Starting with Linux
Understanding What Linux Is
Understanding How Linux Differs from Other Operating Systems
Exploring Linux History
Understanding How Linux Distributions Emerged
Finding Professional Opportunities with Linux Today
Summary
CHAPTER 2: Creating the Perfect Linux Desktop
Understanding Linux Desktop Technology
Starting with the Fedora GNOME Desktop Live image
Using the GNOME 3 Desktop
Using the GNOME 2 Desktop
Summary
Exercises
Part II: Becoming a Linux Power User
CHAPTER 3: Using the Shell
About Shells and Terminal Windows
Choosing Your Shell
Running Commands
Recalling Commands Using Command History
Connecting and Expanding Commands
Using Shell Variables
Creating Your Shell Environment
Getting Information about Commands
Summary
Exercises
CHAPTER 4: Moving Around the Filesystem
Using Basic Filesystem Commands
Using Metacharacters and Operators
Listing Files and Directories
Understanding File Permissions and Ownership
Moving, Copying, and Removing Files
Summary
Exercises
CHAPTER 5: Working with Text Files
Editing Files with vim and vi
Finding Files
Summary
Exercises
CHAPTER 6: Managing Running Processes
Understanding Processes
Listing Processes
Managing Background and Foreground Processes
Killing and Renicing Processes
Limiting Processes with cgroups
Summary
Exercises
CHAPTER 7: Writing Simple Shell Scripts
Understanding Shell Scripts
Summary
Exercises
Part III: Becoming a Linux System Administrator
CHAPTER 8: Learning System Administration
Understanding System Administration
Using Graphical Administration Tools
Using the root User Account
Exploring Administrative Commands, Configuration Files, and Log Files
Using Other Administrative Accounts
Checking and Configuring Hardware
Summary
Exercises
CHAPTER 9: Installing Linux
Choosing a Computer
Installing Fedora from Live Media
Installing Red Hat Enterprise Linux from Installation Media
Understanding Cloud-Based Installations
Installing Linux in the Enterprise
Exploring Common Installation Topics
Summary
Exercises
CHAPTER 10: Getting and Managing Software
Managing Software on the Desktop
Going Beyond the Software Window
Understanding Linux RPM and DEB Software Packaging
Managing RPM Packages with YUM
Installing, Querying, and Verifying Software with the rpm Command
Managing Software in the Enterprise
Summary
Exercises
CHAPTER 11: Managing User Accounts
Creating User Accounts
Understanding Group Accounts
Managing Users in the Enterprise
Centralizing User Accounts
Summary
Exercises
CHAPTER 12: Managing Disks and Filesystems
Understanding Disk Storage
Partitioning Hard Disks
Using Logical Volume Manager Partitions
Mounting Filesystems
Using the mkfs Command to Create a Filesystem
Managing Storage with Cockpit
Summary
Exercises
Part IV: Becoming a Linux Server Administrator
CHAPTER 13: Understanding Server Administration
Starting with Server Administration
Checking and Setting Servers
Managing Remote Access with the Secure Shell Service
Configuring System Logging
Checking System Resources with sar
Checking System Space
Managing Servers in the Enterprise
Summary
Exercises
CHAPTER 14: Administering Networking
Configuring Networking for Desktops
Configuring Networking from the Command Line
Configuring Networking in the Enterprise
Summary
Exercises
CHAPTER 15: Starting and Stopping Services
Understanding the Initialization Daemon (init or systemd)
Checking the Status of Services
Stopping and Starting Services
Enabling Persistent Services
Configuring a Default Runlevel or Target Unit
Adding New or Customized Services
Summary
Exercises
CHAPTER 16: Configuring a Print Server
Common UNIX Printing System
Setting Up Printers
Working with CUPS Printing
Using Printing Commands
Configuring Print Servers
Summary
Exercises
CHAPTER 17: Configuring a Web Server
Understanding the Apache Web Server
Getting and Installing Your Web Server
Starting Apache
Troubleshooting Your Web Server
Summary
Exercises
CHAPTER 18: Configuring an FTP Server
Understanding FTP
Installing the vsftpd FTP Server
Starting the vsftpd Service
Securing Your FTP Server
Configuring Your FTP Server
Using FTP Clients to Connect to Your Server
Summary
Exercises
CHAPTER 19: Configuring a Windows File Sharing (Samba) Server
Understanding Samba
Installing Samba
Starting and Stopping Samba
Securing Samba
Configuring Samba
Accessing Samba Shares
Using Samba in the Enterprise
Summary
Exercises
CHAPTER 20: Configuring an NFS File Server
Installing an NFS Server
Starting the NFS service
Sharing NFS Filesystems
Securing Your NFS Server
Using NFS Filesystems
Unmounting NFS filesystems
Summary
Exercises
CHAPTER 21: Troubleshooting Linux
Boot-Up Troubleshooting
Troubleshooting Software Packages
Troubleshooting Networking
Troubleshooting Memory
Troubleshooting in Rescue Mode
Summary
Exercises
Part V: Learning Linux Security Techniques
CHAPTER 22: Understanding Basic Linux Security
Implementing Physical Security
Monitoring Your Systems
Auditing and Reviewing Linux
Summary
Exercises
CHAPTER 23: Understanding Advanced Linux Security
Implementing Linux Security with Cryptography
Implementing Linux Security with PAM
Summary
Exercises
CHAPTER 24: Enhancing Linux Security with SELinux
Understanding SELinux Benefits
Understanding How SELinux Works
Configuring SELinux
Monitoring and Troubleshooting SELinux
Putting It All Together
Obtaining More Information on SELinux
Summary
Exercises
CHAPTER 25: Securing Linux on a Network
Auditing Network Services
Working with Firewalls
Summary
Exercises
Part VI: Engaging with Cloud Computing
CHAPTER 26: Shifting to Clouds and Containers
Understanding Linux Containers
Starting with Linux Containers
Summary
Exercises
CHAPTER 27: Using Linux for Cloud Computing
Overview of Linux and Cloud Computing
Trying Basic Cloud Technology
Setting Up a Small Cloud
Summary
Exercises
CHAPTER 28: Deploying Linux to the Cloud
Getting Linux to Run in a Cloud
Creating Linux Images for Clouds
Using OpenStack to Deploy Cloud Images
Using Amazon EC2 to Deploy Cloud Images
Summary
Exercises
CHAPTER 29: Automating Apps and Infrastructure with Ansible
Understanding Ansible
Exploring Ansible Components
Stepping Through an Ansible Deployment
Installing Ansible
Running Ad-Hoc Ansible Commands
Automating Tasks with Ansible Tower Automation Framework
Summary
Exercises
CHAPTER 30: Deploying Applications as Containers with Kubernetes
Understanding Kubernetes
Trying Kubernetes
Enterprise-Quality Kubernetes with OpenShift
Summary
Exercises
Part VII: Appendixes
APPENDIX A: MediaMedia
Getting Fedora
Getting Red Hat Enterprise Linux
Getting Ubuntu
Booting Linux from a USB Drive
Creating Linux CDs and DVDs
APPENDIX B: Exercise AnswersExercise Answers
Chapter 1: Starting with Linux
Chapter 2: Creating the Perfect Linux Desktop
Chapter 3: Using the Shell
Chapter 4: Moving Around the Filesystem
Chapter 5: Working with Text Files
Chapter 6: Managing Running Processes
Chapter 7: Writing Simple Shell Scripts
Chapter 8: Learning System Administration
Chapter 9: Installing Linux
Chapter 10: Getting and Managing Software
Chapter 11: Managing User Accounts
Chapter 12: Managing Disks and Filesystems
Chapter 13: Understanding Server Administration
Chapter 14: Administering Networking
Chapter 15: Starting and Stopping Services
Chapter 16: Configuring a Print Server
Chapter 17: Configuring a Web Server
Chapter 18: Configuring an FTP Server
Chapter 19: Configuring a Windows File Sharing (Samba) Server
Chapter 20: Configuring an NFS File Server
Chapter 21: Troubleshooting Linux
Chapter 22: Understanding Basic Linux Security
Chapter 23: Understanding Advanced Linux Security
Chapter 24: Enhancing Linux Security with SELinux
Chapter 25: Securing Linux on a Network
Chapter 26: Shifting to Clouds and Containers
Chapter 27: Using Linux for Cloud Computing
Chapter 28: Deploying Linux to the Cloud
Chapter 29: Automating Apps and Infrastructure with Ansible
Chapter 30: Deploying Applications as Containers with Kubernetes
Index
End User License Agreement
Chapter 2
TABLE 2.1 Keyboard Shortcuts
Chapter 3
TABLE 3.1 Keystrokes for Navigating Command Lines
TABLE 3.2 Keystrokes for Editing Command Lines
TABLE 3.3 Keystrokes for Cutting and Pasting Text from within Command Lines
TABLE 3.4 Keystrokes for Using Command History
TABLE 3.5 Common Shell Environment Variables
TABLE 3.6 Bash Configuration Files
TABLE 3.7 Characters to Add Information to Bash Prompt
TABLE 3.8 Manual Page Sections
Chapter 4
TABLE 4.1 Commands to Create and Use Files
TABLE 4.2 Setting Read, Write, and Execute Permissions
Chapter 6
TABLE 6.1 Signals Available in Linux
Chapter 7
TABLE 7.1 Operators for Test Expressions
Chapter 9
TABLE 9.1 Boot Options for Disabling Features
TABLE 9.2 Boot Options for Video Problems
TABLE 9.3 Boot Options for VNC Installations
TABLE 9.4 Assigning Partitions to Particular Directories
Chapter 11
TABLE 11.1 Commands to Create and Use Files
Chapter 13
TABLE 13.1 Commands to Determine
sshd
Status
TABLE 13.2 Commands to Start
sshd
TABLE 13.3 Commands to Start
sshd
at Boot
Chapter 15
TABLE 15.1 Standard Linux Runlevels
Chapter 22
TABLE 22.1 Ideas for Good Passwords
TABLE 22.2
chage
Options
TABLE 22.3 Log Files in the
/var/log
Directory
TABLE 22.4 Viewing Log Files That Need Special Commands
TABLE 22.5 Package Verification Discrepancies
TABLE 22.6 Additional Filesystem Scans
TABLE 22.7 Popular Linux Intrusion Detection Systems
Chapter 23
TABLE 23.1 Cryptography Ciphers
TABLE 23.2 Linux Miscellaneous Cryptography Tools
TABLE 23.3 PAM Contexts
TABLE 23.4 PAM Configuration Control Flags and Response Handling
Chapter 24
TABLE 24.1
secon
Command Options
TABLE 24.2 File Security Context Label Management Commands
TABLE 24.3 SELinux Policy Package Tools
Chapter 25
TABLE 25.1 Chains Available for Each netfilter/iptables Table
Chapter 2
FIGURE 2.1 Starting with the GNOME 3 desktop in Fedora.
FIGURE 2.2 Show all windows on the desktop minimized.
FIGURE 2.3 Show the list of available applications.
FIGURE 2.4 Click the middle mouse button to display an application's selecti...
FIGURE 2.5 As new desktops are used, additional ones appear on the right.
FIGURE 2.6 Press Ctrl+Alt+Tab to display additional desktop areas to select....
FIGURE 2.7 Press Alt+Tab to select which running application to go to.
FIGURE 2.8 Change desktop settings from the System Settings window.
FIGURE 2.9 Extensions add features to the GNOME 3 desktop.
FIGURE 2.10 Change desktop settings using the GNOME Tweak Tool (Appearance s...
FIGURE 2.11 Manage files and folders from the Nautilus window.
FIGURE 2.12 Access remote folders using the Nautilus Connect to Server featu...
FIGURE 2.13 Download and install software from the huge Fedora repository.
FIGURE 2.14 Play music, podcasts, and Internet radio from Rhythmbox.
FIGURE 2.15 The GNOME 2 desktop environment
FIGURE 2.16 The GNOME Panel menu
FIGURE 2.17 Placing applets on the panel makes accessing them easy.
FIGURE 2.18 Add launchers or applets to a drawer on your GNOME 2 panel.
FIGURE 2.19 Rotate workspaces on a cube with AIGLX desktop effects enabled....
Chapter 4
FIGURE 4.1 The Linux filesystem is organized as a hierarchy of directories....
Chapter 6
FIGURE 6.1 Displaying running processes with
top
FIGURE 6.2 Use the System Monitor window to view and change running processe...
FIGURE 6.3 Renice, kill, or pause a process from the System Monitor window....
Chapter 8
FIGURE 8.1 Logging in to Cockpit
FIGURE 8.2 View system activity and other topics from the Cockpit dashboard....
Chapter 9
FIGURE 9.1 Start the installation process from Live media.
FIGURE 9.2 Select configuration options from the Installation Summary screen...
FIGURE 9.3 Choose from Localization, Software, and System topics on the Inst...
Chapter 10
FIGURE 10.1 Install and manage software packages from the Software window.
Chapter 11
FIGURE 11.1 Add and modify user accounts from Cockpit.
Chapter 12
FIGURE 12.1 LVM logical volumes can be mounted like regular partitions on a ...
FIGURE 12.2 View storage devices, filesystems, and activities from the Cockp...
FIGURE 12.3 View and change disk partitions for a select storage device.
FIGURE 12.4 Creating a new partition table
Chapter 13
FIGURE 13.1 Log in to Cockpit
Chapter 14
FIGURE 14.1 Checking network interfaces with NetworkManager
FIGURE 14.2 Viewing network settings with NetworkManager
FIGURE 14.3 Viewing and changing network settings from Cockpit
FIGURE 14.4 View services that are accessible through the firewall from Cock...
FIGURE 14.5 Changing network settings with NetworkManager
FIGURE 14.6 Setting up Firefox to use a proxy server
FIGURE 14.7 Configuring networking with NetworkManager TUI
FIGURE 14.8 Set static IP addresses by selecting Manual from the Edit Connec...
Chapter 16
FIGURE 16.1 CUPS provides a web-based administration tool.
FIGURE 16.2 You can do administration tasks from the Printers tab.
FIGURE 16.3 The Printer Properties window after adding a printer
Chapter 17
FIGURE 17.1 Access Apache documentation directly from the local Apache serve...
FIGURE 17.2 Accessing an SSL website with a default certificate
Chapter 18
FIGURE 18.1 Open access to your FTP service from the Firewall Configuration ...
FIGURE 18.2 Accessing an FTP server from Firefox
FIGURE 18.3 The gFTP FTP client lets you see both sides of an FTP session.
Chapter 19
FIGURE 19.1 Identify a Samba share from the Nautilus Connect to Server box....
FIGURE 19.2 Add your Samba credentials.
FIGURE 19.3 Displaying a Samba share from Connect to Server in Nautilus
FIGURE 19.4 Accessing Samba shares from Windows
Chapter 20
FIGURE 20.1 View NFS shares mounted locally using Cockpit Web UI
FIGURE 20.2 Add a new NFS mount using Cockpit Web UI
FIGURE 20.3 Use the Firewall Configuration window to open your firewall to a...
Chapter 21
FIGURE 21.1 Interrupt the GRUB bootloader to modify the boot process.
FIGURE 21.2 Confirm each service in RHEL interactive startup mode.
FIGURE 21.3 Snippet from
systemd-analyze
startup plot
FIGURE 21.4 Monitor RAM and Swap usage in real time with Cockpit.
Chapter 23
FIGURE 23.1 The Fedora ISO security page tells how to get and check with
sha
...
FIGURE 23.2 Basic asymmetric key cryptography
FIGURE 23.3 Red Hat Enterprise Linux installation encryption option
FIGURE 23.4 Linux Fedora encryption symmetric key password
FIGURE 23.5 Asking for the encryption symmetric key password at boot
Chapter 25
FIGURE 25.1 Firewall Configuration window
FIGURE 25.2 Firewall Configuration
Chapter 27
FIGURE 27.1 Start Virtual Machine Manager and check connection details.
FIGURE 27.2 Open the virtual machine and begin using it.
FIGURE 27.3 Choose which hypervisor to migrate the VM to.
Chapter 28
FIGURE 28.1 Cloning lets you save a permanent copy of a cloud instance.
FIGURE 28.2 Log in to the OpenStack Dashboard.
FIGURE 28.3 View your network topology from the OpenStack Dashboard.
FIGURE 28.4 Launch cloud instances using the Amazon EC2 Management Console....
FIGURE 28.5 Configure and launch a RHEL 8 instance on AWS.
Chapter 30
FIGURE 30.1 Step through the Kubernetes project tutorials
FIGURE 30.2 OpenShift features an intuitive web UI for deploying and managin...
Appendix A
FIGURE A.1 Download Fedora ISO images from the Get Fedora page.
FIGURE A.2 Download Ubuntu Live ISO images, or choose an alternative downloa...
FIGURE A.3 Use K3b to burn your Linux CDs or DVDs.
Cover
Table of Contents
Begin Reading
iii
xxxv
xxxvi
xxxvii
xxxviii
xxxix
xl
1
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
691
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
787
788
789
790
791
792
793
794
795
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
iv
v
vii
ix
xi
888
Tenth Edition
Christopher Negus
You can't learn Linux without using it.
I've come to that conclusion after more than two decades of teaching people how to use Linux. You can't just read a book; you can't just listen to a lecture. You need someone to guide you, and you need to jump in and do it yourself.
In 1999, I wrote my first Linux book, the Red Hat Linux Bible. The book's huge success gave me the opportunity to become a full-time, independent Linux author. For about a decade, I wrote dozens of Linux books and explored the best ways to explain Linux from the quiet of my small home office.
In 2008, I hit the road. I was hired by Red Hat, Inc., as a full-time instructor, teaching Linux to professional system administrators seeking Red Hat Certified Engineer (RHCE) certification. In my three years as a Linux instructor, I honed my teaching skills in front of a live audience whose Linux experience ranged from none to experienced professionals. Over time, I was able to broaden my own knowledge of Linux by acquiring about 10 certifications, including the Red Hat Certified Architect (RHCA) certification.
In the previous edition of the Linux Bible, I turned my teaching experience into text to take a reader from someone who has never used Linux to someone with the foundational skills to become a Linux professional. The skills that you could acquire from that edition remain in effect in this edition as well. They include the following:
Beginner to certified professional
: As long as you have used a computer, mouse, and keyboard, you can start with this book. I tell you how to get Linux, begin using it, step through critical topics, and ultimately excel at administering and securing it.
System administrator focused
: When you are finished with this book, you will know how to use Linux and how to modify and maintain it. Almost all of the topics needed to become a Red Hat Certified Engineer are introduced in this book. That said, many software developers have also used this book to understand how to work on a Linux system as a development platform or target for their applications.
Emphasis on command-line tools
: Although point-and-click windows for managing Linux have improved greatly in recent years, many advanced features can only be utilized by entering commands and editing configuration files manually. I teach you how to become proficient with the Linux command-line shell, and I occasionally compare shell features with graphical tools for accomplishing the same tasks.
Aimed at fewer Linux distributions
: In past editions, I described about 18 different Linux distributions. With only a few notable exceptions, most popular Linux distributions are either Red Hat based (Red Hat Enterprise Linux, Fedora, CentOS, and so on) or Debian based (Ubuntu, Linux Mint, KNOPPIX, and so forth). Although this book most thoroughly covers Red Hat distributions, I increased the coverage of Ubuntu throughout the book, because that's where many of the biggest Linux fans begin.
Many, many demos and exercises
: Instead of just telling you what Linux does, I actually show you what it does. Then, to make sure that you got it, you have the opportunity to try Linux exercises yourself. Every procedure and exercise has been tested to work in Fedora or Red Hat Enterprise Linux. Most work in Ubuntu as well.
For this 10th edition, major enhancements include a focus on simplified Linux administration, automating tasks, and managing containerized applications (individually or at scale):
Cockpit administration web UI
: Since Linux was created, people have tried to develop simple graphical or browser-based interfaces for managing Linux systems. I believe that Cockpit is the best web UI ever created for managing most basic Linux features. Throughout this book, I have replaced most older system-config* tool descriptions with those focusing on Cockpit. With Cockpit, you can now add users, manage storage, monitor activities, and do many other administrative tasks through a single interface.
Lead into cloud technologies
: After introducing cloud technologies in the previous edition, I've expanded on that coverage here. This coverage includes setting up your own Linux host for running virtual machines and running Linux in a cloud environment, such as Amazon Web Services. Linux is at the heart of most technological advances in cloud computing today. That means you need a solid understanding of Linux to work effectively in tomorrow's data centers. I help you learn Linux basics in the front of this book. Then in the last few chapters, I demonstrate how you can try out Linux systems as hypervisors, cloud controllers, and virtual machines as well as manage virtual networks and networked storage.
Ansible
: Automating tasks for managing systems is becoming more and more essential in modern data centers. Using Ansible, you can create playbooks that define the state of a Linux system. This includes things like setting which packages are installed, which services are running, and how features are configured. A playbook can configure one system or a thousand systems, be combined to form a set of system services, and be run again to return a system to a defined state. In this edition, I introduce you to Ansible, help you create your first Ansible playbook, and show you how to run ad-hoc Ansible commands.
Containers
: Packaging and running applications in containers is becoming the preferred method for deploying, managing, and updating small, scalable software services and features. I describe how to pull containers to your system, run them, stop them, and even build your own container images using
podman
and
docker
commands.
Kubernetes and OpenShift
: While containers are nice on their own, to be able to deploy, manage, and upgrade containers in a large enterprise, you need an orchestration platform. The Kubernetes project provides that platform. For a commercial, supported Kubernetes platform, you can use a product such as OpenShift.
The book is organized to enable you to start off at the very beginning with Linux and grow to become a professional Linux system administrator and power user.
Part I, “Getting Started,” includes two chapters designed to help you understand what Linux is and get you started with a Linux desktop:
Chapter 1
, “Starting with Linux,” covers topics such as what the Linux operating system is, where it comes from, and how to get started using it.
Chapter 2
, “Creating the Perfect Linux Desktop,” provides information on how you can create a desktop system and use some of the most popular desktop features.
Part II, “Becoming a Linux Power User,” provides in-depth details on how to use the Linux shell, work with filesystems, manipulate text files, manage processes, and use shell scripts:
Chapter 3
, “Using the Shell,” includes information on how to access a shell, run commands, recall commands (using history), and do tab completion. The chapter also describes how to use variables, aliases, and man pages (traditional Linux command reference pages).
Chapter 4
, “Moving Around the Filesystem,” includes commands for listing, creating, copying, and moving files and directories. More advanced topics in this chapter include filesystem security, such as file ownership, permissions, and access control lists.
Chapter 5
, “Working with Text Files,” includes everything from basic text editors to tools for finding files and searching for text within files.
Chapter 6
, “Managing Running Processes,” describes how to see what processes are running on your system and change them. Ways of changing processes include killing, pausing, and sending other types of signals.
Chapter 7
, “Writing Simple Shell Scripts,” includes shell commands and functions that you can gather together into a file to run as a command itself.
In Part III, “Becoming a Linux System Administrator,” you learn how to administer Linux systems:
Chapter 8
, “Learning System Administration,” provides information on basic graphical tools, commands, and configuration files for administering Linux systems. It introduces the Cockpit web UI for simplified, centralized Linux administration.
Chapter 9
, “Installing Linux,” covers common installation tasks, such as disk partitioning and initial software package selection, as well as more advanced installation tools, such as installing from kickstart files.
Chapter 10
, “Getting and Managing Software,” provides an understanding of how software packages work and how to get and manage software packages.
Chapter 11
, “Managing User Accounts,” discusses tools for adding and deleting users and groups as well as how to centralize user account management.
Chapter 12
, “Managing Disks and Filesystems,” provides information on adding partitions, creating filesystems, and mounting filesystems, as well as working with logical volume management.
In Part IV, “Becoming a Linux Server Administrator,” you learn to create powerful network servers and the tools needed to manage them:
Chapter 13
, “Understanding Server Administration,” covers remote logging, monitoring tools, and the Linux boot process.
Chapter 14
, “Administering Networking” discusses how to configure networking.
Chapter 15
, “Starting and Stopping Services,” provides information on starting and stopping services.
Chapter 16
, “Configuring a Print Server,” describes how to configure printers to use locally on your Linux system or over the network from other computers.
Chapter 17
, “Configuring a Web Server,” describes how to configure an Apache web server.
Chapter 18
, “Configuring an FTP Server,” covers procedures for setting up a vsftpd FTP server that can be used to enable others to download files from your Linux system over the network.
Chapter 19
, “Configuring a Windows File Sharing (Samba) Server,” covers Windows file server configuration with Samba.
Chapter 20
, “Configuring an NFS File Server,” describes how to use Network File System features to share folders of files among systems over a network.
Chapter 21
, “Troubleshooting Linux,” covers popular tools for troubleshooting your Linux system.
In Part V, “Learning Linux Security Techniques,” you learn how to secure your Linux systems and services:
Chapter 22
, “Understanding Basic Linux Security,” covers basic security concepts and techniques.
Chapter 23
, “Understanding Advanced Linux Security,” provides information on using Pluggable Authentication Modules (PAM) and cryptology tools to tighten system security and authentication.
Chapter 24
, “Enhancing Linux Security with SELinux,” shows you how to enable Security Enhanced Linux (SELinux) to secure system services.
Chapter 25
, “Securing Linux on a Network,” covers network security features, such as
firewalld
and
iptables
firewalls, to secure system services.
In Part VI,” Engaging with Cloud Computing” the book pivots from a single-system focus toward containerization, cloud computing, and automation:
Chapter 26
, “Shifting to Clouds and Containers,” describes how to pull, push, start, stop, tag, and build container images.
Chapter 27
, “Using Linux for Cloud Computing,” introduces concepts of cloud computing in Linux by describing how to set up hypervisors, build virtual machines, and share resources across networks.
Chapter 28
, “Deploying Linux to the Cloud,” describes how to deploy Linux images to different cloud environments, including OpenStack, Amazon EC2, or a local Linux system that is configured for virtualization.
Chapter 29
, “Automating Apps and Infrastructure with Ansible,” tells you how to create Ansible playbooks and run ad-hoc Ansible commands to automate the configuration of Linux systems and other devices.
Chapter 30
, “Deploying Applications as Containers with Kubernetes,” describes the Kubernetes project and how it is used to orchestrate container images, with the potential to massively scale up for large data centers.
Part VII contains two appendixes to help you get the most from your exploration of Linux. Appendix A, “Media,” provides guidance on downloading Linux distributions. Appendix B, “Exercise Answers,” provides sample solutions to the exercises included in Chapters 2 through 30.
Throughout the book, special typography indicates code and commands. Commands and code are shown in a monospaced font:
This is how code looks.
In the event that an example includes both input and output, the monospaced font is still used, but input is presented in bold type to distinguish the two. Here's an example:
$
ftp ftp.handsonhistory.com
Name (home:jake):
jake
Password:
******
As for styles in the text:
New terms and important words appear in
italic
when introduced.
Keyboard strokes appear like this: Ctrl+A. This convention indicates to hold the Ctrl key as you also press the "a" key.
Filenames, URLs, and code within the text appear as follows:
persistence.properties
.
The following items call your attention to points that are particularly important.
A Note box provides extra information to which you need to pay special attention.
A Tip box shows a special way of performing a particular task.
A Caution box alerts you to take special care when executing a procedure or damage to your computer hardware or software could result.
If you are new to Linux, you might have vague ideas about what it is and where it came from. You may have heard something about it being free (as in cost) or free (as in freedom to use it as you please). Before you start putting your hands on Linux (which we will do soon enough), Chapter 1 seeks to answer some of your questions about the origins and features of Linux.
Take your time and work through this book to get up to speed on Linux and how you can make it work to meet your needs. This is your invitation to jump in and take the first step toward becoming a Linux expert!
To find links to various Linux distributions, tips on gaining Linux certification, and corrections to the book as they become available, go to www.wiley.com/go/linuxbible10e.
You can contact Christopher Negus at [email protected].
If you believe you have found an error in this book, and it is not listed on the book's page at www.wiley.com, you can report the issue to our customer technical support team at support.wiley.com.
Chapter 1
Starting with Linux
Chapter 2
Creating the Perfect Linux Desktop
Learning what Linux is
Learning where Linux came from
Choosing Linux distributions
Exploring professional opportunities with Linux
Becoming certified in Linux
The operating systems war is over, and Linux has won. Proprietary operating systems simply cannot keep up with the pace of improvements and quality that Linux can achieve with its culture of sharing and innovation. Even Microsoft, whose former CEO Steve Ballmer once referred to Linux as “a cancer,” now says that Linux's use on its Microsoft's Azure cloud computing service has surpassed the use of Windows.
Linux is one of the most important technological advancements of the twenty-first century. Beyond its impact on the growth of the Internet and its place as an enabling technology for a range of computer-driven devices, Linux development has become a model for how collaborative projects can surpass what single individuals and companies can do alone.
Google runs thousands upon thousands of Linux servers to power its search technology. Its Android phones are based on Linux. Likewise, when you download and run Google's Chrome OS, you get a browser that is backed by a Linux operating system.
Facebook builds and deploys its site using what is referred to as a LAMP stack (Linux, Apache web server, MySQL database, and PHP web scripting language)—all open source projects. In fact, Facebook itself uses an open source development model, making source code for the applications and tools that drive Facebook available to the public. This model has helped Facebook shake out bugs quickly, get contributions from around the world, and fuel its exponential growth.
Financial organizations that have trillions of dollars riding on the speed and security of their operating systems also rely heavily on Linux. These include the New York Stock Exchange, Chicago Mercantile Exchange, and the Tokyo Stock Exchange.
As cloud continues to be one of the hottest buzzwords today, a part of the cloud groundswell that isn't hype is that Linux and other open source technologies continue to be the foundation on which today's greatest cloud innovations are being built. Every software component that you need to build a private or public cloud (such as hypervisors, cloud controllers, network storage, virtual networking, and authentication) is freely available for you to start using from the open source world.
The widespread adoption of Linux around the world has created huge demand for Linux expertise. This chapter starts you down a path to becoming a Linux expert by helping you understand what Linux is, where it came from, and what your opportunities are for becoming proficient in it.
The rest of this book provides you with hands-on activities to help you gain that expertise. Finally, I show you how to apply that expertise to cloud technologies, including automation tools, such as Ansible, and containerization orchestration technologies, such as Kubernetes and OpenShift.
Linux is a computer operating system. An operating system consists of the software that manages your computer and lets you run applications on it. The features that make up Linux and similar computer operating systems include the following:
Detecting and preparing hardware
: When the Linux system boots up (when you turn on your computer), it looks at the components on your computer (CPU, hard drive, network cards, and so on) and loads the software (drivers and modules) needed to access those particular hardware devices.
Managing processes
: The operating system must keep track of multiple processes running at the same time and decide which have access to the CPU and when. The system also must offer ways of starting, stopping, and changing the status of processes.
Managing memory
: RAM and swap space (extended memory) must be allocated to applications as they need memory. The operating system decides how requests for memory are handled.
Providing user interfaces
: An operating system must provide ways of accessing the system. The first Linux systems were accessed from a command-line interpreter called a
shell
. Today, graphical desktop interfaces are commonly available as well.
Controlling filesystems
: Filesystem structures are built into the operating system (or loaded as modules). The operating system controls ownership and access to the files and directories (folders) that the filesystems contain.
Providing user access and authentication
: Creating user accounts and allowing boundaries to be set between users is a basic feature of Linux. Separate user and group accounts enable users to control their own files and processes.
Offering administrative utilities
: In Linux, hundreds (perhaps thousands) of commands and graphical windows are available to do such things as add users, manage disks, monitor the network, install software, and generally secure and manage your computer. Web UI tools, such as Cockpit, have lowered the bar for doing complex administrative tasks.
Starting up services
: To use printers, handle log messages, and provide a variety of system and network services, processes called
daemon processes
run in the background, waiting for requests to come in. Many types of services run in Linux. Linux provides different ways of starting and stopping these services. In other words, while Linux includes web browsers to view web pages, it can also be the computer that serves up web pages to others. Popular server features include web, mail, database, printer, file, DNS, and DHCP servers.
Programming tools
: A wide variety of programming utilities for creating applications and libraries for implementing specialty interfaces are available with Linux.
As someone managing Linux systems, you need to learn how to work with those features just described. While many features can be managed using graphical interfaces, an understanding of the shell command line is critical for someone administering Linux systems.
Modern Linux systems now go way beyond what the first UNIX systems (on which Linux was based) could do. Advanced features in Linux, often used in large enterprises, include the following:
Clustering
: Linux can be configured to work in clusters so that multiple systems can appear as one system to the outside world. Services can be configured to pass back and forth between cluster nodes while appearing to those using the services that they are running without interruption.
Virtualization
: To manage computing resources more efficiently, Linux can run as a virtualization host. On that host, you could run other Linux systems, Microsoft Windows, BSD, or other operating systems as virtual guests. To the outside world, each of those virtual guests appears as a separate computer. KVM and Xen are two technologies in Linux for creating virtual hosts.
Cloud computing
: To manage large-scale virtualization environments, you can use full-blown cloud computing platforms based on Linux. Projects such as OpenStack and Red Hat Virtualization (and its upstream oVirt project) can simultaneously manage many virtualization hosts, virtual networks, user and system authentication, virtual guests, and networked storage. Projects such as Kubernetes can manage containerized applications across massive data centers.
Real-time computing
: Linux can be configured for real-time computing, where high-priority processes can expect fast, predictable attention.
Specialized storage
: Instead of just storing data on the computer's hard disk, you can store it on many specialized local and networked storage interfaces that are available in Linux. Shared storage devices available in Linux include iSCSI, Fibre Channel, and Infiniband. Entire open source storage platforms include projects such as Ceph (
https://ceph.io
) and GlusterFS (
https://www.gluster.org
).
Some of these advanced topics are not covered in this book. However, the features covered here for using the shell, working with disks, starting and stopping services, and configuring a variety of servers should serve as a foundation for working with those advanced features.
If you are new to Linux, chances are good that you have used a Microsoft Windows or MacOS operating system. Although MacOS had its roots in a free software operating system, referred to as the Berkeley Software Distribution (more on that later), operating systems from both Microsoft and Apple are considered proprietary operating systems. What that means is the following:
You cannot see the code used to create the operating system, and therefore, you cannot change the operating system at its most basic levels if it doesn't suit your needs, and you can't use the operating system to build your own operating system from source code.
You cannot check the code to find bugs, explore security vulnerabilities, or simply learn what that code is doing.
You may not be able to plug your own software easily into the operating system if the creators of that system don't want to expose the programming interfaces you need to the outside world.
You might look at those statements about proprietary software and say, “What do I care? I'm not a software developer. I don't want to see or change how my operating system is built.”
That may be true. However, the fact that others can take free and open source software and use it as they please has driven the explosive growth of the Internet (think Google), mobile phones (think Android), special computing devices (think TiVo), and hundreds of technology companies. Free software has driven down computing costs and allowed for an explosion of innovation.
Maybe you don't want to use Linux—as Google, Facebook, and other companies have done—to build the foundation for a multi-billion-dollar company. Nonetheless, those companies and others who now rely on Linux to drive their computer infrastructures need more and more people with the skills to run those systems.
You may wonder how a computer system that is so powerful and flexible has come to be free as well. To understand how that could be, you need to see where Linux came from. Thus the next sections of this chapter describe the strange and winding path of the free software movement that led to Linux.
Some histories of Linux begin with the following message entitled “What would you like to see most in minix?” posted by Linus Torvalds to the comp.os.minix newsgroup on August 25, 1991, at
https://groups.google.com/forum/#!msg/comp.os.minix/dlNtH7RRrGA/SwRavCzVE7gJ
Linus Benedict Torvalds
Hello everybody out there using minix -
I'm doing a (free) operating system (just a hobby, won't be big and professional like gnu) for 386(486) AT clones. This has been brewing since april, and is starting to get ready. I'd like any feedback on things people like/dislike in minix, as my OS resembles it somewhat (same physical layout of the file-system (due to practical reasons, among other things)…Any suggestions are welcome, but I won't promise I'll implement them :-)
Linus ([email protected])
PS. Yes — it's free of any minix code, and it has a multi-threaded fs. It is NOT protable[sic] (uses 386 task switching etc), and it probably never will support anything other than AT-harddisks, as that's all I have :-(.
Minix was a UNIX-like operating system that ran on PCs in the early 1990s. Like Minix, Linux was also a clone of the UNIX operating system. With few exceptions, such as Microsoft Windows, most modern computer systems (including MacOS and Linux itself) were derived from UNIX operating systems, created originally by AT&T.
To truly appreciate how a free operating system could have been modeled after a proprietary system from AT&T Bell Laboratories, it helps to understand the culture in which UNIX was created and the chain of events that made the essence of UNIX possible to reproduce freely.
To learn more about how Linux was created, pick up the book Just for Fun: The Story of an Accidental Revolutionary by Linus Torvalds (Harper Collins Publishing, 2001).
From the very beginning, the UNIX operating system was created and nurtured in a communal environment. Its creation was not driven by market needs but by a desire to overcome impediments to producing programs. AT&T, which owned the UNIX trademark originally, eventually made UNIX into a commercial product. By that time, however, many of the concepts (and even much of the early code) that made UNIX special had fallen into the public domain.
If you are not old enough to remember when AT&T split up in 1984, you may not remember a time when AT&T was the phone company. Up until the early 1980s, AT&T didn't have to think much about competition because if you wanted a phone in the United States, you had to go to AT&T. It had the luxury of funding pure research projects. The mecca for such projects was the Bell Laboratories site in Murray Hill, New Jersey.
After a project called Multics failed around 1969, Bell Labs employees Ken Thompson and Dennis Ritchie set off on their own to create an operating system that would offer an improved environment for developing software. Up to that time, most programs were written on paper punch cards that had to be fed in batches to mainframe computers. In a 1980 lecture on “The Evolution of the UNIX Time-sharing System,” Dennis Ritchie summed up the spirit that started UNIX:
What we wanted to preserve was not just a good environment in which to do programming, but a system around which a fellowship could form. We knew from experience that the essence of communal computing as supplied by remote-access, time-shared machines is not just to type programs into a terminal instead of a keypunch, but to encourage close communication.
The simplicity and power of the UNIX design began breaking down barriers that, until this point, had impeded software developers. The foundation of UNIX was set with several key elements:
The UNIX filesystem
: Because it included a structure that allowed levels of subdirectories (which, for today's desktop users, look like folders inside of folders), UNIX could be used to organize the files and directories in intuitive ways. Furthermore, complex methods of accessing disks, tapes, and other devices were greatly simplified by representing those devices as individual device files that you could also access as items in a directory.
Input/output redirection
: Early UNIX systems also included input redirection and pipes. From a command line, UNIX users could direct the output of a command to a file using a right-arrow key (
>
). Later, the concept of pipes (
|
) was added where the output of one command could be directed to the input of another command. For example, the following command line concatenates (
cat
) file1 and file2, sorts (
sort
) the lines in those files alphabetically, paginates the sorted text for printing (
pr
), and directs the output to the computer's default printer (
lpr
):
$ cat file1 file2 | sort | pr | lpr
This method of directing input and output enabled developers to create their own specialized utilities that could be joined with existing utilities. This modularity made it possible for lots of code to be developed by lots of different people. A user could just put together the pieces they needed.
Portability
: Simplifying the experience of using UNIX also led to it becoming extraordinarily portable to run on different computer hardware. By having device drivers (represented by files in the filesystem tree), UNIX could present an interface to applications in such a way that the programs didn't have to know about the details of the underlying hardware. To port UNIX later to another system, developers had only to change the drivers. The application programs didn't have to change for different hardware!
To make portability a reality, however, a high-level programming language was needed to implement the software needed. To that end, Brian Kernighan and Dennis Ritchie created the C programming language. In 1973, UNIX was rewritten in C. Today, C is still the primary language used to create the UNIX (and Linux) operating system kernels.
As Ritchie went on to say in a 1979 lecture (https://www.bell-labs.com/usr/dmr/www/hist.html):
Today, the only important UNIX program still written in assembler is the assembler itself; virtually all the utility programs are in C, and so are most of the application's programs, although there are sites with many in Fortran, Pascal, and Algol 68 as well. It seems certain that much of the success of UNIX follows from the readability, modifiability, and portability of its software that in turn follows from its expression in high-level languages.
If you are a Linux enthusiast and are interested in what features from the early days of Linux have survived, an interesting read is Dennis Ritchie's reprint of the first UNIX programmer's manual (dated November 3, 1971). You can find it at Dennis Ritchie's website: https://www.bell-labs.com/usr/dmr/www/1stEdman.html. The form of this documentation is UNIX man pages, which is still the primary format for documenting UNIX and Linux operating system commands and programming tools today.
What's clear as you read through the early documentation and accounts of the UNIX system is that the development was a free-flowing process, lacked ego, and was dedicated to making UNIX excellent. This process led to a sharing of code (both inside and outside of Bell Labs), which allowed rapid development of a high-quality UNIX operating system. It also led to an operating system that AT&T would find difficult to reel back in later.
Before the AT&T divestiture in 1984, when it was split up into AT&T and seven “Baby Bell” companies, AT&T was forbidden to sell computer systems. Companies that would later become Verizon, Qwest, Nokia, and Alcatel-Lucent were all part of AT&T. As a result of AT&T's monopoly of the telephone system, the US government was concerned that an unrestricted AT&T might dominate the fledgling computer industry.
Because AT&T was restricted from selling computers directly to customers before its divestiture, UNIX source code was licensed to universities for a nominal fee. This allowed UNIX installations to grow in size and mindshare among top universities. However, there was still no UNIX operating system for sale from AT&T that you didn't have to compile yourself.
In 1975, UNIX V6 became the first version of UNIX available for widespread use outside of Bell Laboratories. From this early UNIX source code, the first major variant of UNIX was created at University of California, Berkeley. It was named the Berkeley Software Distribution (BSD).
For most of the next decade, the BSD and Bell Labs versions of UNIX headed off in separate directions. BSD continued forward in the free-flowing, share-the-code manner that was the hallmark of the early Bell Labs UNIX, whereas AT&T started steering UNIX toward commercialization. With the formation of a separate UNIX Laboratory, which moved out of Murray Hill and down the road to Summit, New Jersey, AT&T began its attempts to commercialize UNIX. By 1984, divestiture was behind AT&T and it was really ready to start selling UNIX.
The UNIX Laboratory was considered a jewel that couldn't quite find a home or a way to make a profit. As it moved between Bell Laboratories and other areas of AT&T, its name changed several times. It is probably best remembered by the name it had as it began its spin-off from AT&T: UNIX System Laboratories (USL).
The UNIX source code that came out of USL, the legacy of which was sold in part to Santa Cruz Operation (SCO), was used for a time as the basis for ever-dwindling lawsuits by SCO against major Linux vendors (such as IBM and Red Hat, Inc.). Because of that, I think the efforts from USL that have contributed to the success of Linux are lost on most people.