Module 3 - Server services
Module 3 - Server services
In this module, we will cover five key lessons focused on installing and configuring real-world Linux server
services. By the end of this module, you will have hands-on experience setting up and managing critical
infrastructure components that are essential for any robust Linux-based system.
The first lesson will dive into web servers, covering the installation and configuration of both Apache and
Nginx. You'll learn how to set up virtual hosts, configure SSL/TLS, and optimize performance for your web
applications.
Next, we'll explore database servers, walking through the installation and configuration of MySQL and
PostgreSQL. You'll gain practical experience creating databases, managing user accounts, and
implementing backup and recovery strategies.
In the third lesson, we'll introduce virtualization using the Kernel-based Virtual Machine (KVM)
hypervisor. You'll learn how to install and configure KVM, create and manage virtual machines, and set up
virtual networks to suit your needs.
The fourth lesson will focus on Zabbix, a powerful open-source monitoring solution. You'll install and
configure the Zabbix server, deploy agents on your systems, and learn how to set up comprehensive
monitoring and alerting for your infrastructure.
Finally, we'll cover FTP servers and Samba file sharing. You'll learn how to install and configure an FTP
server, set up user access controls, and implement Samba to provide file sharing capabilities across your
network.
Throughout this module, you'll have the opportunity to apply your knowledge by working on real-world
projects, ensuring that you gain practical experience that can be directly applied in your professional or
personal Linux server administration endeavors.
Lesson 1 - Web servers (Apache, Nginex) installation and configuration
--------------------------------------------------------------------------------------------------------------------------------------
Apache and Nginx are two of the most popular web servers used on the internet today. Here's a brief
explanation of each:
Apache:
Apache is an open-source web server software that was first released in 1995. It is the most widely used
web server software, powering over 46% of all websites on the internet as of 2023. Apache is highly
customizable, with a vast ecosystem of modules and plugins that allow users to extend its functionality. It
is known for its stability, security, and performance, particularly for serving static content. Apache
supports a wide range of operating systems, including Linux, Windows, and macOS.
Nginx:
Nginx (pronounced "engine-x") is another popular web server software, known for its high performance
and efficiency, particularly in handling high-traffic websites. Nginx was initially developed in 2002 to
address the shortcomings of Apache in handling large numbers of concurrent connections. Unlike
Apache, which uses a threaded or process-based architecture, Nginx employs an event-driven,
asynchronous architecture that allows it to handle more concurrent connections with lower resource
usage. Nginx is often used as a reverse proxy, load balancer, and HTTP cache, in addition to its web server
capabilities.
Both Apache and Nginx have their own strengths and are suitable for different use cases. Apache is
generally better suited for serving dynamic content and running complex web applications, while Nginx
excels at serving static content and handling high-traffic loads. Many web servers use a combination of
Apache and Nginx, with Nginx handling the front-end and Apache handling the back-end.
<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/example.com/html
ErrorLog /var/log/httpd/example.com_error.log
</VirtualHost>
psql
name VARCHAR(100),
age INT
);
Insert a test record:
Database servers are the backbone of modern web applications, providing a reliable and scalable storage
solution for data. Two of the most popular open-source database servers are MySQL and PostgreSQL.
Here's a brief overview of their installation and configuration:
MySQL:
MySQL is a relational database management system (RDBMS) that is widely used in web applications. To
install MySQL, you can download the appropriate package for your operating system from the official
MySQL website. The installation process varies depending on the platform, but it generally involves
running the installer and following the on-screen instructions. After installation, you can configure MySQL
by setting up user accounts, creating databases, and tuning the server's settings to optimize performance.
One of the key steps in configuring MySQL is setting up the root user password. This is the main
administrative account that has full access to the database. You can also create additional user accounts
with specific permissions, depending on the needs of your application. MySQL also provides various
configuration options, such as setting the maximum number of connections, adjusting the memory
allocation for the query cache, and enabling or disabling specific features.
PostgreSQL:
PostgreSQL, often referred to as Postgres, is another popular open-source RDBMS that is known for its
reliability, data integrity, and advanced features. The installation process for PostgreSQL is similar to
MySQL, with the user downloading the appropriate package for their operating system from the official
PostgreSQL website.
After the initial installation, you'll need to configure PostgreSQL to suit your needs. This includes creating
user accounts, setting up databases, and tuning the server's settings. Unlike MySQL, PostgreSQL has a
more robust security model, with the ability to define granular permissions for different user roles. You
can also configure PostgreSQL to use various authentication methods, such as password-based or
certificate-based authentication.
One of the key advantages of PostgreSQL is its support for advanced data types, such as arrays, JSON, and
geospatial data. This makes it a popular choice for applications that require more complex data storage
requirements. Additionally, PostgreSQL has a rich ecosystem of extensions and plugins that can be easily
integrated to add new functionality to the database server.
$ su - postgres
$ psql
Virtualization is a powerful technology that allows you to run multiple operating systems on a single
physical server. One of the most popular virtualization solutions for Linux is Kernel-based Virtual Machine
(KVM).
To install KVM on a Linux system, you'll first need to ensure that your system meets the hardware
requirements, such as support for hardware virtualization (Intel VT-x or AMD-V). Then, you can install the
necessary packages using your Linux distribution's package manager.
For example, on Ubuntu, you can install KVM with the following command:
Configuring KVM:
After installing KVM, you'll need to configure it to suit your needs. This involves setting up virtual
networks, creating and managing virtual machines (VMs), and configuring storage for the VMs.
One of the key steps in configuring KVM is setting up the virtual network. This typically involves creating a
bridge interface that the VMs can use to connect to the physical network. You can also configure firewall
rules and other network settings to control the traffic to and from the VMs.
To create and manage VMs, you can use a command-line tool like virsh or a graphical user interface (GUI)
tool like GNOME Boxes or virt-manager. These tools allow you to create new VMs, start and stop them,
and configure their hardware and software settings.
Finally, you'll need to configure storage for the VMs, which can be done using a variety of storage options,
such as local storage, network-attached storage (NAS), or storage area networks (SANs).
Maintaining KVM:
Maintaining a KVM-based virtualization environment requires ongoing monitoring and management. This
includes keeping the host system and guest VMs up-to-date with security patches, monitoring resource
utilization, and troubleshooting any issues that may arise.
Additionally, you may need to perform regular backups of the VMs to ensure that you can restore them in
the event of a failure or disaster. KVM provides various tools and utilities to automate these tasks and
ensure the reliability and availability of your virtualized environment.
By following these steps, you can successfully install, configure, and maintain a KVM-based virtualization
environment on your Linux system to meet your organization's computing needs.
https://docs.oracle.com/en/virtualization/oracle-linux-virtualization-manager/getstart/getstarted-
manager-install.html#manager-config
Zabbix is a powerful open-source monitoring solution that allows you to monitor the health and
performance of your IT infrastructure, including servers, network devices, and applications. Here's a high-
level overview of installing and configuring Zabbix on a Linux system:
Installing Zabbix:
The first step in setting up Zabbix is to install the necessary packages on your Linux system. Zabbix
provides official repositories for various Linux distributions, making the installation process relatively
straightforward.
For example, on a CentOS/RHEL system, you can install Zabbix by adding the official Zabbix repository and
then running the following commands:
Updating the Zabbix server configuration file (zabbix_server.conf) with the database connection details
Configuring the web interface by setting the appropriate database connection settings and timezone
Additionally, you may need to configure firewall rules to allow communication between the Zabbix server
and agents, as well as any other components of your monitoring setup.
To deploy Zabbix agents, you can download the appropriate package for your Linux distribution and install
it on the target hosts. Once installed, you'll need to configure the agent to connect to the Zabbix server
and specify any additional monitoring settings.
By following these steps, you can successfully install, configure, and maintain a Zabbix monitoring solution
on your Linux system, providing you with valuable insights into the health and performance of your IT
infrastructure.
https://www.zabbix.com/download?zabbix=6.0&os_distribution=oracle_linux&os_version=9&component
s=server_frontend_agent&db=mysql&ws=apache