====== Redhat - Clean Up ====== ===== Disable selinux ===== Edit **/etc/selinux/config**. Change **SELINUX=enforcing** to **SELINUX=disabled**: # This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - No SELinux policy is loaded. SELINUX=enforcing # SELINUXTYPE= can take one of these two values: # targeted - Targeted processes are protected, # mls - Multi Level Security protection. SELINUXTYPE=targeted ---- ===== Turn off Firewall ===== systemctl stop firewalld systemctl disable firewalld yum -y install net-tools **NOTE:** On some older versions the following might be needed: service iptables save service iptables stop chkconfig iptables off ---- ===== Clean Up Script ===== #!/bin/bash echo "Clean Up" yum clean all > /etc/machine-id rm -f /etc/ssh/ssh_host_rm -rf /root/.ssh/ rm -f /root/anaconda-ks.cfg rm -f /root/.bash_history unset HISTFILE rm -f /var/log/boot.log rm -f /var/log/cron rm -f /var/log/dmesg rm -f /var/log/grubby rm -f /var/log/lastlog rm -f /var/log/maillog rm -f /var/log/messages rm -f /var/log/secure rm -f /var/log/spooler rm -f /var/log/tallylog rm -f /var/log/wpa_supplicant.log rm -f /var/log/wtmp rm -f /var/log/yum.log rm -f /var/log/audit/audit.log rm -f /var/log/tuned/tuned.logroot ---- Make the Script Executable cd /usr/src chmod +x cleanup.sh ---- Run the Clean Up Script ./cleanup.sh ---- ===== Clear History ===== cat /dev/null > ~/.bash_history && history -c && exit ---- ===== Generalize the System Config ===== This prevents conflicts when using this setup as a template when creating different virtual machines deployed from the template. sys-unconfig