目 录CONTENT

文章目录

CentOS系统初始化

ZERO
2022-06-18 / 0 评论 / 0 点赞 / 132 阅读 / 0 字

CentOS 7系统初始化配置

echo "Welcome to Server" > /etc/issue
sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config
chmod +x /etc/rc.d/rc.local
rpm --import http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
mkdir /etc/yum.repos.d/bak
mv /etc/yum.repos.d/*.repo bak
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
rpm --import http://mirrors.aliyun.com/epel/RPM-GPG-KEY-EPEL-7
curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo
yum clean all
yum makecache
yum install vim lrzsz wget bzip2 chrony gcc gcc-c++ kernel-devel openssh-clients tree pam-devel zlib-devel openssl-devel man unzip parted parted-devel net-tools autofs bash-completion sysstat rsync-y
yum update -y

CentOS 8 系统初始化

echo "Welcome to Server" > /etc/issue
sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config
chmod +x /etc/rc.d/rc.local

mkdir  /etc/yum.repos.d/old
mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/old
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
sed -i 's/mirrors.cloud.aliyuncs.com/url_tmp/g' /etc/yum.repos.d/CentOS-Base.repo && sed -i 's/mirrors.aliyun.com/mirrors.cloud.aliyuncs.com/g' /etc/yum.repos.d/CentOS-Base.repo && sed -i 's/url_tmp/mirrors.aliyun.com/g' /etc/yum.repos.d/CentOS-Base.repo

yum clean all
yum makecache

yum install -y https://mirrors.aliyun.com/epel/epel-release-latest-8.noarch.rpm
sed -i 's|^#baseurl=https://download.example/pub|baseurl=https://mirrors.aliyun.com|' /etc/yum.repos.d/epel*
sed -i 's|^metalink|#metalink|' /etc/yum.repos.d/epel*


yum install vim lrzsz wget bzip2 chrony gcc gcc-c++ kernel-devel openssh-clients tree pam-devel zlib-devel openssl-devel man unzip parted net-tools autofs bash-completion sysstat rsync -y
yum update -y
# rm -rf /etc/yum.repos.d/CentOS-[^B]*

0

评论区