解释: y 配置yum仓库
t 查看进程信息
w 配置阿里源
#!/bin/bash
read -p “是否配置yum源仓库y/n(输入其他字符可以显示进程)” y n t l w
case $y in
y)
echo [正在配置———————————]
mount /dev/cdrom /mnt &>/dev/null
mkdir -p /etc/yum.repos.d/mt
mv /etc/yum.repos.d/CentOS-* /etc/yum.repos.d/mt/ &>/dev/null
touch /etc/yum.repos.d/centos7.repo
cat /etc/yum.repos.d/centos7.repo
[centos7]
name=centos7.5
baseurl=file:///mnt
enabled=1
gpgcheck=0
END
echo “已经配置完成”
echo “进行后续配置安装vim上传工具请稍等–“
yum -y install vim &>/dev/null
yum -y install lrzsz &>/dev/null
yum -y install net-tools &>/dev/null
yum -y install unzip gt;/dev/null
yum -y install lrzsz gt;/dev/null
yum -y install lsb gt;/dev/null
echo “vim已经安装完毕”
systemctl stop firewalld
systemctl disable firewalld &>/dev/null
echo “防火墙关闭”
sed -i “s/SELINUX=enforcing/SELINUX=disabled/g” /etc/selinux/config
echo “selinux关闭”
echo “开机自动挂载”
sed -i ‘$a /dev/sr0 /mnt iso9660 defaults 0 0’ /etc/fstab
;;
n)
read -p “您是否要查看磁盘挂载信息:” y
y=yes
if [ $y=”yes” ]
then
df -hT
fi
;;
t)
echo “查看进程信息”
top
;;
l)
echo [查看系统版本信息]
lsb_release -a
;;
w)
echo [配置阿里网络源]
yum -y install wget &>/dev/null
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
;;
f)
echo [查看内存使用率]
free -m | sed -n ‘2p’ | awk ‘{print “mem used is “$3/$2*100″%”}’
;;
esac