此内容没有您所选择的语言版本。

14.5. Upgrading the System Off-line with ISO and Yum


For systems that are disconnected from the Internet or Red Hat Network, using the yum update command with the Red Hat Enterprise Linux installation ISO image is an easy and quick way to upgrade systems to the latest minor version. The following steps illustrate the upgrading process:
  1. Create a target directory to mount your ISO image. This directory is not automatically created when mounting, so create it before proceeding to the next step, as root, type:
    mkdir mount_dir
    Replace mount_dir with a path to the mount directory. Typicaly, users create it as a subdirectory in the /media/ directory.
  2. Mount the Red Hat Enterprise Linux 5 installation ISO image to the previously created target directory. As root, type:
    mount -o loop iso_name mount_dir
    Replace iso_name with a path to your ISO image and mount_dir with a path to the target directory. Here, the -o loop option is required to mount the file as a block device.
  3. Check the numeric value found on the first line of the .discinfo file from the mount directory:
    head -n1 mount_dir/.discinfo
    The output of this command is an identification number of the ISO image, you need to know it to perform the following step.
  4. Create a new file in the /etc/yum.repos.d/ directory, named for instance new.repo, and add a content in the following form. Note that configuration files in this directory must have the .repo extension to function properly.
    [repository] 
    mediaid=media_id 
    name=repository_name
    baseurl=repository_url
    gpgkey=gpg_key 
    enabled=1 
    gpgcheck=1
    
    Replace media_id with the numeric value found in mount_dir/.discinfo. Set the repository name instead of repository_name, replace repository_url with a path to a repository directory in the mount point and gpg_key with a path to the GPG key.
    For example, the repository settings for Red Hat Enterprise Linux 5 Server ISO can look as follows:
    [rhel5-Server] 
    mediaid=1354216429.587870 
    name=RHEL5-Server
    baseurl=file:///media/rhel5/Server 
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release 
    enabled=1 
    gpgcheck=1
    
  5. Update all yum repositories including /etc/yum.repos.d/new.repo created in previous steps. As root, type:
    yum update
    This upgrades your system to the version provided by the mounted ISO image.
  6. After successful upgrade, you can unmount the ISO image, with the root privileges:
    umount mount_dir
    where mount_dir is a path to your mount directory. Also, you can remove the mount directory created in the first step. As root, type:
    rmdir mount_dir
  7. If you will not use the previously created configuration file for another installation or update, you can remove it. As root, type:
    rm /etc/yum.repos.d/new.repo

Example 14.1. Upgrading from Red Hat Enterprise Linux 5.8 to 5.9

Imagine you need to upgrade your system without access to the Internet connection. To do so, you want to use an ISO image with the newer version of the system, called for instance RHEL5.9-Server-20121129.0-x86_64-DVD1.iso. You have crated a target directory /media/rhel5/. As root, change into the directory with your ISO image and type:
~]# mount -o loop RHEL5.9-Server-20121129.0-x86_64-DVD1.iso /media/rhel5/
To find the identification number of the mounted image, run:
~]# head -n1 /media/rhel5/.discinfo 
1354216429.587870
You need this number to configure your mount point as a yum repository. Create the/etc/yum.repos.d/rhel5.repo file and insert the following text into it:
[rhel5-Server] 
mediaid=1354216429.587870 
name=RHEL5-Server
baseurl=file:///media/rhel5/Server 
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release 
enabled=1 
gpgcheck=1
Update the yum repository, which effectively upgrades your system to a version provided by RHEL5.9-Server-20121129.0-x86_64-DVD1.iso. As root, execute:
~]# yum update
When your system is successfully upgraded, unmount the image, remove the target directory and the configuration file:
~]# umount /media/rhel5/
~]# rmdir /media/rhel5/
~]# rm /etc/yum.repos.d/rhel5.repo
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.