安装指南

Ubuntu Initial Server Setup

Get your Ubuntu server production-ready with this essential initial setup guide covering user management, firewall, and SSH hardening.

March 11, 2026 336 浏览

How to Install Ubuntu Server on Ubuntu 22.04 LTS

This comprehensive guide will walk you through installing Ubuntu Server on Ubuntu 22.04 LTS. Follow these steps carefully to ensure a successful installation.

Prerequisites

  • A fresh Ubuntu 22.04 LTS server
  • Root or sudo access
  • At least 1GB of RAM
  • 10GB of available disk space

Step 1: Update System Packages

First, ensure your system is up to date:

sudo apt update && sudo apt upgrade -y

Step 2: Install Dependencies

Install required dependencies:

sudo apt install ufw fail2ban curl wget git -y

Step 3: Install Ubuntu Server

Now install Ubuntu Server using the package manager:

# Create a new sudo user
adduser deployer
usermod -aG sudo deployer

# Set up SSH key authentication
mkdir -p /home/deployer/.ssh
cp ~/.ssh/authorized_keys /home/deployer/.ssh/
chown -R deployer:deployer /home/deployer/.ssh
chmod 700 /home/deployer/.ssh
chmod 600 /home/deployer/.ssh/authorized_keys

Step 4: Start and Enable Service

Start the Ubuntu Server service and enable it to run on boot:

# Disable root login and password authentication
sudo sed -i "s/PermitRootLogin yes/PermitRootLogin no/" /etc/ssh/sshd_config
sudo sed -i "s/#PasswordAuthentication yes/PasswordAuthentication no/" /etc/ssh/sshd_config
sudo systemctl restart sshd

Step 5: Configure Ubuntu Server

Edit the configuration file located at /etc/ssh/sshd_config:

sudo nano /etc/ssh/sshd_config

Step 6: Verify Installation

Check that Ubuntu Server is running correctly:

sudo ufw status
sudo systemctl status sshd
sudo systemctl status fail2ban

Conclusion

Congratulations! You now have Ubuntu Server running on Ubuntu 22.04 LTS. For additional configuration options, refer to the official Ubuntu Server documentation.

请为这篇文章评分

-
Loading...

搜索文档
Launch Your VPS
From $2.50/mo