Book Image

Linux Administration Cookbook

By : Adam K. Dean
Book Image

Linux Administration Cookbook

By: Adam K. Dean

Overview of this book

Linux is one of the most widely used operating systems among system administrators,and even modern application and server development is heavily reliant on the Linux platform. The Linux Administration Cookbook is your go-to guide to get started on your Linux journey. It will help you understand what that strange little server is doing in the corner of your office, what the mysterious virtual machine languishing in Azure is crunching through, what that circuit-board-like thing is doing under your office TV, and why the LEDs on it are blinking rapidly. This book will get you started with administering Linux, giving you the knowledge and tools you need to troubleshoot day-to-day problems, ranging from a Raspberry Pi to a server in Azure, while giving you a good understanding of the fundamentals of how GNU/Linux works. Through the course of the book, you’ll install and configure a system, while the author regales you with errors and anecdotes from his vast experience as a data center hardware engineer, systems administrator, and DevOps consultant. By the end of the book, you will have gained practical knowledge of Linux, which will serve as a bedrock for learning Linux administration and aid you in your Linux journey.
Table of Contents (15 chapters)

Installing VirtualBox

As I said in the previous section, I've chosen to mostly use CentOS for the recipes in this book. Hopefully, this gives you a good baseline for learning about Linux Administration, but also gives you a bit of a head start if you plan on going for any of the Red Hat exams.

Instead of requiring you to have a spare laptop handy, or renting a server somewhere, I'm going to advocate using VMs for testing and running through the examples given.

VMs are exactly as they sound a way of virtualizing computer hardware on one or a cluster of physical machines, thus allowing you to test, break, and play to your heart's content, without risking rendering your own computer unbootable.

There are many ways of creating a VM: macOS has xhyve, Windows has Hyper-V, and Linux has a native implementation called Kernel Virtual Machine (KVM).

KVM (along with libvirt) is the technology that you will come across most often in the Linux virtualization space. It forms the basis of popular technologies, such as Proxmox and OpenStack, while providing near-native speeds.

Another way of creating and managing VMs is a program called VirtualBox, which is now developed by Oracle. The nice thing about this software, and the reason I shall be using it here, is that it's cross-platform, being produced for macOS, Windows, and Linux.

Installing VirtualBox on Ubuntu

I'm using Ubuntu to write this book, so I'll run through the basic way of installing VirtualBox on an Ubuntu desktop.

This will be slightly different to installing it on other distributions, but a good number of them package it for installation, and should provide a guide for installing it.

Command-line installation

Open your Terminal and run the following:

$ sudo apt install virtualbox
Using sudo will generally prompt you for your password, and you won't see anything being printed to screen as you type.

You will likely be prompted to confirm installation of VirtualBox and its dependencies (there may be a lot—it's a complex program and if you haven't updated in a while, you may get a few dependency updates too).

Hit Y and Enter to continue. The following screenshot shows an example of the installation if started from the command line:

Once done, you should have a working VirtualBox installation.

Graphical installation

If you'd like, you can also install VirtualBox through Ubuntu software.

Simply search for the software you desire, in this case, VirtualBox, and click through to its store page.

Once there, click Install and the package will be installed, no Terminal required!

After installation, your screen will change to show Launch and Remove options.

Installing VirtualBox on macOS

Although I'm using Ubuntu, it's not the end of the world if you're not. macOS is a fine OS too, and handily it supports VirtualBox.

In this recipe, we'll run through a couple of ways of installing VirtualBox in macOS. You'll find that the layout is extremely similar, regardless of the OS you use.

Command-line installation

If you already have the command-line program brew installed, then getting VirtualBox is as easy as running the following command:

$ brew cask install virtualbox

You may be prompted for a superuser password to complete the installation.

Homebrew is available from https://brew.sh/ and is effectively the package manager that macOS needs, but doesn't have out of the box. I can't readily recommend blindly running scripts from mysterious websites, so be sure you understand what's being done (read the code) before you take the plunge and install brew.

Graphical installation

Oracle also provides an installation image for macOS, if you'd like to install it in the more traditional way.

Simply navigate to https://www.virtualbox.org/wiki/Downloads and select the OS X hosts option.

This will prompt you to download the installer to your local system, which you can unpack and install.

Running through the installation, you may be prompted for your superuser password.

Installing VirtualBox on Windows

If you're not using a Linux flavor on your computer, and you're not using macOS, it's a good bet that you're running Windows (unless you've delved into FreeBSD on the desktop or similar, in which case I can't help you here—we'd need an entire afternoon).

If using Windows, I can suggest VirtualBox again, due to its cross-OS nature, and it can again be installed from Oracle's site.

Graphical installation

Like the macOS installation, navigate to https://www.virtualbox.org/wiki/Downloads and select the Windows hosts option:

This will download an executable that can be run.

It's worth noting that Windows can complain if you're attempting to run multiple virtualization solutions at once. If you've previously run Hyper-V, or Docker, and you experience issues attempting to start VirtualBox machines, try disabling your other solutions first.