2015年11月24日 星期二

linux yum local media method

RHEL5 & RHEL6
配置yum源,方便安裝套裝軟體  rhel6
[root@test ~]# umount /dev/cdrom
[root@test ~]# mount /dev/cdrom /media
mount: block device /dev/sr0 is write-protected, mounting read-only

[root@test ~]# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda5             17342332   2793528  13667860  17% /
tmpfs                   510268       224    510044   1% /dev/shm
/dev/sda1               198337     28890    159207  16% /boot
/dev/sda3              1032088     34100    945560   4% /tmp
/dev/sr0               3632776   3632776         0 100% /media


[root@test ~]# vi /etc/yum.repos.d/rhel-source.repo

對rhel-source.repo進行修改
[rhel-source]
name=Red Hat Enterprise Linux $releasever - $basearch - Source
baseurl=file:///media
enabled=1
gpgcheck=1
gpgkey=file:///media/RPM-GPG-KEY-redhat-release


[rhel-source-beta]
name=Red Hat Enterprise Linux $releasever Beta - $basearch - Source
baseurl=ftp://ftp.redhat.com/pub/redhat/linux/beta/$releasever/en/os/SRPMS/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta,file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

配置完yum之後執行下面命令之後就可以進行套裝軟體的安裝了
[root@test yum.repos.d]# yum clean all
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Cleaning repos: rhel-source
Cleaning up Everything
[root@test yum.repos.d]# yum repolist
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
rhel-source                                                                          | 3.9 kB     00:00 ...
rhel-source/primary_db                                                               | 3.1 MB     00:00 ...
repo id                        repo name                                                              status
rhel-source                    Red Hat Enterprise Linux 6Server - x86_64 - Source                     3,648
repolist: 3,648
[root@test yum.repos.d]#

安裝套裝軟體
[root@test yum.repos.d]# rpm -qa --qf "%{NAME}_%{VERSION}_%{ARCH}\n"|sort|less 查看已經安裝的套裝軟體
install oracle need pachage
[root@test yum.repos.d]# yum -y install binutils compat-libstdc++-33 compat-libcap1 elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers libaio libaio-devel libgcc libstdc++ libstdc++-devel make sysstat unixODBC unixODBC-devel

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

配置yum源,方便安裝套裝軟體  rhel5

[root@oracle-primary ~]# umount /dev/cdrom
[root@oracle-primary ~]# mount /dev/cdrom /media
mount: block device /dev/cdrom is write-protected, mounting read-only
[root@oracle-primary ~]# df -m
Filesystem           1M-blocks      Used Available Use% Mounted on
/dev/vda7                 9917      3550      5856  38% /
/dev/vda9                77619       184     73428   1% /backup
/dev/vda6                 9917       151      9254   2% /archivelog
/dev/vda5                14529       165     13614   2% /u01
/dev/vda3                14529       165     13614   2% /u03
/dev/vda2                67810       180     64130   1% /u02
/dev/vda1                   99        12        83  13% /boot
tmpfs                      830         0       830   0% /dev/shm
/dev/hdc                  3532      3532         0 100% /media

[root@oracle-primary ~]# vim /etc/yum.repos.d/rhel-source.repo

對rhel-source.repo進行修改
[rhel-source]
name=Red Hat Enterprise Linux $releasever - $basearch - Source
baseurl=file:///media/Server
enabled=1
gpgcheck=1
gpgkey=file:///media/RPM-GPG-KEY-redhat-release

[root@oracle-primary ~]# yum clean all
Loaded plugins: rhnplugin, security
Cleaning up Everything

[root@oracle-primary ~]# yum repolist
Loaded plugins: rhnplugin, security
This system is not registered with RHN.
RHN support will be disabled.
rhel-source                                              | 1.3 kB     00:00
rhel-source/primary                                      | 868 kB     00:00
rhel-source                                                           3116/3116
repo id      repo name                                            status
rhel-source  Red Hat Enterprise Linux 5Server - x86_64 - Source   enabled: 3,116
repolist: 3,116

[root@oracle-primary ~]# yum -y install binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers libaio libaio-devel libgcc libstdc++ libstdc++-devel make sysstat unixODBC unixODBC-devel libXp

沒有留言: