centos7服务器脚本

  |   0 评论   |   0 浏览

脚本:

#!/usr/bin/env bash
#
# Author: value
# Email: 925960983@qq.com
# Date: 2020/10/27
# Usage:system

# turn off firewalld and selinux.
systemctl disable firewalld &&  systemctl stop firewalld
STATUS=$(getenforce)
if [ $STATUS == "Disabled" ];then
  printf "SELINUX is closed.\n"
else
 sed -ri s/SELINUX=enforcing/SELINUX=disabled/g /etc/selinux/config
  setenforce 0
fi

# mount disk
mkdir /data
vgcreate vg0 /dev/sdb
lvcreate -n lv0 -L 499G vg0
mkfs.ext4 /dev/vg0/lv0
mount /dev/vg0/lv0 /data/
echo "/dev/vg0/lv0 /data/ ext4 defaults 0 0" >>/etc/fstab


#make local repo

mkdir -p /etc/yum.repos.d/backup
mv /etc/yum.repos.d/* /etc/yum.repos.d/backup

cat > /etc/yum.repos.d/local.repo <<EOF
[base]
name=CentOS-$releasever - Base - mirror.com
baseurl=http://10.253.33.1/base/
path=/
enabled=1
gpgcheck=0

[updates]
name=CentOS-$releasever - Updates - mirror.com
baseurl=http://10.253.33.1/updates
path=/
enabled=1
gpgcheck=0

[extras]
name=CentOS-$releasever - Extras - mirror.com
baseurl=http://10.253.33.1/extras
path=/
enabled=1
gpgcheck=0

[epel]
name=CentOS-$releasever - epel - mirror.com
baseurl=http://10.253.33.1/epel/
failovermethod=priority
enabled=1
gpgcheck=0
EOF

yum clean all && yum makecache
yum -y install vim


标题:centos7服务器脚本
作者:SmiteLi
地址:https://smite.site/articles/2020/12/03/1607008924484.html