Linux 安装

三种装法:物理机/虚拟机、云主机、容器;以及分区怎么划。

Beginner
Key Points学习用虚拟机或 WSL 最省事;生产用云主机;只想跑个命令用容器。分区至少要有 / 和 swap。

三种装法

WayEffortBest for
Virtual machineLow, reversibleLearning, trying distros
Cloud hostMinutes, costs moneyAnything with a public IP
ContainerSecondsRunning commands, not a full system
Bare metal / dual bootHigh riskDaily driver

虚拟机里装

Bash
# VirtualBox / VMware:新建虚拟机 → 挂 ISO → 启动 → 按向导装
# 建议配置:2 CPU、4GB 内存、20GB 磁盘、网络选 NAT + 端口转发

分区怎么划

MountSizeWhy
/20-40GBRoot filesystem
swap= memory, or 2GBHibernate and OOM cushion
/homeRestSurvives reinstall
/var10-20GBLogs and databases can explode

装完先做

Bash
sudo apt update && sudo apt upgrade -y     # Debian/Ubuntu
sudo dnf upgrade -y                        # RHEL/Rocky

sudo apt install -y vim curl git htop      # 常用工具
sudo systemctl enable --now ssh            # 允许远程登录
A separate /var is old ops wisdom: logs filling the root filesystem locks you out entirely. On containers or cloud hosts, at least configure log rotation.

Friends & Partners