logo
关于我们

技术分享

技术分享 Redhat 本地云源配置

Redhat 本地云源配置

2021-06-07

后面的列子帮助可能更大,大家看到的如果有什么想问的,或者有什么觉得难配的环境,可以告诉我,大家一起研究下。
这个特别适用没有网络或者网络条件不好的情况。
放入redhat的镜像(这个是指在vm上挂载镜像)

新建/media/cdrom

[root@localhost /]# mkdir /media/cdrom

挂载镜像到文件到/media/cdrom

[root@localhost /]# mount /dev/cdrom  /media/cdrom[root@localhost /]# cd /etc/yum.repos.d/

备份*.repo文件

[root@localhost yum.repos.d]# lsrhel-source.repo[root@localhost yum.repos.d]# cp rhel-source.repo local.repo[root@localhost yum.repos.d]# lslocal.repo  rhel-source.repo[root@localhost yum.repos.d]# mv rhel-source.repo  rhel-source.repo.bak[root@localhost yum.repos.d]# lslocal.repo  rhel-source.repo.bak

编辑 local.repo文件

[root@localhost yum.repos.d]# vim local.repo

插入如下内容

[rhel-source]
name=This is a local repo
baseurl=file:///media/cdrom/enabled=1gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta,file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

清除缓存

[root@localhost yum.repos.d]#  yum clean all

建立新缓存

[root@localhost yum.repos.d]# yum makecache

测试

[root@localhost yum.repos.d]#  yum install –y sendmail

另一种配置方式

df -h
umount /media/系统名

mount /dev/cdrom /mnt

 cd /etc/yum.repos.d/
vim rhel-source.repo
[rhel-source]
name=Red Hat Enterprise Linux $releasever - $basearch - Source
baseurl=file:///mntenabled=1gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

简单例子:

[root@localhost /]# mkdir /media/cdrom[root@localhost /]# lsbin   dev  home  lib64       media  opt   root  selinux  sys  usr
boot  etc  lib   lost+found  mnt    proc  sbin  srv      tmp  var
[root@localhost /]# mount /dev/cdrom  /media/cdrommount: block device /dev/sr1 is write-protected, mounting read-only
[root@localhost /]# cd /etc/yum.repos.d/[root@localhost yum.repos.d]# lsrhel-source.repo
[root@localhost yum.repos.d]# cp rhel-source.repo local.repo[root@localhost yum.repos.d]# lslocal.repo  rhel-source.repo
[root@localhost yum.repos.d]# mv rhel-source.repo  rhel-source.repo.bak[root@localhost yum.repos.d]# lslocal.repo  rhel-source.repo.bak
[root@localhost yum.repos.d]# vim local.repo[root@localhost yum.repos.d]#  yum clean allLoaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Cleaning repos: rhel-sourceCleaning up Everything
[root@localhost yum.repos.d]# um makecache-bash: um: command not found
[root@localhost yum.repos.d]# yum makecacheLoaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
rhel-source                                              | 3.9 kB     00:00 ...rhel-source/group_gz                                     | 204 kB     00:00 ...rhel-source/filelists_db                                 | 3.7 MB     00:00 ...rhel-source/primary_db                                   | 3.1 MB     00:00 ...rhel-source/other_db                                     | 1.5 MB     00:00 ...Metadata Cache Created
[root@localhost yum.repos.d]#  yuminstall –y sendmail-bash: yuminstall: command not found
[root@localhost yum.repos.d]#  yum install –y sendmailLoaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package sendmail.x86_64 0:8.14.4-8.el6 will be installed
--> Processing Dependency: procmail for package: sendmail-8.14.4-8.el6.x86_64
--> Processing Dependency: libhesiod.so.0()(64bit) for package: sendmail-8.14.4-8.el6.x86_64
--> Running transaction check
---> Package hesiod.x86_64 0:3.1.0-19.el6 will be installed
---> Package procmail.x86_64 0:3.22-25.1.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package         Arch          Version                 Repository          Size
================================================================================
Installing:
 sendmail        x86_64        8.14.4-8.el6            rhel-source        717 k
Installing for dependencies:
 hesiod          x86_64        3.1.0-19.el6            rhel-source         20 k
 procmail        x86_64        3.22-25.1.el6           rhel-source        163 k

Transaction Summary
================================================================================
Install       3 Package(s)

Total download size: 900 k
Installed size: 1.9 M
Is this ok [y/N]: n
Exiting on user Command
[root@localhost yum.repos.d]#
                                   
云祺备份软件,云祺容灾备份系统,虚拟机备份,数据库备份,文件备份,实时备份,勒索软件,美国,图书馆
  • 标签:
  • 云计算

您可能感兴趣的新闻 换一批

现在下载,可享30天免费试用

立即下载