新机自动创建yum库

时间:2024-11-11 10:33:32

#!/bin/bash
#for a newsystem to setup auto reposity

YUM_DIR=/etc/yum.repos.d
MOUNT_DIR=/mnt
DEV_DIR="192.168.0.155:/uc/files/os/CentOS-6.5-x86_64/"
YUM_CONF=/etc/yum.repos.d/yum.repo
mkdir $YUM_DIR/backup
mkdir $MOUNT_DIR/cdrom
mv $YUM_DIR/Cent* $YUM_DIR/backup
touch $YUM_CONF
echo "[yum]" >> $YUM_CONF
echo "name=yum" >> $YUM_CONF
echo "baseurl=file://${MOUNT_DIR}/cdrom" >> $YUM_CONF
echo "enable=1" >> $YUM_CONF
echo "gpgcheck=0" >> $YUM_CONF

#modify selinux setup
mv /etc/selinux/config /etc/selinux/config.bak #backup selinux configure
sed 's/enforcing/disabled/g' /etc/selinux/config.bak > /etc/selinux/config
chkconfig iptables off
service iptables stop
setenforce 0