#CentOS最小化安装建议安装常用包
yum -y install gcc make autoconf gcc-c++ glibc glibc-devel pcre pcre-devel openssl openssl-devel systemd-devel zlib-devel vim lrzsz tree tmux lsof tcpdump wget net-tools iotop bc bzip2 zip unzip nfs-utils man-pages redhat-lsb-core postfix mailx bash-completion man-pages httpd createrepo apr-devel apr-util-devel redhat-rpm-config
#CentOS 必须做的操作初始化
# 关闭防火墙
systemctl disable --now firewalld\
#centos6
#临时关闭 servcie iptables stop
#永久关闭 chkconfig iptables off
#关闭SELINUX
vi /etc/selinux/config
SELINUX=disabled\
或者
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
#Ubuntu 建议安装常用包
apt purge ufw lxd lxd-client lxcfs liblxc-common
apt -y install iproute2 ntpdate tcpdump telnet traceroute nfs-kernel-server nfs-common lrzsz tree openssl libssl-dev libpcre3 libpcre3-dev zlib1g-dev gcc openssh-server iotop unzip zip apt-file make libapr1-dev libaprutil1-dev
#ubuntu查看防火墙状态:sudo ufw status
#ubuntu查看防火墙状态:
sudo ufw status
#ubuntu开机自动开启防火墙:
#1、
sudo ufw enable
#2、
sudo ufw default deny
#(运行以上两条命令后,开启了防火墙,并在系统启动时自动开启。关闭所有外部对本机的访问,但本机访问外部正常)
#ubuntu开机自动禁用防火墙:
sudo ufw disable
#查看与删除内核
#CentOS
#内核查看
uname -r
#查看本机有几个内核
rpm -qa|grep kernel
#删除多余内核
yum remove -y
#安装和配置邮件系统
yum -y install postfix;systemctl enable --now postfix
vim /etc/mail.rc
set from=*******@qq.com
set smtp=smtp.qq.com
set smtp-auth-user=******@qq.com
set smtp-auth-password=*******
#清理缓存
echo 3 > /proc/sys/vm/drop_caches
#此处补充各个安装包的用途
yum -y install vim #vim文本编辑器
yum -y install net-tools #ifconfig 依赖包
实用命令
du -sm * | sort -nr #统计当前目录下文件大小,并按照大小排序
lsof |grep deleted #的作用是:查看所有已打开文件并筛选出其中已删除状态的文件 参考与https://www.hollischuang.com/archives/5894