Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Detailed explanation of yum installation of local rpm software

2025-01-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Overview

In the face of centos systems that cannot be connected to the Internet, installing rpm packages is a time-consuming task, especially those packages that contain a lot of dependencies. If you install them with the rpm command, it can be said to be a nightmare. Here according to personal practice to release a more complete and convenient solution. (note: this scheme is available in centos6.564bit test)

Concrete plan

Introduction to the basic environment

Target operating system: centos6.564bit, hereinafter referred to as "target machine" (cannot be installed on the Internet with yum)

Local environment: pure centos6.564bit installed under VMware, hereinafter referred to as "virtual machine" (you can download the installation package with yum)

The basic idea of this scheme is to download the rpm installation package in a networked system, then transfer it to the target operating system that can not be connected to the network, establish the installation source, and install it. To reduce unnecessary hassle, install a system that is exactly the same as the target operating system but does not install any additional software locally with the virtual machine, which is used to download various installation and dependency packages.

Configure the local environment

Configure yum to download but not install the RPM package within the virtual machine. To use the-downloadonly option here, you need to install yum-plugin-downloadonly first.

# yum install yum-plugin-downloadonly

Download the rpm installation package in the local environment

# yum install-downloadonly-downloaddir=/tmp RPM_Name

/ tmp is the specified download directory, and RPM_Name is the target software.

Yum-downloadonly will only download the RPM package, not install it, and download all dependent packages. Note that if the virtual machine already has a dependent package installed, it will not be downloaded, so it is important to ensure the purity of the virtual machine (please let me know if there is a solution to download the existing dependent package).

It should be noted that in order to build a software source in the target organization, createrepo is an essential module, so it is necessary to download createrepo-related modules on the virtual machine.

# yum install-downloadonly-downloaddir=/tmp createrepo

Three packages are usually downloaded, one is createrepo, and the other two are dependent packages.

Upload rpm installation package to the target machine

Upload the rpm installation package file to the target machine by scp or pscp.exe (under Windows), and change the permission to executable (chmod755RPM_Name).

Build local software sources in the target organization

Install createrepo

Install createrepo on the target:

# rpm- ivh deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm# rpm- ivh python-deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm# rpm- ivh createrepo-0.9.9-24.el6.noarch.rpm

Createrepo builds local software source

Assume that the installation package is in the / home/user/rpms/ directory of the target machine.

# createrepo / home/user/rpms

Modify yum software source

Remove existing software sources

# mv / etc/yum.repos.d/CentOS-Base.repo / etc/yum.repos.d/CentOS-Base.repo_bk

Open the local software source

# vim / etc/yum.repos.d/CentOS-Media.repo

Add a line to baseurl:

= file:////home/user/rpms/

Then modify: enabled=1

This allows yum to install the software from a local source.

Install target software on the target machine

Use yum to install the software normally.

# yum install demo

If you are using a pure virtual machine environment and are consistent with the target, then the dependency packages will be installed and the yum installation will be smooth. Unless individual packages have dependency conflicts, and A depends on both B and A, which makes it impossible to install, you can use the rpm command to force one of them to be installed, and then use yum to install the software.

# rpm-ivh demo.rpm-nodeps-force

Summary

The above is the whole content of this article on the yum installation of local rpm software, I hope it will be helpful to you. Interested friends can continue to refer to this site:

10 super interesting Linux terminal games to share

Seven things you may not know about the Linux system

If there are any deficiencies, please leave a message to point out. Thank you for your support to this site!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report