When your Linux system can connect to the network, I think you will not need to install local and rpm software. The network source is to install the software you want through the resources on the network, in this way, the system can be updated and maintained in a timely manner.
1. Ensure that your server can connect to the Internet
[Root @ CentOS ~] # Ifconfig eth0
Eth0 Link encap: Ethernet HWaddr 08: 00: 27: 56: AA
Inet addr: 2.2.2.145 Bcast: 2.20.255.255 Mask: 255.0.0.0
Inet6 addr: fe80: a00: 27ff: fe56: aaaa/64 Scope: Link
Up broadcast running multicast mtu: 1500 Metric: 1
RX packets: 424 errors: 0 dropped: 0 overruns: 0 frame: 0
TX packets: 95 errors: 0 dropped: 0 overruns: 0 carrier: 0
Collisions: 0 FIG: 1000
RX bytes: 36395 (35.5 KiB) TX bytes: 12020 (11.7 KiB)
[Root @ centos ~] # Ping www.baidu.com
PING www.a.shifen.com (115.239.210.27) 56 (84) bytes of data.
64 bytes from 115.239.210.27: icmp_seq = 1 ttl = 54 time = 18.1 MS
64 bytes from 115.239.210.27: icmp_seq = 1 ttl = 54 time = 17.9 MS
2. Edit the yum library file (using the official source)
[Root @ RedHat1 ~] # Cd/etc/yum. repos. d/
[Root @ redhat1 ~] # Vim CentOS-Base.repo-with the official source (remove all baseurl before)
[Base]
Name = CentOS-$ releasever-Base
Using list = http://mirrorlist.centos.org /? Release = $ releasever & arch = $ basearch & repo = OS
Baseurl = http://developer.centos.org/centos/?releasever/ OS /?basearch/
Gpgcheck = 1
Gpgkey = file: // etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
# Released updates
[Updates]
Name = CentOS-$ releasever-Updates
Using list = http://mirrorlist.centos.org /? Release = $ releasever & arch = $ basearch & repo = updates
Baseurl = http://developer.centos.org/centos/?releasever/updates/?basearch/
Gpgcheck = 1
Gpgkey = file: // etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
# Additional packages that may be useful
[Extras]
Name = CentOS-$ releasever-Extras
Using list = http://mirrorlist.centos.org /? Release = $ releasever & arch = $ basearch & repo = extras
Baseurl = http://developer.centos.org/centos/?releasever/extras/?basearch/
Gpgcheck = 1
Gpgkey = file: // etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
# Additional packages that extend functionality of existing packages
[Centosplus]
Name = CentOS-$ releasever-Plus
Using list = http://mirrorlist.centos.org /? Release = $ releasever & arch = $ basearch & repo = centosplus
Baseurl = http://developer.centos.org/centos/?releasever/centosplus/?basearch/
Gpgcheck = 1
Enabled = 1 -- enable Repository
Gpgkey = file: // etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
# Contrib-packages by Centos Users
[Contrib]
Name = CentOS-$ releasever-Contrib
Using list = http://mirrorlist.centos.org /? Release = $ releasever & arch = $ basearch & repo = contrib
Baseurl = http://developer.centos.org/centos/?releasever/contrib/?basearch/
Gpgcheck = 1
Enabled = 1 -- enable Repository
Gpgkey = file: // etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
3. Use Netease's network source (the same is true for other open-source image sites)
[Root @ centos1 ~] # Cd/etc/yum. repos. d/-- enter the root directory of the repository.
[Root @ centos1 yum. repos. d] # ll
Total 16
-Rw-r --. 1 root 1926 Feb 25 2013 CentOS-Base.repo1
-Rw-r --. 1 root 638 Feb 25 2013 CentOS-Debuginfo.repo1
-Rw-r --. 1 root 545 Nov 10 CentOS-Media.repo
-Rw-r --. 1 root 3664 Feb 25 2013 CentOS-Vault.repo
[Root @ centos1 yum. repos. d] # wget http://mirrors.163.com/.help/CentOS6-Base-163.repo -- Download 163 source Image
-- 21:23:32 -- http://mirrors.163.com/.help/CentOS6-Base-163.repo
Resolving mirrors.163.com... 123.58.173.106
Connecting to mirrors.163.com | 123.58.173.106 |: 80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2006 (2.0 K) [application/octet-stream]
Saving :?. EntOS6-Base-163.repo?
100% [============================================== ========================================================== ======>] 2,006 --. -K/s in 0.02 s
21:23:32 (97.8 KB/s )-?. EntOS6-Base-163.repo ?. Saved [2, 2006/2006]
[Root @ centos1 yum. repos. d] # ll
Total 20
-Rw-r --. 1 root 2006 Sep 1 2011 CentOS6-Base-163.repo
-Rw-r --. 1 root 1926 Feb 25 2013 CentOS-Base.repo1
-Rw-r --. 1 root 638 Feb 25 2013 CentOS-Debuginfo.repo1
-Rw-r --. 1 root 545 Nov 10 CentOS-Media.repo
-Rw-r --. 1 root 3664 Feb 25 2013 CentOS-Vault.repo
[Root @ centos1 yum. repos. d] # vim CentOS6-Base-163.repo -- remove the # sign before baseurl and change enabled = 0 to 1
[Base]
Name = CentOS-$ releasever-Base-163.com
Baseurl = http://mirrors.163.com/centos/?releasever/ OS /?basearch/
# Items list = http://mirrorlist.centos.org /? Release = $ releasever & arch = $ basearch & repo = OS
Gpgcheck = 1
Gpgkey = http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
# Released updates
[Updates]
Name = CentOS-$ releasever-Updates-163.com
Baseurl = http://mirrors.163.com/centos/?releasever/updates/?basearch/
# Items list = http://mirrorlist.centos.org /? Release = $ releasever & arch = $ basearch & repo = updates
Gpgcheck = 1
Gpgkey = http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
# Additional packages that may be useful
[Extras]
Name = CentOS-$ releasever-Extras-163.com
Baseurl = http://mirrors.163.com/centos/?releasever/extras/?basearch/
# Items list = http://mirrorlist.centos.org /? Release = $ releasever & arch = $ basearch & repo = extras
Gpgcheck = 1
Gpgkey = http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
# Additional packages that extend functionality of existing packages
[Centosplus]
Name = CentOS-$ releasever-Plus-163.com
Baseurl = http://mirrors.163.com/centos/?releasever/centosplus/?basearch/
# Items list = http://mirrorlist.centos.org /? Release = $ releasever & arch = $ basearch & repo = centosplus
Gpgcheck = 1
Enabled = 1
Gpgkey = http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
# Contrib-packages by Centos Users
[Contrib]
Name = CentOS-$ releasever-Contrib-163.com
Baseurl = http://mirrors.163.com/centos/?releasever/contrib/?basearch/
# Items list = http://mirrorlist.centos.org /? Release = $ releasever & arch = $ basearch & repo = contrib
Gpgcheck = 1
Enabled = 1
Gpgkey = http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
[Root @ centos1 yum. repos. d] # yum repolist -- check whether the repository is successful
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Base | 3.7 kB
Base/primary_db | 3.5 MB
Extras | 3.4 kB: 00
Extras/primary_db | 18 kB: 00
Updates | 3.4 kB: 00
Updates/primary_db | 97 kB 00:01
Repo id repo name status
Base-CentOS-6-Base-163.com 4,802
C6-media CentOS-6-Media 4,802
Extras CentOS-6-Extras-163.com 12
Updates CentOS-6-Updates-163.com 93
Repolist: 9,709
[Root @ centos1 yum. repos. d] #
Note: Linux local source Configuration:
Recommended reading:
RedHat Linux local yum source configuration
RedHat 6.2 modify yum source in Linux use CentOS source for free
Configure the epel yum Source
Redhat local yum source configuration
Description of yum configuration file
Install yum in RedHat 6.1)
YUM installation and cleaning