一、前言

本文主要从以下几个方面介绍Linux系统环境初步优化:

  • 配置国内YUM源
  • 安装常用工具
  • 关闭防火墙和Selinux

二、配置国内YUM源

备份yum源配置

$ cp /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/epel-7.repo

三、安装常用工具

使用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

四、关闭防火墙和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