#!/bin/bash
# this shell is just for giving your linux system a ipv4 addr and something you should prepar!
setip () {
# for ipv4
read -p "enter the ipv4 address that you want! ipv4 addr:" addr
read -p "enter the ipv4 gateway that you want! ipv4 geteway:" gate
# read -p "enter the ipv4 dns that you want! ipv4 addr:" dns
nmcli connection modify ens33 ipv4.method manual ipv4.addresses ${addr}/24 ipv4.gateway $gate connection.autoconnect yes
s1=$?
nmcli connection up ens33 > /dev/null 2>&1
s2=$?
systemctl restart network > /dev/null 2>&1
s3=$?
}
setyum () {
# for yum
mkdir /yum_mount > /dev/null 2>&1
mount /dev/cdrom /yum_mount
rm -rf /etc/yum.repos.d/*.repo
echo "[development]
name=yum_centos_7
baseurl=file:///yum_mount
enabled=1
gpgcheck=0" > /etc/yum.repos.d/local.repo
echo "/dev/cdrom /yum_mount iso9660 default 0 0" >> /etc/fstab
}
sethn () {
#for replace hostname
read -p "Please input your hostname\! Hostname:" hn
hostname $hn
echo $hn > /etc/hostname
}
setip
echo " $s1 $s2 $s3"
if [ $(($s1+$s2+$s3)) == 0 ];then
echo "vm centos set yum : "
setyum
上一篇:
互娱出海中的视频直播服务对比
下一篇:
定时任务 编写案例