In production environment , We always encounter the situation that the server can't connect to the Internet , such , If you want to install an app , This application relies on many other class libraries , It's very painful . This is the time , You need to make your own local yum library , For local installation . This article will be Docker Local installation as an example , How to make local yum library .

1、 First , On the Internet 、 And can't access the Internet server Linux On servers with the same distribution version , Execute the installation command , Get all the dependent packages you need to install , as follows :

[root@localhost ~]# yum install libdevmapper* docker
Loaded plugins: fastestmirror, langpacks
Determining fastest mirrors
* base: mirrors.btte.net
* extras: mirrors.zju.edu.cn
* updates: mirrors.skyshe.cn
updates//x86_64/primary_db
Resolving Dependencies
--> Running transaction check
---> Package device-mapper-event-libs.x86_64 :1.02.-.el7 will be updated
--> Processing Dependency: device-mapper-event-libs = :1.02.-.el7 for package: :device-mapper-event-
---> Package device-mapper-event-libs.x86_64 :1.02.-.el7_2. will be an update
---> Package device-mapper-libs.x86_64 :1.02.-.el7 will be updated
--> Processing Dependency: device-mapper-libs = :1.02.-.el7 for package: :device-mapper-1.02.-.el
---> Package device-mapper-libs.x86_64 :1.02.-.el7_2. will be an update
---> Package docker.x86_64 :1.9.-.el7.centos will be installed
--> Processing Dependency: docker-forward-journald = 1.9.-.el7.centos for package: docker-1.9.-.el7
--> Processing Dependency: docker-selinux >= 1.9.-.el7.centos for package: docker-1.9.-.el7.centos.
--> Processing Dependency: libsystemd.so.(LIBSYSTEMD_209)(64bit) for package: docker-1.9.-.el7.centos
--> Processing Dependency: libsystemd.so.()(64bit) for package: docker-1.9.-.el7.centos.x86_64
---> Package lvm2-libs.x86_64 :2.02.-.el7 will be updated
--> Processing Dependency: lvm2-libs = :2.02.-.el7 for package: :lvm2-2.02.-.el7.x86_64
---> Package lvm2-libs.x86_64 :2.02.-.el7_2. will be an update
--> Running transaction check
---> Package device-mapper.x86_64 :1.02.-.el7 will be updated
---> Package device-mapper.x86_64 :1.02.-.el7_2. will be an update
---> Package device-mapper-event.x86_64 :1.02.-.el7 will be updated
---> Package device-mapper-event.x86_64 :1.02.-.el7_2. will be an update
---> Package docker-forward-journald.x86_64 :1.9.-.el7.centos will be installed
---> Package docker-selinux.x86_64 :1.9.-.el7.centos will be installed
---> Package lvm2.x86_64 :2.02.-.el7 will be updated
---> Package lvm2.x86_64 :2.02.-.el7_2. will be an update
--> Processing Dependency: device-mapper-persistent-data >= 0.5.- for package: :lvm2-2.02.-.el7_2.
---> Package systemd-libs.x86_64 :-.el7_1. will be updated
--> Processing Dependency: systemd-libs = -.el7_1. for package: systemd--.el7_1..x86_64
---> Package systemd-libs.x86_64 :-.el7_2. will be an update
--> Running transaction check
---> Package device-mapper-persistent-data.x86_64 :0.4.-.el7 will be updated
---> Package device-mapper-persistent-data.x86_64 :0.5.-.el7 will be an update
---> Package systemd.x86_64 :-.el7_1. will be updated
--> Processing Dependency: systemd = -.el7_1. for package: systemd-python--.el7_1..x86_64
--> Processing Dependency: systemd = -.el7_1. for package: systemd-sysv--.el7_1..x86_64
--> Processing Dependency: systemd = -.el7_1. for package: libgudev1--.el7_1..x86_64
---> Package systemd.x86_64 :-.el7_2. will be an update
--> Processing Dependency: kmod >= - for package: systemd--.el7_2..x86_64
--> Running transaction check
---> Package kmod.x86_64 :-.el7 will be updated
---> Package kmod.x86_64 :-.el7 will be an update
---> Package libgudev1.x86_64 :-.el7_1. will be updated
---> Package libgudev1.x86_64 :-.el7_2. will be an update
---> Package systemd-python.x86_64 :-.el7_1. will be updated
---> Package systemd-python.x86_64 :-.el7_2. will be an update
---> Package systemd-sysv.x86_64 :-.el7_1. will be updated
---> Package systemd-sysv.x86_64 :-.el7_2. will be an update
--> Processing Conflict: systemd--.el7_2..x86_64 conflicts initscripts < 9.49.-
--> Restarting Dependency Resolution with new changes.
--> Running transaction check
---> Package initscripts.x86_64 :9.49.-.el7 will be updated
---> Package initscripts.x86_64 :9.49.-.el7_2. will be an update
--> Processing Conflict: systemd--.el7_2..x86_64 conflicts dracut < -
--> Restarting Dependency Resolution with new changes.
--> Running transaction check
---> Package dracut.x86_64 :-.el7_1. will be updated
--> Processing Dependency: dracut = -.el7_1. for package: dracut-network--.el7_1..x86_64
--> Processing Dependency: dracut = -.el7_1. for package: dracut-config-rescue--.el7_1..x86
---> Package dracut.x86_64 :-.el7_2 will be an update
--> Running transaction check
---> Package dracut-config-rescue.x86_64 :-.el7_1. will be updated
---> Package dracut-config-rescue.x86_64 :-.el7_2 will be an update
---> Package dracut-network.x86_64 :-.el7_1. will be updated
---> Package dracut-network.x86_64 :-.el7_2 will be an update
--> Finished Dependency Resolution Dependencies Resolved =========================================================================================================
Package Arch Ver
=========================================================================================================
Installing:
docker x86_64 1.9
Updating:
device-mapper-event-libs x86_64 :
device-mapper-libs x86_64 :
dracut x86_64
initscripts x86_64 9.4
lvm2-libs x86_64 :
Installing for dependencies:
docker-forward-journald x86_64 1.9
docker-selinux x86_64 1.9
Updating for dependencies:
device-mapper x86_64 :
device-mapper-event x86_64 :
device-mapper-persistent-data x86_64 0.5
dracut-config-rescue x86_64
dracut-network x86_64
kmod x86_64 -
libgudev1 x86_64
lvm2 x86_64 :
systemd x86_64
systemd-libs x86_64
systemd-python x86_64
systemd-sysv x86_64 Transaction Summary
=========================================================================================================
Install Package (+ Dependent packages)
Upgrade Packages (+ Dependent packages) Total download size: M
Is this ok [y/d/N]: n
Exiting on user command
Your transaction was saved, rerun it with:
yum load-transaction /tmp/yum_save_tx.--06.10-.56BPrh.yumtx
[root@localhost ~]# yum install libdevmapper* docker
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.btte.net
* extras: mirrors.zju.edu.cn
* updates: mirrors.skyshe.cn
Resolving Dependencies
--> Running transaction check
---> Package device-mapper-event-libs.x86_64 :1.02.-.el7 will be updated
--> Processing Dependency: device-mapper-event-libs = :1.02.-.el7 for package: :device-mapper-event-1.02.-.el7.x86_64
---> Package device-mapper-event-libs.x86_64 :1.02.-.el7_2. will be an update
---> Package device-mapper-libs.x86_64 :1.02.-.el7 will be updated
--> Processing Dependency: device-mapper-libs = :1.02.-.el7 for package: :device-mapper-1.02.-.el7.x86_64
---> Package device-mapper-libs.x86_64 :1.02.-.el7_2. will be an update
---> Package docker.x86_64 :1.9.-.el7.centos will be installed
--> Processing Dependency: docker-forward-journald = 1.9.-.el7.centos for package: docker-1.9.-.el7.centos.x86_64
--> Processing Dependency: docker-selinux >= 1.9.-.el7.centos for package: docker-1.9.-.el7.centos.x86_64
--> Processing Dependency: libsystemd.so.(LIBSYSTEMD_209)(64bit) for package: docker-1.9.-.el7.centos.x86_64
--> Processing Dependency: libsystemd.so.()(64bit) for package: docker-1.9.-.el7.centos.x86_64
---> Package lvm2-libs.x86_64 :2.02.-.el7 will be updated
--> Processing Dependency: lvm2-libs = :2.02.-.el7 for package: :lvm2-2.02.-.el7.x86_64
---> Package lvm2-libs.x86_64 :2.02.-.el7_2. will be an update
--> Running transaction check
---> Package device-mapper.x86_64 :1.02.-.el7 will be updated
---> Package device-mapper.x86_64 :1.02.-.el7_2. will be an update
---> Package device-mapper-event.x86_64 :1.02.-.el7 will be updated
---> Package device-mapper-event.x86_64 :1.02.-.el7_2. will be an update
---> Package docker-forward-journald.x86_64 :1.9.-.el7.centos will be installed
---> Package docker-selinux.x86_64 :1.9.-.el7.centos will be installed
---> Package lvm2.x86_64 :2.02.-.el7 will be updated
---> Package lvm2.x86_64 :2.02.-.el7_2. will be an update
--> Processing Dependency: device-mapper-persistent-data >= 0.5.- for package: :lvm2-2.02.-.el7_2..x86_64
---> Package systemd-libs.x86_64 :-.el7_1. will be updated
--> Processing Dependency: systemd-libs = -.el7_1. for package: systemd--.el7_1..x86_64
---> Package systemd-libs.x86_64 :-.el7_2. will be an update
--> Running transaction check
---> Package device-mapper-persistent-data.x86_64 :0.4.-.el7 will be updated
---> Package device-mapper-persistent-data.x86_64 :0.5.-.el7 will be an update
---> Package systemd.x86_64 :-.el7_1. will be updated
--> Processing Dependency: systemd = -.el7_1. for package: systemd-python--.el7_1..x86_64
--> Processing Dependency: systemd = -.el7_1. for package: systemd-sysv--.el7_1..x86_64
--> Processing Dependency: systemd = -.el7_1. for package: libgudev1--.el7_1..x86_64
---> Package systemd.x86_64 :-.el7_2. will be an update
--> Processing Dependency: kmod >= - for package: systemd--.el7_2..x86_64
--> Running transaction check
---> Package kmod.x86_64 :-.el7 will be updated
---> Package kmod.x86_64 :-.el7 will be an update
---> Package libgudev1.x86_64 :-.el7_1. will be updated
---> Package libgudev1.x86_64 :-.el7_2. will be an update
---> Package systemd-python.x86_64 :-.el7_1. will be updated
---> Package systemd-python.x86_64 :-.el7_2. will be an update
---> Package systemd-sysv.x86_64 :-.el7_1. will be updated
---> Package systemd-sysv.x86_64 :-.el7_2. will be an update
--> Processing Conflict: systemd--.el7_2..x86_64 conflicts initscripts < 9.49.-
--> Restarting Dependency Resolution with new changes.
--> Running transaction check
---> Package initscripts.x86_64 :9.49.-.el7 will be updated
---> Package initscripts.x86_64 :9.49.-.el7_2. will be an update
--> Processing Conflict: systemd--.el7_2..x86_64 conflicts dracut < -
--> Restarting Dependency Resolution with new changes.
--> Running transaction check
---> Package dracut.x86_64 :-.el7_1. will be updated
--> Processing Dependency: dracut = -.el7_1. for package: dracut-network--.el7_1..x86_64
--> Processing Dependency: dracut = -.el7_1. for package: dracut-config-rescue--.el7_1..x86_64
---> Package dracut.x86_64 :-.el7_2 will be an update
--> Running transaction check
---> Package dracut-config-rescue.x86_64 :-.el7_1. will be updated
---> Package dracut-config-rescue.x86_64 :-.el7_2 will be an update
---> Package dracut-network.x86_64 :-.el7_1. will be updated
---> Package dracut-network.x86_64 :-.el7_2 will be an update
--> Finished Dependency Resolution Dependencies Resolved =========================================================================================================
Package Arch Version Repository Size
=========================================================================================================
Installing:
docker x86_64 1.9.-.el7.centos extras M
Updating:
device-mapper-event-libs x86_64 :1.02.-.el7_2. updates k
device-mapper-libs x86_64 :1.02.-.el7_2. updates k
dracut x86_64 -.el7_2 updates k
initscripts x86_64 9.49.-.el7_2. updates k
lvm2-libs x86_64 :2.02.-.el7_2. updates k
Installing for dependencies:
docker-forward-journald x86_64 1.9.-.el7.centos extras k
docker-selinux x86_64 1.9.-.el7.centos extras k
Updating for dependencies:
device-mapper x86_64 :1.02.-.el7_2. updates k
device-mapper-event x86_64 :1.02.-.el7_2. updates k
device-mapper-persistent-data x86_64 0.5.-.el7 base k
dracut-config-rescue x86_64 -.el7_2 updates k
dracut-network x86_64 -.el7_2 updates k
kmod x86_64 -.el7 base k
libgudev1 x86_64 -.el7_2. updates k
lvm2 x86_64 :2.02.-.el7_2. updates 1.0 M
systemd x86_64 -.el7_2. updates 5.1 M
systemd-libs x86_64 -.el7_2. updates k
systemd-python x86_64 -.el7_2. updates k
systemd-sysv x86_64 -.el7_2. updates k Transaction Summary
=========================================================================================================
Install Package (+ Dependent packages)
Upgrade Packages (+ Dependent packages) Total download size: M
Is this ok [y/d/N]:

2、 Download the corresponding version of rpm package , website :

http://rpmfind.net/linux/rpm2html/search.php

3、 Make local yum library . It will be all rpm Copy the package to a folder , for example docker_rpms, Execute the following command :

[root@localhost test]# ls
docker_rpms
[root@localhost test]# createrepo .
Spawning worker with pkgs
Workers Finished
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete
[root@localhost test]# ls
docker_rpms repodata

4、 edit docker.repo file

# 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-$releasever - Base
baseurl=file:///home/dockeryum
gpgcheck=
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 [update]
name=CentOS-$releasever - update
baseurl=file:///home/dockeryum
gpgcheck=
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

5、 take docker_rpms Folder 、repodata Folder 、docker.repo copy to /home/dockeryum( because docker.repo This configuration is done in the file ) Under the folder . Do the following :

[root@localhost home]# ls
dockeryum laizy
[root@localhost home]# cp -r /etc/yum.repos.d/ /etc/yum.repos.d.bak ( Back up the original yum Source )
[root@localhost home]# rm -rf /etc/yum.repos.d/* ( Empty the original yum Source )
[root@localhost home]# cp /home/dockeryum/docker.repo /etc/yum.repos.d/ ( Copy what you wrote yum Source )
[root@localhost home]# ll /etc/yum.repos.d/
total 4
-rw-r--r--. 1 root root 682 May 6 10:26 docker.repo
[root@localhost home]# yum install libdevmapper* docker (yum install )
Loaded plugins: fastestmirror, langpacks
Existing lock /var/run/yum.pid: another copy is running as pid 13870.
Another app is currently holding the yum lock; waiting for it to exit...
The other application is: PackageKit
Memory : 48 M RSS (922 MB VSZ)
Started: Fri May 6 10:23:42 2016 - 04:13 ago
State : Sleeping, pid: 13870
Another app is currently holding the yum lock; waiting for it to exit...
The other application is: PackageKit
Memory : 48 M RSS (922 MB VSZ)
Started: Fri May 6 10:23:42 2016 - 04:15 ago
State : Running, pid: 13870
^C Exiting on user cancel.
[root@localhost home]# kill -9 13870
[root@localhost home]# yum install libdevmapper* docker
Loaded plugins: fastestmirror, langpacks
base | 2.9 kB 00:00:00
update | 2.9 kB 00:00:00
(1/2): base/primary_db | 23 kB 00:00:00
(2/2): update/primary_db | 23 kB 00:00:00
Loading mirror speeds from cached hostfile
Package 7:device-mapper-event-libs-1.02.93-3.el7.x86_64 already installed and latest version
Package 7:device-mapper-libs-1.02.93-3.el7.x86_64 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package docker.x86_64 0:1.8.2-7.el7.centos will be installed
--> Processing Dependency: docker-selinux >= 1.8.2-7.el7.centos for package: docker-1.8.2-7.el7.centos.x86_64
--> Running transaction check
---> Package docker-selinux.x86_64 0:1.8.2-7.el7.centos will be installed
--> Finished Dependency Resolution Dependencies Resolved =========================================================================================================
Package Arch Version Repository Size
=========================================================================================================
Installing:
docker x86_64 1.8.2-7.el7.centos base 8.7 M
Installing for dependencies:
docker-selinux x86_64 1.8.2-7.el7.centos base 61 k Transaction Summary
=========================================================================================================
Install 1 Package (+1 Dependent package) Total download size: 8.7 M
Installed size: 37 M
Is this ok [y/d/N]: y
Downloading packages:
---------------------------------------------------------------------------------------------------------
Total 160 MB/s | 8.7 MB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : docker-selinux-1.8.2-7.el7.centos.x86_64 1/2
restorecon: lstat(/var/lib/docker) failed: No such file or directory
warning: %post(docker-selinux-1.8.2-7.el7.centos.x86_64) scriptlet failed, exit status 255
Non-fatal POSTIN scriptlet failure in rpm package docker-selinux-1.8.2-7.el7.centos.x86_64
Installing : docker-1.8.2-7.el7.centos.x86_64 2/2
Verifying : docker-1.8.2-7.el7.centos.x86_64 1/2
Verifying : docker-selinux-1.8.2-7.el7.centos.x86_64 2/2 Installed:
docker.x86_64 0:1.8.2-7.el7.centos Dependency Installed:
docker-selinux.x86_64 0:1.8.2-7.el7.centos Complete!
[root@localhost home]# docker -v
Docker version 1.8.2, build bb472f0/1.8.2

installation is complete !

Local yum Library production and local installation Docker More articles about

  1. yum_rpm( utilize dvd Set up local yum library )

    #wget "http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os" Set up index.html ...

  2. Local yum The construction of the library

    1. establish yum The server yum Server can use http perhaps ftp The way , We choose to use http By , It needs to be done first httpd Installation # yum install httpd Set up a package directory locally # mkd ...

  3. Linux Software source writing format analysis and local yum Source production

    1.Debian Class system The configuration file :/etc/apt/sources.list Example :deb https://mirrors.aliyun.com/kali kali-rolling main cont ...

  4. Local YUM Source production

    YUM Relevant concepts What is? YUM YUM( Its full name is Yellow dog Updater, Modified) It's a Fedora and RedHat as well as CentOS Medium Shell Front end package manager . be based on RPM Guarantee ...

  5. 【 Build from scratch K8S】【 Chapter one 】CentOS7.6 Offline installation Docker( Manual installation and based on yum Local source installation )

    download CentOS7.6 And minimize installation CentOS7.6 edition . because CentOS It's open source software , There are also many in China mirror The site is available for download , I choose the Huawei site to download :http://mirrors.huawe ...

  6. Yum Local Rpm Library settings

    http://blog.csdn.net/dc_726/article/details/8497188   1 Yum Support for CDs see /etc/yum.repos.d/CentOS-Media.re ...

  7. Centos Make local yum Source

    Local YUM Source production 1. YUM Relevant concepts 1.1. What is? YUM YUM( Its full name is Yellow dog Updater, Modified) It's a Fedora and RedHat as well as CentOS Medium Shel ...

  8. Make local yum Source

    Image source is centos Where to download the related software , We can make our own image source to specify where we go to download impala Of rpm package , Here we use httpd This software is used as the server , start-up httpd As our mirror source ...

  9. CentOS 6.5 Local yum Source 、 LAN offline yum Warehouse ( It's easy to install all kinds of dependent packages when the network is disconnected )

    At work , Most of the company's servers are forbidden to connect to the Internet , Initialize system , When testing some products , Some software or dependent packages are often missing , Upload one by one to the machine , Such a waste of time , waste of money ,en...yum Can automatically find and solve rpm Dependencies between packages , ...

Random recommendation

  1. xp

    Microsoft MSDN Windows XP Professional download Windows XP Professional Simplified Chinese ( The original version , nothing SP)[505.63MB] file name :CN_WINXP_PRO ...

  2. django ORM

    http://www.cnblogs.com/alex3714/articles/5512568.html Commonly used ORM operation One . Example Models from django.db import model ...

  3. java Based on learning 05( Object oriented fundamentals 02)

    Object oriented fundamentals 02 Goals achieved 1.String The use of the class 2. master this Use of keywords 3. master static Use of keywords 4. Learn about inner classes String class Instantiation String Object a string is a String class ...

  4. Mysql Time stamp function

    1. Convert to timestamp select unix_timestamp('2013-07-15 10-06-07') If the argument is null , Is the current time 2. Turn it into time select from_unixtime(tim ...

  5. nyist 740 “ Dazzle dancer “ST( Dynamic programming )

    dp[i][j][k]: It means the first one i The position of the two feet after the first step j,k Fix one foot first j, The first i After the first stampede , Status as dp[i][j][a[i]] perhaps dp[i][a[i]][j], among a[i] It means the first one i An input element , Then there are ...

  6. Codeforces 328A-IQ Test( The sequence )

    A. IQ Test time limit per test 1 second memory limit per test 256 megabytes input standard input out ...

  7. visual leak dector Memory leak detection methods

    http://vld.codeplex.com/ QT When memory leaks , What tools do you usually use to test ------ Solution -------------------- Do you think this article is detailed :http://newfac ...

  8. linux nfs Folder 、 File sharing

    ◆ One . Concept NFS It's the network file system (Network File System) For short , It's a part of a distributed computer system , It can share and assemble remote file system on heterogeneous network . NFS from SUN Companies to develop , Now it has become a document service ...

  9. Android Gradle Depend on the configuration :implementation &amp; api

    background : Android Gradle plugin 3.0 Start ( Corresponding Gradle edition 4.1 And above ), The original dependency configuration type compile Has been abandoned , Start using implementation.api and anno ...

  10. First time to know gauge Automated testing framework ( Two )

    Some students are interested in this tool , So I'll go on to Gauge Automated test tool . Gauge It's essentially a BDD(Behavior Driven Development) The test framework . therefore , First you need to understand BDD The operation of ...