Complete Guide to Setting Up a Linux Server

Introduction
Setting up a Linux server from scratch can seem daunting, but with this comprehensive guide, you'll have your server up and running in no time.
Prerequisites
- Basic command line knowledge
- SSH access to your server
- Root or sudo privileges
Step 1: Initial Server Setup
First, let's update the system packages:
sudo apt update && sudo apt upgrade -y
Step 2: Create a New User
Never use root for daily operations. Let's create a new user:
adduser newuser usermod -aG sudo newuser
Step 3: Configure SSH
Secure your SSH configuration:
sudo nano /etc/ssh/sshd_config
Make these changes:
- PermitRootLogin no
- PasswordAuthentication no (if using SSH keys)
- Port 2222 (change from default 22)
Step 4: Setup Firewall
Configure UFW (Uncomplicated Firewall):
sudo ufw default deny incoming sudo ufw default allow outgoing sudo ufw allow 2222/tcp sudo ufw enable
Step 5: Install Essential Software
Install commonly needed packages:
sudo apt install curl wget git htop unzip software-properties-common
Conclusion
Your Linux server is now ready for use. In the next tutorial, we'll cover installing and configuring a web server.