Most of the time our server is in the LAN, unable to network, install some services, need to rely on a lot of rpm, and these RPM package dependency also makes us very headache, using Yum to automatically solve these dependencies, now we want to build local Yum source. Our system mainly uses Rhel and CentOS.
RHEL6.3 Local Create Yum source
Premise: RPM package has been placed in/home/intone/packages
Cd/etc/yum.repos.d
Renaming your own Rhel-source.repo
MV Rhel-source.repo Rhel-source.repo.bak
To create your own repo file
Vi/etc/yum.repos.d/local.repo
[Local]
Name=aaa
Baseurl=file:///home/intone/packages
Gpgcheck=1
Enabled=1 # #开启本地源
Gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-redhat-release
Now you can use the local Yum source,
Note: If you need to change the Yum source to a network restore/ETC/YUM.REPOS.D directory file!
CENTOS Local Create Yum source
Next configure the local Yum source
Mount Disc mode
(1) Mount the local CD-ROM to the system: put the cent6.* installation CD into the CD-ROM drive, operate under the terminal command line
Mkdir/mnt/cdrom #新建挂载目录
Mount/dev/cdrom/mnt/cdrom #挂载光盘到 the/mnt/cdrom directory
Cd/mnt/cdrom #进入挂载目录
LS #查看挂载目录, disc mounted successfully
(2) Configure local Yum source
Cd/etc/yum.repos.d/#进入yum配置目录
VI Centos-media.repo #编辑配置文件,
Add the following content:
1 [Guangpan]
2 name=centos-$releasever-media #自定义名称
3 baseurl=file:///mnt/cdrom/#本地光盘挂载路径
4 gpgcheck=0 #检查GPG-key,0 for no check, 1 for inspection
5 enabled=1 #启用yum源, 0 is not enabled, 1 is enabled
(3) Clear Yum cache, install software automatically using Yum install
1 Yum Clean all #清除yum缓存
Note: CentOS needs to rename the Centos-base.repo Centos-debuginfo.repo file in the/etc/yum.rpos.d/directory so that it can bypass the network for local source installation
The installation package has been copied to server mode
(1) Copy all RPM files to a folder cp-rv/media/disc/packs/*/Created folder
Note: Our system has been copied to/home/intone/packages (for security purposes, you can copy a copy to a directory of their own name, the following/home/intone/packages as an example)
(2) Manually install the Createrepo command via the RPM command to create the Yum repository
RPM-IVH Createrepo
(3) Run command createrepo-v/home/intone/packages
(4) Yum clean all (clear cache)
You can use Yum to install the
Note: If you need to change the Yum source to a network restore/ETC/YUM.REPOS.D directory of four files!
Report
[[email protected] packages]# ls createrepo*
createrepo-0.9.8-5.el6.noarch.rpm
[Email protected] packages]# RPM-IVH createrepo-0.9.8-5.el6.noarch.rpm
Warning:createrepo-0.9.8-5.el6.noarch.rpm:header V3 rsa/sha256 Signature, key ID Fd431d51:nokey
error:failed dependencies:
DELTARPM is needed by Createrepo-0.9.8-5.el6.noarch
PYTHON-DELTARPM is needed by Createrepo-0.9.8-5.el6.noarch
[Email protected] packages]# RPM-IVH python-deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm
Warning:python-deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm:header V3 rsa/sha256 Signature, key ID Fd431d51:nokey
error:failed dependencies:
deltarpm = 3.5-0.5.20090913git.el6 is needed by python-deltarpm-3.5-0.5.20090913git.el6.x86_64
[Email protected] packages]# RPM-IVH deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm
Warning:deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm:header V3 rsa/sha256 Signature, key ID Fd431d51:nokey
Preparing ... ########################################### [100%]
1:deltarpm ########################################### [100%]
[Email protected] packages]# RPM-IVH python-deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm
Warning:python-deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm:header V3 rsa/sha256 Signature, key ID Fd431d51:nokey
Preparing ... ########################################### [100%]
1:python-deltarpm ########################################### [100%]
[Email protected] packages]# RPM-IVH createrepo-0.9.8-5.el6.noarch.rpm
Warning:createrepo-0.9.8-5.el6.noarch.rpm:header V3 rsa/sha256 Signature, key ID Fd431d51:nokey
Preparing ... ########################################### [100%]
1:createrepo ########################################### [100%]
[Email protected] packages]#
Createrepo-v/home/intone/packages
Yum Clean All
You can now use Yum to install the
Linux configuration local Yum source