CentOS本地YUM源搭建

CentOS本地YUM源搭建

今天在虚拟机下安装了一台Centos 5.6,为了后期测试方便,准备先搭建个本地yum

[root@localhost ~]# mkdir /mnt/yum

[root@localhost ~]# mount /dev/cdrom /mnt/yum
mount: block device /dev/cdrom is write-protected, mounting read-only
[root@localhost ~]# cd /etc/yum.repos.d/

[root@localhost ~]#mkdir bak
[root@localhost ~]# touch localyum.repo
[root@localhost ~]# cat CentOS-Media.repo >localyum.repo
[root@localhost ~]#cp ./*.repo bak
注意操作前,将之前的配置文件进行备份
[root@localhost yum.repos.d]# vim localyum.repo
# CentOS-Media.repo
#
# This repo is used to mount the default locations for a CDROM / DVD on
# CentOS-5. 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=c5-media [command]
#
# or for ONLY the media repo, do this:
#
# yum --disablerepo=\* --enablerepo=c5-media [command]

[c5-media]
name=CentOS-$releasever - Media
baseurl=file:///mnt/yum/
gpgcheck=0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
:wq! 保存退出
[root@localhost yum.repos.d]# yum clean all
Loaded plugins: fastestmirror
Cleaning up Everything
Cleaning up list of fastest mirrors
[root@localhost yum.repos.d]# yum remove httpd
Loaded plugins: fastestmirror
Setting up Remove Process
Resolving Dependencies
--> Running transaction check
---> Package httpd.i386 0:2.2.3-43.el5.centos set to be erased
--> Processing Dependency: httpd-mmn = 20051115 for package: mod_ssl
--> Processing Dependency: httpd-mmn = 20051115 for package: mod_perl
--> Processing Dependency: httpd-mmn = 20051115 for package: php
--> Processing Dependency: httpd-mmn = 20051115 for package: mod_python
--> Processing Dependency: webserver for package: webalizer
--> Processing Dependency: httpd = 2.2.3-43.el5.centos for package: httpd-manual
--> Processing Dependency: httpd for package: system-config-httpd
--> Processing Dependency: httpd >= 2.0.40 for package: mod_python
--> Processing Dependency: httpd >= 2.2.0 for package: gnome-user-share
--> Processing Dependency: httpd = 2.2.3-43.el5.centos for package: mod_ssl
--> Running transaction check
---> Package gnome-user-share.i386 0:0.10-6.el5 set to be erased
---> Package httpd-manual.i386 0:2.2.3-43.el5.centos set to be erased
---> Package mod_perl.i386 0:2.0.4-6.el5 set to be erased
---> Package mod_python.i386 0:3.2.8-3.1 set to be erased
---> Package mod_ssl.i386 1:2.2.3-43.el5.centos set to be erased
---> Package php.i386 0:5.1.6-27.el5 set to be erased
---> Package system-config-httpd.noarch 5:1.3.3.3-1.el5 set to be erased
---> Package webalizer.i386 0:2.01_10-30.1 set to be erased
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Removing:
httpd i386 2.2.3-43.el5.centos installed 3.1 M
Removing for dependencies:
gnome-user-share i386 0.10-6.el5 installed 89 k
httpd-manual i386 2.2.3-43.el5.centos installed 3.4 M
mod_perl i386 2.0.4-6.el5 installed 6.7 M
mod_python i386 3.2.8-3.1 installed 1.1 M
mod_ssl i386 1:2.2.3-43.el5.centos installed 177 k
php i386 5.1.6-27.el5 installed 5.9 M
system-config-httpd noarch 5:1.3.3.3-1.el5 installed 2.1 M
webalizer i386 2.01_10-30.1 installed 252 k
Transaction Summary
================================================================================
Remove 9 Package(s)
Reinstall 0 Package(s)
Downgrade 0 Package(s)
Is this ok [y/N]: y                   \\注:此处选择y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Erasing : mod_python 1/9
Erasing : httpd-manual 2/9
Erasing : mod_perl 3/9
Erasing : gnome-user-share 4/9
Erasing : webalizer 5/9
Erasing : system-config-httpd 6/9
Erasing : httpd 7/9
Erasing : php 8/9
Erasing : mod_ssl 9/9
Removed:
httpd.i386 0:2.2.3-43.el5.centos
Dependency Removed:
gnome-user-share.i386 0:0.10-6.el5
httpd-manual.i386 0:2.2.3-43.el5.centos
mod_perl.i386 0:2.0.4-6.el5
mod_python.i386 0:3.2.8-3.1
mod_ssl.i386 1:2.2.3-43.el5.centos
php.i386 0:5.1.6-27.el5
system-config-httpd.noarch 5:1.3.3.3-1.el5
webalizer.i386 0:2.01_10-30.1
Complete!                   \\表示完成
 
[root@localhost yum.repos.d]# yum -y install httpd   \\ 快去尝试一下吧
 
提示:关于LINUX一切知识,有兴趣的朋友可以加本人QQ群:71998032 一起学习研究一下:)

你可能感兴趣的:(linux,centos,centos,快速安装,本YUM搭建)