Linux常用命令和安装镜像收集【更新日期:2025.10.19】
编辑
140
2025-10-18
命令镜像不分先后常用顺序,按照添加时间排列
一.常用命令
系统升级
sudo apt update && apt upgrade -y无痕linux系统性能测试
bash <(curl -sL https://run.NodeQuality.com)安装docker
官网一键安装命令
sudo curl -fsSL https://get.docker.com | bash -s docker可在此命令后附带--mirror参数设置镜像源,以提高国内服务器下载docker的速度
使用阿里云镜像
sudo curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun安装caddy
sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https curl
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list
sudo apt update
sudo apt install -y caddy
#安装完成后
sudo systemctl enable caddy
sudo systemctl start caddy安装Nginx
#安装Nginx
sudo apt install nginx -y
#nginx检查配置文件
sudo nginx -t
#重启nginx
sudo systemctl restart nginxswap 安装
# 1. 创建 1GB 的 swap 文件
sudo fallocate -l 1G /swapfile
# 若提示 fallocate 不支持,可改用:
# sudo dd if=/dev/zero of=/swapfile bs=1M count=1024 status=progress
# 2. 设置权限(必须 600)
sudo chmod 600 /swapfile
# 3. 格式化为 swap 类型
sudo mkswap /swapfile
# 4. 启用 swap
sudo swapon /swapfile
# 5. 验证启用情况
sudo swapon --show
free -h
# 6. 设置开机自动挂载(带备份)
sudo cp /etc/fstab /etc/fstab.bak
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstabscreen 终端会话管理
# 新建会话
screen -S <name>
# 分离会话:Ctrl+A+D
# 列出所有会话
screen -ls
# 重新连接会话
screen -r <id>
# 强制终止会话:Ctrl+A+K启用bbr加速
wget -N --no-check-certificate "https://github.com/teddysun/across/raw/master/bbr.sh" && chmod +x bbr.sh && ./bbr.sh一键DD系统(Linux=>Linux)
#国外服务器
curl -O https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.sh || wget -O ${_##*/} $_
#国内服务器
curl -O https://cnb.cool/bin456789/reinstall/-/git/raw/main/reinstall.sh || wget -O ${_##*/} $_
#一键DD Debian13
bash reinstall.sh debian 13 --password PASSWORD
#一键DD ubuntu 22.04
bash reinstall.sh ubuntu 22.04 --password PASSWORD
#一键DD ubuntu 24.04
bash reinstall.sh ubuntu 24.04 --password PASSWORD设置系统镜像源
Ubuntu 22.04
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak && \
sudo bash -c 'cat > /etc/apt/sources.list <<EOF
# 清华大学开源软件镜像站 Ubuntu 22.04 (Jammy)
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse
# 可选:源码源(注释掉)
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse
EOF' && \
sudo apt updateUbuntu 24.04
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak && \
sudo bash -c 'cat > /etc/apt/sources.list <<EOF
# 清华大学开源软件镜像站 Ubuntu 24.04 (Noble Numbat)
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-security main restricted universe multiverse
# 可选:源码源(如不需要可保留注释)
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-security main restricted universe multiverse
EOF' && \
sudo apt updateDebian 13
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak && \
sudo bash -c 'cat > /etc/apt/sources.list <<EOF
# 清华大学开源软件镜像站 Debian 13 (Trixie)
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ trixie main contrib non-free-firmware non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ trixie-updates main contrib non-free-firmware non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security trixie-security main contrib non-free-firmware non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ trixie-backports main contrib non-free-firmware non-free
# 可选:源码源(如不需要可保留注释)
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ trixie main contrib non-free-firmware non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ trixie-updates main contrib non-free-firmware non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security trixie-security main contrib non-free-firmware non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ trixie-backports main contrib non-free-firmware non-free
EOF' && \
sudo apt update二. 常用镜像
1. Ubuntu 22.04
清华镜像:https://mirrors.tuna.tsinghua.edu.cn/ubuntu-releases/22.04/
官网下载:https://releases.ubuntu.com/jammy/
2. Ubuntu 24.04
清华镜像:https://mirrors.tuna.tsinghua.edu.cn/ubuntu-releases/24.04/
官网下载:https://cn.ubuntu.com/download/server/step1
3. Dibian 13
清华镜像:https://mirrors.tuna.tsinghua.edu.cn/debian-cd/13.1.0/amd64/iso-dvd/
官网下载:https://cdimage.debian.org/debian-cd/current/amd64/iso-dvd/
4. unRAID开心版
- 1
- 0
-
分享