centos初始化脚本

#关闭防火墙和selinux:
systemctl stop firewalld
systemctl disable firewalld
setenforce 0
sed -i 's/^SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config

#yum 源加速
#1. 获取wget工具
yum -y install wget
#2. 拉取镜像文件到 `/` 目录下
wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
#3. 将centos中现有的yum的repo备份起来
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
#4. 下载的国内yum的repo替换原本yum的repo
mv CentOS7-Base-163.repo /etc/yum.repos.d/CentOS-Base.repo
#5. 重新生成缓存
yum clean all
yum makecache

#更新内核

yum update


#tab【补全】
yum -y install bash-completion && bash


#安装扩展源头
yum install -y epel-release

yum install net-tools -y

 

posted @ 2023-07-10 17:05  L北冥  阅读(59)  评论(0)    收藏  举报