Mastering Linux System Administration - Christine Bresnahan - E-Book

Mastering Linux System Administration E-Book

Christine Bresnahan

0,0
32,99 €

-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.

Mehr erfahren.
Beschreibung

Achieve Linux system administration mastery with time-tested and proven techniques In Mastering Linux System Administration, Linux experts and system administrators Christine Bresnahan and Richard Blum deliver a comprehensive roadmap to go from Linux beginner to expert Linux system administrator with a learning-by-doing approach. Organized by do-it-yourself tasks, the book includes instructor materials like a sample syllabus, additional review questions, and slide decks. Amongst the practical applications of the Linux operating system included within, you'll find detailed and easy-to-follow instruction on: * Installing Linux servers, understanding the boot and initialization processes, managing hardware, and working with networks * Accessing the Linux command line, working with the virtual directory structure, and creating shell scripts to automate administrative tasks * Managing Linux user accounts, system security, web and database servers, and virtualization environments Perfect for entry-level Linux system administrators, as well as system administrators familiar with Windows, Mac, NetWare, or other UNIX systems, Mastering Linux System Administration is a must-read guide to manage and secure Linux servers.

Sie lesen das E-Book in den Legimi-Apps auf:

Android
iOS
von Legimi
zertifizierten E-Readern

Seitenzahl: 912

Veröffentlichungsjahr: 2021

Bewertungen
0,0
0
0
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



Table of Contents

Cover

Title Page

Copyright

Acknowledgments

About the Authors

About the Technical Editor

Introduction

Who Should Read This Book

The Mastering Series

How to Contact Wiley or the Authors

Part 1: Basic Admin Functions

Chapter 1: Understanding the Basics

What Is Linux?

Linux Distributions

The Bottom Line

Chapter 2: Installing an Ubuntu Server

Pre‐Installation Requirements

Finding the Software

Running the Installation

Checking the Installation

The Bottom Line

Chapter 3: Installing and Maintaining Software in Ubuntu

Exploring Package Management

Inspecting the Debian‐Based Systems

Using Snap Containers

Installing from Source Code

The Bottom Line

Chapter 4: Installing a Red Hat Server

Pre‐Installation Requirements

Finding the Software

Running the Installation

Checking the Installation

The Bottom Line

Chapter 5: Installing and Maintaining Software in Red Hat

Exploring Red Hat Packages

Automated Package Management

Working Directly with Packages

Using Flatpak Containers

The Bottom Line

Chapter 6: Working with the Shell

Exploring the Shell

Working with Commands

Environment Variables

The Bottom Line

Chapter 7: Exploring Linux File Management

Filesystem Navigation

Linux Files

File and Directory Listing

Directory Handling

File Handling

File Features

Finding Files

Archiving Files

The Bottom Line

Chapter 8: Working with Text Files

The

vim

Editor

The

nano

Editor

Working with Data Files

The Bottom Line

Part 2: Intermediate Admin Functions

Chapter 9: Managing Hardware

Device Driver Modules

Communicating with Devices

Working with Devices

Using Hot Pluggable Devices

The Bottom Line

Chapter 10: Booting Linux

Understanding the Boot Process

The GRUB2 Bootloader

Configuring the GRUB2 Bootloader

The systemd Initialization Process

The Bottom Line

Chapter 11: Working with Storage Devices

Storage Basics

Partitioning Tools

Formatting Filesystems

Mounting Filesystems

Managing Filesystems

Storage Alternatives

The Bottom Line

Chapter 12: Configuring Network Settings

Network Settings

Using Network Command‐Line Tools

Basic Network Troubleshooting

Advanced Network Troubleshooting

The Bottom Line

Chapter 13: Managing Users and Groups

Understanding Linux Permissions

Using Access Control Lists

Managing User Accounts

Maintaining the Environment

Managing Groups

The Bottom Line

Chapter 14: Working with Processes and Jobs

Looking at Processes

Monitoring Processes in Real Time

Managing Processes

Running Programs in Background Mode

Running Programs Without a Console

Job Control

Scheduling Jobs

The Bottom Line

Chapter 15: Managing Log Files

The systemd Journaling System

The rsyslog Legacy System

The Bottom Line

Chapter 16: Managing Printers

The Common Unix Printing System

Installing and Configuring CUPS

Using CUPS

The Bottom Line

Part 3: Advanced Admin Functions

Chapter 17: Exploring Ubuntu Security

Locking Down Root

Using OpenSSH on Ubuntu

The AppArmor System

Network Security Using Firewalls

The Bottom Line

Chapter 18: Exploring Red Hat Security

Working with Root Access

Using SELinux

Network Security Using Firewalls

The Bottom Line

Chapter 19: Writing Scripts

Beginning a Shell Script

Using Variables

Adding Conditional Expressions

Using Loops

Using Functions

The Bottom Line

Chapter 20: Managing Web Servers

Linux Web Servers

The Apache Web Server

The nginx Server

The Bottom Line

Chapter 21: Managing Database Servers

Linux Database Servers

Installing and Using MySQL/MariaDB

Installing and Using PostgreSQL

The Bottom Line

Chapter 22: Exploring the Virtualization Environment

Hypervisors

Containers

Software Packaging

The Bottom Line

Appendix: The Bottom Line

Chapter 1: Understanding the Basics

Chapter 2: Installing an Ubuntu Server

Chapter 3: Installing and Maintaining Software in Ubuntu

Chapter 4: Installing a Red Hat Server

Chapter 5: Installing and Maintaining Software in Red Hat

Chapter 6: Working with the Shell

Chapter 7: Exploring Linux File Management

Chapter 8: Working with Text Files

Chapter 9: Managing Hardware

Chapter 10: Booting Linux

Chapter 11: Working with Storage Devices

Chapter 12: Configuring Network Settings

Chapter 13: Managing Users and Groups

Chapter 14: Working with Processes and Jobs

Chapter 15: Managing Log Files

Chapter 16: Managing Printers

Chapter 17: Exploring Ubuntu Security

Chapter 18: Exploring Red Hat Security

Chapter 19: Writing Scripts

Chapter 20: Managing Web Servers

Chapter 21: Managing Database Servers

Chapter 22: Exploring the Virtualization Environment

Index

End User License Agreement

List of Tables

Chapter 1

TABLE 1.1: The SysVinit Runlevels

TABLE 1.2: Linux Filesystems

TABLE 1.3: Other Linux Graphical Desktops

TABLE 1.4: Linux Shells

TABLE 1.5: Core Linux Distributions

TABLE 1.6: Specialized Linux Distributions

Chapter 2

TABLE 2.1: Recommended Server Resources for Ubuntu Server Distribution

TABLE 2.2: Recommended Host Machine Resources for an Ubuntu Server VM

Chapter 4

TABLE 4.1: Recommended Server Resources for CentOS Distribution

TABLE 4.2: Recommended Host Machine Resources for a CentOS VM

Chapter 5

TABLE 5.1: The

rpm

Command Actions

TABLE 5.2: The

rpm

Command Query Action Options

Chapter 6

TABLE 6.1: The Linux Man Page Conventional Section Names

TABLE 6.2: The Linux Man Page Section Areas

TABLE 6.3: A Few

history

Command Options

TABLE 6.4: Linux Standard File Descriptors

TABLE 6.5: A Few Common Default Linux Global Environment Variables

Chapter 7

TABLE 7.1: Common Linux Directory Names

TABLE 7.2: Some Popular

ls

Command Parameters

TABLE 7.3: The

cp

Command Parameters

TABLE 7.4: Useful

find

Command Options

TABLE 7.5: Linux File Compression Utilities

TABLE 7.6: The

tar

Command Functions

TABLE 7.7: The

tar

Command Options

Chapter 8

TABLE 8.1: Commonly Used

vim

Command Mode Moving Commands

TABLE 8.2: Commonly Used

vim

Ex Mode Commands

TABLE 8.3:

nano

Common Control Commands

TABLE 8.4: Commonly Used

sort

Command Options

TABLE 8.5: The

locate

Command's Commonly Used Options

TABLE 8.6: The

find

Command's Commonly Used Options and Expressions

TABLE 8.7: The

grep

Command's Commonly Used Options

TABLE 8.8: The

tar

Command's Commonly Used Archive Creation Options

TABLE 8.9: The

tar

Command's Commonly Used Archive Verification Options

TABLE 8.10: The

tar

Command's Commonly Used File Restore Options

Chapter 9

TABLE 9.1: The

modprobe

Command Options

TABLE 9.2: The

lspci

Command‐Line Options

TABLE 9.3: The

lsusb

Command Options

TABLE 9.4: The

udevadm

Commands

Chapter 10

TABLE 10.1: Commonly Defined

/etc/default/grub

Keys

TABLE 10.2: Commonly Used System Boot Target Unit Files

TABLE 10.3: Commonly Used Service Unit File

[Unit]

Section Directives

TABLE 10.4: Commonly Used Service Unit File

[Service]

Section Directives

TABLE 10.5: Commonly Used Service Unit File

[Install]

Section Directives

TABLE 10.6: Commonly Used

systemctl

Service Management Commands

TABLE 10.7: Convenient

systemctl

Service Status Commands

TABLE 10.8: Operational Statuses Provided by

systemctl is‐system‐running

...

TABLE 10.9: Common

systemd‐analyze

Commands

Chapter 11

TABLE 11.1: Common

fdisk

Commands

TABLE 11.2: Common

gdisk

Commands

TABLE 11.3: The

parted

Commands

TABLE 11.4: Linux Filesystem Stats Commands

TABLE 11.5: Popular

e2fsprogs

Programs

Chapter 12

TABLE 12.1: The

ip

Utility Command Options

TABLE 12.2: Network Interface Bonding Modes

Chapter 13

TABLE 13.1: Octal Mode Permissions

TABLE 13.2: Results from Common

umask

Values for Files and Directories

TABLE 13.3: A Few Vital

/etc/login.defs

Directives

TABLE 13.4: A Few Vital

/etc/default/useradd

Directives

TABLE 13.5: The

/etc/passwd

File's Record Fields

TABLE 13.6: The

/etc/shadow

File's Record Fields

TABLE 13.7: The

useradd

Command's Commonly Used Options

TABLE 13.8: The

passwd

Command's Commonly Used Options

TABLE 13.9: The

usermod

Command's Commonly Used Options

Chapter 14

TABLE 14.1: The

top

Interactive Commands

TABLE 14.2: Linux Process Signals

TABLE 14.3: The

jobs

Command Parameters

Chapter 15

TABLE 15.1: The

journald.conf

File Commonly Modified Directives

TABLE 15.2: The

journalctl

Utility's Commonly Used Options

TABLE 15.3: The Common

journalctl

MATCHES

Parameters Used for Filtering

TABLE 15.4: The syslog Protocol Facility Values

TABLE 15.5: The syslog Protocol Severity Values

Chapter 17

TABLE 17.1: Primary OpenSSH Configuration Files

TABLE 17.2: The

ufw

Commands to Control State and View Status

TABLE 17.3: The

ufw

Command's Commonly Used Arguments

TABLE 17.4: The

ufw

Command's Full Syntax Common Settings

Chapter 18

TABLE 18.1: The Default

firewalld

Zones

Chapter 19

TABLE 19.1: Condition Tests

Chapter 20

TABLE 20.1: The

apache2ctl

Utility Commands

TABLE 20.2: Common Apache Configuration Directives

Chapter 21

TABLE 21.1: RDBMS Data Types

TABLE 21.2: A Few Basic SQL Commands

TABLE 21.3: A Few PostgreSQL Role Access Settings

Chapter 22

TABLE 22.1: Basic

snap

Subcommands

TABLE 22.2: Basic

flatpak

Subcommands

List of Illustrations

Chapter 1

FIGURE 1.1 The Linux system

FIGURE 1.2 The Linux system memory map

FIGURE 1.3 The KDE Plasma desktop on an openSUSE Linux system

FIGURE 1.4 A GNOME 3 desktop on an Ubuntu Linux system

FIGURE 1.5 The Cinnamon desktop from Linux Mint

FIGURE 1.6 The Xfce desktop as seen in the MX Linux distribution

Chapter 2

FIGURE 2.1 Option to choose an Ubuntu Server ISO image file download

Chapter 3

FIGURE 3.1 Upgrading Ubuntu using

apt

Chapter 4

FIGURE 4.1 Option to choose to access the appropriate CentOS ISO image file ...

FIGURE 4.2 Option to choose for CentOS ISO image file download

Chapter 6

FIGURE 6.1 Text mode virtual console login screen

FIGURE 6.2 Manual pages for the

apt

command

FIGURE 6.3 Manual pages for the

uname

command

Chapter 7

FIGURE 7.1 The Linux file structure

Chapter 8

FIGURE 8.1 Using the

vim

text editor

FIGURE 8.2 The

nano

editor window

Chapter 10

FIGURE 10.1 A CentOS GRUB2 boot menu

Chapter 11

FIGURE 11.1 The Linux LVM layout

Chapter 12

FIGURE 12.1 Selecting the network interface during an Ubuntu server installa...

FIGURE 12.2 Setting network information during an Ubuntu server installation...

FIGURE 12.3 The CentOS Network & Host Name dialog box

FIGURE 12.4 The CentOS network settings dialog box

FIGURE 12.5 The Network Manager

nmtui

command‐line tool

Chapter 13

FIGURE 13.1 File information chart

FIGURE 13.2 Permissions with tier identification

FIGURE 13.3 Adding a user account

Chapter 14

FIGURE 14.1 The output of the

top

command

Chapter 16

FIGURE 16.1 The main CUPS web interface page

FIGURE 16.2 The CUPS Administration web page

FIGURE 16.3 The Add Printer web page in CUPS

FIGURE 16.4 The Set Printer Options page in CUPS

FIGURE 16.5 The Printers page in CUPS

FIGURE 16.6 The printer management page in CUPS

Chapter 18

FIGURE 18.1 A Linux server connected to two networks

Chapter 20

FIGURE 20.1 The default Apache web page for Ubuntu

FIGURE 20.2 The default Apache web page for CentOS

FIGURE 20.3 Basic web page authentication

FIGURE 20.4 The nginx default web page in CentOS

Chapter 21

FIGURE 21.1 Apple tree table representation

FIGURE 21.2 App using a database engine to access data stored in a database...

FIGURE 21.3 Apps using a database engine to access data stored in a database...

Chapter 22

FIGURE 22.1 Example of a Type 2 hypervisor

FIGURE 22.2 Oracle VirtualBox Type 2 hypervisor

FIGURE 22.3 Example of a Type 1 hypervisor

FIGURE 22.4 A container example

FIGURE 22.5 Using the

snap find

command

Guide

Cover

Table of Contents

Title Page

Copyright

Acknowledgments

About the Authors

About the Technical Editor

Introduction

Begin Reading

Appendix: The Bottom Line

Index

End User License Agreement

Pages

iii

iv

v

vii

ix

xi

xxv

xxvi

xxvii

1

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

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

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

135

136

137

138

139

140

141

142

143

144

145

146

147

148

149

150

151

152

153

154

155

156

157

158

159

160

161

162

163

164

165

166

167

168

169

170

171

172

173

174

175

176

177

178

179

180

181

182

183

184

185

186

187

189

191

192

193

194

195

196

197

198

199

200

201

202

203

204

205

206

207

208

209

211

212

213

214

215

216

217

218

219

220

221

222

223

224

225

226

227

228

229

230

231

232

233

234

235

236

237

238

239

240

241

242

243

244

245

246

247

248

249

250

251

252

253

254

255

256

257

258

259

260

261

262

263

264

265

266

267

268

269

270

271

272

273

274

275

276

277

279

280

281

282

283

284

285

286

287

288

289

290

291

292

293

294

295

296

297

298

299

300

301

302

303

304

305

306

307

308

309

310

311

312

313

314

315

316

317

318

319

320

321

322

323

324

325

326

327

328

329

330

331

332

333

334

335

336

337

338

339

340

341

342

343

344

345

347

348

349

350

351

352

353

354

355

356

357

358

359

360

361

362

363

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

403

404

405

406

407

408

409

410

411

412

413

414

415

416

417

418

419

420

421

422

423

424

425

426

427

428

429

430

431

433

434

435

436

437

438

439

440

441

442

443

444

445

446

447

448

449

450

451

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

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

 

Mastering Linux® System Administration

 

 

Christine Bresnahan

Richard Blum

 

 

 

 

Copyright © 2021 by John Wiley & Sons, Inc. All rights reserved.

Published by John Wiley & Sons, Inc., Hoboken, New Jersey.Published simultaneously in Canada.

ISBN: 978‐1‐119‐79445‐5ISBN: 978‐1‐119‐79447‐9 (ebk.)ISBN: 978‐1‐119‐79446‐2 (ebk.)

No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning, or otherwise, except as permitted under Section 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization through payment of the appropriate per‐copy fee to the Copyright Clearance Center, Inc., 222 Rosewood Drive, Danvers, MA 01923, (978) 750‐8400, fax (978) 750‐4470, or on the web at www.copyright.com. Requests to the Publisher for permission should be addressed to the Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748‐6011, fax (201) 748‐6008, or online at http://www.wiley.com/go/permission.

Limit of Liability/Disclaimer of Warranty: While the publisher and author have used their best efforts in preparing this book, they make no representations or warranties with respect to the accuracy or completeness of the contents of this book and specifically disclaim any implied warranties of merchantability or fitness for a particular purpose. No warranty may be created or extended by sales representatives or written sales materials. The advice and strategies contained herein may not be suitable for your situation. You should consult with a professional where appropriate. Neither the publisher nor author shall be liable for any loss of profit or any other commercial damages, including but not limited to special, incidental, consequential, or other damages.

For general information on our other products and services or for technical support, please contact our Customer Care Department within the United States at (800) 762‐2974, outside the United States at (317) 572‐3993 or fax (317) 572‐4002.

Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be available in electronic formats. For more information about Wiley products, visit our web site at www.wiley.com.

Library of Congress Control Number: 2021938273

TRADEMARKS: WILEY and the Wiley logo are trademarks or registered trademarks of John Wiley & Sons, Inc. and/or its affiliates, in the United States and other countries, and may not be used without written permission. Linux is a registered trademark of Linus Torvalds. All other trademarks are the property of their respective owners. John Wiley & Sons, Inc. is not associated with any product or vendor mentioned in this book.

Cover Image: © gorodenkoff/Getty ImagesCover Design: Wiley

To the Lord God Almighty, “in whom are hidden all the treasures of wisdom and knowledge.”

—Colossians 2:3

Acknowledgments

First, all glory and praise go to God, who through His Son, Jesus Christ, makes all things possible and gives us the gift of eternal life.

Many thanks go to the fantastic team of people at John Wiley & Sons for their outstanding work on this project. Thanks to Kenyon Brown, the acquisitions editor, for offering us the opportunity to work on this book. Also, thanks to Kathryn Duggan, the project editor, for keeping things on track and making this book more presentable. Thanks, Kathi, for all your hard work and diligence. The technical editor, Jason Eckert, did a wonderful job of double‐checking all the work in the book, plus making suggestions to improve the content. Thanks to Barath Kumar Rajasekaran and his team for their endless patience and diligence to make our work readable. We would also like to thank Carole Jelen at Waterside Productions, Inc., for arranging this opportunity for us, and for helping us out in our writing careers.

Christine would like to thank her husband, Timothy, for his encouragement, patience, and willingness to listen, even when he has no idea what she is talking about. Rich would like to thank his wife, Barbara, for the life‐sustaining baked goods she readily prepared to help him keep up his energy while writing!

About the Authors

Christine Bresnahan started working with computers more than 30 years ago in the IT industry as a system administrator. Christine is an adjunct professor at Ivy Tech Community College where she teaches Linux certification and Python programming classes. She also writes books and produces instructional resources. During her downtime, Christine enjoys spending time with her husband and family, hiking, and gardening.

Richard Blum has worked in the IT industry for more than 30 years as both a systems and network administrator, working with lots of different operating systems (including Linux, of course). Over the years, he's also volunteered for several nonprofit organizations to help support small networks that had little financial support. Rich is the author of many Linux‐based books for total Linux geeks and teaches online courses in Linux and web programming. When he's not busy being a computer nerd, Rich enjoys playing piano and bass guitar and spending time with his wife, Barbara, and their two daughters, Katie Jane and Jessica.

About the Technical Editor

Jason W. Eckert is an experienced technical trainer, systems architect, software engineer, and best‐selling author in the technology industry. With 45 industry certifications, more than 30 years of technology and programming experience, 4 published apps, and 25 published textbooks covering UNIX, Linux, Security, Windows Server, Microsoft Exchange Server, PowerShell, BlackBerry Enterprise Server, and video game development, Mr. Eckert brings his expertise to every class that he teaches at triOS College. He was also named 2019 Outstanding Train‐the‐Trainer from the Computing Technology Industry Association (CompTIA). For more information about Mr. Eckert, visit jasoneckert.net.

Introduction

Over the last few decades, the Linux operating system has evolved from being a hobbyist curiosity to becoming the operating system of choice for most servers on the Internet. The explosion in popularity of cloud computing is due to the robustness of Linux servers, and knowing how to install, configure, and manage Linux servers has become a necessary skill for most data center system administrators.

This book covers what you'll need to know to work in a Linux server environment. One of the difficulties of working on Linux servers is that more often than not, you don't have access to a graphical desktop, so knowing how to interact with the server using text commands is a crucial skill to have for Linux system administrators. This book covers all aspects of Linux server management from the command line, from installing the system to configuring and monitoring common software packages found on Linux servers.

One of the confusing aspects of Linux is that there are many different “flavors,” or distributions, of Linux available. However, there are two main Linux server distributions that have risen to the top in popularity in professional data centers. This book covers how to interact with both Ubuntu and Red Hat servers, providing separate instructions for each server environment when necessary.

Who Should Read This Book

This book is intended for the classroom environment, so the primary audience for the book is educators working at the high school, college, or university level. The book provides sufficient exercises, quizzes, and instructor material to create a one‐semester course in Linux system administration.

That said, this book can also be used as a standard reference for any individual wanting to learn more about Linux system administration. There are several ways you can use this book. The most straightforward is to start at the beginning and follow all the steps to install, configure, and use a Linux server as described over the course of the book. Alternately, you can skip around from chapter to chapter and follow only the steps of the individual chapters. The book will also make for a handy reference guide as you work in a Linux server environment, performing your day‐to‐day duties in supporting your system users.

NOTE

This book provides Instructor Materials that include PowerPoints for each chapter, a course syllabus, and bonus questions. Please visit the book page at

www.wiley.com

.

What You Will Learn

This book covers the basics of installing a Linux server, working in a command‐line environment, and managing users, hardware, and software. The book starts by covering the basic Linux skills you'll need to install and work in a Linux server and then goes on to cover more intermediate skills such as configuring and troubleshooting user accounts, storage devices, and networks. Finally, the book finishes by providing advanced system administration skills in writing shell script programs, setting up a web or database server, and even using virtualization in the Linux environment.

What You Need

To follow along in the chapters and complete the exercises in this book, you'll need some type of Linux server environment. The book specifically covers both the Ubuntu and Red Hat servers. If you intend to use the Red Hat server environment, you don't necessarily need to purchase a commercial copy of Red Hat Enterprise Linux. Instead, you can use the open source CentOS Linux server, which is an authorized copy of Red Hat intended for the open source world. At the time of this writing, the current versions of each are Ubuntu 20.04LTS and CentOS 8.1. These are the versions used in the exercises; if you opt to use newer versions of either server, you may experience different results in some exercises.

The best way to learn Linux is to install it on a separate physical system. If you don't plan on having your server host thousands of clients, you can use any old Windows workstation to install Linux (the book covers how to do that). Just remember that if you replace an existing Windows workstation with Linux, you will lose all data currently on the workstation, so make sure you back up any important data first.

Alternatively, you can load a virtualization software package, such as VirtualBox, in an existing Windows workstation. The virtualization software allows you to install and run the Linux server software in a virtual environment on top of Windows, sharing the hardware and disk space with your Windows workstation. In this setup, you don't need to worry about your Windows workstation data—it will remain safely separate from the Linux server.

The Mastering Series

The Mastering series from Wiley provides outstanding instruction for readers with intermediate and advanced skills, in the form of top‐notch training and development for those already working in their field and clear, serious education for those aspiring to become pros. Every Mastering book features the following:

The Wiley “by professionals for professionals” commitment. Mastering authors are themselves practitioners, with plenty of credentials in their areas of specialty.

A practical perspective for a reader who already knows the basics—someone who needs solutions, not a primer.

Real‐World Scenarios, ranging from case studies to interviews, that show how the tool, technique, or knowledge presented is applied in actual practice.

Skill‐based instruction, with chapters organized around real tasks rather than abstract concepts or subjects.

Self‐review test “Master It” problems and questions, so you can be certain you're equipped to do the job right.

How to Contact Wiley or the Authors

Sybex strives to keep you supplied with the latest tools and information you need for your work. If you believe you have found an error in this book and it is not listed on the book's web page, you can report the issue to the Wiley customer support team at wileysupport.com.

You can email the authors with your comments or questions at [email protected].

Part 1Basic Admin Functions

Chapter 1: Understanding the Basics

Chapter 2: Installing an Ubuntu Server

Chapter 3: Installing and Maintaining Software in Ubuntu

Chapter 4: Installing a Red Hat Server

Chapter 5: Installing and Maintaining Software in Red Hat

Chapter 6: Working with the Shell

Chapter 7: Exploring Linux File Management

Chapter 8: Working with Text Files

Chapter 1Understanding the Basics

The Linux operating system has taken the world by storm. Whether it's embedded Linux software operating in phones and refrigerators or full‐blown Linux servers running famous Internet sites, you can find Linux systems just about everywhere. If you've chosen (or have been chosen) to be a Linux system administrator, the task before you can seem daunting at first. But don't panic—while complex, the Linux system is organized and structured. Just knowing the basics of how Linux works will go a long way in helping you with your goals of becoming a Linux system administrator. This chapter walks you through the basics of what Linux is and explains the different versions of Linux that are available.

IN THIS CHAPTER, YOU WILL LEARN TO

List the components of a standard Linux system

Explain how GNU utilities are used in Linux

Describe the various Linux user interface environments

Explain why there are different Linux distributions

What Is Linux?

If you've never worked with Linux, you may be confused as to why there are so many different versions of it available. You've probably heard various terms such as distribution, LiveDVD, and GNU when looking at Linux packages, and may have been confused. Wading through the world of Linux for the first time can be a tricky experience. This chapter takes some of the mystery out of the Linux system before you start working on commands and scripts.

For starters, these four main parts make up a Linux system:

The Linux kernel

The GNU utilities

A user interface

Application software

Each of these four parts has a specific job in the Linux system. Figure 1.1 shows a basic diagram of how the parts fit together on top of the computer hardware to create the overall Linux system.

FIGURE 1.1 The Linux system

This section describes these four main parts in detail and gives you an overview of how they work together to create a complete Linux system.

Looking into the Linux Kernel

The core of the Linux system is the kernel. The kernel controls all of the hardware and software on the computer system, allocating hardware when necessary and executing software when required.

If you've been following the Linux world at all, no doubt you've heard the name Linus Torvalds. Linus is the person responsible for creating the first Linux kernel software while he was a student at the University of Helsinki. He intended it to be a copy of the Unix system, at the time a popular operating system used at many universities.

After developing the Linux kernel, Linus released it to the Internet community and solicited suggestions for improving it. This simple process started a revolution in the world of computer operating systems. Soon Linus was receiving suggestions from students as well as professional programmers from around the world.

Allowing anyone to change programming code in the kernel would result in complete chaos. To simplify things, Linus acted as a central point for all improvement suggestions. It was ultimately Linus's decision whether to incorporate suggested code in the kernel. This same concept is still in place with the Linux kernel code, except that instead of just Linus controlling the kernel code, a team of developers has taken on the task.

The kernel is primarily responsible for these four main functions:

System memory management

Software program management

Hardware management

Filesystem management

The following sections explore each of these functions in more detail.

SYSTEM MEMORY MANAGEMENT

One of the primary functions of the operating system kernel is memory management. Not only does the kernel manage the physical memory available on the server, but it can also create and manage virtual memory, or memory that does not actually exist.

It does this by using space on the hard disk, called the swap space. The kernel swaps the contents of virtual memory locations back and forth from the swap space to the actual physical memory. This allows the system to think there is more memory available than what physically exists (shown in Figure 1.2).

FIGURE 1.2 The Linux system memory map

The memory locations are grouped into blocks called pages. The kernel locates each page of memory either in the physical memory or in the swap space. The kernel then maintains a table of the memory pages that indicates which pages are in physical memory and which pages are swapped out to disk.

The kernel keeps track of which memory pages are in use and automatically copies memory pages that have not been accessed for a period of time to the swap space area (called swapping out), even if there's other memory available. When a program wants to access a memory page that has been swapped out, the kernel must make room for it in physical memory by swapping out a different memory page and swapping in the required page from the swap space. Obviously, this process takes time and can slow down a running process. The process of swapping out memory pages for running applications continues for as long as the Linux system is running.

Real World Scenario

LOOKING AT MEMORY

There are a couple of simple commands you can use to get an idea of just how your Linux system is managing memory. While we'll be exploring these commands in more detail later in the book, here's a quick exercise for you to get started exploring your Linux system:

Log into your Linux system. (If you don't have a Linux system available yet, you can come back to here after going through either

Chapter 2

, “Installing an Ubuntu Server,” or

Chapter 4

, “Installing a Red Hat Server.”)

From the command prompt, enter the command

free

. You should see something similar to this output:

$ free

total used free shared buff/cache available

Mem: 2035504 135668 1449568 1048 450268 1742704

Swap: 2097148 0 2097148

The output from the free command shows the total amount of physical memory installed on the system, as well as the amount of swap space currently configured.

The

free

command just provides an overview of the memory for your Linux system. For a more detailed look, enter the command

cat /proc/meminfo

. You should see a long listing, similar to this:

$ cat /proc/meminfo

MemTotal: 2035504 kB

MemFree: 1449632 kB

MemAvailable: 1742352 kB

Buffers: 25452 kB

Cached: 386028 kB

SwapCached: 0 kB

Active: 166036 kB

Inactive: 290704 kB

Active(anon): 51796 kB

Inactive(anon): 128 kB

Active(file): 114240 kB

Inactive(file): 290576 kB

Unevictable: 18640 kB

Mlocked: 18640 kB

SwapTotal: 2097148 kB

SwapFree: 2097148 kB

Dirty: 156 kB

Writeback: 0 kB

AnonPages: 63940 kB

Mapped: 63344 kB

Shmem: 1048 kB

KReclaimable: 38664 kB

Slab: 74316 kB

SReclaimable: 38664 kB

SUnreclaim: 35652 kB

KernelStack: 2044 kB

PageTables: 1268 kB

NFS_Unstable: 0 kB

Bounce: 0 kB

WritebackTmp: 0 kB

CommitLimit: 3114900 kB

Committed_AS: 376812 kB

VmallocTotal: 34359738367 kB

VmallocUsed: 27676 kB

VmallocChunk: 0 kB

Percpu: 516 kB

HardwareCorrupted: 0 kB

AnonHugePages: 0 kB

ShmemHugePages: 0 kB

ShmemPmdMapped: 0 kB

FileHugePages: 0 kB

FilePmdMapped: 0 kB

CmaTotal: 0 kB

CmaFree: 0 kB

HugePages_Total: 0

HugePages_Free: 0

HugePages_Rsvd: 0

HugePages_Surp: 0

Hugepagesize: 2048 kB

Hugetlb: 0 kB

DirectMap4k: 90048 kB

DirectMap2M: 2007040 kB

$

The kernel continually updates the meminfo file to show exactly what's going on in memory at that moment in time, so the file constantly changes.

SOFTWARE PROGRAM MANAGEMENT

The Linux operating system calls a running program a process. A process can run in the foreground, displaying output on a display, or it can run in background, behind the scenes. The kernel controls how the Linux system manages all the processes running on the system.

The kernel creates the first process, called the init process, to start all other processes on the system. When the kernel starts, it loads the init process into virtual memory. As the kernel starts each additional process, it gives it a unique area in virtual memory to store the data and code that the process uses.

There are a few different types of init process implementations available in Linux, but these days, the two most popular are as follows:

SysVinit

—The

SysVinit

(SysV) initialization method was the original method used by Linux and was based on the Unix System V initialization method. Though it is not used by many Linux distributions these days, you still may find it around in older Linux distributions.

Systemd

—The

systemd

initialization method was created in 2010 and has become the most popular initialization and process management system used by Linux distributions.

The SysVinit initialization method used a concept called runlevels to determine what processes to start. The runlevel defines the state of the running Linux system and what processes should run in each state. Table 1.1 shows the different runlevels associated with the SysVinit initialization method.

TABLE 1.1: The SysVinit Runlevels

RUNLEVEL

DESCRIPTION

0

Shuts down the system

1

Single‐user mode used for system maintenance

2

Multiuser mode without networking services enabled

3

Multiuser mode with networking services enabled

4

Custom

5

Multiuser mode with GUI available

6

Reboots the system

The /etc/inittab file defines the default runlevel for a system. The processes that start for specific runlevels are defined in subdirectories of the /etc/rc.d directory. You can view the current runlevel at any time using the runlevel command, as shown here:

$ runlevel

N 5

$

The systemd initialization method became popular because it has the ability to start processes based on different events such as these:

When the system boots

When a particular hardware device is connected

When a service is started

When a network connection is established

When a timer has expired

The systemd method determines what processes to run by linking events to unit files. Each unit file defines the programs to start when the specified event occurs. The systemctl program allows you to start, stop, and list the unit files currently running on the system.

The systemd method groups unit files together into targets. A target defines a specific running state of the Linux system, similar to the SysVinit runlevel concept. At system startup, the default.target unit defines all the unit files to start. You can view the current default target using the systemctl command.

$ systemctl get-default

graphical.target

$

The graphical.target target defines the processes to start when a multiuser graphical environment is running, similar to the old SysVinit runlevel 5.

Real World Scenario

EXAMINING PROCESSES

In Chapter 14, “Working with Processes and Jobs,” you'll see how to use the ps command to view the processes currently running on the Linux system. You can use it now to take a quick peek at what programs are currently running on your Linux system.

Log into your Linux system. (If you don't have a Linux system available yet, you can come back to here after going through either

Chapter 2

or

Chapter 4

.)

At the command prompt, enter the command

ps

ax

. You should see something similar to this output:

$ ps ax

PID TTY STAT TIME COMMAND

1 ? Ss 0:00 /sbin/init maybe-ubiquity

2 ? S 0:00 [kthreadd]

3 ? I< 0:00 [rcu_gp]

4 ? I< 0:00 [rcu_par_gp]

5 ? I 0:00 [kworker/0:0-memcg_kmem_cache]

6 ? I< 0:00 [kworker/0:0H-kblockd]

7 ? I 0:00 [kworker/0:1-events]

8 ? I 0:00 [kworker/u2:0-events_power_efficient]

. . .

1033 tty1 S 0:00 -bash

1054 tty1 R+ 0:00 ps ax

$

We've just shown the start of the listing, along with the last two lines, but you should see a long list of different programs running on your Linux system (including the ps command that you started). The kernel is keeping track of all those programs!

HARDWARE MANAGEMENT

Still another responsibility for the kernel is hardware management. Any device that the Linux system must communicate with needs driver code inserted inside the kernel code. The driver code allows the kernel to pass data back and forth to the device, acting as a middleman between applications and the hardware. There are two methods used for inserting device driver code in the Linux kernel.

Drivers compiled in the kernel

Driver modules added to the kernel

Previously, the only way to insert device driver code was to recompile the kernel. Each time you added a new device to the system, you had to recompile the kernel code. This process became even more inefficient as Linux kernels supported more hardware. Fortunately, Linux developers devised a better method to insert driver code into the running kernel.

Programmers developed the concept of kernel modules to allow you to insert driver code into a running kernel without having to recompile the kernel. Also, a kernel module could be removed from the kernel when the device was finished being used. This greatly simplified and expanded using hardware with Linux.

The Linux system identifies hardware devices as special files, called device files. There are three different classifications of device files.

Character

Block

Network

Character device files are for devices that can only handle data one character at a time. Most types of modems and terminals are created as character files. Block files are for devices that can handle data in large blocks at a time, such as disk drives.

The network file types are used for devices that use packets to send and receive data. This includes network cards and a special loopback device that allows the Linux system to communicate with itself using common network programming protocols.

Linux creates special files, called nodes, for each device on the system. All communication with the device is performed through the device node. Each node has a unique number pair that identifies it to the Linux kernel. The number pair includes a major and a minor device number. Similar devices are grouped into the same major device number. The minor device number is used to identify a specific device within the major device group.

FILESYSTEM MANAGEMENT

Unlike some other operating systems, the Linux kernel can support different types of filesystems to read and write data to and from hard drives. Besides having more than a dozen filesystems of its own, Linux can read and write to and from filesystems used by other operating systems, such as Microsoft Windows. The kernel must be compiled with support for all types of filesystems that the system will use. Table 1.2 lists the standard filesystems that a Linux system can use to read and write data.

TABLE 1.2: Linux Filesystems

FILESYSTEM

DESCRIPTION

ext

Linux extended filesystem—the original Linux filesystem

ext2

Second extended filesystem; provides advanced features over ext

ext3

Third extended filesystem; supports journaling

ext4

Fourth extended filesystem; supports advanced journaling

btrfs

A newer, high‐performance filesystem that supports journaling and large files

exfat

The extended Windows filesystem, used mainly for SD cards and USB sticks

hpfs

OS/2 high‐performance filesystem

jfs

IBM's journaling file system

iso9660

ISO 9660 filesystem (CD‐ROMs)

minix

MINIX filesystem

msdos

Microsoft FAT16

ncp

NetWare filesystem

nfs

Network File System

ntfs

Support for Microsoft NT filesystem

proc

Access to system information

smb

Samba SMB filesystem for network access

sysv

Older Unix filesystem

ufs

BSD filesystem

umsdos

Unix‐like filesystem that resides on top of msdos

vfat

Windows 95 filesystem (FAT32)

XFS

High‐performance 64‐bit journaling filesystem

Any hard drive that a Linux server accesses must be formatted using one of the filesystem types listed in Table 1.2.

The Linux kernel interfaces with each filesystem using the Virtual File System (VFS). This provides a standard interface for the kernel to communicate with any type of filesystem. VFS caches information in memory as each filesystem is mounted and used.

The GNU Utilities

Besides having a kernel to control hardware devices and launch programs, a computer operating system needs utilities to perform standard functions, such as controlling files and programs. While Linus created the Linux system kernel, he had no system utilities to run on it. Fortunately for him, at the same time he was working, a group of people were working together on the Internet trying to develop a standard set of computer system utilities that mimicked the popular Unix operating system.

The GNU organization (GNU stands for GNU's Not Unix) developed a complete set of Unix utilities but had no kernel system to run them on. These utilities were developed under a software philosophy called open source software (OSS).

The concept of OSS allows programmers to develop software and then release it to the world with no licensing fees attached. Anyone can use the software, modify it, or incorporate it into their own system without having to pay a license fee. Uniting Linus's Linux kernel with the GNU operating system utilities created a complete, functional, free operating system.

While the bundling of the Linux kernel and GNU utilities is often just called Linux, you will see some Linux purists on the Internet refer to it as the GNU/Linux system to give credit to the GNU organization for its contributions to the cause.

The GNU project was mainly designed for Unix system administrators to have a Unix‐like environment available. This focus resulted in the project porting many common Unix system command‐line utilities. The core bundle of utilities supplied for Linux systems is called the coreutils package.

The GNU coreutils package consists of these three parts:

Utilities for handling files

Utilities for manipulating text

Utilities for managing processes

Each of these three main groups of utilities contains several utility programs that are invaluable to the Linux system administrator and programmer.

Linux User Interfaces

Having a world‐class operating system that can manage your computer hardware and software is great, but you also need some way to communicate with it. Back in the old days of computers, you communicated with the mainframe computer by punching holes into cards, feeding them into a card reader, and then waiting for the output to appear on a printer. Fortunately, those days are long gone.

Thanks to the Apple macOS and Microsoft Windows operating systems, these days most desktop computer users expect some type of graphical display to interact with their system. Linux doesn't disappoint, offering a plethora of graphical desktops you can choose from. The following sections describe a few of the more popular ones.

THE X WINDOW SOFTWARE

Two basic elements control your video environment—the video card in your PC and your monitor. To display fancy graphics on your computer, the Linux software needs to know how to talk to both of them. The X Window software is the core element in presenting graphics.

The X Window software is a low‐level program that works directly with the video card and monitor in the PC and controls how Linux applications can present fancy windows and graphics on your computer.

Linux isn't the only operating system that uses X Window; there are versions written for many different operating systems. In the Linux world, there are a few different software packages that can implement it. There are two X Window packages that are most commonly used in Linux:

X.org

Wayland

The X.org package is the older of the two, based on the original Unix X Window System version 11 (often called X11). More Linux distributions are migrating to the newer Wayland software, which is more secure and easier to maintain.

When you first install a Linux distribution, it attempts to detect your video card and monitor and then creates an X Window configuration file that contains the required information. During installation, you may notice a time when the installation program scans your monitor for supported video modes. Sometimes this causes your monitor to go blank for a few seconds. Because there are lots of different types of video cards and monitors out there, this process can take a little while to complete.

The core X Window software produces a graphical display environment, but nothing else. While this is fine for running individual applications, it is not too useful for day‐to‐day computer use. There is no desktop environment allowing users to manipulate files or launch programs. To do that, you need a desktop environment on top of the X Window system software.

THE KDE PLASMA DESKTOP

The K Desktop Environment (KDE) was first released in 1996 as an open source project to produce a graphical desktop similar to the Microsoft Windows environment. The KDE desktop incorporates all of the features you are probably familiar with if you are a Windows user. Figure 1.3 shows the current version, called KDE Plasma, running in the openSUSE Linux distribution.

FIGURE 1.3 The KDE Plasma desktop on an openSUSE Linux system

The KDE Plasma desktop allows you to place both application and file icons in a special area on the desktop. If you single‐click an application icon, the Linux system starts the application. If you single‐click a file icon, the KDE desktop attempts to determine what application to start to handle the file.

The bar at the bottom of the desktop is called the Panel. The Panel consists of these four parts:

The KDE Start menu—

Much like the Windows Start menu, the KDE Start menu contains links to start installed applications.

Program shortcuts—

These are quick links to start applications directly from the Panel.

The taskbar—

The taskbar shows icons for applications currently running on the desktop.

Applets—

These are small applications that have an icon in the Panel that often can change depending on information from the application.

All of the Panel features are similar to what you would find in Windows. In addition to the desktop features, the KDE project has produced a wide assortment of applications that run in the KDE environment.

THE GNOME DESKTOP

The GNU Network Object Model Environment (GNOME) is another popular Linux desktop environment. First released in 1999, GNOME has become the default desktop environment for many Linux distributions (the most popular being Red Hat Linux).

GNOME CONTROVERSY

The GNOME desktop underwent a radical change with version 3, released in 2011. It departed from the standard look and feel of most desktops using standard menu bars and taskbars to make the interface more user‐friendly across multiple platforms, such as tablets and mobile phones. This change led to controversy (see the “Other Desktops” section), but slowly many Linux enthusiasts accepted the new look and feel of the GNOME 3 desktop.

Figure 1.4 shows the standard GNOME desktop used in the Ubuntu Linux distribution.

The GNOME 3 desktop cleans up the desktop interface by reducing the available menus to just these three:

Activities

—Displays favorites, as well as any running application icons

Calendar

—Shows the current date/time, along with any system notification messages

System

—Shows network connections, system settings, and options to restart the system

The GNOME 3 desktop was designed to work on multiple types of devices, so you'll find there aren't a lot of menus. To launch applications, you must search for them using the Activities Overview, which is a search feature from the Activities menu.

FIGURE 1.4 A GNOME 3 desktop on an Ubuntu Linux system

Not to be outdone by KDE, the GNOME developers have also produced a host of graphical applications that integrate with the GNOME desktop.

OTHER DESKTOPS

One of the main features of Linux is choice, and nowhere is that more evident than in the graphical desktop world. There are a plethora of different types of graphical desktops available in the Linux world. If you're not happy with the default desktop in your Linux distribution, it usually doesn't take much effort to change it to something else.

When the GNOME desktop project radically changed its interface in version 3, many Linux developers who preferred the look and feel of GNOME version 2 created spin‐off versions based on GNOME 2. Of these, two became somewhat popular.

Cinnamon

—The Cinnamon desktop was developed in 2011 by the Linux Mint distribution in an attempt to continue development of the original GNOME 2 desktop. It's now available as an option in several Linux distributions, including Ubuntu, Fedora, and openSUSE.

MATE

—The MATE desktop was also developed in 2011 by an Arch Linux user who disliked the switch to GNOME 3. However, it incorporates a few features of GNOME 3 (such as replacing the taskbar) but maintains the overall look and feel of GNOME 2.

Figure 1.5 shows the Cinnamon desktop as it appears in the Linux Mint distribution.

The downside to these fancy graphical desktop environments is that they require a fair amount of system resources to operate properly. In the early days of Linux, a hallmark and selling feature of Linux was its ability to operate on older, less powerful PCs that the newer Microsoft desktop products couldn't run on. However, with the popularity of KDE Plasma and GNOME 3 desktops, this has changed, as it takes just as much memory to run a KDE Plasma or GNOME 3 desktop as the latest Microsoft desktop environment.

FIGURE 1.5 The Cinnamon desktop from Linux Mint

If you have an older PC, don't be discouraged. The Linux developers have banded together to take Linux back to its roots. They've created several low‐memory–oriented graphical desktop applications that provide basic features that run perfectly fine on older PCs.

While these graphical desktops don't have a plethora of applications designed around them, they still run many basic graphical applications that support features such as word processing, spreadsheets, databases, drawing, and, of course, multimedia support.

Table 1.3 shows some of the smaller Linux graphical desktop environments that can be used on lower‐powered PCs and laptops.

TABLE 1.3: Other Linux Graphical Desktops

DESKTOP

DESCRIPTION

Fluxbox

A bare‐bones desktop that doesn't include a Panel, only a pop‐up menu to launch applications

Xfce

A desktop that's similar to the GNOME 2 desktop, but with fewer graphics for low‐memory environments

JWM

Joe's Window Manager, a lightweight desktop ideal for low‐memory and low‐disk space environments

fvwm

Supports some advanced desktop features such as virtual desktops and Panels, but runs in low‐memory environments

fvwm95

Derived from fvwm, but made to look like a Windows 95 desktop

These graphical desktop environments are not as fancy as the KDE Plasma and GNOME 3 desktops, but they provide basic graphical functionality just fine. Figure 1.6 shows what the Xfce desktop used in the MX Linux distribution looks like.

FIGURE 1.6 The Xfce desktop as seen in the MX Linux distribution

If you are using an older PC, try a Linux distribution that uses one of these desktops and see what happens. You may be pleasantly surprised.

THE COMMAND‐LINE INTERFACE

While having a fancy graphical desktop interface is nice, there are drawbacks. The extra processing power required to interact with the graphics card takes away crucial CPU time that can be used for other programs. Nowhere is this more important than in a server environment.

Because of that, many Linux servers don't load a graphical desktop and instead rely on a text‐based interface, called the command‐line interface (CLI). The CLI provides a way for users to start programs, manage files on the filesystem, and manage processes running on the Linux system using simple text commands. The CLI is produced by a program called a shell. The shell allows you to enter text commands, and then it interprets the commands and then executes them in the kernel.

The shell contains a set of internal commands that you use to control things such as copying files, moving files, renaming files, displaying the programs currently running on the system, and stopping programs running on the system. Besides the internal commands, the shell also allows you to enter the name of a program at the command prompt. The shell passes the program name off to the kernel to start it.

You can also group shell commands into files to execute as a program. Those files are called shell scripts. Any command that you can execute from the command line can be placed in a shell script and run as a group of commands. This provides great flexibility in creating utilities for commonly run commands, or processes that require several commands grouped together.

There are quite a few Linux shells available to use on a Linux system. Different shells have different characteristics, some being more useful for creating scripts and some being more useful for managing processes. The default shell used in all Linux distributions is the Bash Shell. The Bash Shell was developed by the GNU project as a replacement for the standard Unix shell, called the Bourne shell (after its creator). The Bash Shell name is a play on this wording, referred to as the “Bourne again shell.”

In addition to the Bash Shell, there are several other popular shells you could run into in a Linux environment. Table 1.4 lists the more popular ones.

TABLE 1.4: Linux Shells

SHELL

DESCRIPTION

ash

A simple, lightweight shell that runs in low‐memory environments but has full compatibility with the Bash Shell

korn

A programming shell compatible with the Bourne shell but supporting advanced programming features like associative arrays and floating‐point arithmetic

tcsh

A shell that incorporates elements from the C programming language into shell scripts

zsh

An advanced shell that incorporates features from bash, tcsh, and korn, providing advanced programming features, shared history files, and themed prompts

Most Linux distributions include more than one shell, although usually they pick one of them to be the default. If your Linux distribution includes multiple shells, feel free to experiment with different shells and see which one fits your needs.

Linux Distributions

Now that you have seen the four main components required for a complete Linux system, you may be wondering how you are going to get them all put together to make a Linux system. Fortunately, there are people who have already done that for you.

A complete Linux system package is called a distribution. There are lots of different Linux distributions available to meet just about any computing requirement you could have. Most distributions are customized for a specific user group, such as business users, multimedia enthusiasts, software developers, or average home users. Each customized distribution includes the software packages required to support specialized functions, such as audio‐ and video‐editing software for multimedia enthusiasts, or compilers and integrated development environments (IDEs) for software developers.

The different Linux distributions are often divided into two categories.

Core Linux distributions

Specialized distributions

The following sections describe these different types of Linux distributions and show some examples of Linux distributions in each category.

Core Linux Distributions

A core Linux distribution contains a kernel, one or more graphical desktop environments, and just about every Linux application that is available, precompiled for the kernel. It provides one‐stop shopping for a complete Linux installation. Table 1.5 shows some of the more popular core Linux distributions.

TABLE 1.5: Core Linux Distributions

DISTRIBUTION

DESCRIPTION

Slackware