AI智能
改变未来

shell脚本自动部署本地yum源

自动部署本地yum源有一下两种方式:
   方式一:

      #!/bin/bash                                                                           //脚本格式

      mkdir /centos                                                                         //根目录下创建centos文件

      mount /dev/cdrom  /centos                                                   //将光盘挂载到centos下

      echo ‘[centos]’  > /etc /yum.repos.d/centos.repo

      echo ’name=centos’  >> /etc /yum.repos.d/centos.repo

      echo ‘baseurl=file:///centos’  >>/etc /yum.repos.d/centos.repo

      echo ‘gpgcheck=0’  >>/etc /yum.repos.d/centos.repo

      echo ‘enabled=1’  >>/etc /yum.repos.d/centos.repo

    方式二:

      #!/bin/bash                                                                              //脚本格式

      mkdir /centos                                                                            //根目录下创建centos文件

      mount /dev/cdrom  /centos                                                     //将光盘挂载到centos下

      echo ‘[centos]

      name=centos

      baseurl= file:///centos

      gpgcheck=0                                                                               //是否红帽开启检查   0是关闭 1是开启

      enabled=1’                                                                                //是否开启开机自启   0关闭  1开启

      >/etc/yum.repos.d/centos.repo

赞(0) 打赏
未经允许不得转载:爱站程序员基地 » shell脚本自动部署本地yum源