Linux搭建yum脚本
  zemmmtQ2H13W 2023年11月02日 58 0

#!/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

【版权声明】本文内容来自摩杜云社区用户原创、第三方投稿、转载,内容版权归原作者所有。本网站的目的在于传递更多信息,不拥有版权,亦不承担相应法律责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@moduyun.com

  1. 分享:
最后一次编辑于 2023年11月08日 0

暂无评论

推荐阅读
  ehrZuhofWJiC   2024年04月26日   34   0   0 内核linux
  ehrZuhofWJiC   2024年05月17日   34   0   0 linuxsvn
  ehrZuhofWJiC   2024年05月17日   38   0   0 KVMlinux
  ehrZuhofWJiC   2024年05月17日   33   0   0 服务器linux
zemmmtQ2H13W