删除系统机器ID
(1)删除系统的ID:machine-id是系统的唯一性ID,每一台服务器的machin-ID都应该不一样,为了解决ID的冲突,故删除
[root@localhost ~] echo "" > /etc/machine-id
(2)重新生成mache-id
在/etc/profile文件最后添加:使之开机重启后,通过systemd-machine-id-setup的命令来生成全新的machine-id号
[root@localhost ~]# cat >> /etc/profile
systemd-machine-id-setup
EOF
(3)清除UDEV
系统重启后会自动创建,删除/etc/udev/rules.d/目录下的所有文件
[root@localhost ~]#rm -fr /etc/udev/rules.d/*
(4)清除ssh私钥文件
不同的系统私钥应该是不同的,删除后重启系统会自动生成全新的私钥
[root@localhost ~]#rm -fr /etc/ssh/ssh_host_*
清除系统中的旧日志文件
先停止系统的日志服务
(1)[root@localhost ~]#systemctl stop systemd-journald.socket
(2)将原来的旧日志文件删除
[root@localhost ~]#find /var/log -type f -exec rm {} \;
(3)创建journal日志目录,用来保存日志使用,原日志是保存在/run/log/journal目录下,掉电就会丢失
[root@localhost ~]#mkdir -p /var/log/journal
[root@localhost ~]#chgrp systemd-journal /var/log/journal
[root@localhost ~]#chmod g+s /var/log/journal
(4)清除所有命令的历史记录
[root@localhost ~]#cd /root && rm -fr .bash_history && history -c
(5)关闭系统
[root@localhost ~]#systemctl poweroff