一、Linux环境初步优化¶
1、检查是否能联网(虚拟机是否可以访问外部网络)
ping baidu.com
2、配置国内YUM源
https://developer.aliyun.com/mirror/centos?spm=a2c6h.13651102.0.0.3e221b11SN4lWR
备份yum源配置
$ mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
配置国内YUM源
$ curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
$ wget -O /etc/yum.repos.d/epel.repo https://mirrors.aliyun.com/repo/epel-7.repo
更新yum缓存
sudo yum clean all
sudo yum makecache
3、安装常用工具
使用yum命令安装常用工具
$ yum install -y tree vim wget bash-completion bash-completion-extras lrzsz net-tools sysstat iotop iftop htop unzip nc nmap telnet bc psmisc httpd-tools bind-utils nethogs expect
4、关闭防火墙和Selinux
关闭防火墙
$ systemctl disable --now firewalld
关闭Selinux
$ setenforce 0
$ sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/sysconfig/selinux
$ sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config