使用Linux光盘制作本地源

2950阅读 0评论2017-10-31 今生路人甲
分类:系统运维

最近装了台Redhat Enterprise 6.9,使用最简安装,很多rpm包都没有安装,在拷贝一些自定义的脚本到这台机器的时候发现了一些问题,通过制作本地源很方便的安装了相关软件,解决了这个问题。

问题描述:

拷贝文件到目标主机报错

点击(此处)折叠或打开

  1. scp /usr/bin/xxx root@10.90.244.15:/usr/bin/

  1. root@10.90.244.15's password:

  1. bash: scp: command not found

发现问题:

1. 查询本地scp属于哪个rpm包

点击(此处)折叠或打开

  1. [root@xxx ~]# rpm -qf /usr/bin/scp
  2. openssh-clients-5.3p1-81.el6.x86_64
2. 查询目的机器是否存在这个rpm包

点击(此处)折叠或打开

  1. [root@localhost yum.repos.d]# rpm -qa|grep openssh-clients
  2. [root@localhost yum.repos.d]#

解决问题:

搭建本地源安装oepnssh-client

点击(此处)折叠或打开

  1. [root@localhost yum.repos.d]# cat /etc/yum.repos.d/rhel.repo
  2. [rhel]   #ID
  3. name=rhel-6.9 #repo name
  4. baseurl=file:///media #location
  5. enabled=1 #1 enable this repo 0 disable this repo
  6. gpgcheck=0 # 0 no gpg check 1 start gpg check

点击(此处)折叠或打开

  1. [root@localhost yum.repos.d]# mount ~/rhel-server-6.9-x86_64-dvd.iso -o loop /media/
    

点击(此处)折叠或打开

  1. [root@localhost yum.repos.d]# yum repolist                   
    Loaded plugins: product-id, search-disabled-repos, subscription-manager
    This system is not registered with an entitlement server. You can use subscription-manager to register.
    rhel                                                     | 4.1 kB     00:00 ... 
    rhel/primary_db                                          | 3.1 MB     00:00 ... 
    repo id                             repo name                             status
    rhel                                rhel-6.9                              3,854
    repolist: 3,854
  • 安装openssh-clients    
        

点击(此处)折叠或打开

  1. [root@localhost yum.repos.d]# yum install -y openssh-clients
  2. Loaded plugins: product-id, search-disabled-repos, subscription-manager
  3. This system is not registered with an entitlement server. You can use subscription-manager to register.
  4. Setting up Install Process
  5. Resolving Dependencies
  6. --> Running transaction check
  7. ---> Package openssh-clients.x86_64 0:5.3p1-122.el6 will be installed
  8. --> Processing Dependency: libedit.so.0()(64bit) for package: openssh-clients-5.3p1-122.el6.x86_64
  9. --> Running transaction check
  10. ---> Package libedit.x86_64 0:2.11-4.20080712cvs.1.el6 will be installed
  11. --> Finished Dependency Resolution
  12. Dependencies Resolved
  13. ================================================================================
  14. Package Arch Version Repository
  15. Size
  16. ================================================================================
  17. Installing:
  18. openssh-clients x86_64 5.3p1-122.el6 rhel 443 k
  19. Installing for dependencies:
  20. libedit x86_64 2.11-4.20080712cvs.1.el6 rhel 74 k
  21. Transaction Summary
  22. ================================================================================
  23. Install 2 Package(s)
  24. Total download size: 518 k
  25. Installed size: 1.5 M
  26. Downloading Packages:
  27. --------------------------------------------------------------------------------
  28. Total 21 MB/s | 518 kB 00:00
  29. Running rpm_check_debug
  30. Running Transaction Test
  31. Transaction Test Succeeded
  32. Running Transaction
  33. Installing : libedit-2.11-4.20080712cvs.1.el6.x86_64 1/2
  34. Installing : openssh-clients-5.3p1-122.el6.x86_64 2/2
  35. rhel/productid | 1.6 kB 00:00 ...
  36. Verifying : libedit-2.11-4.20080712cvs.1.el6.x86_64 1/2
  37. Verifying : openssh-clients-5.3p1-122.el6.x86_64 2/2
  38. Installed:
  39. openssh-clients.x86_64 0:5.3p1-122.el6
  40. Dependency Installed:
  41. libedit.x86_64 0:2.11-4.20080712cvs.1.el6
  42. Complete!

结果:

拷贝文件到远程主机

点击(此处)折叠或打开

  1. [root@xxx ~]# scp /usr/bin/xxx root@10.90.244.15:/usr/bin/
  2. root@10.90.244.15's password:
  3. xxx 100% 5049 4.9KB/s 00:00




上一篇:python日志解读
下一篇:Docker native network - None