Ubuntu Linux Bible

; Christopher Negus

Quickly learn how to use Ubuntu, the fastest growing Linux distribution, in a personal or enterprise environment

Whether you're a newcomer to Linux or an experienced system administrator, the Ubuntu Linux Bible provides what you need to get the most out of one the world's top Linux distributions. Les mer
Vår pris

(Paperback) Fri frakt!
Leveringstid: Sendes innen 7 virkedager
På grunn av Brexit-tilpasninger og tiltak for å begrense covid-19 kan det dessverre oppstå forsinket levering.

Legg i
Legg i
Vår pris: 487,-

(Paperback) Fri frakt!
Leveringstid: Sendes innen 7 virkedager
På grunn av Brexit-tilpasninger og tiltak for å begrense covid-19 kan det dessverre oppstå forsinket levering.

Om boka

Quickly learn how to use Ubuntu, the fastest growing Linux distribution, in a personal or enterprise environment

Whether you're a newcomer to Linux or an experienced system administrator, the Ubuntu Linux Bible provides what you need to get the most out of one the world's top Linux distributions. Clear, step-by-step instructions cover everything from installing Ubuntu and creating your desktop, to writing shell scripts and setting up file sharing on your network. This up-to-date guide covers the latest Ubuntu release with long-term support (version 20.04 ) as well as the previous version. Throughout the book, numerous examples, figures, and review questions with answers ensure that you will fully understand each key topic.

Organized into four parts, the book offers you the flexibility to master the basics in the "Getting Started with Ubuntu Linux" section, or to skip directly to more advanced tasks. "Ubuntu for Desktop Users" shows you how to setup email, surf the web, play games, and create and publish documents, spreadsheets, and presentations. "Ubuntu for System Administrators" covers user administration, system backup, device management, network configuration, and other fundamentals of Linux administration. The book's final section, "Configuring Servers on Ubuntu," teaches you to use Ubuntu to support network servers for the web, e-mail, print services, networked file sharing, DHCP (network address management), and DNS (network name/address resolution). This comprehensive, easy-to-use guide will help you:

Install Ubuntu and create the perfect Linux desktop

Use the wide variety of software included with Ubuntu Linux

Stay up to date on recent changes and new versions of Ubuntu

Create and edit graphics, and work with consumer IoT electronic devices

Add printers, disks, and other devices to your system

Configure core network services and administer Ubuntu systems

Ubuntu Linux Bible is a must-have for anyone looking for an accessible, step-by-step tutorial on this hugely popular Linux operating system.



Acknowledgments ix

Introduction xxix

Part I: Getting Started 1

Chapter 1: Starting with Linux 3

Understanding What Linux is 4

Understanding How Linux Differs from Other Operating Systems 6

Exploring Linux History 7

Free-flowing UNIX culture at Bell Labs 7

Commercial UNIX 9

Berkeley Software Distribution arrives 9

UNIX Laboratory and commercialization 10

GNU transitions UNIX to freedom 11

BSD loses some steam 13

Linus builds the missing piece 13

OSI open source definition 14

Understanding How Linux Distributions Emerged 16

Understanding Red Hat 17

Understanding Ubuntu and other Debian distributions 17

Finding Professional Opportunities with Linux Today 18

Understanding how companies make money with Linux 19

Summary 20

Chapter 2: Creating the Perfect Linux Desktop 21

Understanding Linux Desktop Technology 22

Starting with the GNOME 3 Desktop Live Image 24

Using the GNOME 3 Desktop 25

After the computer boots up 25

Navigating with the mouse 25

Navigating with the keyboard 30

Setting up the GNOME 3 desktop 31

Extending the GNOME 3 desktop 31

Using GNOME shell extensions 32

Using the GNOME Tweak Tool 33

Starting with desktop applications 33

Managing files and folders with Nautilus 33

Installing and managing additional software 35

Playing music with Rhythmbox 37

Stopping the GNOME 3 desktop 37

Using the Unity Graphical Shell with the GNOME Desktop 37

Using the Metacity window manager 38

Changing GNOME's appearance 40

Using the panels 40

Adding a drawer 41

Changing panel properties 41

Summary 42

Exercises 42

Part II: Becoming a Linux Power User 43

Chapter 3: Using the Shell 45

About Shells and Terminal Windows 46

Using the shell prompt 47

Using a Terminal window 48

Using virtual consoles 49

Choosing Your Shell 49

Running Commands 50

Understanding command syntax 51

Locating commands 53

Recalling Commands Using Command History 56

Command-line editing 56

Command-line completion 58

Command-line recall 59

Connecting and Expanding Commands 61

Piping between commands 62

Sequential commands 62

Background commands 63

Expanding commands 63

Expanding arithmetic expressions 63

Expanding variables 64

Using Shell Variables 64

Creating and using aliases 66

Exiting the shell 67

Creating Your Shell Environment 67

Configuring your shell 67

Setting your prompt 68

Adding environment variables 70

Getting Information about Commands 71

Summary 74

Exercises 74

Chapter 4: Moving Around the Filesystem 77

Using Basic Filesystem Commands 80

Using Metacharacters and Operators 82

Using fi le-matching metacharacters 82

Using fi le-redirection metacharacters 84

Using brace expansion characters 85

Listing Files and Directories 86

Understanding File Permissions and Ownership 90

Changing permissions with chmod (numbers) 91

Changing permissions with chmod (letters) 92

Setting default file permission with umask 93

Changing file ownership 93

Moving, Copying, and Removing Files 94

Summary 95

Exercises 96

Chapter 5: Working with Text Files 97

Editing Files with vim and vi 97

Starting with vi 99

Adding text 99

Moving around in the text 100

Deleting, copying, and changing text 101

Pasting (putting) text 102

Repeating commands 102

Exiting vi 102

Skipping around in the file 103

Searching for text 103

Using ex mode 104

Learning more about vi and vim 104

Finding Files 105

Using locate to find files by name 105

Searching for files with find 107

Finding files by name 108

Finding files by size 108

Finding files by user 109

Finding files by permission 109

Finding files by date and time 110

Using "not" and "or" when finding files 111

Finding files and executing commands 112

Searching in files with grep 113

Summary 115

Exercises 115

Chapter 6: Managing Running Processes 117

Understanding Processes 117

Listing Processes 118

Listing processes with ps 118

Listing and changing processes with top 120

Listing processes with System Monitor 122

Managing Background and Foreground Processes 124

Starting background processes 124

Using foreground and background commands 125

Killing and Renicing Processes 126

Killing processes with kill and killall 126

Using kill to signal processes by PID 127

Using killall to signal processes by name 128

Setting processor priority with nice and renice 128

Limiting Processes with cgroups 129

Summary 131

Exercises 131

Chapter 7: Writing Simple Shell Scripts 133

Understanding Shell Scripts 133

Executing and debugging shell scripts 134

Understanding shell variables 135

Special shell positional parameters 136

Reading in parameters 137

Parameter expansion in bash 137

Performing arithmetic in shell scripts 138

Using programming constructs in shell scripts 139

The "if then" statements 139

The case command 142

The "for do" loop 143

The "while do" and "until do" loops 144

Trying some useful text manipulation programs 145

The global regular expression print 145

Remove sections of lines of text (cut) 145

Translate or delete characters (tr) 146

The stream editor (sed) 146

Using simple shell scripts 147

Telephone list 147

Backup script 148

Summary 149

Exercises 149

Part III: Becoming a Linux System Administrator 151

Chapter 8: Learning System Administration 153

Understanding System Administration 153

Using Graphical Administration Tools 155

Using Cockpit browser-based administration 155

Using other browser-based admin tools 157

Invoking Administration Privileges 158

Becoming root from the shell 158

Gaining temporary admin access with sudo 159

Exploring Administrative Commands, Configuration Files, and Log Files 161

Administrative commands 161

Administrative configuration files 162

Administrative log files and systemd journal 165

Using journalctl to view the systemd journal 165

Managing log messages with rsyslogd 166

Using Other Administrative Accounts 167

Checking and Configuring Hardware 167

Checking your hardware 168

Managing removable hardware 171

Working with loadable modules 172

Listing loaded modules 172

Loading modules 173

Removing modules 174

Summary 174

Exercises 175

Chapter 9: Installing Linux 177

Choosing a Computer 178

Installing Ubuntu Desktop 180

Installing Ubuntu Server 185

Understanding Cloud-Based Installations 188

Installing Linux in the Enterprise 189

Exploring Common Installation Topics 189

Upgrading or installing from scratch 189

Dual booting 190

Installing Linux to run virtually 191

Using installation boot options 192

Boot options for disabling features 192

Boot options for video problems 193

Boot options for special installation types 193

Using specialized storage 194

Partitioning hard drives 195

Understanding different partition types 196

Tips for creating partitions 196

Using the GRUB 2 boot loader 198

Summary 199

Exercises 199

Chapter 10: Getting and Managing Software 201

Managing Software on the Desktop 201

Going Beyond the Software Window 203

Understanding Linux Software Packaging 204

Working with Debian Packaging 205

APT basics 205

Working with APT repositories 209

Working with dpkg 211

Summary 214

Exercises 214

Chapter 11: Managing User Accounts 215

Creating User Accounts 215

Adding users with adduser 218

Setting user defaults 220

Modifying users with usermod 222

Deleting users with deluser 223

Understanding Group Accounts 223

Using group accounts 224

Creating group accounts 225

Managing Users in the Enterprise 225

Setting permissions with Access Control Lists 226

Setting ACLs with setfacl 227

Setting default ACLs 228

Enabling ACLs 229

Adding directories for users to collaborate 231

Creating group collaboration directories (set GID bit) 231

Creating restricted deletion directories (sticky bit) 233

Centralizing User Accounts 233

Summary 234

Exercises 234

Chapter 12: Managing Disks and Filesystems 237

Understanding Disk Storage 237

Partitioning Hard Disks 239

Understanding partition tables 239

Viewing disk partitions 240

Creating a single-partition disk 241

Creating a multiple-partition disk 245

Using Logical Volume Manager Partitions 249

Checking an existing LVM 249

Creating LVM logical volumes 252

Growing LVM logical volumes 254

Mounting Filesystems 254

Supported filesystems 255

Enabling swap areas 257

Disabling swap area 258

Using the fstab file to define mountable filesystems 258

Using the mount command to mount filesystems 261

Mounting a disk image in loopback 262

Using the umount command 262

Using the mkfs Command to Create a Filesystem 263

Managing Storage with Cockpit 264

Summary 265

Exercises 266

Part IV: Becoming a Linux Server Administrator 267

Chapter 13: Understanding Server Administration 269

Getting Started with Server Administration 270

Step 1: Install the server 270

Step 2: Configure the server 272

Using configuration files 272

Checking the default configuration 272

Step 3: Start the server 272

Step 4: Secure the server 274

Password protection 274

Firewalls 274

TCP Wrappers 274

AppArmor 275

Security settings in configuration files 275

Step 5: Monitor the server 275

Configure logging 275

Run system activity reports 276

Watch activity live with Cockpit 276

Keep system software up to date 277

Check the filesystem for signs of crackers 277

Checking and Setting Servers 277

Managing Remote Access with the Secure Shell Service 277

Starting the openssh-server service 278

Using SSH client tools 278

Using ssh for remote login 279

Using SSH for remote execution 280

Copying files between systems with scp and rsync 281

Interactive copying with sftp 284

Using key-based (passwordless) authentication 285

Configuring System Logging 286

Enabling system logging with rsyslog 287

Understanding the rsyslog.conf file 287

Understanding log messages 289

Setting up and using a loghost with rsyslogd 289

Watching logs with logwatch 290

Checking System Resources with sar 291

Checking System Space 293

Displaying system space with df 293

Checking disk usage with du 294

Finding disk consumption with find 294

Managing Servers in the Enterprise 295

Summary 296

Exercises 296

Chapter 14: Administering Networking 299

Configuring Networking for Desktops 300

Checking your network interfaces 302

Checking your network from NetworkManager 302

Checking your network from Cockpit 303

Checking your network from the command line 304

Configuring network interfaces 308

Setting IP addresses manually 308

Setting IP address aliases 309

Setting routes 310

Configuring a network proxy connection 311

Configuring Networking from the Command Line 312

Configure networking with nmtui 312

Editing a NetworkManager TUI connection 313

Understanding networking configuration files 314

Other networking files 315

Setting alias network interfaces 318

Setting up Ethernet channel bonding 319

Setting custom routes 320

Configuring Networking in the Enterprise 321

Configuring Linux as a router 321

Configuring Linux as a DHCP server 322

Configuring Linux as a DNS server 322

Configuring Linux as a proxy server 323

Summary 323

Exercises 324

Chapter 15: Starting and Stopping Services 327

Understanding the Initialization Daemon (init or systemd) 328

Understanding the classic init daemons 329

Understanding systemd initialization 335

Learning systemd basics 335

Learning systemd's backward compatibility to SysVinit 341

Checking the Status of Services 343

Checking services for SysVinit systems 343

Stopping and Starting Services 346

Stopping and starting SysVinit services 346

Stopping a service with systemd 347

Starting a service with systemd 348

Restarting a service with systemd 348

Reloading a service with systemd 349

Enabling Persistent Services 350

Configuring persistent services for SysVinit 350

Enabling a service with systemd 351

Disabling a service with systemd 352

Configuring a Default Runlevel or Target Unit 353

Configuring the SysVinit default runlevel 353

Adding New or Customized Services 354

Adding new services to SysVinit 355

Step 1: Create a new or customized service script file 355

Step 2: Add the service script to /etc/rc.d/init.d 356

Step 3: Set appropriate permission on the script 357

Step 4: Add the service to runlevel directories 357

Adding new services to systemd 357

Step 1: Create a new or customized service configuration unit file 358

Step 2: Move the service configuration unit file 358

Step 3: Add the service to the Wants directory 359

Summary 360

Exercises 360

Chapter 16: Configuring a Print Server 363

Common UNIX Printing System 363

Setting Up Printers 365

Adding a printer automatically 365

Using web-based CUPS administration 366

Allow remote printing administration 367

Add a printer not automatically detected 367

Using the Print Settings window 368

Configuring local printers with the Print Settings window 369

Configuring remote printers 372

Adding a remote CUPS printer 373

Adding a remote UNIX (LDP/LPR) printer 373

Adding a Windows (SMB) printer 374

Working with CUPS Printing 375

Configuring the CUPS server (cupsd.conf) 375

Starting the CUPS server 376

Configuring CUPS printer options manually 377

Using Printing Commands 378

Printing with lp 378

Listing status with lpstat -t 379

Removing print jobs with cancel 379

Configuring Print Servers 380

Configuring a shared CUPS printer 380

Configuring a shared Samba printer 381

Understanding smb.conf for printing 382

Setting up SMB clients 382

Summary 383

Exercises 383

Chapter 17: Configuring a Web Server r 385

Understanding the Apache Web Server 385

Getting and Installing Your Apache Web Server 386

Controlling Apache 389

Securing Apache 389

Apache file permissions and ownership 389

Apache and firewalls 390

Apache and AppArmor 390

Understanding the Apache configuration files 393

Using directives 393

Understanding default settings 395

Adding a virtual host to Apache 398

Allowing users to publish their own web content 400

Securing your web traffic with TLS 401

Understanding how SSL is configured 402

Generating an SSL key and self-signed certificate 403

Generating a certificate signing request 405

Troubleshooting Your Web Server 406

Checking for configuration errors 406

Access forbidden and server internal errors 408

Summary 410

Exercises 410

Chapter 18: Configuring an FTP Server 413

Understanding FTP 413

Installing the vsftpd FTP Server 415

Controlling the vsftpd Service 416

Securing your FTP server 417

Integrating Linux file permissions with vsftpd 418

Configuring Your FTP Server 418

Setting up user access 418

Allowing uploading 419

Setting up vsftpd for the Internet 420

Using FTP Clients to Connect to Your Server 422

Accessing an FTP server from a browser 422

Accessing an FTP server with the lftp command 423

Using the gFTP client 425

Summary 426

Exercises 426

Chapter 19: Configuring a Windows File Sharing (Samba) Server r 429

Understanding Samba 429

Installing Samba 430

Controlling Samba 431

Viewing Samba processes 431

Configuring Samba 435

Configuring the [global] section 435

Configuring the [homes] section 437

Configuring the [printers] section 437

Creating a Samba shared folder 438

Checking the Samba share 438

Accessing Samba Shares 441

Accessing Samba shares in Linux 442

Accessing Samba shares from a Linux file manager 442

Mounting a Samba share from a Linux command line 442

Accessing Samba shares in Windows 444

Using Samba in the Enterprise 444

Summary 444

Exercises 445

Chapter 20: Configuring an NFS File Server 447

Installing an NFS Server 448

Starting the NFS Service 449

Sharing NFS Filesystems 450

Configuring the /etc/exports file 450

Hostnames in /etc/exports 451

Access options in /etc/exports 452

User mapping options in /etc/exports 453

Exporting the shared filesystems 454

Securing Your NFS Server 454

Using NFS Filesystems 455

Viewing NFS shares 456

Manually mounting an NFS filesystem 456

Mounting an NFS filesystem at boot time 457

Mounting noauto filesystems 458

Using mount options 458

Using autofs to mount NFS filesystems on demand 460

Automounting to the /net directory 460

Automounting home directories 461

Unmounting NFS Filesystems 463

Summary 464

Exercises 464

Chapter 21: Troubleshooting Linux 467

Boot-Up Troubleshooting 467

Understanding startup 468

Starting from the firmware (BIOS or UEFI) 469

Troubleshooting BIOS setup 470

Troubleshooting boot order 471

GRUB 2 boot loader 471

Starting the kernel 472

Troubleshooting the initialization system 474

Troubleshooting Software Packages 476

Troubleshooting Networking 479

Troubleshooting outgoing connections 479

View network interfaces 480

Check physical connections 480

Check routes 481

Check hostname resolution 482

Troubleshooting incoming connections 483

Check if the client can reach your system at all 483

Check if the service is available to the client 484

Check the service on the server 485

Troubleshooting Memory 485

Uncovering memory issues 486

Checking for memory problems 488

Dealing with memory problems 489

Summary 490

Exercises 490

Part V: Learning Linux Security Techniques 493

Chapter 22: Understanding Basic Linux Security y 495

Implementing Physical Security 495

Implementing disaster recovery 496

Securing user accounts 496

One user per user account 497

Limiting access to the root user account 497

Setting expiration dates on temporary accounts 497

Removing unused user accounts 498

Securing passwords 500

Choosing good passwords 500

Setting and changing passwords 501

Enforcing best password practices 502

Understanding the password files and password hashes 504

Securing the filesystem 506

Managing dangerous filesystem permissions 506

Securing the password files 507

Locking down the filesystem 508

Managing software and services 509

Updating software packages 509

Keeping up with security advisories 509

Advanced implementation 510

Monitoring Your Systems 510

Monitoring log files 510

Monitoring user accounts 512

Detecting counterfeit accounts and privileges 512

Detecting bad account passwords 514

Monitoring the filesystem 516

Verifying software packages 516

Scanning the filesystem 516

Detecting viruses and rootkits 518

Auditing and Reviewing Linux 521

Conducting compliance reviews 521

Conducting security reviews 522

Summary 522

Exercises 523

Chapter 23: Understanding Advanced Linux Security y 525

Implementing Linux Security with Cryptography 525

Understanding hashing 526

Understanding encryption/decryption 527

Understanding cryptographic ciphers 527

Understanding cryptographic cipher keys 527

Understanding digital signatures 533

Implementing Linux cryptography 535

Ensuring file integrity 535

Encrypting a Linux filesystem at installation 536

Encrypting a Linux directory 537

Encrypting a Linux file 540

Encrypting Linux with miscellaneous tools 540

Using Encryption from the Desktop 541

Implementing Linux Security with PAM 541

Understanding the PAM authentication process 542

Understanding PAM contexts 543

Understanding PAM control flags 544

Understanding PAM modules 545

Understanding PAM system event configuration files 545

Administering PAM on your Linux system 546

Managing PAM-aware application configuration files 546

Implementing resources limits with PAM 547

Implementing time restrictions with PAM 549

Enforcing good passwords with PAM 550

Encouraging sudo use with PAM 551

Obtaining more information on PAM 551

Summary 552

Exercises 552

Chapter 24: Enhancing Linux Security with AppArmor 553

Understanding AppArmor 553

Working with AppArmor 556

Summary 559

Exercises 560

Chapter 25: Securing Linux on a Network 561

Auditing Network Services 561

Evaluating access to network services with nmap 563

Using nmap to audit your network services' advertisements 566

Working with Firewalls 570

Understanding firewalls 571

Implementing firewalls 572

Starting with UFW 572

Understanding the iptables utility 574

Using the iptables utility 576

Summary 583

Exercises 583

Part VI: Engaging with Cloud Computing 585

Chapter 26: Shifting to Clouds and Containers 587

Understanding Linux Containers 588

Namespaces 589

Container registries 589

Base images and layers 590

Working with Linux Containers 590

Deploying LXD containers 590

Deploying Docker containers 593

Using containers in the enterprise 600

Summary 600

Exercises 600

Chapter 27: Deploying Linux to the Public Cloud 601

Running Linux in the Cloud Using cloud-init 601

Creating LXD Linux Images for Cloud Deployments 604

Working with LXD profiles 604

Working with LXD images 607

Using OpenStack to deploy cloud images 608

Using Amazon EC2 to Deploy Cloud Images 610

Installing the AWS CLI 611

Provisioning and launching an EC2 instance 613

Summary 618

Exercises 618

Chapter 28: Automating Apps and Infrastructure with Ansible 619

Understanding Ansible 620

Exploring Ansible Components 621

Inventories 621

Playbooks 622

Plays 622

Tasks 622

Modules 622

Roles, imports, and includes 623

Stepping Through an Ansible Deployment 623

Prerequisites 624

Setting up SSH keys to each node 624

Installing Ansible 626

Creating an inventory 626

Authenticating to the hosts 626

Creating a playbook 627

Run the playbook 628

Running Ad-Hoc Ansible Commands 629

Trying ad-hoc commands 629

Summary 631

Exercises 631

Chapter 29 Deploying Applications as Containers with Kubernetes 633

Understanding Kubernetes 634

Kubernetes masters 634

Kubernetes workers 635

Kubernetes applications 635

Kubernetes interfaces 636

Trying Kubernetes 636

Getting Kubernetes up and running 637

Deploying a Kubernetes application 638

Getting information on the deployment's pods 639

Exposing applications with services 643

Scaling up an application 644

Checking the load balancer 645

Scaling down an application 646

Deleting a service 646

Summary 647

Exercises 647

Appendix: Exercise Answers 649

Index 701

Om forfatteren

David Clinton is a Linux server administrator who has worked with IT infrastructure in academic and enterprise environments. He has taught video courses for Amazon Web Services, as well as other technologies. He is a co-author of AWS Certified Solutions Architect Study Guide: Associate (SAA-C01) Exam and AWS Certified Cloud Practitioner Study Guide: Foundational (CLF-C01) Exam.
Christopher Negus is a senior open source technical writer at Amazon Web Services. He has written dozens of books on Linux, including Red Hat Linux Bible, Linux Troubleshooting Bible and Linux Toys.