一、关闭防火墙
1、关闭防火墙(临时)
systemctl stop firewalld
2、禁止开机自启,永久关闭
systemctl disable firewalld
二、关闭SELinux
sed -i 's/enforcing/disabled/' /etc/selinux/config
三、更改yum源为阿里源
1、备份当前yum源
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
2、下载阿里源,点击跳转:阿里官方源
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
或
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
3、重建缓存
yum clean all
yum makecache
4、非阿里云ECS用户会出现 Couldn't resolve host 'mirrors.cloud.aliyuncs.com' 信息,不影响使用。用户也可自行修改相关配置: eg:
sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo
四、安装常用软件包
1、wget下载工具
yum install -y wget
2、vim文本编辑器
yum install -y vim
3、查看ifconfig
yum install net-tools
4、gcc编译
yum install -y gcc gcc-c++
以下可根据自己需求选择
zlib:压缩和解压缩
openssl
虚拟机上传下载组件
zip unzip
yum-utils工具包
yum install -y zlib zlib-devel ruby
yum install -y openssl openssl-devel patch
yum install -y lrzsz
yum install -y unzip zip
yum install -y yum-utils