Linux Study之--CentOS 创建本地yum库
系统环境:
操作系统:CentOS 65(64)
一、挂载系统光盘
[root@cent65 yum.repos.d]# mount /dev/cdrom /media
[root@cent65 yum.repos.d]# ls /media/
EFI p_w_picpaths RELEASE-NOTES-hi-IN.html RELEASE-NOTES-te-IN.html EULA isolinux RELEASE-NOTES-it-IT.html RELEASE-NOTES-zh-CN.html EULA_de LoadBalancer RELEASE-NOTES-ja-JP.html RELEASE-NOTES-zh-TW.html EULA_en media.repo RELEASE-NOTES-kn-IN.html repodata EULA_es Packages RELEASE-NOTES-ko-KR.html ResilientStorage EULA_fr README RELEASE-NOTES-ml-IN.html RPM-GPG-KEY-redhat-beta EULA_it RELEASE-NOTES-as-IN.html RELEASE-NOTES-mr-IN.html RPM-GPG-KEY-redhat-release EULA_ja RELEASE-NOTES-bn-IN.html RELEASE-NOTES-or-IN.html ScalableFileSystem EULA_ko RELEASE-NOTES-de-DE.html RELEASE-NOTES-pa-IN.html Server EULA_pt RELEASE-NOTES-en-US.html RELEASE-NOTES-pt-BR.html TRANS.TBL EULA_zh RELEASE-NOTES-es-ES.html RELEASE-NOTES-ru-RU.html GPL RELEASE-NOTES-fr-FR.html RELEASE-NOTES-si-LK.html HighAvailability RELEASE-NOTES-gu-IN.html RELEASE-NOTES-ta-IN.html
二、查看yum库配置文件
[root@cent65 yum.repos.d]# ls -l
total 20
-rw-r--r--. 1 root root 1926 Dec 3 11:57 CentOS-Base.repo
-rw-r--r--. 1 root root 638 Nov 27 2013 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root 629 Dec 3 12:01 CentOS-Media.repo
-rw-r--r--. 1 root root 630 Dec 3 12:04 CentOS-Media.repo.bak
-rw-r--r--. 1 root root 3664 Nov 27 2013 CentOS-Vault.repo
如果只使用本地yum库,可只需要CentOS-Media.repo配置文件:
[root@cent65 yum.repos.d]# ls -l
total 20
-rw-r--r--. 1 root root 1926 Dec 3 11:57 CentOS-Base.repo.bak
-rw-r--r--. 1 root root 638 Nov 27 2013 CentOS-Debuginfo.repo.bak
-rw-r--r--. 1 root root 629 Dec 3 12:19 CentOS-Media.repo
-rw-r--r--. 1 root root 630 Dec 3 12:04 CentOS-Media.repo.bak
-rw-r--r--. 1 root root 3664 Nov 27 2013 CentOS-Vault.repo.bak
编辑yum配置文件:
[root@cent65 yum.repos.d]# vi CentOS-Media.repo
# CentOS-Media.repo
#
# This repo can be used with mounted DVD media, verify the mount point for
# CentOS-6. You can use this repo and yum to install items directly off the
# DVD ISO that we release.
#
# To use this repo, put in your DVD and use it with the other repos too:
# yum --enablerepo=c6-media [command]
#
# or for ONLY the media repo, do this:
#
# yum --disablerepo=\* --enablerepo=c6-media [command]
[c6-media]
name=CentOS-$releasever - Media
baseurl=file:///media/Server
file:///media/cdrom/
file:///media/cdrecorder/
gpgcheck=0
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
~
三、通过yum安装软件
[root@cent65 yum.repos.d]# yum install -y perl-IO-Socket-SSL* --enablerepo=c6-media
Loaded plugins: fastestmirror, refresh-packagekit, security Loading mirror speeds from cached hostfile * c6-media: base | 3.9 kB 00:00 ... base/primary_db | 3.1 MB 00:00 ... c6-media | 3.9 kB 00:00 ... c6-media/primary_db | 3.1 MB 00:00 ... Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package perl-IO-Socket-SSL.noarch 0:1.31-2.el6 will be installed --> Processing Dependency: perl(Net::SSLeay) >= 1.21 for package: perl-IO-Socket-SSL-1.31-2.el6.noarch --> Processing Dependency: perl(Net::LibIDN) for package: perl-IO-Socket-SSL-1.31-2.el6.noarch --> Running transaction check ---> Package perl-Net-LibIDN.x86_64 0:0.12-3.el6 will be installed ---> Package perl-Net-SSLeay.x86_64 0:1.35-9.el6 will be installed --> Finished Dependency Resolution Dependencies Resolved =========================================================================================================== Package Arch Version Repository Size =========================================================================================================== Installing: perl-IO-Socket-SSL noarch 1.31-2.el6 base 69 k Installing for dependencies: perl-Net-LibIDN x86_64 0.12-3.el6 base 35 k perl-Net-SSLeay x86_64 1.35-9.el6 base 173 k Transaction Summary =========================================================================================================== Install 3 Package(s) Total download size: 276 k Installed size: 807 k Downloading Packages: ----------------------------------------------------------------------------------------------------------- Total 2.6 MB/s | 276 kB 00:00 Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Warning: RPMDB altered outside of yum. Installing : perl-Net-LibIDN-0.12-3.el6.x86_64 1/3 Installing : perl-Net-SSLeay-1.35-9.el6.x86_64 2/3 Installing : perl-IO-Socket-SSL-1.31-2.el6.noarch 3/3 Verifying : perl-Net-SSLeay-1.35-9.el6.x86_64 1/3 Verifying : perl-Net-LibIDN-0.12-3.el6.x86_64 2/3 Verifying : perl-IO-Socket-SSL-1.31-2.el6.noarch 3/3 Installed: perl-IO-Socket-SSL.noarch 0:1.31-2.el6 Dependency Installed: perl-Net-LibIDN.x86_64 0:0.12-3.el6 perl-Net-SSLeay.x86_64 0:1.35-9.el6 Complete!
[root@cent65 yum.repos.d]# yum install -y perl-TermReadKey* --enablerepo=c6-media
Loaded plugins: fastestmirror, refresh-packagekit, security Loading mirror speeds from cached hostfile * c6-media: c6-media | 3.9 kB 00:00 ... Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package perl-TermReadKey.x86_64 0:2.30-13.el6 will be installed --> Finished Dependency Resolution Dependencies Resolved =========================================================================================================== Package Arch Version Repository Size =========================================================================================================== Installing: perl-TermReadKey x86_64 2.30-13.el6 c6-media 31 k Transaction Summary =========================================================================================================== Install 1 Package(s) Total download size: 31 k Installed size: 62 k Downloading Packages: Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Warning: RPMDB altered outside of yum. Installing : perl-TermReadKey-2.30-13.el6.x86_64 1/1 Verifying : perl-TermReadKey-2.30-13.el6.x86_64 1/1 Installed: perl-TermReadKey.x86_64 0:2.30-13.el6 Complete!
[root@cent65 mysql]# rpm -ivh percona-toolkit-2.2.10-1.noarch.rpm
warning: percona-toolkit-2.2.10-1.noarch.rpm: Header V4 DSA/SHA1 Signature, key ID cd2efd2a: NOKEY
Preparing... ########################################### [100%]
1:percona-toolkit ########################################### [100%]