Installing Ubuntu and Post-Installation Configuration

Not that long ago, the mere mention of installing Linux struck fear into the hearts of mortal men. Thanks to a cam- paign of fear, uncertainty, and doubt (commonly referred to as FUD), Linux garnered a reputation as something of an elitist operating system that could be installed, configured, and used only by extreme computer geeks and profession- als. Nowadays, it is a different story entirely, and Ubuntu is one of the easiest Linux distributions (distros) to install. This tutorial covers how to get started with an install disc, including booting from an Ubuntu Live DVD or USB drive to test your system. The tutorial then covers the actual installation of Ubuntu, looking at the various options avail- able. The whole process is pain free with Ubuntu, as you are about to learn.

This tutorial covers installation on a typical desktop or lap-top computer system.

Before You Begin the Installation

Installing a new operating system is a major event, and you should make sure that you have properly thought through what is going to take place. The first thing to consider is how the hardware will be affected by the software that you propose to install. Although Ubuntu runs well on a variety of hardware, checking your hardware components is worthwhile because some bits of hardware do not work well with Ubuntu. This section provides some areas for you to investigate and think about; it might even save you hours of frustration when something goes wrong. Problems are becoming much less frequent, but they still crop up occasionally.

You start by researching and documenting your hardware. This information will prove helpful later on, during the installation.

Researching Your Hardware Specifications

At the absolute minimum, you should know the basics of your system, such as how much RAM you have installed and what type of mouse, keyboard, and monitor you have. Knowing the storage capacity and type of hard drive you have is important because it helps you plan how you will divide it for Ubuntu and troubleshoot if problems occur. A small detail, such as whether your mouse uses the USB or PS/2 interface, ensures proper pointer configuration—something that should happen without any problem, but you will be glad you know it in case something does go wrong. The more information you have, the better prepared you are for any problems.

At the absolute minimum, you should know the basics of your system, such as how much RAM you have installed and what type of mouse, keyboard, and monitor you have. Knowing the storage capacity and type of hard drive you have is important because it helps you plan how you will divide it for Ubuntu and troubleshoot if problems occur. A small detail, such as whether your mouse uses the USB or PS/2 interface, ensures proper pointer configuration—something that should happen without any problem, but you will be glad you know it in case something does go wrong. The more information you have, the better prepared you are for any problems.

DVD INSTALLATION JUMP START
To install Ubuntu Desktop from an install disc, you should first test whether your system is compatible by running Ubuntu from the DVD live. In general, a system must have at least a 2GHz dual-core processor, 25GB of hard drive space, 2GiB RAM, and a monitor with a display resolution of at least 1024×768. You also need a DVD drive or USB stick, memory card, or external drive for the installer media. Internet access is not required but is very helpful and strongly recommended. See https://help.ubuntu.com/community/ Installation/SystemRequirements for a more detailed list of requirements.

Installation Options

Ubuntu is made available in two main forms: the Desktop DVD and the Server install DVD. (This list does not include derivative distributions like Kubuntu or Lubuntu or less commonly used methods such as the network install disk.) For most people, the Desktop DVD is what you want. The Server install DVD can get a LAMP (Linux, Apache, MySQL, and PHP) server up and running in about 20 minutes, but, as you learn in this tutorial, all these components are available to the Ubuntu default distribution. An ISO image contains the entire contents of a CD or DVD in a single file that can be used as if it were a CD or DVD and that can be burned to a physical CD or DVD if desired; see tutorial 7, “Multimedia Applications,” to learn how to burn CDs and DVDs in Ubuntu. You can find a list of the currently available ISO images in a couple of places. The place that is best for most people to download from is www.ubuntu.com/download, which includes a nice graphical menu system and links to easyto-read information and detailed instructions. Those with more specific requirements, such as a desire to use one of the official alternative Ubuntu versions, like Kubuntu or Lubuntu, can find what they need by navigating the menus at https://cdimage.ubuntu.com.

OFFICIAL UBUNTU FLAVORS

Ubuntu has several official variants, called flavors, as follows:

  • Ubuntu
  • Kubuntu
  • Lubuntu
  • Ubuntu Budgie
  • Ubuntu Kylin
  • Ubuntu Mate
  • Ubuntu Studio
  • Xubuntu

Almost everything in this tutorial applies to any of these flavors. The exceptions include GUI-specific content, such as GNOME-specific descriptions, and content that refers to programs not installed by default, such as many of the server and programming options. For more information about Ubuntu flavors, see https://wiki.ubuntu.com/UbuntuFlavors.

To install via a USB thumb drive (one that holds at least 2GB), download the ISO image you need. You also need to download a program that enables you to use this image to create a bootable USB drive. For Windows, try Universal USB Installer (www.pendrivelinux.com/ universal-usb-installer-easy-as-1-2-3/) or ISO Recorder (https://isorecorder.alexfeinman.com/) and follow the instructions given by the authors. For macOS, use Disk Utility to erase and format the USB drive and Etcher (www.balena.io/etcher/) to write. For Ubuntu, use the installed Startup Disk Creator program available in the default install. After the ISO is written to the USB drive, use it as you follow the installation instructions in this section. To install using a DVD that you create, download the ISO image you need from www.ubuntu.com/download or https://cdimage.ubuntu.com. You need to download a program to enable you to burn this image to physical media. For Windows, try either InfraRecorder (https://infrarecorder.org) or ISO Recorder (https://isorecorder.alexfeinman.com/) and follow the instructions given by the authors. For macOS, you can use Apple’s Disk Utility, which is installed by default. For Ubuntu, right-click the icon for an ISO image and select Write to Disc. After the DVD is created, use it as you follow the installation instructions in this section.

UBUNTU ON MAC HARDWARE
There are sometimes problems installing Ubuntu on Mac hardware. Apple designs and configures its devices with the intent that only its own software should be run on its hardware. Be warned if you want to try to install Ubuntu or anything else on Mac hardware: Here be dragons. It can work, but be prepared to search the web and maybe ask questions in some of the places listed in tutorial 2, “Background Information and Resources.” In addition, it is not currently possible to install Ubuntu or any Linux distro on modern Mac computers that have the Apple T2 storage controller because there is no Linux driver available for that hardware.

32-Bit Versus 64-Bit Ubuntu

Starting with Ubuntu 20.04 LTS, Ubuntu is only officially releasing a 64-bit version. However, we are keeping this section for the moment for those using an older release on older hardware. Nearly all consumer and enterprise hardware released in the last 15+ years is 64-bit, the exception being in specific categories using specific processors (certain embedded applications on ARM or Atom chips, for example), which are not the focus for pretty much anyone reading this tutorial. If you have special needs like these, you may need to contact Canonical for ideas and support and may just be out of luck with Ubuntu.

All users who can use it are better off using the 64-bit version of Ubuntu. The main difference has to do with how a computer processor is able to register and use memory, but speed is also a factor. Here is why.

A computer with a 32-bit processor will be able to use a maximum of 4GB of memory (actually a bit less, but this is a more practical-focused tutorial and not a computer science text, so the approximation is close enough for our uses; and yes, there are exceptions such as when using physical address extension (PAE), but this is a reasonable general rule for those just getting started). A computer with a 64-bit processor will be able to use up to a theoretical limit of 17 billion GB. More memory addresses means that you can store more data in RAM, which is much faster than processing it while reading from and writing to disks or other storage media.

If you are dealing with large amounts of data, this is a huge benefit. Processing audio or video, manipulating large databases of weather data, or playing 3D video games will be much smoother. It will also happen faster.

Speed is increased for another reason. When you have more memory addresses, it is kind of like when the supermarket has more checkout lines open. You can process more operations simultaneously. As a result of the extra capacity, variables and arrays in programs are processed more efficiently, function arguments are passed more easily, and even new data models are available for programmers and languages to use.

This requires some adaptation. Programs written for 32-bit operating systems must generally be adapted to take advantage of the capabilities of 64-bit processors. Although it is (usually, or at least often) possible to run 32-bit programs on a 64-bit processor, doing so is not always advantageous. However, in the Linux world, including Ubuntu, most software has been refactored and recompiled to take advantage of 64-bit processors and their capabilities. Software written for 64-bit processors is not backward compatible with 32-bit processors.

This requires some adaptation. Programs written for 32-bit operating systems must generally be adapted to take advantage of the capabilities of 64-bit processors. Although it is (usually, or at least often) possible to run 32-bit programs on a 64-bit processor, doing so is not always advantageous. However, in the Linux world, including Ubuntu, most software has been refactored and recompiled to take advantage of 64-bit processors and their capabilities. Software written for 64-bit processors is not backward compatible with 32-bit processors.

If you browse to https://ubuntu.com/releases, you will find downloadable .iso files that will allow you to create a DVD from which you can boot/install Ubuntu.

If you are using a moder consumer- or enterprise-focused processor (for example, AMD Ryzen, Intel Core i3/5/7/9, or Xeon) you are all set.

Planning Partition Strategies

Partitioning is a topic that can make novice Linux users nervous. Coming from a Microsoft world, where you might be used to having just one hard drive, it can seem a bit strange to use an operating system that makes partitioning a hard drive possible or even preferable and common.

Depending on your needs, you can opt to have a single large partition to contain everything, which is the official recommendation of the Ubuntu community and developers. You might prefer to segment your installation across several partitions if you have advanced knowledge and specific needs.

If you are installing Ubuntu in a corporate or business environment, the needs of the business should be a primary concern. Be careful to ensure that you build in an adequate upgrade path that allows you to extend the life of the system and add any additional storage or memory. Knowing how software is placed on your hard drive for Linux involves knowing how Ubuntu organizes its file system. This knowledge helps you make the most of hard drive space. In some instances, such as when you’re planning to have user directories mounted via NFS or other means, this information can help head off data loss, increase security, and accommodate future needs. Create a great system, and you’ll be the hero of information services. The Linux file system is covered along with commands to manipulate files and directories in tutorial 10, “Command-Line Beginner’s Class.”

To plan the best partitioning scheme, research and know the answers to these questions:

  • How much disk space does your system require?
  • Do you expect your disk space needs to grow significantly in the future?
  • Will the system boot only Ubuntu, or do you need a dual-boot system?
  • How much data requires backup, and what backup system will work best? (See tutorial 17, “Backing Up,” for more information about backing up your system.)

The Boot Loader

If your system does not have a UEFI BIOS, then during installation, Ubuntu automatically installs GRUB2 (Grand Unified Boot Loader) to the Master Boot Record (MBR) or to the GPT (GUID Partition Table) of your hard drive. Handily enough, it also detects any other operating systems, such as Windows, and adds entries in GRUB2 as appropriate. If you have a specific requirement not to install GRUB2 to the MBR, you need to install using the Alternate disc, which enables you to specify the install location for GRUB2.

DUAL BOOT NOT RECOMMENDED, BUT YOU CAN TRY IT IF YOU WANT

If you are attempting to create a dual-boot system using both Windows and Ubuntu—a system in which multiple operating systems exist on the hard drive and the user selects which one to use at boot time—it depends on your system as to whether this is easy or difficult. For systems that do not have a UEFI BIOS, you should install Windows first because it will overwrite the MBR and ignore any other operating systems on the disk. Ubuntu also overwrites the MBR, but it does so in a way that creates a boot menu that includes all operating systems it detects on the disk. If you do have a UEFI system, then GRUB2 is installed as an EFI application on the EFI system partition, which makes dual booting much less painful and more reliable.

Either way, you can get dual-booting to work, but in the past few years options have arisen that are better for most people.

If you decide you must dual boot, make sure you have your Windows recovery media available and that you either already have enough free space on your hard drive or know how to shrink the existing Windows partition and create a new partition on the hard drive for Ubuntu. No support or instructions for doing this are given in this tutorial. If you need to use more than one operating system on the same hardware, this tutorial recommends virtualization.

Installing from DVD or USB Drive

On most PCs, the BIOS supports booting directly from a CD, DVD, or USB drive and enables you to set a specific order of devices (such as hard drive, CD-ROM, or USB) to search for bootable software. Turn on your PC and set its BIOS if required (usually accessed by pressing a function key or the Del key after powering on) and then insert your Ubuntu install media and boot to install Ubuntu.

UEFI
If you have hardware that is from 2010 or newer, it probably includes a firmware interface called UEFI. The Unified Extensible Firmware Interface is a specification that defines how an operating system and the hardware interact. It replaces the BIOS mentioned earlier, although some manufacturers and most end users continue to use the term BIOS, just for consistency over time, even when they are using UEFI. In the past, UEFI has also been known to cause problems when you try to install a different operating system than the default one it came with on one of these machines. The 64-bit version of Ubuntu is typically quite reliable in supporting installation regardless. However, if you encounter difficulties, see https://help.ubuntu.com/community/UEFI for assistance.

Step-by-Step Installation

This section describes a basic step-by-step installation of Ubuntu from an install DVD or USB drive you create yourself using an ISO image you downloaded and wrote to a disk or USB drive using the instructions provided earlier; just replace mentions of DVD with your install medium. The install process itself is fairly straightforward, and you should not encounter any real problems.

CAUTION
If you have anything at all on your computer that you want to save, back it up first. Installing an operating system has become easier to do, but it is still a major change. Your entire hard drive will be erased, and new information will be written to it. This is expected when installing Ubuntu to the entire hard drive, but it can even happen due to user error or gremlins (unexplained problems) when attempting a dual-boot installation. Back up anything you want to preserve. Save data and files to an external hard drive or other medium. You may even want to back up your entire operating system and current installation using something like Clonezilla (http://clonezilla.org). Whatever you do, go in with the perspective that everything currently on the computer will disappear. If this is okay, continue.

Having your computer connected to the Internet as you proceed is useful and recommended so that you can download updates while installing.

Installing

To get started, insert the install DVD into your drive and reboot your computer.

NOTICE
The installation process occasionally changes when new releases occur, but the overall idea is consistent. The screenshots you see here are probably accurate, but it is possible you may see a change or two. If you understand what you need to do, any changes should be trivial to you.

The initial screen offers a variety of languages for you to use during installation (see Figure 1.1) and two options. The Try Ubuntu option boots and runs Ubuntu from the DVD without making any changes to your system so that when you remove the DVD and reboot, everything will be as it was before. Install Ubuntu installs Ubuntu instead of your current operating system or alongside it (for dual-booting). Select Install Ubuntu to begin.

Figure 1.2 shows the Preparing to Install Ubuntu screen. If you select the two check boxes at the bottom, Ubuntu downloads extra software, such as multimedia codecs and any software updates that have been released since the disk was created, and includes them in the installation. Doing so is recommended.

Choose a language for the installation in this opening screen.
Figure 1.1: Choose a language for the installation in this opening screen.
Before proceeding, decide whether you want to download updates during 
        installation.
Figure 1.2: Before proceeding, decide whether you want to download updates during installation.

If other operating systems are found on your system, you are given the option to install Ubuntu alongside them or to erase them and use the whole disk for Ubuntu. See the dualboot note and backup warning earlier in this tutorial before continuing.

Next, as shown in Figure 1.3, you have the option either to erase and use the entire hard disk for your installation (recommended for people who are new to Linux and are nervous about partitioning a hard drive) or to specify partitions manually, which is not as difficult as it sounds. You also have the opportunity to have the entire Ubuntu installation encrypted; this is very secure, but if you lose your password, you are eternally out of luck, so choose wisely.

What do you want to do with your storage drive?
Figure 1.2: What do you want to do with your storage drive?
NOTE
More complex partitioning schemes might be useful for more complex systems, such as servers, especially when multiple hard drives are available. Read tutorial 10, “CommandLine Beginner’s Class,” for a quick discussion of the parts of the Linux file system to get an idea of parts of the file system that could benefit from residing on their own (or even multiple!) partitions or disks.

NOTE

Adding, formatting, and partitioning a hard drive can be done at any time, not only during installation. You should not try to modify a drive you are currently using, such as the one on which you have installed Ubuntu, because doing so could make the computer unusable, and you would have to start over. However, if you are adding a second drive or if you want to reformat a flash drive, partitioning the drive you’re using is a useful skill to know. In any case, this is an instance where the standard warning applies: Pay attention to what you are doing and know why you are doing it because this powerful tool both is useful and has the potential to cause you serious problems and data loss if used incorrectly.

The easiest and simplest method is to use GParted, which is a graphical partition manager. GParted is not installed by default, but it is available in the Ubuntu software repositories; see tutorial 9, “Managing Software,” if you need help installing it.

In addition to being useful for adding drives, GParted can also assist you in recovering from problems. You can run it after booting Ubuntu in a live session or running from a live CD or a USB drive. In this case, the system’s hard drives are not mounted, and you can manage them from the live session.

After you have made your partitioning selections, installation continues by asking about your current location; it helps you select the most appropriate keyboard layout for your system, based on that location and the most common language used there, and it asks you to enter your name, a username that you will use to log in to the system, and a password. You can even choose to encrypt your /home folder during the process.

A QUICK ASIDE ON PASSWORDS

When you create your password, be sure to remember what you entered. If you forget it, you cannot use your new system because you will not be able to log on to it.

When setting a password, the common advice is to make sure it has a mixture of letters and numbers to make it more secure. For instance, a good example of a historically recommended style of password is T1a5c0p. Although this might seem like garbage at first glance, you can remember it easily by thinking of the phrase This Is A Good Choice Of Password, shortened to Tiagcop, and substituting some of the letters with similar-looking numbers.

There are some reasons this might not be the best recommendation anymore because computer systems are much faster than they used to be. It is a true statement that the longer a password is, the harder it is to break. For this reason, the newest recommendation is to use a passphrase consisting of at least four words, perhaps something like green monkeys chortle often. There is no doubt that a password the length of four common words combined together would be harder to break than the T1a5c0p example. From that perspective, it seems like a no-brainer. On the other hand, a longer password that does not use any words found in a dictionary would be even better, but the problem here is that these passwords, and even the T1a5c0p example, can be hard to remember and may end up being written down on a sticky note next to the computer, perhaps even stuck to the monitor. That is worse, especially if you use good security and create a different password for every website and computer system that requires one.

One solution is to choose a really good password for your system, one that you will remember, like the four-word example or a long passphrase like PeanutButterandJelly $andwiches, and then create one more good password to use with a password manager program like KeePassX (available in the Ubuntu software repositories; see tutorial 9, “Managing Software,” for details on how to find and install it), which can generate long, completely random passwords for you and keep them in a list that can only be viewed by accessing your system and then accessing the program, both of which will use good passwords. Let’s get back to the installation.

While you are answering the questions asked by the installer, the Ubuntu install begins to copy files to your hard drive. Performing these tasks in parallel makes the process even faster than it used to be. When you have input all necessary information and as the installation completes, you see a series of information screens that are filled with interesting content about Ubuntu and are worth reading while you wait

When the process is complete, you are prompted to restart the computer. Do so and remove the install media when it is ejected. Then log in when the reboot is complete. That’s it.

In previous editions of this tutorial, this tutorial was longer and described a process that was sometimes confusing and fraught with peril. The Ubuntu developers deserve high praise for making the installation so incredibly easy and fast. The Linux kernel supports more hardware than ever before, and the Ubuntu kernel gurus (who make the decisions about what hardware modules to enable, among other things) do a great job, and most hardware works out of the box.

First Update

It used to be that the first thing you needed to do with your new system was update it to the latest package versions. You would do this mainly to ensure that you had the latest security updates available. Remember the first installation step, where we recommended checking the box to have software updates download during the installation process? If you did, the updates were acquired during the installation, and your system should already be up-to-the-minute current.

If you want to double-check that you have all the current versions of software and security updates installed, read tutorial 9 and tutorial 10 for more information.

Shutting Down

At some point, you are going to want to shut down your computer. As with most other things in Linux, there are different ways to do it. You can use the power icon located in the upper-right corner of your screen to access the power menu, shown in Figure 1.4.

Ubuntu power menu.
Figure 1.4: You can also lock the screen, access settings, and more from the power menu.

If you are working at the command line, you can immediately shut down your system by using the shutdown command, like this:

matthew@seymour:~$ sudo shutdown -h now

You can also use the shutdown command to restart your computer, as follows:

matthew@seymour:~$ sudo shutdown -r now

For new users, installing Ubuntu is the beginning of a new and highly rewarding journey on the path to learning Linux. For Ubuntu system administrators, the tasks ahead are to fine-tune the installation and to customize the server or user environment.

NOTE
Now that you have completed the primary task of installing Ubuntu, you can begin to customize your new operating system. This tutorial looks at getting up and running with Ubuntu. tutorial 3, “Foundations of the Linux GUI,” gives you a tour around the desktop. Next, this tutorial describes some basic administration tasks. By the end of this tutorial, you should feel comfortable enough to move on through the rest of the tutorial.

Finding Programs and Files

In the past, Ubuntu used a system of menus to guide users in searching for programs, but now there is an easier, faster way: Use search to find programs. You access search by clicking Activities at the upper left of the screen, and then start typing in the search box to find specific programs or documents on your system (see Figure 1.5). The desktop (also known as the GNOME user interface) is covered in more detail in tutorial 3.

Search is the place to find programs and files.
Figure 1.5: Search is the place to find programs and files.

Software Updater

Software Updater is covered in greater detail in tutorial 9, but it is worthy of a quick mention now so that from the start you can benefit from any available security and bug fixes. The easiest way to check for updates is to use Software Updater. Open Software Updater from search by typing software updater to search for it. When the window opens, Update Manager checks the Ubuntu software repositories to determine whether any updates are available. When it detects that new versions of installed software are available, it displays them in the window. Uncheck the check box next to any item if you don’t want to install that particular software update. Click Install Now to complete the process (see Figure 1.6). Software repositories are discussed later in this tutorial.

Search is the place to find programs and files.
Figure 1.6: Software Updater, showing available software updates.

Another way of updating your system is to use the command line. This is vital on servers that do not have a GUI installed, and it is sometimes quicker than using Software Updater on a desktop computer. I like to use the command line to manage all the computers on my home network because I can use Secure Shell (SSH) to connect to each from a terminal and perform updates from another room in the house; anyone using that computer is left undisturbed while I’m making updates. You find out how to connect using the command line in tutorial 19, “Remote Access with SSH and VNC.”

NOTE

In the second half of the “Software Updater” section and in “The sudo Command” section that follows, we introduce some commands that must be entered from the command line, also known as the terminal. Rather than a graphics-based user interface, the command line is a more traditional text-based user interface. tutorial 10, “Command-Line Beginner’s Class,” tutorial 11, “Command-Line Master Class, Part 1,” and tutorial 12, “Command-Line Master Class, Part 2,” cover this topic is much greater detail.

For now, the goal is to introduce you to the idea and let you know what can be done. You are not yet expected to know what a lot of this means.

To use the command line, open search and type terminal.


When you open the terminal, you are greeted with a prompt similar to the one here:

matthew@seymour:~$

A blinking cursor also displays. Ubuntu is awaiting your first command. Issue the following command:

matthew@seymour:~$ sudo apt update

This command tells the package management utility apt to check the Ubuntu repositories and look for any updates to your installed software. In a matter of seconds, Ubuntu completes all of this, and your screen should look something like this:

matthew@seymour:~$ sudo apt update
[sudo] password for matthew:
Hit:1 http://security.ubuntu.com bionic-security InRelease
Hit:2 http://us.archive.ubuntu.com bionic InRelease
Hit:3 http://us.archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit:4 http://us.archive.ubuntu.com/ubuntu bionic-backports InRelease
Reading package lists... Done
Building dependency tree
Reading state information... Done
Building dependency tree
Reading state information... Done
67 packages can be upgraded. Run 'apt list --upgradable' to see them.
matthew@seymour:~$

Upgrade your software by entering the following:

matthew@seymour:~$ sudo apt full-upgrade

Because you have already checked for updates, Ubuntu automatically knows to download and install only the packages it needs. The full-upgrade option works intelligently to ensure that any dependencies that are needed can be satisfied and will be installed, even if major changes are needed. You can also use the option upgrade, which isn’t as smart as full-upgrade, but it might be a better choice on a production server because upgrade does not make major changes to software installations. It only makes changes that are necessary for security and simple package updates. This allows the systems administrator more flexibility to keep up to date with security while keeping running setups otherwise unchanged.

The sudo Command

You will find as you work through this tutorial that Ubuntu relies on the sudo command while you work at the command line. This command is used in front of other commands to tell Ubuntu that you want to run the specified command with super user powers. This sounds really special, and it actually is. When you work using the sudo command, you can make wide-ranging changes to your system that affect the way it runs. Be extra careful when running any command prefixed with sudo, however; a wrong option or an incorrect command can have devastating consequences.

The use of sudo is straightforward. All you have to do is enter it like this:

matthew@seymour:~$ sudo command commandoptions

Just replace the word command with the command you want to run and commandoptions with any options. For example, the following command opens your xorg.conf file in vi and enables you to make any changes as the super user before being able to save it:

matthew@seymour:~$ sudo vi /etc/X11/xorg.conf

Whenever you execute a command using sudo, you are prompted for your password. This is the same password that you use to log in to Ubuntu, so it is important that you remember it.

Sometimes, however, you might want to work with a classic root prompt instead of having to type sudo in front of every command (if you have to work with lots of commands at the command line that require super user access, for example). sudo enables you to do this by using the sudo -i command. Again, you are prompted for your password, which you should enter, after which Ubuntu gives you the standard root prompt, as follows:

matthew@seymour:~#

From here, you can execute any command without having to keep entering sudo.

WARNING
Working from the root prompt can be really dangerous unless you know what you are doing. Until you are experienced, we recommend that you stick to using sudo, which is covered in more detail in tutorial 10.

Configuring Software Repositories

Ubuntu uses software repositories to get information about available software that can be installed on your system. Ubuntu is based on a much older Linux distribution called Debian. Debian has access to tens of thousands of different packages, which means that Ubuntu has access to these packages, too. The Debian packages are made available in Ubuntu’s Universe repository. A set of volunteers called Masters of the Universe (MOTUs) are well trained and follow strict guidelines to package software and make even more packages available to Ubuntu users in the Universe repository. (See tutorial 40, “Helping with Ubuntu Development,” for more information about the MOTUs and how you can become one of them.) The Universe repository is filled with optional and often useful or fun software; it is enabled by default, along with other official repositories containing security updates, software updates, and software necessary for Ubuntu to be installed and run in all of its various official forms.

You can adjust which repositories are enabled using the Software & Updates GUI tool, available in Software Updater by clicking Settings. On the first tab (Ubuntu Software), you have five options to choose from. The default settings are shown in Figure 1.7. Which options you check is entirely up to you, but make sure that at least the first check box is selected to allow you access to Canonical-supported open source software, which includes all the packages necessary for a basic Ubuntu installation and a few more that are commonly used. (Canonical is the company the funds much of Ubuntu development.) The more boxes you check, the wider your selection of software. Making sure that the Proprietary Drivers for Devices box is checked is also a good idea so that you can benefit from drivers that might enhance your system’s performance.

You can find or add other options under the Other Software, Updates, Additional 
        Drivers, and other tabs..
Figure 1.7: You can find or add other options under the Other Software, Updates, Additional Drivers, and other tabs.

OPEN SOURCE VERSUS PROPRIETARY

You might hear some arguments about using proprietary drivers or other software in Ubuntu. Some people feel that the use of such drivers goes against what open source stands for because the program code used for the drivers or software cannot be viewed and modified by the wider community but only by the original developers or company that owns it. There is also a strong argument that users should have to undergo the least amount of work for a fully functional system.

Ubuntu takes a middle-of-the-road stand on this and leaves it up to the user to decide. Open source software is installed by default, but options are given to allow proprietary software to be installed easily.


When you are happy with your selections, switch to the Updates tab to configure Ubuntu’s behavior when updates are available (see Figure 1.8). By default, both the important security updates and recommended updates are checked to ensure that you have the latest bug fixes and patches. You can also choose to receive proposed updates and backports(software that is released for a newer version of Ubuntu but reprogrammed to be compatible with the current release), but we recommend this only if you are happy to carry out testing for the community because any updated software from these repositories can adversely affect your system.

Ubuntu also enables you to configure how often it checks for updates and how they are installed. By default, Ubuntu checks daily for updates and, if any are available, notifies you. However, you can change the frequency and the actions Ubuntu carries out when it finds available updates. We recommend keeping the notification-only option because this enables you to see what updates are available prior to their installation. If you want to save time, choose Download All Updates in the Background to configure Ubuntu to silently download the updates before it gives you the option to install them.

Updates tab of software and updates window on ubuntu.
Figure 1.8: In the Updates tab of Software & Updates, configure which updates you want and how you want them to be handled.

Part of the magic of Ubuntu is the ease in which you can upgrade from major version to major version, such as moving from 19.04 to 19.10. Some Ubuntu releases are called LTS, for long-term support, and are intended for production use by most people. The interim releases are for those who feel they must have the most recent version of everything or those who help work on Ubuntu development. These releases are stable, but they are supported for only a short time, so if you choose to use them, you should plan to upgrade to the new release every six months. By ensuring that the release upgrade option is set to LTS releases only, you’ll be prompted to upgrade your version of Ubuntu only every two years; the current LTS version used to write this tutorial, 20.04, was released in April 2020, and the next LTS is scheduled to be released in April 2022.

The Other Software tab enables you to add other repositories. It comes by default with everything you need to connect to and use Canonical’s partner repository, with nonfree (usually in the licensing sense, but occasionally for payment) software from companies that have an agreement with Canonical to make it easily available to interested users. This repository is disabled by default, and if you want to use it, you must enable it by checking a box next to its entry in the Other Software tab.

System Settings

To configure system settings, search for System Settings or click the settings logo in the power menu (refer to Figure 1.4). This opens the Settings window, shown in Figure 1.9, from which you can select entries from the menu at the left and then make adjustments as desired. A couple of the options are described in the following sections.

System settings window on ubuntu.
Figure 1.9: Adjust your system settings.

Detecting and Configuring a Printer

Setting up a printer in Linux used to be so difficult that previous editions of this tutorial included an entire tutorial filled with command-line magic and scary-looking configuration files. The setup is no longer that difficult in most cases

Ubuntu includes drivers for many printers, and installing and using a printer in Ubuntu is usually easier than in other operating systems. (This is not an absolute rule, though.) Some printer manufacturers do not write and release drivers for Linux, and for some printers, no open source driver exists. Before you buy a printer, spending some time on the Internet searching for printers that are known to work with Linux is a good idea. One great resource is the Open Printing database from The Linux Foundation, at www. openprinting.org/printers.

If you choose wisely, all you need to do is plug your printer into the computer and turn it on. In many cases, Ubuntu finds the printer and adds the driver automatically. Within a couple of minutes, you should be able to use it. From the Settings window, select Devices and then select Printers to add a printer, to see all installed and configured printers, and to change printer settings. From here you can choose to enable printer sharing on a network, set options for default print quality, print a test page, and more

Configuring Power Management in Ubuntu

Select Power from the Settings window to control how Ubuntu handles power-saving features in specific situations.

Ubuntu provides good support for suspend, which means your computer writes its current state to memory and goes into a low-power mode. Your computer will start much faster the next time you use it because it does not need to perform a full boot; it brings the system up to its previous state out of memory instead of loading and starting every program again from scratch.

Setting the Time and Date

Linux provides a system time and date; your computer hardware provides a hardware clock-based time. In many cases, it is possible for the two times to drift apart. Linux system time is based on the number of seconds elapsed since January 1, 1970. Your computer’s hardware time depends on the type of clock chips installed on your PC’s motherboard, and many motherboard chipsets are notoriously subject to drift.

Keeping accurate time is important on a single workstation, but it is critically important in a network environment. Backups, scheduled downtimes, and other network-wide actions need to be accurately coordinated.

The Ubuntu installer sets the time and date during the installation process when it asks for your location. If you move or just want to change the settings (for example, to have your computer automatically synchronize its clock with official time servers on the Internet), you can do so.

Changing the Time and Date

Using Ubuntu’s graphical tool is the simplest way to set your system date and time and the most obvious for a desktop user. From the Settings window, select Details and then select Date & Time to make changes. You can manually set the date and time in the GUI or have your computer obtain updated date and time information via the Internet.

Using the date Command

Use the date command to display or set your Linux system time. This command requires you to use a specific sequence of numbers to represent the desired date and time. To see your Linux system’s idea of the current date and time, use the date command like this:

 matthew@seymour:~$ date
 Tue Sep 28 21:03:14 CDT 2021

To adjust your system’s time (for example, to September 28, 2021 at 10:33 a.m.), use a command line with the month, day, hour, minute, and year, like so:

 matthew@seymour:~$ sudo date 092810332021
 Tue Sep 28 21:03:14 CDT 2021

Using the hwclock Command

Use the hwclock command to display or set your Linux system time, display or set your PC’s hardware clock, or synchronize the system and hardware times. To see your hardware time and date, use hwclock with the --show option, like so:

 matthew@seymour:~$ sudo hwclock --show
 Tue 28 Sep 2021 06:04:43 PM CDT -0.281699 seconds

Use hwclock with its --set and --date options to manually set the hardware clock, as follows:

 matthew@seymour:~$ sudo hwclock --set --date "09/28/21 10:33:00"
 matthew@seymour:~$ hwclock --show
 Tue 28 Sep 2021 10:33:09 AM MST -0.904668 seconds

In these examples, the hardware clock has been set using hwclock, which is then used again to verify the new hardware date and time. You can also use hwclock to set the Linux system time and date, using your hardware clock’s values, with the Linux system time and date.

For example, to set the system time from your PC’s hardware clock, use the --hctosys option, like so:

matthew@seymour:~$ sudo hwclock --hctosys

To set your hardware clock using the system time, use the --systohc option, like so:

matthew@seymour:~$ sudo hwclock --systohc

Configuring Wireless Networks

To manage networking from the GUI in Ubuntu, click the power icon (refer to Figure 1.4 earlier in this tutorial). Entries in the menu that appears allow you to handle and monitor network connections.

Click the networking icon in the toolbar to connect to a wireless network. If your wireless access point broadcasts its service set identifier (SSID), it should appear in the list under wireless networks. Click the desired network, and Network Manager detects what encryption (if any) is in use and asks you for the passkey. Enter this, and Network Manager starts the wireless connection. The passkey is then stored in the default keyring, a secure area that is unique to your login. From now on, whenever you log in to Ubuntu and are in range of this network, Network Manager will start the connection automatically.

If for some reason your wireless network does not appear (you might have your SSID hidden), you must use the Connect to Other Wireless Network option, in which case you enter the network name, wireless security type, and, when needed, the password for the connection.

Network Manager can also connect to Cisco VPN connections through use of the vpnc software. Install this from the Ubuntu repositories (see tutorial 9), and you can specify connection settings as appropriate, or if you have access to a predefined configuration file (PCF), you can import it directly into Network Manager.

Troubleshooting Post-Installation Configuration Problems

A lot of work has gone into making Ubuntu as versatile as possible, but sometimes you might come across a piece of hardware that Ubuntu is not sure about. Knowing what to do in these situations is important, especially when you are new to working with Ubuntu.

Because Ubuntu (and Linux in general) is built on a resilient UNIX foundation, it is much more stable than some other operating systems. However, even though things might seem to be working fine, Ubuntu could have a problem that might not affect the appearance of the system. In this section, you learn how to examine some of Ubuntu’s built-in error logs, which can help you discover or diagnose unseen problems.

Ubuntu has a command that responds with detailed messages that are output directly by the operating system: the dmesg command, which we introduce here and cover more completely in tutorial 12. This command is commonly used with the grep command to filter output. The dmesg command takes its output directly from the /var/log/syslog file, so you can choose to either run dmesg or read the file directly by typing less /var/log/syslog. The output is fairly detailed, so be prepared for an initial shock when you see how much information is generated. You might find it easier to generate a file with the dmesg output by using the following command:

matthew@seymour:~$ dmesg > dmesg.txt

This takes the output from the dmesg command and stores it in a new text file called dmesg.txt. You can then browse it at your leisure, using your choice of text editor, such as vi or emacs. You can even use the less command, like so:

matthew@seymour:~$ less dmesg.txt

The messages are generated by the kernel, by other software run by /etc/init.d, and by Systemd scripts. You might find what appear at first glance to be errors, but some errors are not really problems (for example, if a piece of hardware is configured but not present on your system).

Thanks to Google, troubleshooting is no longer the slow process it used to be. You can copy and paste error messages into Google’s search bar to bring up a whole selection of results similar to the problem you face. You are likely to come across people who have had the same problem as you.

It is important to work on finding and testing only one solution to one problem at a time; otherwise, you might end up getting no work done whatsoever. You should also get into the habit of making backup copies of all files that you modify, just in case you make a bad situation worse. Use the copy (cp) command like this:

matthew@seymour:~$ cp file file.backup20210101

You should not use a .bak extension on your backup files because this could get overwritten by another automatic process and leave you frustrated when you try to restore the original file. I like to use the convention backupYYYYMMDD, as in the preceding code, where I used the date for New Year’s Day 2021: 2021(year)01(month)01(day).

If something breaks as a result of your changes to the original file, you can always copy the original back into place by using the command like this:

matthew@seymour:~$ cp file.backup20210101 file
NOTE
Something as simple as copying the original back into place can really save you, especially when you are under pressure because you’ve changed something you shouldn’t have changed on a production system. The best practice is not to make sweeping changes on a production system.

If you are having trouble with booting your system, you may find it helpful to read Chapter 15, “The Boot Process,” as it details aspects like the boot loader and startup process. Understanding what happens during this process will give you an idea of what to look for and how to solve problems.

References

  • www.ubuntu.com This is the place to start when looking for news, information, and documentation about installing, configuring, and using Ubuntu.
  • https://ubuntu.com/download This page has specific information and links for downloading, burning, and installing the current release of Ubuntu.
  • www.gnu.org/software/grub This is the home page for the GRUB boot loader.