wiki:CentOS_7_YUM

CentOS 7 yum & rpm

## 更换默认源,添加EPEL源
yum clean all
sed -i "/^enabled/ s/1/0/" /etc/yum/pluginconf.d/fastestmirror.conf
sed -i 's/^#baseurl/baseurl/g' /etc/yum.repos.d/CentOS-Base.repo
sed -i 's/^mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-Base.repo
sed -i 's/mirror.centos.org/mirrors.aliyun.com/g' /etc/yum.repos.d/CentOS-Base.repo
rpm -ivh http://mirrors.aliyun.com/epel/epel-release-latest-7.noarch.rpm
sed -i 's/^#baseurl/baseurl/g' /etc/yum.repos.d/epel.repo
sed -i 's/^mirrorlist/#mirrorlist/g' /etc/yum.repos.d/epel.repo
sed -i 's/download.fedoraproject.org\/pub/mirrors.aliyun.com/g' /etc/yum.repos.d/epel.repo
yum makecache

## 修改默认配置
sed -i '/SELINUX/ s/enforcing/disabled/g' /etc/selinux/config
sed -i 's/4096/65535/g' /etc/security/limits.d/20-nproc.conf
cat <<EOM >/etc/security/limits.d/30-nfile.conf
*          soft    nofile     65535
root       soft    nofile     unlimited
EOM

## 关闭不用的服务
systemctl stop postfix.service NetworkManager.service wpa_supplicant.service
systemctl disable postfix.service NetworkManager.service wpa_supplicant.service

## 工具包
yum install -y wget lsof rsync unzip vim chrony tcpdump bind-utils lftp ftp telnet nmap pciutils sysstat lrzsz
yum update -y


## 防火墙
firewall-cmd --zone=public --add-service=http
firewall-cmd --zone=public --add-service=https
firewall-cmd --zone=public --list-services
firewall-cmd --zone=public --permanent --add-service=http
firewall-cmd --zone=public --permanent --add-service=https
firewall-cmd --zone=public --permanent --list-services

Last modified 3 years ago Last modified on 10/24/19 15:45:20