Servers are the backbone of computer networks, providing essential services to other devices or clients on the network. In the realm of servers, Linux has established itself as a very popular and robust option due to its stability, security, and flexibility. These servers can handle a wide variety of tasks, from hosting websites and managing databases to operating enterprise applications and email services.
Unix-type operating systems are known for their robustness and wide use in servers and workstations. Below are some notable examples:
Unix: An old and robust operating system mainly used in servers and workstations.
Linux: Known for its flexibility and diversity of distributions.
BSD (FreeBSD, OpenBSD, NetBSD): Unix derivatives with different focuses on security, portability, and performance.
Linux is a Unix-like operating system with a common architecture and philosophy based on the idea that “everything is a file”. Multi-user and multitasking, it allows multiple tasks to be executed simultaneously by different users.
Linux Distributions:
Rolling Release: Examples like Arch Linux and Manjaro. These distributions receive continuous updates, providing the latest features and software improvements constantly.
Fixed Release: Examples like Debian, Ubuntu, and Fedora. These distributions release specific versions with periodic updates not only for security but also for functionality. They are designed for different target audiences, such as hackers, servers, common users, gamers, among others. Some distributions are more stable than others, and each is optimized for a certain type of work.
File Systems in Linux
File systems are structured methods for storing and organizing data on storage devices such as hard drives and flash drives. Each file system has distinct features that affect its performance, reliability, and ability to handle different types of data.
Here are some file systems in Linux environments:
Ext4: Default in many distributions, known for its performance and reliability.
Btrfs: Designed to handle large data sets with high redundancy and scalability.
XFS: Suitable for very large file systems.
NTFS, FAT32: Compatible with Windows, commonly used on portable drives.
The Role of the Server Administrator
Key Skills:
Access control: Managing permissions and user authentication.
System monitoring: Using tools like top, htop, and ps to monitor processes and resources.
Resource management: Efficiently managing CPU, memory, and storage.
Troubleshooting: Resolving issues through logs and diagnostic tools.
Software installation and maintenance: Using package managers like APT and DNF (formerly YUM).
Creating backups: Planning and executing regular backups.
Documentation: Keeping detailed records of configurations and changes.
Specific Roles:
DevOps Engineer: Focused on continuous integration and delivery in software development.
Site Reliability Engineer: Ensures the operation and reliability of systems.
Security Operations Engineer: In charge of network and application-level security.
Network Engineer, Database Administrator, Cloud Engineer, etc.
Server Installation
Installation Methods:
Direct installation: Download an ISO image and use it to install the operating system on the hardware.
Virtualization: Using software like VirtualBox or KVM to create virtual machines. Type 1 Hypervisor: Example: VMware ESXi, KVM installed directly on the hardware. Type 2 Hypervisor: Example: VirtualBox installed on a host operating system.
User and Permissions Management
Creating users:
useradd username
Assigning passwords:
passwd nombre_usuario
Group management:
groupadd groupname
usermod -aG groupname username
Basic permissions: chmod to change permissions, chown to change owner.
chmod 755 file
chown user:group file
Memory and Storage Management
Viewing Storage Devices:
lsblk
Partition Management:
fdisk /dev/sdX
parted /dev/sdX
Formatting Partitions with Different File Systems:
mkfs.ext4 /dev/sdX1
mkfs.xfs /dev/sdX1
mkfs.btrfs /dev/sdX1
mkfs.ntfs /dev/sdX1
mkfs.fat -F 32 /dev/sdX1
Mounting and Unmounting File Systems:
mount /dev/sdX1 /mnt
umount /mnt
Viewing Storage Space:
df -h
du -sh /ruta
Managing Logical Volumes with LVM: LVM (Logical Volume Manager) is a storage management technology that allows you to manage logical volumes in Linux in a flexible and dynamic way. This is a very broad topic. We will delve deeper into LVM in a dedicated blog where we will explore each command and its practical application in Linux storage management scenarios.
System Monitoring and Maintenance
Monitoring Processes and Resources:
ps command: Lists running processes.
ps aux
top command: Monitors real-time resource usage.
top
lsof command: Lists open files and the processes that use them.
lsof -i :80
Find process ID:
pidof process_name
The kill -15 PID command is used to send a termination signal to the process specified by its PID. The -15 can be replaced with the number -9, which corresponds to the SIGKILL signal that forces the immediate termination of the process without allowing it to perform any cleanup or orderly shutdown of resources.
Managing Daemons and Services:
Using systemd:
Create and manage daemons
systemctl start service_name
systemctl enable service_name
To create a new custom service in systemd, you must create a unit file in the /etc/systemd/system/ directory. ExampleHere is an example of a unit file for the D-Bus service (a messaging system that allows different applications to communicate with each other). This file configures how the D-Bus service should start, stop, and reload on the system, along with its dependencies and environment settings.
Security
Ensuring security on Linux systems involves implementing appropriate practices and tools to protect the system from unauthorized access and vulnerabilities. Here are some basic measures and how to use specific tools to configure firewalls and manage updates:
Firewall Configuration:
Using ufw (Ubuntu):
ufw allow 22/tcp
ufw enable
Using firewalld (CentOS, Fedora, Red Hat, Oracle Linux):
firewall-cmd --permanent --add-service=http
firewall-cmd --reload
Managing Updates and Patches:
apt update && apt upgrade (Debian/Ubuntu)
dnf update (Red Hat/CentOS)
SSH Configuration: Securing Remote Access:
Changes in SSH: Edit /etc/ssh/sshd_config, the following changes are recommended:
Change the SSH port
Disable root access
Restrict specific users
Configure public key authentication
Limit weak protocols and ciphers
Configure timeout and attempt limits
Automation with Cron Jobs
Configuring and using cron jobs effectively helps automate routine processes and maintain the consistency and efficiency of the Linux operating system. It is important to regularly check existing cron jobs and ensure they work as expected to avoid problems and maintain system integrity.
tar -czf /path/destination/backup.tar.gz /path/source
Incremental backup with rsync:
rsync -av --delete /path/source /path/destination
Using Backup Tools:
duplicity
borg
Recovery Strategies:
Restore files with tar:
tar -xzf backup.tar.gz -C /path/destination
Restore files with rsync:
rsync -av /path/destination /path/source
Disaster Recovery Planning:
Document recovery procedures.
Regularly test restoration.
Package Management
Package Managers:
APT (Debian/Ubuntu):
Update package list: sudo apt update
Install a package: sudo apt install package_name
Remove a package: sudo apt remove package_name
YUM (Red Hat/CentOS):
Update package list: sudo yum update
Install a package: sudo yum install package_name
Remove a package: sudo yum remove package_name
DNF (Fedora/CentOS 8+):
Update package list: sudo dnf update
Install a package: sudo dnf install package_name
Remove a package: sudo dnf remove package_name
In conclusion, Linux server administration encompasses a wide range of skills and knowledge from initial installation and configuration to continuous monitoring, maintenance, and security.
Get to know our services
Application and Services Orchestration
Our approach to Kubernetes is designed to boost the scalability of your IT infrastructure.
Essentials for Linux Server Administration
Servers are the backbone of computer networks, providing essential services to other devices or clients on the network. In the realm of servers, Linux has established itself as a very popular and robust option due to its stability, security, and flexibility. These servers can handle a wide variety of tasks, from hosting websites and managing databases to operating enterprise applications and email services.
Content:
Operating Systems
Unix-type operating systems are known for their robustness and wide use in servers and workstations. Below are some notable examples:
Linux is a Unix-like operating system with a common architecture and philosophy based on the idea that “everything is a file”. Multi-user and multitasking, it allows multiple tasks to be executed simultaneously by different users.
Linux Distributions:
File Systems in Linux
File systems are structured methods for storing and organizing data on storage devices such as hard drives and flash drives. Each file system has distinct features that affect its performance, reliability, and ability to handle different types of data.
Here are some file systems in Linux environments:
The Role of the Server Administrator
Key Skills:
Specific Roles:
Server Installation
Installation Methods:
Type 1 Hypervisor: Example: VMware ESXi, KVM installed directly on the hardware.
Type 2 Hypervisor: Example: VirtualBox installed on a host operating system.
User and Permissions Management
Memory and Storage Management
Partition Management:
Formatting Partitions with Different File Systems:
Mounting and Unmounting File Systems:
Viewing Storage Space:
Managing Logical Volumes with LVM:
LVM (Logical Volume Manager) is a storage management technology that allows you to manage logical volumes in Linux in a flexible and dynamic way. This is a very broad topic. We will delve deeper into LVM in a dedicated blog where we will explore each command and its practical application in Linux storage management scenarios.
System Monitoring and Maintenance
ps command: Lists running processes.
top command: Monitors real-time resource usage.
lsof command: Lists open files and the processes that use them.
Find process ID:
Using systemd:
To create a new custom service in systemd, you must create a unit file in the /etc/systemd/system/ directory.
ExampleHere is an example of a unit file for the D-Bus service (a messaging system that allows different applications to communicate with each other). This file configures how the D-Bus service should start, stop, and reload on the system, along with its dependencies and environment settings.
Security
Ensuring security on Linux systems involves implementing appropriate practices and tools to protect the system from unauthorized access and vulnerabilities. Here are some basic measures and how to use specific tools to configure firewalls and manage updates:
Using ufw (Ubuntu):
Using firewalld (CentOS, Fedora, Red Hat, Oracle Linux):
SSH Configuration: Securing Remote Access:
Automation with Cron Jobs
Configuring and using cron jobs effectively helps automate routine processes and maintain the consistency and efficiency of the Linux operating system. It is important to regularly check existing cron jobs and ensure they work as expected to avoid problems and maintain system integrity.
Creating Cron Jobs:
Crontab syntax: minute hour day_month month day_week command
List cron jobs:
Backup and Recovery
Incremental backup with rsync:
Using Backup Tools:
Recovery Strategies:
Restore files with rsync:
Disaster Recovery Planning:
Package Management
APT (Debian/Ubuntu):
YUM (Red Hat/CentOS):
DNF (Fedora/CentOS 8+):
In conclusion, Linux server administration encompasses a wide range of skills and knowledge from initial installation and configuration to continuous monitoring, maintenance, and security.
Get to know our services
Application and Services Orchestration
Our approach to Kubernetes is designed to boost the scalability of your IT infrastructure.
Categories
Tags
Contacts
De las Alondras, E10-115
+593 979 733 071
olivia@softwareevolutivo.net
8:30am-6:00pm