yum Installation of local rpm software solution details

  • 2020-06-23 02:36:21
  • OfStack

An overview of the

Installing rpm packages on centos systems that cannot be connected to the Internet is a time-consuming task, especially those that contain a lot of dependencies, which can be a nightmare if installed using the rpm command. Here is a more complete and convenient solution based on personal practice. (Note: This scheme is available for centos6.564bit test)

The specific plan

Introduction to Basic Environment

Target operating system: centos6.564ES15en, hereinafter referred to as "Target machine" (unable to be installed with yum for networking)

Local environment: Pure centos6.564ES21en installed under VMware, referred to as "virtual machine" (installation package can be downloaded from yum for networking)

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 cannot be networked, set up the installation source and carry out the installation. To reduce unnecessary hassle, install a system that is modeled after the target operating system but does not have any additional software installed locally with the virtual machine for downloading various installation packages and dependencies.

Configuring the local environment

Configure yum in the virtual machine to download RPM packages instead of installing them. To use the downloadonly option, install ES33en-ES34en-ES35en first.


# yum install yum-plugin-downloadonly 

Download the rpm installation package in your local environment


# yum install --downloadonly --downloaddir=/tmp RPM_Name

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

yum � downloadonly can only download RPM package is not installed, the dependent packages are downloaded at the same time, pay attention to such as virtual machine depend on the package has been installed, do not download, so be sure to ensure the purity of the virtual machine (if there is some solution can download already rely on package, welcome to inform).

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


# yum install --downloadonly --downloaddir=/tmp createrepo

Generally, 3 packages are downloaded, one is createrepo, and the other two are dependent packages.

Upload the rpm installation package to the target machine

Upload the rpm installation package file to the target machine by means of scp or ES65en. exe (under Windows), and modify the permissions to be executable (chmod755RPM_Name).

Create a local software source at the target organization

Install createrepo

Install createrepo on the target machine:


# 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 sources

Assume the installation package is in the target machine's /home/user/rpms/ directory.


# createrepo /home/user/rpms

Modify the 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 1 line to baseurl:


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

Then modify: enabled=1
This enables yum to install the software from a local source.

Install the 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 keep 1 to the target machine, then the dependency packages will all be installed and the yum installation will be smooth. A depends on B and B depends on A, so it cannot be installed. At this time, 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

conclusion

That is the end of this article on yum installation of local rpm software solution, I hope to help you. Those who are interested can continue to see this site:

10 super fun Linux terminal games to share

7 things you may not know about the Linux system

If there is any deficiency, please let me know. Thank you for your support!


Related articles: