Read a sample: 1. Build a Safe Administration Lab
A good Linux administrator learns to make changes deliberately, verify their effects, and recover when a change does not work. The best place to begin practicing that routine is not a production server or your everyday workstation. It is a small virtual machine that you can inspect, alter, and, when necessary, return to a known state.
In this chapter, you will build a disposable Linux lab, identify the operating system inside it, establish a baseline snapshot, and practice using administrative privileges for a narrowly defined task. You will also start a lab journal. The journal and the baseline will give the exercises throughout this book a starting point: before changing accounts, services, packages, or backups, you will have somewhere to record what you expected and what actually happened.
A virtual machine reduces the consequences of many mistakes, but it is not a license to ignore the surrounding environment. The VM shares a physical computer and may have network access, shared folders, or attached storage. Keep the lab separated from important files, use test credentials, and check which machine is receiving each command.
You need a computer with enough available memory and storage to run a Linux guest alongside its existing operating system, plus virtualization software that supports snapshots. Common choices include VirtualBox, VMware products, and a Linux host using a suitable virtual machine manager. The exact setup screens vary, so use the instructions for your chosen product when a menu name differs from the description here.
For the examples in this book, a current, supported release of a mainstream Linux distribution is a sensible choice. Debian or Ubuntu makes a convenient first lab, as does a Red Hat–family distribution such as Fedora. Commands and package names can differ between families, and later chapters will call out important differences. What matters now is that you know which system you installed and can sign in to a terminal.
A minimal server installation is sufficient, although a desktop installation is also fine if you prefer a graphical interface. A practical starting configuration is:
- Two virtual CPUs, if your host can spare them.
- A few gigabytes of memory, adjusted to the distribution’s requirements and your host’s capacity.
- A virtual disk large enough for the operating system, updates, and practice files; 25 GB is a reasonable starting point.
- One network adapter using the virtualization software’s NAT mode, if available.
These are starting choices, not universal requirements. Leave enough resources for the host to remain responsive. A dynamically allocated virtual disk may initially use less host storage than its configured maximum, but it can grow as the guest writes data. Confirm that the host has room for the disk and for snapshots.
NAT usually lets the guest reach external networks without making it directly accessible like another machine on the local network. It is not a complete security boundary, and behavior depends on the virtualization software and any forwarding rules you configure. For this initial lab, avoid bridged networking, port forwarding, shared folders, and removable-device passthrough unless you understand why you need them. You can add capabilities later as an explicit exercise.
Download an installation image from the distribution’s official source. Follow that source’s verification instructions when available; checking an image before installation helps you catch an incomplete or unexpected download. Create a new VM in your virtualization application and attach the downloaded image as its installation media.
Give the VM an unmistakable name such as linux-admin-lab. A distinctive name helps prevent an administrative command or snapshot operation from being applied to the wrong machine. Select the guest type that most closely matches your distribution, allocate the resources you chose, and create a new virtual disk. Do not attach a disk containing files you need.
Start the VM and work through the installer. Create an ordinary user for routine work; the examples in this chapter use labuser. Choose a password you can remember for the lab, but do not reuse a password that protects a real account. If the installer offers to enable remote access, you can leave it disabled for now and work through the VM console.
Some distributions ask you to set a root password; others guide you toward an ordinary account that can use sudo. Installer choices vary, so note what you selected. You need a documented way to perform administrative tasks inside the guest. If your account is not granted administrative access during installation, consult your distribution’s installation guidance rather than guessing at permissions.
When installation finishes, detach the installation image if necessary and reboot into the installed system. Sign in as your ordinary user. Open a terminal and verify that commands are running inside the guest, not in a terminal on the host:
bash
whoami
hostname
pwd
The first command should show your guest username, and the other two give you useful context about the machine and current directory. Their exact output will depend on your installation. If the results are unfamiliar, pause and confirm which window has keyboard focus.
It is worth making the terminal visually distinct from any host terminal. A different window title, color scheme, or desktop background can provide a useful reminder. It is not a substitute for checking the system identity before a consequential command, but it can help prevent an ordinary moment of distraction from becoming a host-side mistake.
Linux distributions share many tools, but they do not all arrange software,…