Ubuntu 18.04 Essentials: Learn to Install, Administer and Use Ubuntu 18.04 Systems
By Neil Smyth
()
About this ebook
Arguably one of the most highly regarded and widely used enterprise level operating systems available today is the Ubuntu 18.04 distribution. Not only is it considered to be among the most stable and reliable operating systems, it is also backed by the considerable resources and technical skills of Canonical, Ltd.
Ubuntu 18.04 Essentials i
Read more from Neil Smyth
iOS 17 App Development Essentials: Developing iOS 17 Apps with Xcode 15, Swift, and SwiftUI Rating: 0 out of 5 stars0 ratingsRocky Linux 9 Essentials: Learn to Install, Administer, and Deploy Rocky Linux 9 Systems Rating: 0 out of 5 stars0 ratingsJetpack Compose 1.3 Essentials: Developing Android Apps with Jetpack Compose 1.3, Android Studio, and Kotlin Rating: 0 out of 5 stars0 ratingsUbuntu 20.04 Essentials: A Guide to Ubuntu 20.04 Desktop and Server Editions Rating: 0 out of 5 stars0 ratingsJetpack Compose 1.6 Essentials: Developing Android Apps with Jetpack Compose 1.6, Android Studio, and Kotlin Rating: 5 out of 5 stars5/5Android Studio Development Essentials Rating: 5 out of 5 stars5/5Jetpack Compose 1.5 Essentials: Developing Android Apps with Jetpack Compose 1.5, Android Studio, and Kotlin Rating: 0 out of 5 stars0 ratingsAndroid 4.4 App Development Essentials Rating: 4 out of 5 stars4/5Android Studio Giraffe Essentials - Java Edition: Developing Android Apps Using Android Studio 2022.3.1 and Java Rating: 0 out of 5 stars0 ratingsRed Hat Enterprise Linux 9 Essentials: Learn to Install, Administer and Deploy RHEL 9 Systems Rating: 0 out of 5 stars0 ratingsBuilding iOS 17 Apps with Xcode Storyboards: Develop iOS 17 Apps with Xcode 15 and Swift Rating: 0 out of 5 stars0 ratingsUbuntu 22.04 Essentials: A Guide to Ubuntu 22.04 Desktop and Server Editions Rating: 0 out of 5 stars0 ratingsSwiftUI Essentials - iOS Edition: Learn to Develop iOS Apps Using SwiftUI, Swift 5 and Xcode 11 Rating: 0 out of 5 stars0 ratingsUbuntu 23.04 Essentials: A Guide to Ubuntu 23.04 Desktop and Server Editions Rating: 5 out of 5 stars5/5Android Studio Hedgehog Essentials - Kotlin Edition: Developing Android Apps Using Android Studio 2023.1.1 and Kotlin Rating: 0 out of 5 stars0 ratingsAndroid Studio Ladybug Essentials - Java Edition: Developing Android Apps Using Android Studio Ladybug and Java Rating: 0 out of 5 stars0 ratingsiOS 18 App Development Essentials: Developing iOS Apps with SwiftUI, Swift, and Xcode 16 Rating: 0 out of 5 stars0 ratingsCentOS 8 Essentials: Learn to Install, Administer and Deploy CentOS 8 Systems Rating: 0 out of 5 stars0 ratingsAndroid Studio Electric Eel Essentials - Kotlin Edition: Developing Android Apps Using Android Studio 2022.1.1 and Kotlin Rating: 0 out of 5 stars0 ratingsJetpack Compose 1.7 Essentials: Developing Android Apps with Jetpack Compose 1.7, Android Studio, and Kotlin Rating: 0 out of 5 stars0 ratingsAndroid Studio Iguana Essentials - Java Edition: Developing Android Apps Using Android Studio 2023.2.1 and Java Rating: 0 out of 5 stars0 ratingsiOS 16 App Development Essentials - UIKit Edition: Learn to Develop iOS 16 Apps with Xcode 14 and Swift Rating: 0 out of 5 stars0 ratingsAndroid Studio Hedgehog Essentials - Java Edition: Developing Android Apps Using Android Studio 2023.1.1 and Java Rating: 0 out of 5 stars0 ratingsAndroid Studio Electric Eel Essentials - Java Edition: Developing Android Apps Using Android Studio 2022.1.1 and Java Rating: 0 out of 5 stars0 ratingsAndroid Studio Koala Essentials - Java Edition: A guide to developing Android apps using Android Studio Koala Feature Drop and Java Rating: 0 out of 5 stars0 ratings
Related to Ubuntu 18.04 Essentials
Related ebooks
Jetpack Compose 1.5 Essentials: Developing Android Apps with Jetpack Compose 1.5, Android Studio, and Kotlin Rating: 0 out of 5 stars0 ratingsCentOS 8 Essentials: Learn to Install, Administer and Deploy CentOS 8 Systems Rating: 0 out of 5 stars0 ratingsCentOS Stream 9 Essentials: Learn to Install, Administer, and Deploy CentOS Stream 9 Systems Rating: 0 out of 5 stars0 ratingsMobile Python: Rapid prototyping of applications on the mobile platform Rating: 4 out of 5 stars4/5Virtualization Essentials Rating: 0 out of 5 stars0 ratingsMastering KVM Virtualization Rating: 5 out of 5 stars5/5Linux in Action Rating: 0 out of 5 stars0 ratingsAndroid Studio Hedgehog Essentials - Kotlin Edition: Developing Android Apps Using Android Studio 2023.1.1 and Kotlin Rating: 0 out of 5 stars0 ratingsOptimizing Visual Studio Code for Python Development: Developing More Efficient and Effective Programs in Python Rating: 0 out of 5 stars0 ratingsWindows Server 2012 Hyper-V Installation and Configuration Guide Rating: 0 out of 5 stars0 ratingsAndroid in Practice Rating: 0 out of 5 stars0 ratingsMastering Linux System Administration Rating: 0 out of 5 stars0 ratingsExtending Docker Rating: 0 out of 5 stars0 ratingsUltimate Git and GitHub for Modern Software Development Rating: 0 out of 5 stars0 ratingsModern PyQt: Create GUI Applications for Project Management, Computer Vision, and Data Analysis Rating: 0 out of 5 stars0 ratingsTroubleshooting OpenVPN Rating: 0 out of 5 stars0 ratingsNoSQL Essentials: Navigating the World of Non-Relational Databases Rating: 0 out of 5 stars0 ratingsPractical Threat Detection Engineering: A hands-on guide to planning, developing, and validating detection capabilities Rating: 0 out of 5 stars0 ratingsBSD UNIX Toolbox: 1000+ Commands for FreeBSD, OpenBSD and NetBSD Rating: 0 out of 5 stars0 ratingsTroubleshooting Ubuntu Server Rating: 0 out of 5 stars0 ratingsOpa Application Development Rating: 0 out of 5 stars0 ratingsMastering Linux Administration: Take your sysadmin skills to the next level by configuring and maintaining Linux systems Rating: 0 out of 5 stars0 ratingsvSphere Virtual Machine Management Rating: 0 out of 5 stars0 ratingsUltimate Cisco Collaboration Infrastructure for Enterprise Solutions Rating: 0 out of 5 stars0 ratingsNginx Troubleshooting Rating: 0 out of 5 stars0 ratingsIntelliJ IDEA Essentials Rating: 0 out of 5 stars0 ratingsOpenFlow Cookbook Rating: 5 out of 5 stars5/5Ultimate Certified Kubernetes Administrator (CKA) Certification Guide Rating: 0 out of 5 stars0 ratings
Operating Systems For You
Excel : The Ultimate Comprehensive Step-By-Step Guide to the Basics of Excel Programming: 1 Rating: 5 out of 5 stars5/5Hacking : The Ultimate Comprehensive Step-By-Step Guide to the Basics of Ethical Hacking Rating: 5 out of 5 stars5/5The Mac Terminal Reference and Scripting Primer Rating: 4 out of 5 stars4/5Linux: Learn in 24 Hours Rating: 5 out of 5 stars5/5Windows 11 For Dummies Rating: 0 out of 5 stars0 ratingsApple Card and Apple Pay: A Ridiculously Simple Guide to Mobile Payments Rating: 0 out of 5 stars0 ratingsMacBook Pro User Manual: 2022 MacBook Pro User Guide for beginners and seniors to Master Macbook Pro like a Pro Rating: 0 out of 5 stars0 ratingsmacOS Sonoma For Dummies Rating: 0 out of 5 stars0 ratingsBash Command Line Pro Tips Rating: 5 out of 5 stars5/5iPhone Unlocked Rating: 0 out of 5 stars0 ratingsTor Darknet Bundle: Master the Art of Invisibility Rating: 0 out of 5 stars0 ratingsWindows 11 All-in-One For Dummies Rating: 5 out of 5 stars5/5The Linux Command Line Beginner's Guide Rating: 4 out of 5 stars4/5Networking for System Administrators: IT Mastery, #5 Rating: 5 out of 5 stars5/5iPhone For Dummies Rating: 0 out of 5 stars0 ratingsLinux Command-Line Tips & Tricks Rating: 0 out of 5 stars0 ratingsHacking for Beginners: Mastery Guide to Learn and Practice the Basics of Computer and Cyber Security Rating: 0 out of 5 stars0 ratingsMake Your PC Stable and Fast: What Microsoft Forgot to Tell You Rating: 4 out of 5 stars4/5XDA Developers' Android Hacker's Toolkit: The Complete Guide to Rooting, ROMs and Theming Rating: 2 out of 5 stars2/5The Windows Command Line Beginner's Guide: Second Edition Rating: 4 out of 5 stars4/5Ultimate SwiftUI Handbook for iOS Developers: A complete guide to native app development for iOS, macOS, watchOS, tvOS, and visionOS Rating: 0 out of 5 stars0 ratingsUbuntu: 101 Tips & Tricks Rating: 0 out of 5 stars0 ratingsCompTIA Linux+ Study Guide: Exam XK0-004 Rating: 0 out of 5 stars0 ratingsPowerShell: A Beginner's Guide to Windows PowerShell Rating: 4 out of 5 stars4/5Linux for Beginners: Linux Command Line, Linux Programming and Linux Operating System Rating: 4 out of 5 stars4/5Raspberry Pi Cookbook for Python Programmers Rating: 0 out of 5 stars0 ratings
Reviews for Ubuntu 18.04 Essentials
0 ratings0 reviews
Book preview
Ubuntu 18.04 Essentials - Neil Smyth
Ubuntu 18.04 Essentials
Ubuntu 18.04 Essentials
ISBN-13: 978-1-951442-17-0
© 2020 Neil Smyth / Payload Media, Inc. All Rights Reserved.
This book is provided for personal use only. Unauthorized use, reproduction and/or distribution strictly prohibited. All rights reserved.
The content of this book is provided for informational purposes only. Neither the publisher nor the author offers any warranties or representation, express or implied, with regard to the accuracy of information contained in this book, nor do they accept any liability for any loss or damage arising from any errors or omissions.
This book contains trademarked terms that are used solely for editorial purposes and to the benefit of the respective trademark owner. The terms used within this book are not intended as infringement of any trademarks.
Rev: 1.0
Table of Contents
1. Introduction
1.1 Superuser Conventions
1.2 Opening a Terminal Window
1.3 Editing Files
1.4 Feedback
1.5 Errata
2. A Brief History of Linux
2.1 What exactly is Linux?
2.2 UNIX Origins
2.3 Who Created Linux?
2.4 The History of Ubuntu
2.5 What does the word Ubuntu
Mean?
2.6 Summary
3. Installing Ubuntu on a Clean Disk Drive
3.1 Ubuntu Installation Options
3.2 Server vs. Desktop Editions
3.3 Obtaining the Ubuntu Installation Media
3.4 Writing the ISO Installation Image to a USB Drive
3.4.1 Linux
3.4.2 macOS
3.4.3 Windows
3.5 Booting from the Ubuntu USB Image
3.6 Installing Ubuntu
3.7 Accessing the Ubuntu Desktop
3.8 Installing Updates
3.9 Displaying Boot Messages
3.10 Summary
4. Installing Ubuntu with the Network Installer
4.1 Network Installer Advantages
4.2 Obtaining the Network Installer Image
4.3 Booting from the Installer Image
4.4 Performing the Installation
4.5 Disk Partitioning
4.6 Software Collection Selection
4.7 Installing Software Collections After System Setup
4.8 Summary
5. Dual Booting Ubuntu with Windows
5.1 Beginning the Ubuntu Installation
5.2 Booting Ubuntu for the First Time
5.3 Changing the Default Boot Option
5.4 Accessing the Windows Partition from the Command-line
5.5 Accessing the Windows Partition from the Desktop
5.6 Summary
6. Allocating Windows Disk Partitions to Ubuntu
6.1 Unmounting the Windows Partition
6.2 Deleting the Windows Partitions from the Disk
6.3 Formatting the Unallocated Disk Partition
6.4 Mounting the New Partition
6.5 Editing the Boot Menu
6.6 Using GNOME Disks Utility
6.7 Summary
7. A Guided Tour of the GNOME 3 Desktop
7.1 Installing the GNOME Desktop
7.2 An Overview of the GNOME 3 Desktop
7.3 Launching Activities
7.4 Managing Windows
7.5 Using Workspaces
7.6 Calendar and Notifications
7.7 Desktop Settings
7.8 Customizing the Dash
7.9 Installing Ubuntu Software
7.10 Beyond Basic Customization
7.11 Summary
8. An Overview of the Ubuntu Cockpit Web Interface
8.1 An Overview of Cockpit
8.2 Installing and Enabling Cockpit
8.3 Accessing Cockpit
8.4 System
8.5 Logs
8.6 Storage
8.7 Networking
8.8 Accounts
8.9 Services
8.10 Applications
8.11 Virtual Machines
8.12 Software Updates
8.13 Terminal
8.14 Connecting to Multiple Servers
8.15 Summary
9. Using the Bash Shell on Ubuntu
9.1 What is a Shell?
9.2 Gaining Access to the Shell
9.3 Entering Commands at the Prompt
9.4 Getting Information about a Command
9.5 Bash Command-line Editing
9.6 Working with the Shell History
9.7 Filename Shorthand
9.8 Filename and Path Completion
9.9 Input and Output Redirection
9.10 Working with Pipes in the Bash Shell
9.11 Configuring Aliases
9.12 Environment Variables
9.13 Writing Shell Scripts
9.14 Summary
10. Managing Ubuntu Users and Groups
10.1 User Management from the Command-line
10.2 User Management with Cockpit
10.3 User Management using the Settings App
10.4 Summary
11. Ubuntu Software Package Management and Updates
11.1 Repositories
11.2 Managing Repositories with Software & Updates
11.3 Managing Packages with APT
11.4 Performing Updates
11.5 Enabling Automatic Updates
11.6 Enabling Livepatch
11.7 Summary
12. Configuring Ubuntu systemd Units
12.1 Understanding Ubuntu systemd Targets
12.2 Understanding Ubuntu systemd Services
12.3 Ubuntu systemd Target Descriptions
12.4 Identifying and Configuring the Default Target
12.5 Understanding systemd Units and Unit Types
12.6 Dynamically Changing the Current Target
12.7 Enabling, Disabling and Masking systemd Units
12.8 Working with systemd Units in Cockpit
12.9 Summary
13. Ubuntu Network Management
13.1 An Introduction to NetworkManager
13.2 Installing and Enabling NetworkManager
13.3 Basic nmcli Commands
13.4 Working with Connection Profiles
13.5 Interactive Editing
13.6 Configuring NetworkManager Permissions
13.7 Summary
14. Ubuntu Firewall Basics
14.1 Understanding Ports and Services
14.2 Securing Ports and Services
14.3 Ubuntu Services and iptables Rules
14.4 Well Known Ports and Services
14.5 Summary
15. Using gufw and ufw to Configure an Ubuntu Firewall
15.1 An Overview of gufw and ufw
15.2 Installing gufw on Ubuntu
15.3 Running and Enabling gufw
15.4 Creating a New Profile
15.5 Adding Preconfigured Firewall Rules
15.6 Adding Simple Firewall Rules
15.7 Adding Advanced Rules
15.8 Configuring the Firewall from the Command Line using ufw
15.9 Summary
16. Basic Ubuntu Firewall Configuration with firewalld
16.1 An Introduction to firewalld
16.1.1 Zones
16.1.2 Interfaces
16.1.3 Services
16.1.4 Ports
16.2 Checking firewalld Status
16.3 Configuring Firewall Rules with firewall-cmd
16.3.1 Identifying and Changing the Default Zone
16.3.2 Displaying Zone Information
16.3.3 Adding and Removing Zone Services
16.3.4 Working with Port-based Rules
16.3.5 Creating a New Zone
16.3.6 Changing Zone/Interface Assignments
16.3.7 Masquerading
16.3.8 Adding ICMP Rules
16.3.9 Implementing Port Forwarding
16.4 Managing firewalld using firewall-config
16.5 Summary
17. Configuring SSH Key-based Authentication on Ubuntu
17.1 An Overview of Secure Shell (SSH)
17.2 SSH Key-based Authentication
17.3 Setting Up Key-based Authentication
17.4 Installing and Starting the SSH Service
17.5 SSH Key-based Authentication from Linux and macOS Clients
17.6 Managing Multiple Keys
17.7 SSH Key-based Authentication from Windows 10 Clients
17.8 SSH Key-based Authentication using PuTTY
17.9 Generating a Private Key with PuTTYgen
17.10 Installing the Public Key for a Google Cloud Instance
17.11 Summary
18. Ubuntu Remote Desktop Access with Vino
18.1 Remote Desktop Access Types
18.2 Secure and Insecure Remote Desktop Access
18.3 Enabling Remote Desktop Access on Ubuntu
18.4 Connecting to the Shared Desktop
18.5 Connecting from Non-Linux Clients
18.6 Establishing a Secure Remote Desktop Session
18.7 Establishing a Secure Tunnel on Windows using PuTTY
18.8 Summary
19. Ubuntu Remote Desktop Access with VNC
19.1 Installing the GNOME Desktop Environment
19.2 Installing VNC on Ubuntu
19.3 Configuring the VNC Server
19.4 Starting the VNC Server
19.5 Connecting to a VNC Server
19.6 Summary
20. Displaying Ubuntu Applications Remotely (X11 Forwarding)
20.1 Requirements for Remotely Displaying Ubuntu Applications
20.2 Remotely Displaying an Ubuntu Application
20.3 Trusted X11 Forwarding
20.4 Compressed X11 Forwarding
20.5 Displaying Remote Ubuntu Apps on Windows
20.6 Summary
21. Using NFS to Share Ubuntu Files with Remote Systems
21.1 Ensuring NFS Services are running on Ubuntu
21.2 Configuring the Ubuntu Firewall to Allow NFS Traffic
21.3 Specifying the Folders to be Shared
21.4 Accessing Shared Ubuntu Folders
21.5 Mounting an NFS Filesystem on System Startup
21.6 Unmounting an NFS Mount Point
21.7 Accessing NFS Filesystems in Cockpit
21.8 Summary
22. Sharing Files between Ubuntu and Windows Systems with Samba
22.1 Accessing Windows Resources from the GNOME Desktop
22.2 Samba and Samba Client
22.3 Installing Samba on an Ubuntu System
22.4 Configuring the Ubuntu Firewall to Enable Samba
22.5 Configuring the smb.conf File
22.5.1 Configuring the [global] Section
22.5.2 Configuring a Shared Resource
22.5.3 Removing Unnecessary Shares
22.6 Creating a Samba User
22.7 Testing the smb.conf File
22.8 Starting the Samba and NetBIOS Name Services
22.9 Accessing Samba Shares
22.10 Accessing Windows Shares from Ubuntu
22.11 Summary
23. An Overview of Virtualization Techniques
23.1 Guest Operating System Virtualization
23.2 Hypervisor Virtualization
23.2.1 Paravirtualization
23.2.2 Full Virtualization
23.2.3 Hardware Virtualization
23.3 Virtual Machine Networking
23.4 Summary
24. Installing KVM Virtualization on Ubuntu
24.1 An Overview of KVM
24.2 KVM Hardware Requirements
24.3 Preparing Ubuntu for KVM Virtualization
24.4 Verifying the KVM Installation
24.5 Summary
25. Creating KVM Virtual Machines using Cockpit and virt-manager
25.1 Installing the Cockpit Virtual Machines Module
25.2 Creating a Virtual Machine in Cockpit
25.3 Starting the Installation
25.4 Creating a Virtual Machine using virt-manager
25.5 Starting the Virtual Machine Manager
25.6 Configuring the KVM Virtual System
25.7 Working with Storage Volumes and Storage Pools
25.8 Starting the KVM Virtual Machine
25.9 Summary
26. Creating KVM Virtual Machines with virt-install and virsh
26.1 Running virt-install to build a KVM Guest System
26.2 An Example Ubuntu virt-install Command
26.3 Starting and Stopping a Virtual Machine from the Command-Line
26.4 Creating a Virtual Machine from a Configuration File
26.5 Summary
27. Creating an Ubuntu KVM Networked Bridge Interface
27.1 Identifying the Network Management System
27.2 Getting the Netplan Network Settings
27.3 Creating a Netplan Network Bridge
27.4 Getting the Current Network Manager Settings
27.5 Creating a Network Manager Bridge from the Command-Line
27.6 Declaring the KVM Bridged Network
27.7 Using a Bridge Network in a Virtual Machine
27.8 Creating a Bridge Network using nm-connection-editor
27.9 Summary
28. Managing KVM using the virsh Command-Line Tool
28.1 The virsh Shell and Command-Line
28.2 Listing Guest System Status
28.3 Starting a Guest System
28.4 Shutting Down a Guest System
28.5 Suspending and Resuming a Guest System
28.6 Saving and Restoring Guest Systems
28.7 Rebooting a Guest System
28.8 Configuring the Memory Assigned to a Guest OS
28.9 Summary
29. An Introduction to Linux Containers
29.1 Linux Containers and Kernel Sharing
29.2 Container Uses and Advantages
29.3 Ubuntu Container Tools
29.4 The Docker Registry
29.5 Container Networking
29.6 Summary
30. Working with Containers on Ubuntu
30.1 Installing the Container Tools
30.2 Pulling a Container Image
30.3 Running the Image in a Container
30.4 Managing a Container
30.5 Saving a Container to an Image
30.6 Removing an Image from Local Storage
30.7 Removing Containers
30.8 Building a Container with Buildah
30.9 Summary
31. Setting Up an Ubuntu Web Server
31.1 Requirements for Configuring an Ubuntu Web Server
31.2 Installing the Apache Web Server Packages
31.3 Configuring the Firewall
31.4 Port Forwarding
31.5 Starting the Apache Web Server
31.6 Testing the Web Server
31.7 Configuring the Apache Web Server for Your Domain
31.8 The Basics of a Secure Web Site
31.9 Configuring Apache for HTTPS
31.10 Obtaining an SSL Certificate
31.11 Summary
32. Configuring an Ubuntu Postfix Email Server
32.1 The structure of the Email System
32.1.1 Mail User Agent
32.1.2 Mail Transfer Agent
32.1.3 Mail Delivery Agent
32.1.4 SMTP
32.1.5 SMTP Relay
32.2 Configuring an Ubuntu Email Server
32.3 Postfix Pre-Installation Steps
32.4 Firewall/Router Configuration
32.5 Installing Postfix on Ubuntu
32.6 Configuring Postfix
32.7 Configuring DNS MX Records
32.8 Starting Postfix on an Ubuntu System
32.9 Testing Postfix
32.10 Sending Mail via an SMTP Relay Server
32.11 Summary
33. Adding a New Disk Drive to an Ubuntu System
33.1 Mounted File Systems or Logical Volumes
33.2 Finding the New Hard Drive
33.3 Creating Linux Partitions
33.4 Creating a File System on a Disk Partition
33.5 An Overview of Journaled File Systems
33.6 Mounting a File System
33.7 Configuring Ubuntu to Automatically Mount a File System
33.8 Adding a Disk Using Cockpit
33.9 Summary
34. Adding a New Disk to an Ubuntu Volume Group and Logical Volume
34.1 An Overview of Logical Volume Management (LVM)
34.1.1 Volume Group (VG)
34.1.2 Physical Volume (PV)
34.1.3 Logical Volume (LV)
34.1.4 Physical Extent (PE)
34.1.5 Logical Extent (LE)
34.2 Getting Information about Logical Volumes
34.3 Adding Additional Space to a Volume Group from the Command-Line
34.4 Summary
35. Adding and Managing Ubuntu Swap Space
35.1 What is Swap Space?
35.2 Recommended Swap Space for Ubuntu
35.3 Identifying Current Swap Space Usage
35.4 Adding a Swap File to an Ubuntu System
35.5 Adding Swap as a Partition
35.6 Adding Space to an Ubuntu LVM Swap Volume
35.7 Adding Swap Space to the Volume Group
35.8 Summary
36. Ubuntu System and Process Monitoring
36.1 Managing Processes
36.2 Real-time System Monitoring with htop
36.3 Command-Line Disk and Swap Space Monitoring
36.4 Summary
Index
1. Introduction
Ubuntu is arguably one of the most highly regarded and widely used Linux distributions available today. Praised both for its ease of use and reliability, Ubuntu also has a loyal following of Linux users and an active community of developers.
Ubuntu 18.04 Essentials is designed to provide detailed information on the installation, use and administration of the Ubuntu 18.04 distribution. For beginners, the book covers topics such as operating system installation, the basics of the GNOME desktop environment, configuring email and web servers and installing packages and system updates. Additional installation topics such as dual booting with Microsoft Windows are also covered, together with all important security topics such as configuring a firewall and user and group administration.
For the experienced user, topics such as remote desktop access, the Cockpit web interface, logical volume management (LVM), disk partitioning, swap management, KVM virtualization, Secure Shell (SSH), Linux Containers and file sharing using both Samba and NFS are covered in detail to provide a thorough overview of this enterprise class operating system.
1.1 Superuser Conventions
Ubuntu, in common with Linux in general, has two types of user account, one being a standard user account with restricted access to many of the administrative files and features of the operating system, and the other a superuser (root) account with elevated privileges. Typically, a user can gain root access either by logging in as the root user, or using the su - command and entering the root password. In the following example, a user is gaining root access via the su - command:
[neil@demo-server ~]$ su -
Password:
[root@demo-server ~]#
Note that the command prompt for a regular user ends with a $ sign while the root user has a # character. When working with the command-line, this is a useful indication as to whether or not you are currently issuing commands as the root user.
If the su - command fails, the root account on the system has most likely been disabled for security reasons. In this case, the sudo command can be used instead as outlined below.
Alternatively, a single command requiring root privileges may be executed by a non-root user via the sudo command. Consider the following attempt to update the operating system with the latest patches and packages:
$ apt update
Reading package lists... Done
E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)
Optionally, user accounts may be configured so that they have access to root level privileges. Instead of using the su - command to first gain root access, user accounts with administration privileges are able to run otherwise restricted commands using sudo.
$ sudo apt update
[sudo] password for demo:
Hit:1 http://us.archive.ubuntu.com/ubuntu bionic InRelease
.
.
To perform multiple commands without repeatedly using the sudo command, a command prompt with persistent super-user privileges may be accessed as follows:
[neil@demo-server]$ sudo su -
[neil@demo-server]#
The reason for raising this issue so early in the book is that many of the command-line examples outlined in this book will require root privileges. Rather than repetitively preface every command-line example with directions to run the command as root, the command prompt at the start of the line will be used to indicate whether or not the command needs to be performed as root. If the command can be run as a regular user, the command will be prefixed with a $ command prompt as follows:
$ date
If, on the other hand, the command requires root privileges, the command will be preceded by a # command prompt:
# apt install openssh-server
1.2 Opening a Terminal Window
If you are running Ubuntu with the GNOME desktop and need to access a command-prompt you will need to open a terminal window. This can be achieved by right-clicking on the desktop background and selecting the Open Terminal menu option as shown in Figure 1-1:
Figure 1-1
A terminal window may also be opened within the GNOME desktop using the Ctrl-Alt-T keyboard accelerator.
1.3 Editing Files
Configuring a Linux system typically involves editing files. For those new to Linux it can be unclear which editor to use. If you are running a terminal session and do not already have a preferred editor we recommend using the nano editor. To launch nano in a terminal window simply enter the following command:
# nano
Where
# nano /etc/passwd
Once loaded, nano will appear as illustrated in Figure 1-2:
Figure 1-2
To create a new file simply run nano as follows:
# nano
When you have finished editing the file, type Ctrl-S to save the file followed by Ctrl-X to exit. To open an existing file, use the Ctrl-R keyboard shortcut.
If you prefer to use a graphical editor within the GNOME desktop environment gedit is a useful starting point for basic editing tasks. To launch gedit from the desktop press Alt-F2 to display the Enter a Command window as shown in Figure 1-3:
Figure 1-3
Enter gedit into the text field and press the Enter key. After a short delay, gedit will load ready to open, create and edit files:
Figure 1-4
Alternatively, launch gedit from a terminal window either with or without the path to the file to open:
# gedit
# gedit /etc/passwd
1.4 Feedback
We want you to be satisfied with your purchase of this book. If you find any errors in the book, or have any comments, questions or concerns please contact us at [email protected].
1.5 Errata
While we make every effort to ensure the accuracy of the content of this book, it is inevitable that a book covering a subject area of this size and complexity may include some errors and oversights. Any known issues with the book will be outlined, together with solutions, at the following URL:
https://www.ebookfrenzy.com/errata/ubuntu1804.html
In the event that you find an error not listed in the errata, please let us know by emailing our support team at [email protected].
2. A Brief History of Linux
Ubuntu Linux is one of a number of variants (also referred to as distributions) of the Linux operating system and is the product of a U.K. company named Canonical Ltd. The company was founded in 1994 by Mark Shuttleworth. The origins of Linux, however, go back even further. This chapter will outline the history of both the Linux operating system and Ubuntu.
2.1 What exactly is Linux?
Linux is an operating system in much the same way that Windows is an operating system (and there any similarities between Linux and Windows end). The term operating system is used to describe the software that acts as a layer between the hardware in a computer and the applications that we all run on a daily basis. When programmers write applications, they interface with the operating system to perform such tasks as writing files to the hard disk drive and displaying information on the screen. Without an operating system, every programmer would have to write code to directly access the hardware of the system. In addition, the programmer would have to be able to support every single piece of hardware ever created to be sure the application would work on every possible hardware configuration. Because the operating system handles all of this hardware complexity, application development becomes a much easier task. Linux is just one of a number of different operating systems available today.
2.2 UNIX Origins
To understand the history of Linux, we first have to go back to AT&T Bell Laboratories in the late 1960s. During this time AT&T had discontinued involvement in the development of a new operating system named Multics. Two AT&T engineers, Ken Thompson and Dennis Ritchie, decided to take what they had learned from the Multics project and create a new operating system named UNIX which quickly gained popularity and wide adoption both with corporations and academic institutions.
A variety of proprietary UNIX implementations eventually came to market including those created by IBM (AIX), Hewlett-Packard (HP-UX) and Sun Microsystems (SunOS and Solaris). In addition, a UNIX-like operating system named MINIX was created by Andrew S. Tanenbaum designed for educational use with source code access provided to universities.
2.3 Who Created Linux?
The origins of Linux can be traced back to the work and philosophies of two people. At the heart of the Linux operating system is something called the kernel. This is the core set of features necessary for the operating system to function. The kernel manages the system’s resources and handles communication between the hardware and the applications. The Linux kernel was developed by Linus Torvalds who, taking a dislike to MS-DOS, and impatient for the availability of MINIX for the new Intel 80386 microprocessor, decided to write his own UNIX-like kernel. When he had finished the first version of the kernel, he released it under an open source license that enabled anyone to download the source code and freely use and modify it without having to pay Linus any money.
Around the same time, Richard Stallman at the Free Software Foundation, a strong advocate of free and open source software, was working on an open source operating system of his own. Rather than focusing initially on the kernel, however, Stallman decided to begin by developing open source versions of all the UNIX tools, utilities and compilers necessary to use and maintain an operating system. By the time he had finished developing this infrastructure it seemed like the obvious solution was to combine his work with the kernel Linus had written to create a full operating system. This combination became known as GNU/Linux. Purists insist that Linux always be referred to as GNU/Linux (in fact, at one time, Richard Stallman refused to give press interviews to any publication which failed to refer to Linux as GNU/Linux). This is not unreasonable given that the GNU tools developed by the Free Software Foundation make up a significant and vital part of GNU/Linux. Unfortunately, most people and publications simply refer to Linux as Linux and this will probably always continue to be the case.
2.4 The History of Ubuntu
As mentioned previously, Ubuntu is one of a number of Linux distributions. The source code that makes up the Ubuntu distribution originates from a highly regarded Linux distribution known as Debian created Ian Murdoch.
A South African internet mogul named Mark Shuttleworth (who made his fortune selling his company to VeriSign for around $500 million) decided it was time for a more user friendly Linux. He took the Debian distribution and worked to make it a more human friendly distribution which he called Ubuntu. He subsequently formed a company called Canonical Ltd to promote and provide support for Ubuntu.
If you are new to Linux, or already use Linux and want to try a different Linux distribution it is unlikely you will find a better option than Ubuntu.