模板制作教程
以Ubuntu为例:
1、安装好ubuntu系统并设置国内的源
https://mirror.tuna.tsinghua.edu.cn/help/ubuntu/
系统升级:apt-get update;apt-get upgrade
安装软件
apt-get install sysstat vim gcc wget iftop nload curl lrzsz dmidecode screen ntp ntpdate parted lsb-core libcurses-perl libcurses-ui-perl libterm-readkey-perl eject
2、安装qemu-guest-agent
apt-get install qemu-guest-agent
安装完成后 开启服务
systemctl start qemu-guest-agent
3、压缩磁盘
dd if=/dev/zero of=/zero.dat
待完成后执行
rm -rf /zero.dat
待完成后执行
qemu-img convert -c -O qcow2 /path/old.qcow2 /path/new.qcow2
4、清理日志
# cd /var/log
# >btmp ;>dmesg;>messages ;>wtmp
# history -c && history -w && poweroff
Ubuntu22.04开启root用户登陆
修改/etc/ssh/sshd_config
permitRootLogin prohibit-password 变成 PermitRootLongin yes
取消注释 PasswordAuthentication yes
文档更新时间: 2022-11-17 17:50 作者:admin