Table of Contents
Introduction
Licensing
Who This Book Is For
Those Wanting to Become Intermediate or Advanced Users
Sysadmins, Programmers, and DevOps
What This Book Contains
Conventions Used in This Book
Part I Getting Started
1 Installing Ubuntu and Post-Installation Configuration
Before You Begin the Installation
Researching Your Hardware Specifications
Installation Options
32-Bit vs 64-Bit Ubuntu
Planning Partition Strategies
The Boot Loader
Installing from DVD or USB Drive
Step-by-Step Installation
Installing
First Update
Shutting Down
Finding Programs and Files
Software Updater
The sudo
Command
Configuring Software Repositories
System Settings
Detecting and Configuring a Printer
Configuring Power Management in Ubuntu
Setting the Time and Date
Configuring Wireless Networks
Troubleshooting Post-Installation Configuration Problems
References
2 Background Information and Resources
What Is Linux?
Why Use Linux?
What Is Ubuntu?
Ubuntu for Business
Ubuntu in Your Home
Getting the Most from Ubuntu and Linux Documentation
Ubuntu Developers and Documentation
Websites and Search Engines
Web Search Tips
Google Is Your Friend
Ubuntu Package Listings
Commercial Support
Documentation
Linux Guides
Ubuntu
Mailing Lists
Ubuntu Project Mailing Lists
Internet Relay Chat
Part II Desktop Ubuntu
3 Working with Unity
Foundations and the X Server
Basic X Concepts
Using X
Elements of the xorg.conf
File
Starting X
Using a Display Manager
Changing Window Managers
Using Unity, a Primer
The Desktop
Customizing and Configuring Unity
Power Shortcuts
References
4 On the Internet
Getting Started with Firefox
Checking Out Google Chrome and Chromium
Choosing an Email Client
Mozilla Thunderbird
Evolution
Other Mail Clients
RSS Readers
Firefox
Liferea
Internet Relay Chat
Usenet Newsgroups
References
5 Productivity Applications
Introducing LibreOffice
Other Office Suites for Ubuntu
Working with GNOME Office
Working with KOffice
Other Useful Productivity Software
Working with PDF
Working with XML and DocBook
Working with LaTeX
Productivity Applications Written for Microsoft Windows
References
6 Multimedia Applications
Sound and Music
Sound Cards
Adjusting Volume
Sound Formats
Listening to Music
Graphics Manipulation
The GNU Image Manipulation Program
Using Scanners in Ubuntu
Working with Graphics Formats
Capturing Screen Images
Other Graphics Manipulation Options
Using Digital Cameras with Ubuntu
Handheld Digital Cameras
Using Shotwell Photo Manager
Burning CDs and DVDs in Ubuntu
Creating CDs and DVDs with Brasero
Creating CDs from the Command Line
Creating DVDs from the Command Line
Viewing Video
TV and Video Hardware
Video Formats
Viewing Video in Linux
Personal Video Recorders
Video Editing
References
7 Other Ubuntu Interfaces
Desktop Environment
KDE and Kubuntu
Xfce and Xubuntu
LXDE and Lubuntu
GNOME3 and Ubuntu GNOME
MATE and Ubuntu MATE
Ubuntu Kylin
References
8 Games
Ubuntu Gaming
Installing Proprietary Video Drivers
Steam
Installing Games in Ubuntu
Warsow
Scorched 3D
Frozen Bubble
SuperTux
Battle for Wesnoth
Frets on Fire
FlightGear
Speed Dreams
Games for Kids
Commercial Games
Playing Windows Games
References
Part III System Administration
9 Managing Software
Ubuntu Software
Using Synaptic for Software Management
Staying Up-to-Date
Working on the Command Line
Day-to-Day Usage
Finding Software
Using apt
Instead of apt-get
Compiling Software from Source
Compiling from a Tarball
Compiling from Source from the Ubuntu Repositories
Configuration Management
dotdee
Snappy Ubuntu Core
Using Snaps
References
10 Command-Line Beginner’s Class
What Is the Command Line?
Accessing the Command Line
Text-Based Console Login
Logging Out
Logging In and Out from a Remote Computer
User Accounts
Reading Documentation
Using Man Pages
Using apropros
Using whereis
Understanding the Linux File System Hierarchy
Essential Commands in /bin
and /sbin
Configuration Files in /etc
User Directories: /home
Using the Contents of the /proc
Directory to Interact with the Kernel
Working with Shared Data in the /usr
Directory
Temporary File Storage in the /tmp
Directory
Accessing Variable Data Files in the /var
Directory
Navigating the Linux File System
Listing the Contents of a Directory with ls
Changing Directories with cd
Finding Your Current Directory with pwd
Working with Permissions
Assigning Permissions
Directory Permissions
Altering File Permissions with chmod
File Permissions with umask
File Permissions with chgrp
Changing File Permissions with chown
Understanding Set User ID, Set Group ID, and Sticky Bit Permissions
Setting Permissions with Access Control Lists
Working with Files
Creating a File with touch
Creating a Directory with mkdir
Deleting a Directory with rmdir
Deleting a File or Directory with rm
Moving or Renaming a File with mv
Copying a File with cp
Displaying the Contents of a File with cat
Displaying the Contents of a File with less
Using Wildcards and Regular Expressions
Working as Root
Understanding and Fixing sudo
Creating Users
Deleting Users
Shutting Down the System
Rebooting the System
Commonly Used Commands and Programs
References
11 Command-Line Master Class Part 1
Why Use the Command Line?
Using Basic Commands
Printing the Contents of a File with cat
Changing Directories with cd
Changing File Access Permissions with chmod
Copying Files with cp
Printing Disk Usage with du
Using echo
Finding Files by Searching with find
Searches for a String in Input with grep
Paging Through Output with less
Creating Links Between Files with ln
Finding Files from an Index with locate
Listing Files in the Current Directory with ls
Listing System Information with lsblk
, lshw
, lsmod
, and lspci
Reading Manual Pages with man
Making Directories with mkdir
Moving Files with mv
Renaming Files with rename
Deleting Files and Directories with rm
Sorting the Contents of a File with sort
Printing the Last Lines of a File with tail
Printing the Location of a Command with which
Download Files with wget
References
12 Command-Line Master Class Part 2
Redirecting Output and Input
stdin
, stdout
, stderr
, and Redirection
Comparing Files
Finding Differences in Files with diff
Finding Similarities in Files with comm
Limiting Resource Use and Job Control
Listing Processes with ps
Listing Jobs with jobs
Running One or More Tasks in the Background
Moving Jobs to the Background or Foreground with bg
and fg
Printing Resource Usage with top
Setting Processes Priority with nice
Combining Commands
Pipes
Combining Commands with Boolean Operators
Running Separate Commands in Sequence
Process Substitution
Using Environment Variables
Using Common Text Editors
Working with nano
Working with vi
Working with emacs
Working with sed
and awk
Working with Compressed Files
Using Multiple Terminals with byobu
Polite System Reset Using REISUB
Fixing an Ubuntu System That Will Not Boot
Checking BIOS
Checking GRUB
Reinstalling GRUB
Using Recovery Mode
Reinstalling Ubuntu
Tips and Tricks
Running the Previous Command
Running Any Previous Command
Running a Previous Command that Started with Specific Letters
Running the Same Thing You Just Ran with a Different First Word
Viewing Your History and More
Doing Two or More Things
Using Shortcuts
Confining a Script to a Directory
Using Coreutils
Reading the Contents of the Kernel Ring Buffer with dmesg
References
13 Managing Users
User Accounts
The Super User/Root User
User IDs and Group IDs
File Permissions
Managing Groups
Group Listing
Group Management Tools
Managing Users
User Management Tools
Adding New Users
Monitoring User Activity on the System
Managing Passwords
System Password Policy
The Password File
Shadow Passwords
Managing Password Security for Users
Changing Passwords in a Batch
Granting System Administrator Privileges to Regular Users
Temporarily Changing User Identity with the su
Command
Granting Root Privileges on Occasion: The sudo
Command
Disk Quotas
Implementing Quotas
Manually Configuring Quotas
Related Ubuntu Commands
References
14 Automating Tasks and Shell Scripting
Scheduling Tasks
Using at
and batch
to Schedule Tasks for Later
Using cron
to Run Jobs Repeatedly
Using rtcwake
to Wake Your Computer from Sleep Automatically
Basic Shell Control
The Shell Command Line
Shell Pattern-Matching Support
Redirecting Input and Output
Piping Data
Background Processing
Writing and Executing a Shell Script
Running the New Shell Program
Storing Shell Scripts for System-Wide Access
Interpreting Shell Scripts Through Specific Shells
Using Variables in Shell Scripts
Assigning a Value to a Variable
Accessing Variable Values
Positional Parameters
A Simple Example of a Positional Parameter
Using Positional Parameters to Access and Retrieve Variables from the Command Line
Using a Simple Script to Automate Tasks
Built-In Variables
Special Characters
Using Double Quotes to Resolve Variables in Strings with Embedded Spaces
Using Single Quotes to Maintain Unexpanded Variables
Using the Backslash as an Escape Character
Using the Backtick to Replace a String with Output
Comparison of Expressions in pdksh
and bash
Comparing Expressions with tcsh
The for
Statement
The while
Statement
The until
Statement
The repeat
Statement (tcsh
)
The select
Statement (pdksh
)
The shift
Statement
The if
Statement
The case
Statement
The break
and exit
Statements
Using Functions in Shell Scripts
References
15 The Boot Process
Running Services at Boot
Beginning the Boot Loading Process
Loading the Linux Kernel
System Services and Runlevels
Runlevel Definitions
Booting into the Default Runlevel
Understanding init
Scripts and the Final Stage of Initialization
Controlling Services at Boot with Administrative Tools
Changing Runlevels
Troubleshooting Runlevel Problems
Starting and Stopping Services Manually
Using Upstart
systemd
Boot Repair
References
16 System-Monitoring Tools
Console-Based Monitoring
Using the kill
Command to Control Processes
Using Priority Scheduling and Control
Displaying Free and Used Memory with free
Disk Space
Disk Quotas
Checking Log Files
Rotating Log Files
Graphical Process and System Management Tools
System Monitor
Conky
Other
KDE Process- and System-Monitoring Tools
Enterprise Server Monitoring
Landscape
Other
References
17 Backing Up
Choosing a Backup Strategy
Why Data Loss Occurs
Assessing Your Backup Needs and Resources
Evaluating Backup Strategies
Making the Choice
Choosing Backup Hardware and Media
Removable Storage Media
CD-RW and DVD+RW/-RW Drives
Network Storage
Tape Drive Backup
Cloud Storage
Using Backup Software
tar:
The Most Basic Backup Tool
The GNOME File Roller
The KDE ark
Archiving Tool
Déjà Dup
Back In Time
Unison
Using the Amanda Backup Application
Alternative Backup Software
Copying Files
Copying Files Using tar
Compressing, Encrypting, and Sending tar
Streams
Copying Files Using cp
Copying Files Using mc
Using rsync
Version Control for Configuration Files
System Rescue
The Ubuntu Rescue Disc
Restoring the GRUB2 Boot Loader
Saving Files from a Nonbooting Hard Drive
References
18 Networking
Laying the Foundation: The localhost
Interface
Checking for the Availability of the Loopback Interface
Configuring the Loopback Interface Manually
Checking Connections with ping
, traceroute
, and mtr
Networking with TCP/IP
TCP/IP Addressing
Using IP Masquerading in Ubuntu
Ports
IPv6 Basics
Network Organization
Subnetting
Subnet Masks
Broadcast, Unicast, and Multicast Addressing
Hardware Devices for Networking
Network Interface Cards
Network Cable
Hubs and Switches
Routers and Bridges
Initializing New Network Hardware
Using Network Configuration Tools
Command-Line Network Interface Configuration
Network Configuration Files
Using Graphical Configuration Tools
Dynamic Host Configuration Protocol
How DHCP Works
Activating DHCP at Installation and Boot Time
DHCP Software Installation and Configuration
Using DHCP to Configure Network Hosts
Other Uses for DHCP
Wireless Networking
Support for Wireless Networking in Ubuntu
Advantages of Wireless Networking
Choosing from Among Available Wireless Protocols
Beyond the Network and onto the Internet
Common Configuration Information
Understanding PPP over Ethernet
Configuring a PPPoE Connection Manually
Configuring Dial-Up Internet Access
Troubleshooting Connection Problems
References
19 Remote Access with SSH, Telnet, and VNC
Setting Up a Telnet Server
Telnet Versus SSH
Setting Up an SSH Server
SSH Tools
Using scp
to Copy Individual Files Between Machines
Using sftp
to Copy Many Files Between Machines
Using ssh-keygen
to Enable Key-Based Logins
Virtual Network Computing
References
20 Securing Your Machines
Understanding Computer Attacks
Assessing Your Vulnerability
Protecting Your Machine
Securing a Wireless Network
Passwords and Physical Security
Configuring and Using Tripwire
Devices
Viruses
Configuring Your Firewall
AppArmor
Forming a Disaster Recovery Plan
References
21 Performance Tuning
Hard Disk
Using the BIOS and Kernel to Tune the Disk Drives
The hdparm
Command
File System Tuning
The tune2fs
Command
The e2fsck
Command
The badblocks
Command
Disabling File Access Time
Kernel
Apache
MySQL
Measuring Key Buffer Usage
Using the Query Cache
Miscellaneous Tweaks
Query Optimization
References
22 Kernel and Module Management
The Linux Kernel
The Linux Source Tree
Types of Kernels
Managing Modules
When to Recompile
Kernel Versions
Obtaining the Kernel Sources
Patching the Kernel
Compiling the Kernel
Using xconfig
to Configure the Kernel
Creating an Initial RAM Disk Image
When Something Goes Wrong
Errors During Compile
Runtime Errors, Boot Loader Problems, and Kernel Oops
References
Part IV Ubuntu as a Server
23 Sharing Files and Printers
Using the Network File System
Installing and Starting or Stopping NFS
NFS Server Configuration
NFS Client Configuration
Putting Samba to Work
Manually Configuring Samba with /etc/samba/smb.conf
Testing Samba with the testparm
Command
Starting, Stopping, and Restarting the smbd
Daemon
Mounting Samba Shares
Network and Remote Printing with Ubuntu
Creating Network Printers
Using the Common UNIX Printing System GUI
Avoiding Printer Support Problems
References
24 Apache Web Server Management
About the Apache Web Server
Installing the Apache Server
Starting and Stopping Apache
Runtime Server Configuration Settings
Runtime Configuration Directives
Editing apache2.conf
Apache Multiprocessing Modules
Using .htaccess
Configuration Files
File System Authentication and Access Control
Restricting Access with Require
Authentication
Final Words on Access Control
Apache Modules
mod_access
mod_alias
mod_asis
mod_auth
mod_auth_anon
mod_auth_dbm
mod_auth_digest
mod_autoindex
mod_cgi
mod_dir
and mod_env
mod_expires
mod_headers
mod_include
mod_info
and mod_log_config
mod_mime
and mod_mime_magic
mod_negotiation
mod_proxy
mod_rewrite
mod_setenvif
mod_speling
mod_status
mod_ssl
mod_unique_id
mod_userdir
mod_usertrack
mod_vhost_alias
Virtual Hosting
Address-Based Virtual Hosts
Name-Based Virtual Hosts
Logging
HTTPS
References
25 Nginx Web Server Management
About the Nginx Web Server
Installing the Nginx Server
Installing from the Ubuntu Repositories
Building the Source Yourself
Configuring the Nginx Server
Virtual Hosting
Setting Up PHP
Adding and Configuring Modules
HTTPS
References
26 Other HTTP Servers
lighttpd
Yaws
Cherokee
Jetty
thttpd
Apache Tomcat
References
27 Remote File Serving with FTP
Choosing an FTP Server
Choosing an Authenticated or Anonymous Server
Ubuntu FTP Server Packages
Other FTP Servers
Installing FTP Software
The FTP User
Configuring the Very Secure FTP Server
Controlling Anonymous Access
Other vsftpd
Server Configuration Files
Using the ftphosts
File to Allow or Deny FTP Server Connection
References
28 Handling Email
How Email Is Sent and Received
The Mail Transport Agent
Choosing an MTA
The Mail Delivery Agent
The Mail User Agent
Basic Postfix Configuration and Operation
Configuring Masquerading
Using Smart Hosts
Setting Message Delivery Intervals
Mail Relaying
Forwarding Email with Aliases
Using Fetchmail to Retrieve Mail
Installing Fetchmail
Configuring Fetchmail
Choosing a Mail Delivery Agent
Procmail
Spamassassin
Squirrelmail
Virus Scanners
Autoresponders
Alternatives to Microsoft Exchange Server
Microsoft Exchange Server/Outlook Client
CommuniGate Pro
Oracle Beehive
Bynari
Open-Xchange
Horde
References
29 Proxying, Reverse Proxying, and Virtual Private Networks (VPN)
What Is a Proxy Server?
Installing Squid
Configuring Clients
Access Control Lists
Specifying Client IP Addresses
Sample Configurations
Virtual Private Networks (VPN)
Setting Up a VPN Client
Setting Up a VPN Server
References
30 Administering Relational Database Services
A Brief Review of Database Basics
How Relational Databases Work
Understanding SQL Basics
Creating Tables
Inserting Data into Tables
Retrieving Data from a Database
Choosing a Database: MySQL Versus PostgreSQL
Speed
Data Locking
ACID Compliance in Transaction Processing to Protect Data Integrity
SQL Subqueries
Procedural Languages and Triggers
Configuring MySQL
Setting a Password for the MySQL Root User
Creating a Database in MySQL
Configuring PostgreSQL
Initializing the Data Directory in PostgreSQL
Creating a Database in PostgreSQL
Creating Database Users in PostgreSQL
Deleting Database Users in PostgreSQL
Granting and Revoking Privileges in PostgreSQL
Database Clients
SSH Access to a Database
Local GUI Client Access to a Database
Web Access to a Database
The MySQL Command-Line Client
The PostgreSQL Command-Line Client
Graphical Clients
References
31 NoSQL Databases
Key/Value Stores
Berkeley DB
Cassandra
Memcached and MemcacheDB
Redis
Riak
Document Stores
CouchDB
MongoDB
BaseX
Wide Column Stores
BigTable
HBase
Graph Stores
Neo4j
OrientDB
HyperGraphDB
FlockDB
References
32 Lightweight Directory Access Protocol (LDAP)
Configuring the Server
Creating Your Schema
Populating Your Directory
Configuring Clients
Evolution
Thunderbird
Administration
References
33 Linux Terminal Server Project (LTSP)
Requirements
Installation
Using LTSP
References
34 Virtualization on Ubuntu
KVM
VirtualBox
VMware
Xen
References
35 Ubuntu in the Cloud
Why a Cloud?
Software as a Service (SaaS)
Platform as a Service (PaaS)
Infrastructure as a Service (IaaS)
Metal as a Service (MaaS)
Before You Do Anything
Deploy/Install Basics: Public, Private, or Hybrid?
Ubuntu Cloud and OpenStack
Compute Infrastructure (Nova)
Storage Infrastructure (Swift)
Networking Service (Neutron)
Identity Service (Keystone)
Imaging Service (Glance)
Dashboard (Horizon)
Learning More
Juju
Getting Started
Charms
The Juju GUI
Juju Quickstart
Juju on Mac OS X and Windows
Mojo: Continuous Delivery for Juju
Snappy Ubuntu Core
Ubuntu Metal as a Service (MaaS)
Landscape
References
36 Managing Sets of Servers
Juju
Puppet
Chef
CFEngine
Ansible
Landscape
References
37 Name Serving with the Domain Name System (DNS)
Understanding Domain Names
DNS Servers
DNS Records
Setting Up a DNS Server with BIND
References
Part V Programming Linux
38 Using Programming Tools for Ubuntu
Programming with Linux
Using the C Programming Project Management Tools Provided with Ubuntu
Building Programs with make
Using Makefiles
Using the autoconf
Utility to Configure Code
Debugging Tools
Using the GNU C Compiler
Graphical Development Tools
Using the KDevelop Client
The Glade Client for Developing in GNOME
Use an IDE or SDK
References
39 Opportunistic Development
Version Control Systems
Managing Software Projects with Git
Managing Software Projects with Bazaar
Managing Software Projects with Subversion
Managing Software Projects with Mercurial
Introduction to Opportunistic Development
Launchpad
Ubuntu Make
Creating Snap Packages
Bikeshed and Other Tools
References
40 Helping with Ubuntu Development
Introduction to Ubuntu Development
Setting Up Your Development System
Install Basic Packages and Configure
Create a Launchpad Account
Set Up Your Environment to Work with Launchpad
Developing Apps and Scopes
Fixing Bugs and Packaging
Finding Bugs to Fix with Harvest
Masters of the Universe
References
41 Helping with Ubuntu Testing and QA
Community Teams
Ubuntu Testing Team
QA Team
Bug Squad
Test Drive
References
42 Using Popular Programming Languages
Ada
Clojure
COBOL
Dart
Elixir
Erlang
Forth
Go
Fortran
Groovy
Haskell
Java
JavaScript
Lisp
Lua
Mono
OCaml
Perl
PHP
Python
Ruby
Rust
Scala
Scratch
Vala
References
43 Beginning Mobile Development for Android
Introduction to Android
Hardware
Linux Kernel
Libraries
Android Runtime
Application Framework
Applications
Installing Android Studio
Install Android Studio
Install SDK Packages
Create Your First Application
References
44 Developing for Ubuntu Mobile/Touch
Install the SDK
Create Your First Application
References
Index
Bonus Chapters
45 Using Perl
Using Perl with Linux
Perl Versions
A Simple Perl Program
Perl Variables and Data Structures
Perl Variable Types
Special Variables
Operators
Comparison Operators
Compound Operators
Arithmetic Operators
Other Operators
Special String Constants
Conditional Statements: if/else
and unless
if
unless
Looping
for
foreach
while
until
last
and next
do ... while
and do ... until
Regular Expressions
Access to the Shell
Modules and CPAN
Code Examples
Sending Mail
Purging Logs
Posting to Usenet
One-Liners
Command-Line Processing
References
46 Using Python
Python on Linux
The Basics of Python
Numbers
More on Strings
Lists
Dictionaries
Conditionals and Looping
Functions
Object Orientation
Class and Object Variables
Constructors and Destructors
Class Inheritance
The Standard Library and the Python Package Index
References
47 Using PHP
Introduction to PHP
Entering and Exiting PHP Mode
Variables
Arrays
Constants
References
Comments
Escape Sequences
Variable Substitution
Operators
Conditional Statements
Special Operators
Switching
Loops
Including Other Files
Basic Functions
Strings
Arrays
Files
Miscellaneous
Handling HTML Forms
Databases
References