Thanks to Teklan Hosting
A big thank you to Teklan Hosting for providing us with a server. Their support has made it possible for us to create and share this guide with you.
We appreciate Teklan Hosting’s contribution to our project – Give them a look if you need a VPS, Web hosting, Domains or dedicated servers and much more!
Introduction
If you’re interested in managing your own server, you can’t do much better than the highly versatile Debian 12, an operating system renowned for its robust stability and security. Debian is often the go-to choice for new server setups due to its well-documented, highly supportive community and vast software repository.
This guide will provide a comprehensive overview of the basics of managing a Debian 12 server. We will be covering installation, basic commands, software management, user management, and security enhancements.
- Installation
The first step to managing a Debian 12 server is installing the operating system itself.
You can download the latest Debian ISO from the official Debian website. After downloading, create a bootable USB or CD, then restart your machine and boot from this media. You’ll be presented with the Debian installer interface.
The installer will guide you through a series of prompts including language selection, disk partitioning, network configuration, and root password setup. Make sure to remember the root password as it will be required for system-wide changes and updates.
Once installation is complete, restart your machine and you should be greeted with the Debian 12 login screen.
- Basic Commands
Navigating and managing your Debian 12 server will be predominantly done via the command-line interface (CLI). Here are some basic commands you need to know:
cd
: Changes the current directory.ls
: Lists all files and directories in the current directory.pwd
: Shows the current directory path.cp
: Copies files or directories.mv
: Moves or renames files or directories.rm
: Removes files or directories.nano
,vi
,emacs
: Opens a file in a text editor.man
: Opens the manual page for a command.
- Software Management
One of the most crucial aspects of server management is handling software packages. Debian uses the Advanced Packaging Tool (APT) for this purpose. Some key commands include:
sudo apt update
: Updates the package lists for upgrades and new packages from repositories.sudo apt upgrade
: Upgrades all upgradable packages.sudo apt install package-name
: Installs a package.sudo apt remove package-name
: Removes a package but keeps configuration files.sudo apt purge package-name
: Removes a package along with its configuration files.sudo apt autoremove
: Removes unnecessary packages.
- User Management
On a Debian server, you’ll likely need to add, remove, or modify user accounts. Here are some of the essential commands for user management:
adduser username
: Adds a new user.deluser username
: Deletes a user.passwd username
: Changes a user’s password.usermod
: Modifies a user account.
Remember, for system-wide changes, prefix these commands with sudo
.
- Security Enhancements
Securing your server is critical. Here are some general security best practices for a Debian server:
- Update Regularly: Regularly update your system packages to receive security patches using
sudo apt update
andsudo apt upgrade
. - Firewall: Use a firewall to restrict access to your server. UFW is an uncomplicated firewall that is easy to use. To enable it, use
sudo ufw enable
. - Secure Shell (SSH): For remote server management, SSH is a secure protocol. Always change the default SSH port and disable root login for added security.
- Fail2ban: This tool helps prevent brute-force attacks. It blocks IP addresses that show malicious signs such as too many password failures.
Conclusion
In this guide, we’ve covered the basics of managing a Debian 12 server, from installation to essential commands, software management, user management, and security enhancements. Debian is a powerful, flexible server operating system, but its real strength lies in the hands of a knowledgeable administrator.
By learning these basic skills, you’ve taken the first steps toward effective server management. As you become more comfortable with Debian, you can delve into advanced topics such as networking, server hosting, and more. Remember, the Debian community is a fantastic resource, so never hesitate to seek help or advice as you continue your journey in mastering Debian server management.