linux server set up local area network YUM source warehouse

 yum Profile

  Yum (called the Yellow dog Updater, Modified) is a front end package manager Shell Fedora and RedHat and CentOS in. RPM-based package management, can automatically download from the specified server RPM package and installed, you can automatically handle dependencies, and install all packages depending on, again and again without the cumbersome download and installation.

  By means of YUM repositories, you can complete the installation, uninstallation, and other tasks automatically upgrade the rpm package that can automatically find and resolve dependencies between the rpm package without the need for administrators to manually install each rpm package, the administrator more comfortable when maintaining a large number of Linux servers. In particular those with a large number of Linux hosts on the local network, to build a source server can greatly ease software installation, upgrades, etc. dependence on lnterner of.

  yum server set up

  yum server Overview

  yum repositories usually by means of HTTP or FTP protocol to publish, so you can face all the clients in the network to provide software source service. In order to facilitate the client queries the package, get dependencies and other information required to provide data warehouse (Repodata) in the depot, which collects information on all head rpm package directory.

  Preparation network installation source (server)

  (1) preparing depot catalog

  The root directory of the CD-ROM package CentOS6.5 copy of the first CD content to a local FTP server anonymous user access

  [root@localhost ~]# cd /var/ftp/

  [root@localhost ftp]# mkdir centos6

  [root@localhost ftp]# cp -rf /media/CentOS_6.5_Final/* /var/ftp/centos6/ &

  [1] 45717

  [root@localhost ftp]# jobs

  [1]+ Done cp -i -rf /media/CentOS_6.5_Final/* /var/ftp/centos6/

  [Root @ localhost ksh] # cp /media/CentOS_6.5_Final/Packages/ksh-20120801-10.el6.x86_64.rpm / var / ftp / ksh /

  [Root @ localhost ksh] # cp /media/CentOS_6.5_Final/Packages/mksh-39-7.el6_4.1.x86_64.rpm / var / ftp / ksh /

  [root@localhost ksh]# ls

  ksh-20120801-10.el6.x86_64.rpm mksh-39-7.el6_4.1.x86_64.rpm

  No need to install the package installation createrepo

  [root@localhost ksh]# yum -y install createrepo

  [root@localhost ksh]# createrepo -v ./

  Spawning worker 0 with 2 pkgs

  Worker 0: reading ksh-20120801-10.el6.x86_64.rpm

  Worker 0: reading mksh-39-7.el6_4.1.x86_64.rpm

  Workers Finished

  Gathering worker results

  Saving Primary metadata

  Saving file lists metadata

  Saving other metadata

  Generating sqlite DBs

  Starting other db creation: Thu May 31 18:20:51 2018

  Ending other db creation: Thu May 31 18:20:51 2018

  Starting filelists db creation: Thu May 31 18:20:51 2018

  Ending filelists db creation: Thu May 31 18:20:51 2018

  Starting primary db creation: Thu May 31 18:20:51 2018

  Ending primary db creation: Thu May 31 18:20:51 2018

  Sqlite DBs complete

  [root@localhost ksh]# ls

  ksh-20120801-10.el6.x86_64.rpm mksh-39-7.el6_4.1.x86_64.rpm repodata

  Install and start vsftpd service (see the FTP service content)

  [root@localhost ksh]# service vsftpd restart

  Close vsftpd: [OK]

  As vsftpd start vsftpd: [OK]

  [root@localhost ksh]# chkconfig vsftpd on

  [root@localhost ksh]# chkconfig vsftpd --list

  vsftpd 0: Close 1: Close 2: Enabled 3: Enable 4: Enable 5: 6 Enable: Off

  Yum configuration software warehouse location (client side)

  Typical warehouse configuration

  YUM network source

  [root@n2 ~]# cd /etc/yum.repos.d/

  [root@n2 yum.repos.d]# ls

  CentOS-Base.repo CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Vault.repo

  [root@n2 yum.repos.d]# mkdir bak

  [root@n2 yum.repos.d]# mv *o ./bak/

  [root@n2 yum.repos.d]# ls

  behind

  [root@n2 yum.repos.d]# vim amber.repo

  [yum]

  name=centos 6.5

  baseurl=ftp://192.168.28.128/centos6/

  gpgcheck=0

  enabled=1

  [ksh]

  name=ksh

  baseurl=ftp://192.168.28.128/ksh/

  gpgcheck=0

  enabled=1

  ~

  [root@n2 ~]# yum -y clean all

  Loaded plugins: fastestmirror, refresh-packagekit, security

  Cleaning repos: ksh yum

  Cleaning up Everything

  Cleaning up list of fastest mirrors

  [root@n2 ~]# yum makecache

  Loaded plugins: fastestmirror, refresh-packagekit, security

  Determining fastest mirrors

  ksh | 2.9 kB 00:00

  ksh/filelists_db | 1.1 kB 00:00

  ksh/primary_db | 3.3 kB 00:00

  ksh/other_db | 2.2 kB 00:00

  yum | 4.0 kB 00:00

  yum/group_gz | 220 kB 00:00

  yum/filelists_db | 5.8 MB 00:00

  yum/primary_db | 4.4 MB 00:00

  yum/other_db | 2.7 MB 00:00

  Metadata Cache Created

  查看yum缓存是否生成

  [root@n2 ~]# ls /var/cache/yum/x86_64/6/

  base extras ksh timedhosts.txt updates yum

  [root@n2 ~]# ls /var/cache/yum/x86_64/6/yum/

  0dafccfdbf892f02acca8267ade4bdcee7280a682e65dc7e29145f3341fd7a8c-primary.sqlite

  594d4bb4a79ed01d66635adbcf76c45ca4a85b30fc3e3c3c28316e64f0a83f21-filelists.sqlite

  ca525c73086186bfcb81ad9edd45796026dac7e4e50524e0f2daf901532aaf66-c6-x86_64-comps.xml.gz

  cachecookie

  fdd542ef36b0cde54ee0521fae90b98911db06483163aa1c049995b6d109349b-other.sqlite

  gen

  packages

  repomd.xml

  [root@n2 ~]# ls /var/cache/yum/x86_64/6/ksh

  046862454d1aa798eb72c70668a54e25905c276a613fd0cc15abdf13fc20d6de-filelists.sqlite

  38c945c0799d8cfb481c6145b8c227b1f2ef91100f3b7bc8cad97645594f4643-primary.sqlite

  cachecookie

  fe7ae063ad2b6e2c4bcdbc676581ac33eb74c0645132fb0c4bac78f24300ffb5-other.sqlite

  packages

  repomd.xml

  测试

  [root@n2 ~]# yum -y install dhcp

  Loaded plugins: fastestmirror, refresh-packagekit, security

  Loading mirror speeds from cached hostfile

  Setting up Install Process

  Resolving Dependencies

  --> Running transaction check

  ---> Package dhcp.x86_64 12:4.1.1-38.P1.el6.centos will be installed

  --> Finished Dependency Resolution

  Dependencies Resolved

  ========================================================================================================================================================

  Package Arch Version Repository Size

  ========================================================================================================================================================

  Installing:

  dhcp x86_64 12:4.1.1-38.P1.el6.centos yum 817 k

  Transaction Summary

  ========================================================================================================================================================

  Install 1 Package(s)

  Total download size: 817 k

  Installed size: 1.9 M

  Downloading Packages:

  dhcp-4.1.1-38.P1.el6.centos.x86_64.rpm | 817 kB 00:00

  Running rpm_check_debug

  Running Transaction Test

  Transaction Test Succeeded

  Running Transaction

  Warning: RPMDB altered outside of yum.

  Installing : 12:dhcp-4.1.1-38.P1.el6.centos.x86_64 1/1

  Verifying : 12:dhcp-4.1.1-38.P1.el6.centos.x86_64 1/1

  Installed:

  dhcp.x86_64 12:4.1.1-38.P1.el6.centos

  Complete!

  注意;因为ksh包在光盘中存在,所以需先修改repo文件后重建yum缓存再进行安装测试,否则安装的是光盘中的包。

Guess you like

Origin www.cnblogs.com/guarderming/p/11570669.html