yum

本文介绍了一种用于配置Linux系统的脚本,包括设置网络连接、修改主机名、配置YUM源等步骤。该脚本通过命令行操作实现网络接口的配置,并停用防火墙与SELinux以确保网络畅通。同时,还详细展示了如何建立自定义的YUM源以方便软件包的安装与更新。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

#!/bin/bash
nmcli connection add type ethernet con-name $1 ifname $1
nmcli connection modify "$1" ipv4.method manual ipv4.addresses "$2" connection.autoconnect yes
nmcli connection up "$1"
hostnamectl set-hostname "$3"
echo "$*"
ifconfig $1 | awk '/netmask/{print}'
rm  -rf /etc/yum.repos.d/*.repo &> /dev/null
yum=/etc/yum.repos.d/rhel7.repo &> /dev/null

touch $yum
echo "[rhel7]" > $yum
echo "name=rhel7" >> $yum
echo "baseurl=http://192.168.4.254/rhel7" >> $yum
echo "gpgcheck=0" >> $yum
echo "enabled=1" >> $yum
yum clean all &> /dev/null
yum repolist | awk -F: '/repolist/{print}'

systemctl stop firewalld
systemctl disable firewalld
setenforce 0

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值