码迷,mamicode.com
首页 > 其他好文 > 详细

ReaHat7.6/7.7 最小化安装更新yum源

时间:2020-01-01 13:24:33      阅读:84      评论:0      收藏:0      [点我收藏+]

标签:failure   stat   rpm -e   existing   ice   保存   nec   x86_64   nal   


### 设置IP地址

TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=enp7s0f1
UUID=056ff806-7d15-4009-b461-b68a5d3c2363  #这个有可能不一样,用系统的
DEVICE=enp7s0f1
#一般以下的才是要改的
ONBOOT=yes
IPADDR=192.168.1.240
GATEWAY=192.168.1.254
NETMASK=255.255.255.0
PREFIX=24
DNS1=202.101.224.69
DNS2=202.101.226.68
ZONE=public

 

### 挂载磁盘仓库

[root@localhost ~]# mount /dev/cdrom /mnt
mount: block device /dev/cdrom is write-protected, mounting read-only
[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# vi rhel-debuginfo.repo --添加下面内容

 


>添加下面内容

[localyum]
name=localyum
baseurl=file:///mnt
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta,file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

>:wq --退出并保存.

### 使用yum命令自动安装软件

[root@localhost yum.repos.d]# yum clean all #清除yum缓存 
[root@localhost yum.repos.d]# yum makecache #缓存本地yum源中的软件包信息

>测试

yum install wget -y

 

### 下载最新的安装包

>[root@localhost yum.repos.d]# wget http://mirrors.163.com/centos/7.7.1908/os/x86_64/Packages/python-iniparse-0.4-9.el7.noarch.rpm
>[root@localhost yum.repos.d]# wget http://mirrors.163.com/centos/7.7.1908/os/x86_64/Packages/python-urlgrabber-3.10-9.el7.noarch.rpm
>[root@localhost yum.repos.d]# wget http://mirrors.163.com/centos/7.7.1908/os/x86_64/Packages/yum-3.4.3-163.el7.centos.noarch.rpm
>[root@localhost yum.repos.d]# wget http://mirrors.163.com/centos/7.7.1908/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
>[root@localhost yum.repos.d]# wget http://mirrors.163.com/centos/7.7.1908/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-52.el7.noarch.rpm

 

###卸载原先的yum(rpm -qa|grep yum|xargs rpm -e --nodeps)

>[root@MiWiFi-R3P-srv data]# rpm -qa|grep yum|xargs rpm -e --nodeps
>[root@MiWiFi-R3P-srv data]# rpm -qa |grep yum
>[root@MiWiFi-R3P-srv data]# rpm -ivh *.rpm
>[root@MiWiFi-R3P-srv data]# rpm -ivh yum-metadata-parser-1.1.4-10.el7.x86_64.rpm yum-3.4.3-163.el7.centos.noarch.rpm yum-plugin-fastestmirror-1.1.31-52.el7.noarch.rpm 

 


###更新文件

>[root@MiWiFi-R3P-srv data]# vi /etc/yum.repos.d/CentOS-Base.repo
#CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[base]
name=CentOS-$7 - Base - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$7&arch=$basearch&repo=os
baseurl=http://mirrors.163.com/centos/7/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
#released updates
[updates]
name=CentOS-$7 - Updates - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$7&arch=$basearch&repo=updates
baseurl=http://mirrors.163.com/centos/7/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
#additional packages that may be useful
[extras]
name=CentOS-$7 - Extras - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$7&arch=$basearch&repo=extras
baseurl=http://mirrors.163.com/centos/7/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$7 - Plus - 163.com
baseurl=http://mirrors.163.com/centos/7/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

 

###更新源以及安装一些工具

>[root@MiWiFi-R3P-srv data]# yum clean all
>[root@MiWiFi-R3P-srv data]# yum makecache
>[root@MiWiFi-R3P-srv data]# umount /dev/cdrom
>[root@MiWiFi-R3P-srv data]# yum install gcc gcc++ -y
>[root@MiWiFi-R3P-srv data]# yum -y install lrzsz nano vim curl net-tools lsof zip

 

 

ReaHat7.6/7.7 最小化安装更新yum源

标签:failure   stat   rpm -e   existing   ice   保存   nec   x86_64   nal   

原文地址:https://www.cnblogs.com/kingkoo/p/12128626.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!