Linux Server Management

From Server rental store
Jump to navigation Jump to search
  1. Linux Server Management

This article provides a comprehensive guide to managing a Linux server, focusing on essential tasks for maintaining a stable and secure environment. This is intended for newcomers to server administration and assumes a basic understanding of the Linux command line. We will cover user management, package management, firewall configuration, and basic monitoring.

User Management

Effective user management is crucial for security. We’ll cover creating, modifying, and deleting user accounts. Always use strong passwords! Refer to Secure Password Practices for more details.

Creating a New User

The `useradd` command is used to create new user accounts. The `-m` flag creates a home directory, and `-s` specifies the shell.

```bash sudo useradd -m -s /bin/bash newuser sudo passwd newuser ```

Modifying User Accounts

The `usermod` command modifies existing user accounts. For example, to change a user’s shell:

```bash sudo usermod -s /bin/zsh newuser ```

Deleting User Accounts

The `userdel` command deletes user accounts. The `-r` flag removes the home directory and mail spool. **Use with extreme caution!**

```bash sudo userdel -r newuser ```

The following table summarizes user management commands:

Command Description
`useradd` Creates a new user account.
`usermod` Modifies an existing user account.
`userdel` Deletes a user account.
`passwd` Changes a user’s password.
`id` Displays user and group information.

Package Management

Package managers simplify software installation, updates, and removal. The specific package manager depends on the Linux distribution. This section details usage for Debian/Ubuntu (APT) and Red Hat/CentOS/Fedora (YUM/DNF). See Choosing a Linux Distribution for help selecting an OS.

Debian/Ubuntu (APT)

  • `sudo apt update`: Updates the package lists.
  • `sudo apt upgrade`: Upgrades installed packages.
  • `sudo apt install <package_name>`: Installs a package.
  • `sudo apt remove <package_name>`: Removes a package.

Red Hat/CentOS/Fedora (YUM/DNF)

  • `sudo yum update` or `sudo dnf update`: Updates the package lists and installed packages.
  • `sudo yum install <package_name>` or `sudo dnf install <package_name>`: Installs a package.
  • `sudo yum remove <package_name>` or `sudo dnf remove <package_name>`: Removes a package.

Here's a comparison of package management systems:

Distribution Package Manager Update Command Install Command
Debian/Ubuntu APT `sudo apt update` `sudo apt install <package_name>`
Red Hat/CentOS/Fedora YUM/DNF `sudo yum update` or `sudo dnf update` `sudo yum install <package_name>` or `sudo dnf install <package_name>`
Arch Linux Pacman `sudo pacman -Syu` `sudo pacman -S <package_name>`

Firewall Configuration

A firewall protects your server from unauthorized access. `ufw` (Uncomplicated Firewall) is a common choice on Debian/Ubuntu, while `firewalld` is prevalent on Red Hat-based systems. Always consult Firewall Best Practices before making changes.

UFW (Debian/Ubuntu)

  • `sudo ufw enable`: Enables the firewall.
  • `sudo ufw allow <port>`: Allows traffic on a specific port. (e.g., `sudo ufw allow 22` for SSH)
  • `sudo ufw deny <port>`: Denies traffic on a specific port.
  • `sudo ufw status`: Checks the firewall status.

Firewalld (Red Hat/CentOS/Fedora)

  • `sudo systemctl start firewalld`: Starts the firewall.
  • `sudo firewall-cmd --zone=public --add-port=<port>/tcp --permanent`: Allows traffic on a specific port (TCP) permanently.
  • `sudo firewall-cmd --reload`: Reloads the firewall rules.
  • `sudo firewall-cmd --list-all`: Lists all firewall rules.

Basic Monitoring

Monitoring your server's resource usage is vital for identifying performance bottlenecks and potential issues.

Top/Htop

`top` and `htop` provide real-time views of system processes and resource usage. `htop` is a more interactive and user-friendly alternative to `top`. Install `htop` using your package manager (e.g., `sudo apt install htop` or `sudo yum install htop`). See System Monitoring Tools for more options.

Disk Space Usage

The `df -h` command displays disk space usage in a human-readable format.

CPU Usage

The `top` command (or `htop`) displays CPU usage. Alternatively, `mpstat` can provide detailed CPU statistics.

Here’s a summary of useful monitoring commands:

Command Description
`top` Displays real-time system processes and resource usage.
`htop` Interactive process viewer.
`df -h` Displays disk space usage in a human-readable format.
`free -m` Displays memory usage in megabytes.
`uptime` Shows system uptime and load average.

Further Resources


Intel-Based Server Configurations

Configuration Specifications Benchmark
Core i7-6700K/7700 Server 64 GB DDR4, NVMe SSD 2 x 512 GB CPU Benchmark: 8046
Core i7-8700 Server 64 GB DDR4, NVMe SSD 2x1 TB CPU Benchmark: 13124
Core i9-9900K Server 128 GB DDR4, NVMe SSD 2 x 1 TB CPU Benchmark: 49969
Core i9-13900 Server (64GB) 64 GB RAM, 2x2 TB NVMe SSD
Core i9-13900 Server (128GB) 128 GB RAM, 2x2 TB NVMe SSD
Core i5-13500 Server (64GB) 64 GB RAM, 2x500 GB NVMe SSD
Core i5-13500 Server (128GB) 128 GB RAM, 2x500 GB NVMe SSD
Core i5-13500 Workstation 64 GB DDR5 RAM, 2 NVMe SSD, NVIDIA RTX 4000

AMD-Based Server Configurations

Configuration Specifications Benchmark
Ryzen 5 3600 Server 64 GB RAM, 2x480 GB NVMe CPU Benchmark: 17849
Ryzen 7 7700 Server 64 GB DDR5 RAM, 2x1 TB NVMe CPU Benchmark: 35224
Ryzen 9 5950X Server 128 GB RAM, 2x4 TB NVMe CPU Benchmark: 46045
Ryzen 9 7950X Server 128 GB DDR5 ECC, 2x2 TB NVMe CPU Benchmark: 63561
EPYC 7502P Server (128GB/1TB) 128 GB RAM, 1 TB NVMe CPU Benchmark: 48021
EPYC 7502P Server (128GB/2TB) 128 GB RAM, 2 TB NVMe CPU Benchmark: 48021
EPYC 7502P Server (128GB/4TB) 128 GB RAM, 2x2 TB NVMe CPU Benchmark: 48021
EPYC 7502P Server (256GB/1TB) 256 GB RAM, 1 TB NVMe CPU Benchmark: 48021
EPYC 7502P Server (256GB/4TB) 256 GB RAM, 2x2 TB NVMe CPU Benchmark: 48021
EPYC 9454P Server 256 GB RAM, 2x2 TB NVMe

Order Your Dedicated Server

Configure and order your ideal server configuration

Need Assistance?

⚠️ *Note: All benchmark scores are approximate and may vary based on configuration. Server availability subject to stock.* ⚠️