Linux 5/6、Suse11本地yum源配置步骤

Redhat 5:
# mount -o loop rhel-server-5.8-x86_64-dvd.iso /media/cdrom 
# vim /etc/yum.repos.d/dvd.repo 
[dvd] 
name=install dvd 
baseurl=file:///iso/suse/x86_64
enabled=1 
gpgcheck=0 
# yum clean all 
# yum list

Redhat 6:
1、在/media目录下建立目录 
#mkdir /media/rhel 
2、创建配置文件 
#vi /etc/yum.repos.d/rhel6.repo 
[Server] 
name=Red Hat Enterprise Linux Server 
baseurl=file:///media/rhel 
enabled=1 
gpgcheck=1 
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release     
3、修改配置文件 
#vi /usr/lib/python2.6/site-packages/yum/yumRepo.py  
    修改 
    remote = url + '/' + relative 
    为 
    remote = "/media/rhel" + '/' + relative 
4、清除缓存目录(/var/cache/yum)下的软件包及旧的headers 
#yum clean all 

Suse 11:
lkdb:/etc/zypp/repos.d # uname -a
Linux lkdb 3.0.76-0.11-default #1 SMP Fri Jun 14 08:21:43 UTC 2013 (ccab990) x86_64 x86_64 x86_64 GNU/Linux

lkdb:/etc/zypp/repos.d # df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda2        97G  6.8G   89G   8% /
udev            3.9G  116K  3.9G   1% /dev
tmpfs           3.9G   76K  3.9G   1% /dev/shm
/dev/loop0      3.2G  3.2G     0 100% /dac
/dev/loop1      3.2G  3.2G     0 100% /iso

lkdb:/etc # zypper ar file:///iso update
Adding repository 'update' [done]
Repository 'update' successfully added
Enabled: Yes
Autorefresh: No
GPG check: Yes
URI: file:/iso

lkdb:/etc # zypper lr
# | Alias                                            | Name                                             | Enabled | Refresh
--+--------------------------------------------------+--------------------------------------------------+---------+--------
1 | SUSE-Linux-Enterprise-Server-11-SP3 11.3.3-1.138 | SUSE-Linux-Enterprise-Server-11-SP3 11.3.3-1.138 | Yes     | No     
2 | update                                           | update                                           | Yes     | No     

lkdb:/etc # cd /etc/zypp/repos.d/
lkdb:/etc/zypp/repos.d # ls
SUSE-Linux-Enterprise-Server-11-SP3 11.3.3-1.138.repo  update.repo
lkdb:/etc/zypp/repos.d # cat update.repo 
[update]
name=update
enabled=1
autorefresh=0
baseurl=file:/iso
type=NONE

lkdb:/etc/zypp/repos.d # zypper in c++
Building repository 'update' cache [done]
Loading repository data...
Reading installed packages...
'c++' not found in package names. Trying capabilities.
No provider of 'c++' found.
Resolving package dependencies...

Nothing to do.


lkdb:/etc/zypp/repos.d # zypper in GCC*
Loading repository data...
Reading installed packages...
Resolving package dependencies...

The following NEW packages are going to be installed:
  gcc gcc-32bit gcc-c++ gcc-info gcc-locale gcc43 gcc43-32bit gcc43-c++ gcc43-info gcc43-locale glibc-devel glibc-devel-32bit 
  libgomp1-32bit libstdc++43-devel linux-kernel-headers 

15 new packages to install.
Overall download size: 21.8 MiB. After the operation, additional 100.2 MiB will be used.
Continue? [y/n/?] (y): Y
Retrieving package linux-kernel-headers-2.6.32-1.13.5.noarch (1/15), 721.0 KiB (2.6 MiB unpacked)
Retrieving package gcc43-info-4.3.4_20091019-0.37.30.x86_64 (2/15), 1.7 MiB (1.6 MiB unpacked)
Retrieving package libgomp1-32bit-4.7.2_20130108-0.15.45.x86_64 (3/15), 33.0 KiB (62.0 KiB unpacked)
Retrieving package glibc-devel-2.11.3-17.54.1.x86_64 (4/15), 4.8 MiB (31.0 MiB unpacked)
Retrieving package gcc-info-4.3-62.198.x86_64 (5/15), 5.0 KiB (1.0 KiB unpacked)
Retrieving package libstdc++43-devel-4.3.4_20091019-0.37.30.x86_64 (6/15), 2.2 MiB (18.1 MiB unpacked)
Retrieving package glibc-devel-32bit-2.11.3-17.54.1.x86_64 (7/15), 3.8 MiB (18.6 MiB unpacked)
Retrieving package gcc43-4.3.4_20091019-0.37.30.x86_64 (8/15), 2.1 MiB (7.2 MiB unpacked)
Retrieving package gcc43-locale-4.3.4_20091019-0.37.30.x86_64 (9/15), 1.4 MiB (7.1 MiB unpacked)
Retrieving package gcc43-c++-4.3.4_20091019-0.37.30.x86_64 (10/15), 3.2 MiB (8.6 MiB unpacked)
Retrieving package gcc43-32bit-4.3.4_20091019-0.37.30.x86_64 (11/15), 1.8 MiB (5.3 MiB unpacked)
Retrieving package gcc-4.3-62.198.x86_64 (12/15), 5.0 KiB (0 B unpacked)
Retrieving package gcc-locale-4.3-62.198.x86_64 (13/15), 5.0 KiB (1.0 KiB unpacked)
Retrieving package gcc-c++-4.3-62.198.x86_64 (14/15), 5.0 KiB (0 B unpacked)
Retrieving package gcc-32bit-4.3-62.198.x86_64 (15/15), 5.0 KiB (1.0 KiB unpacked)
Installing: linux-kernel-headers-2.6.32-1.13.5 [done]
Additional rpm output:
post linux-kernel-headers-2.6.32-1.13.5 /var/tmp/rpm-tmp.8685 1

Installing: gcc43-info-4.3.4_20091019-0.37.30 [done]
Installing: libgomp1-32bit-4.7.2_20130108-0.15.45 [done]
Installing: glibc-devel-2.11.3-17.54.1 [done]
Installing: gcc-info-4.3-62.198 [done]
Installing: libstdc++43-devel-4.3.4_20091019-0.37.30 [done]
Installing: glibc-devel-32bit-2.11.3-17.54.1 [done]
Installing: gcc43-4.3.4_20091019-0.37.30 [done]
Installing: gcc43-locale-4.3.4_20091019-0.37.30 [done]
Installing: gcc43-c++-4.3.4_20091019-0.37.30 [done]
Installing: gcc43-32bit-4.3.4_20091019-0.37.30 [done]
Installing: gcc-4.3-62.198 [done]
Installing: gcc-locale-4.3-62.198 [done]
Installing: gcc-c++-4.3-62.198 [done]
Installing: gcc-32bit-4.3-62.198 [done]
lkdb:/etc/zypp/repos.d # 

你可能感兴趣的:(Linux)