ubuntu2204_0123.box
源于网上的ubunt22.04,具体忘记是哪个版本了。
变更历史:
- 将apt源替换成了清华源
- 安装了python3-pip
下载地址:
我用夸克网盘分享了「ubuntu2204_0123.box」,点击链接即可保存。打开「夸克APP」,无需下载在线播放视频,畅享原画5倍速,支持电视投屏。
链接:https://pan.quark.cn/s/ccd942ce5cba
提取码:i7LE
执行的脚本:
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
# 清华源
sudo bash -c 'cat > /etc/apt/sources.list << "EOF"
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble main restricted universe multiverse
# deb-src 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-src 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-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-backports main restricted universe multiverse
# 以下安全更新软件源包含了官方源与镜像站配置,如有需要可自行修改注释切换
deb http://security.ubuntu.com/ubuntu/ noble-security main restricted universe multiverse
# deb-src http://security.ubuntu.com/ubuntu/ noble-security main restricted universe multiverse
# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-proposed main restricted universe multiverse
EOF'
sudo apt-get update
# 安装python3-pip
sudo apt install python3-pip -y
sudo apt-get install sshpass -y
# 删除已安装软件包的安装包
sudo apt-get autoremove --purge -y
sudo apt-get clean
sudo apt-get autoclean
# 清理缓存目录
sudo rm -rf /var/cache/apt/archives/*
# 轮转并清理日志
sudo journalctl --vacuum-time=1s
sudo find /var/log -type f -name "*.log" -exec truncate -s 0 {} \;
sudo find /var/log -type f -name "*.gz" -delete
# 使用 dd 命令创建全零的大文件直到磁盘满,然后删除它
dd if=/dev/zero of=/EMPTY bs=1M
sudo rm -f /EMPTY
# 确保所有写入都已同步到磁盘
sync
关闭虚拟机,导出镜像。
vagrant package web --output my_custom.box