Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Mastering Linux Administration - Second Edition

You're reading from  Mastering Linux Administration - Second Edition

Product type Book
Published in Mar 2024
Publisher Packt
ISBN-13 9781837630691
Pages 764 pages
Edition 2nd Edition
Languages
Authors (2):
Alexandru Calcatinge Alexandru Calcatinge
Profile icon Alexandru Calcatinge
Julian Balog Julian Balog
Profile icon Julian Balog
View More author details

Table of Contents (24) Chapters

Preface 1. Part 1:Basic Linux Administration
2. Chapter 1: Installing Linux 3. Chapter 2: The Linux Shell and Filesystem 4. Chapter 3: Linux Software Management 5. Chapter 4: Managing Users and Groups 6. Chapter 5: Working with Processes, Daemons, and Signals 7. Part 2:Advanced Linux Administration
8. Chapter 6: Working with Disks and Filesystems 9. Chapter 7: Networking with Linux 10. Chapter 8: Linux Shell Scripting 11. Chapter 9: Securing Linux 12. Chapter 10: Disaster Recovery, Diagnostics, and Troubleshooting 13. Part 3:Server Administration
14. Chapter 11: Working with Virtual Machines 15. Chapter 12: Managing Containers with Docker 16. Chapter 13: Configuring Linux Servers 17. Part 4:Cloud Administration
18. Chapter 14: Short Introduction to Cloud Computing 19. Chapter 15: Deploying to the Cloud with AWS and Azure 20. Chapter 16: Deploying Applications with Kubernetes 21. Chapter 17: Infrastructure and Automation with Ansible 22. Index 23. Other Books You May Enjoy

Configuring Linux Servers

In this chapter, you will learn how to set up different types of Linux servers. This will include Domain Name System (DNS) servers, Domain Host Configuration Protocol (DHCP) servers, Samba or Server Message Block/Common Internet File System (SMB/CIFS) file servers, and Network File System (NFS) servers. All these servers, in one way or another, are powering the backbone of the World Wide Web. Even though we will not cover it here, you should know that the reason your computer is showing the exact time is because of a well-implemented Network Time Protocol (NTP) server. You can shop online and transfer files between your friends and colleagues thanks to effective DHCP, web, and file servers. Configuring the different types of Linux services that power all these servers represents the knowledge base for any Linux system administrator. In this edition of the book, we will only cover a select few of these Linux servers, those we consider the most important and...

Technical requirements

Basic knowledge of networking and Linux commands is required. You will need access to multiple working systems, preferably on premise or in the cloud. If this is not possible, you can use local virtual machines on your system. Furthermore, it would be useful to have a domain available for you to use too. We will use Ubuntu Server 22.04.2 LTS as the distribution of choice for this chapter’s exercises and examples. Nevertheless, any other major Linux distribution—such as Fedora, RHEL, openSUSE, or Debian—is equally suitable for the tasks detailed in this chapter.

Introducing Linux services

Everything you have learned up until now will easily apply to any workstation or desktop/laptop running Linux. We have delved into advanced networking subjects that are meant to ease your learning path to becoming a seasoned Linux system administrator. Now we will enter the server territory as a natural path to the cloud, which will be discussed in detail in the last four chapters of this book.

A Linux server, compared to a Linux workstation, is a system that serves content over a network. While doing so, a server provides its hardware and software resources to different clients that are accessing it. For example, every time you enter a website address into your browser, a server is accessed. That particular type of server is a web server. When you print over the network in your workplace, you access a print server, and when you read your email, you access a mail server. All these are specialized systems that run a specific piece of software (sometimes...

Setting up SSH

We will configure SSH on a computer running Ubuntu Server 22.04.2 LTS as the host operating system. Throughout the entire book, we used SSH connections several times, and showed you how to create an SSH key pair in Chapter 11, Working with Virtual Machines, when we worked with cloud-init. This time, we will show you how to install OpenSSH, how to enable SSH, and how to modify some of its configuration defaults.

Installing and configuring OpenSSH on Ubuntu

In order to use SSH, the first thing we need to do is to install the openssh package. On Ubuntu, this can be done by using the following command:

sudo apt install openssh-server

Chances are that it is already installed on your system. If that is the case, you can go ahead and skip this step and go to the configuration files.

After installation, we can start and enable the openssh service with the following commands:

sudo systemctl enable ssh && sudo systemctl start ssh

For openSSH, the configuration...

Setting up a DNS server

One of the most widely used DNS services is Berkeley Internet Name Domain 9 (BIND 9). You can visit its official website at the following address: https://www.isc.org/bind/. Before continuing, let’s underline the system configuration and goals. For this section, we will use a computer running on Ubuntu Server 22.04.2 LTS. On this system, we will create two types of servers, a caching name server and a primary name server, which you can use on your local network to manage hostnames and private IP addresses.

Important note

There are different DNS servers, such as authoritative, caching, or forwarding types; those are also called functional types. Among those, a caching DNS server is the one that always answers recursive requests from clients. Also, there are relational server types, such as primary and secondary DNS servers. Those are authoritative types, and are almost identical, with the only difference between the primary and the secondary being...

Setting up a DHCP server

DHCP is a network service that is used to assign IP addresses to hosts on a network. The settings are enabled by the server, without any control from the host. Most commonly, the DHCP server provides the IP addresses and netmasks for clients, the default gateway IP, and the DNS server’s IP address.

To install the DHCP service on Ubuntu, use the following command:

sudo apt install isc-dhcp-server

As a test system, we will use the same system on which we installed the DNS services in the previous section. After installation, we will configure two specific files. On an Ubuntu system, like ours, the default configuration will be set inside the /etc/dhcp/dhcpd.conf file, while the interfaces will be configured inside the /etc/default/isc-dhcp-server file:

  1. We will first show you how to set up a basic local DHCP server. In this respect, we will alter the /etc/dhcp/dhcpd.conf file by adding the IP address pool. You can either uncomment one of...

Setting up an NFS server

NFS is a distributed filesystem used to share files over a network. To show you how it works, we will set up the NFS server on one of our machines on the network. We will use Ubuntu 22.04.2 LTS as the base for the NFS server. For more in-depth theoretical information about NFS, please refer to Chapter 7, Networking with Linux.

The NFS filesystem type is supported by any Linux and/or Unix environment and also by Windows, but with some limitations. For mostly-Windows client environments, we recommend using the Samba/Common Internet File System (CIFS) protocol instead. Also, for those of you concerned about privacy and security, please keep in mind that the NFS protocol is not encrypted, thus any transfer of data is not protected by default.

Installing and configuring the NFS server

On our network, we will use an Ubuntu machine as a server and we will show you how to access the files from another Linux client. First, let’s install and configure...

Setting up a Samba file server

The Samba server allows you to share files over a network where clients use different operating systems, such as Windows, macOS, and Linux. In this section, we will set up a Samba server on Ubuntu 22.04.2 LTS and access shares from different operating systems on the network. The SMB/CIFS protocol is developed by Microsoft; for more details, you can visit their developer pages at https://docs.microsoft.com/en-us/windows/win32/fileio/microsoft-smb-protocol-and-cifs-protocol-overview. Some information about the SMB/CIFS protocol can be found in Chapter 7, Networking with Linux, too. In the following sub-sections we will show you how to install and configure it on your local network.

Installing and configuring Samba

The installation procedure has the following steps:

  1. First, we will install Samba on the system using the following command:
    sudo apt install samba
  2. Once Samba is installed, we can check whether the service is running as expected...

Summary

In this chapter, we covered the installation and configuration processes for the most well-known services available for Linux. Knowing how to configure all the servers described in this chapter—from DNS to DHCP, Apache, and a printing server—is a minimum requirement for any Linux administrator.

By going through this chapter, you learned how to provide essential services for any Linux server. You learned how to set up and configure a web server using the Apache package; how to provide networked printing services to a small office or home office; how to run an FTP server and share files over TCP; how to share files with Windows clients on your network using the Samba/CIFS protocol; how to share files over Unix and Linux systems using the NFS file-sharing protocol; how to set up NTP to show an accurate time; and how to configure DNS and local DHCP servers. In a nutshell, you learned a lot in this chapter, and yet we have barely scratched the surface of Linux server...

Questions

Now that you have a clear view of how to manage some of the most widely used services in Linux, here are some exercises that will further contribute to your learning:

  1. Try using a VPS for all the services detailed in this chapter, not on your local network.
  2. Try setting up a LEMP stack on Ubuntu.
  3. Test all the services described in this chapter using Fedora or RHEL-based distributions.

Further reading

For more information about the topics covered in the chapter, you can refer to the following links:

lock icon The rest of the chapter is locked
You have been reading a chapter from
Mastering Linux Administration - Second Edition
Published in: Mar 2024 Publisher: Packt ISBN-13: 9781837630691
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}