Server Setup
- How do I set up a Linux server for the first time?
Install a Linux distribution, update packages, create a non-root user with sudo, configure SSH key authentication, set up a firewall, and disable password logins. - How do I create a new user on a Linux server?
Use sudo adduser username (Debian/Ubuntu) or sudo useradd -m username (RHEL-based), then set a password with sudo passwd username and add sudo privileges if needed. - What is SSH and how does it work?
SSH (Secure Shell) is a protocol for encrypted remote login and command execution. It uses public-key cryptography to authenticate the server and optionally the client. - How do I configure a firewall on Linux?
Use UFW on Debian/Ubuntu or firewalld on RHEL-based systems. Allow SSH first, then enable the firewall and open only the ports you need. - How do I keep a Linux server updated?
Use your distribution's package manager to apply updates regularly, and enable automatic security updates where possible. For Debian/Ubuntu use apt; for RHEL/CentOS/Rocky use dnf or yum. - What is the best way to secure a new Linux server?
There is no single best way, but a strong baseline includes: update the system, create a non-root user with sudo, disable password SSH logins, set up a firewall, and enable automatic security updates. - How do I install Nginx on a Linux server?
On Ubuntu or Debian, run sudo apt update, then sudo apt install nginx, and start it with sudo systemctl enable --now nginx. Then open web ports in your firewall. - How do I set up SSH key login on a Linux server?
Create a key pair with ssh-keygen -t ed25519, copy the public key to the server with ssh-copy-id, then test a new login before turning off password logins. - Should I run my app as root on a Linux server?
Avoid running applications as root. Create a dedicated user with only the permissions the app needs, so a bug or exploit has less room to damage the whole server. - Which command sets a hostname on a new Linux server?
On most modern distributions using systemd, run hostnamectl set-hostname followed by the new name. Then check it with hostnamectl and confirm the name also appears in your hosts file.