发布时间:2014-09-05 17:07:16作者:知识屋
想必大家对linux下的YUM服务并不陌生吧,之前有将linux下redhat构建YUM的步骤有写出来,今天主要写一下如何在centos下构建YUM,尽管centos是redhat的克隆版,但也有很多的不同之处;
此链接是讲解如何在redhat上构建YUM,http://www.linuxdiyf.com/bbs/viewthread.php?tid=204212&extra=page%3D2%26amp%3Borderby%3Ddateline
下面是CentOS下构建YUM的步骤
1.首先把镜像盘挂在上:mount /dev/cdrom /media/cdrom/
2.安装http的包, rpm -ivh /media/cdrom/CentOS/httpd-2.2.3-43.el5.centos.i386.rpm
3.安装YUM常用的RPM包(有的包是默认已经安装的,但也要查一下是否安装)
rpm -ivh /media/cdrom/CentOS/yum-3.2.22-26.el5.centos.noarch.rpm
rpm -ivh /media/cdrom/CentOS/yum-metadata-parser-1.1.2-3.el5.centos.i386.rpm
rpm -ivh /media/cdrom/CentOS/yum-fastestmirror-1.1.16-14.el5.centos.1.noarch.rpm
rpm -ivh /media/cdrom/CentOS/yum-updatesd-0.9-2.el5.noarch.rpm
4.新建一个自定义的目录,用来放置你的RPM包,也是http访问的目录:/data/CentOS/i386/
将挂在的rpm包的集合复制一份到/data/CentOS/i386/下,(因为你不可能挂在你的镜像盘一辈子)
/cp -rf /media/cdrom/CentOS/ /data/CentOS/i386/
5.将/media/cdrom下的repodata/ 拷贝到/data/CentOS/i386/CentOS下
cp -rf /media/cdrom/repodata/ /data/CentOS/i386/CentOS/ (后面会用到的)
6.安装rpm -ivh /media/cdrom/CentOS/createrepo-0.4.11-3.el5.noarch.rpm (此包是用来安装服务端设置软件仓库及信息文件)
rpm -ivh /media/cdrom/CentOS/createrepo-0.4.11-3.el5.noarch.rpm
7.先把http服务启动,service httpd start ,如果这个服务不能搞定,其他的一切都是做无用功)
netstat -anpt | grep 80
tcp 0 0 :::80 :::* LISTEN 8389/httpd
8.生成客户端所需的信息文件
createrepo -g /media/cdrom/repodata/comps.xml /data/CentOS/i386/
9.将key文件(用于客户端与服务端的认证)拷入指定目录/data/CentOS/i386 下
cp /media/cdrom/RPM-GPG-KEY-CentOS-5 /data/CentOS/i386/
10.修改http服务的配置文件,如何你是默认安装的httpd,其配置文件路径为:
vi /etc/httpd/conf/httpd.conf
修改一下两行即可:(显示的是更改后的)
DocumentRoot "/data/CentOS/"
<Directory "/data/CentOS/">
之后保存,退出。。重启httpd服务、、、service httpd restart
11.用你的IE浏览器浏览下,看能不能访问http://172.16.17.140/i386/CentOS/ 下面显示的是rpm包算是正却的
12.更改yum的配置文件,更改之前要做好备份
、cp CentOS-Base.repo CentOS-Base.repo.bak
之后清空你的CentOS-Base.repo 文件
方法:> CentOS-Base.repo 即可
vi CentOS-Base.repo
[base]
name=CentOS5.3-base
baseurl=http://172.16.17.140/i386/
enable=1
gpgcheck=1
gpgkey=http://172.16.17.140/i386/RPM-GPG-KEY-CentOS-5
这样即可了
下面就是测试了。。。
先执行下yum clean all
之后验证下
[root@centos yum.repos.d]# yum install gcc
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
base | 1.1 kB 00:00
base/primary | 912 kB 00:00
base 2599/2599
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package gcc.i386 0:4.1.2-48.el5 set to be updated
--> Processing Dependency: libgomp >= 4.1.2-48.el5 for package: gcc
--> Processing Dependency: glibc-devel >= 2.2.90-12 for package: gcc
--> Running transaction check
---> Package glibc-devel.i386 0:2.5-49 set to be updated
--> Processing Dependency: glibc-headers = 2.5-49 for package: glibc-devel
--> Processing Dependency: glibc-headers for package: glibc-devel
---> Package libgomp.i386 0:4.4.0-6.el5 set to be updated
--> Running transaction check
---> Package glibc-headers.i386 0:2.5-49 set to be updated
--> Processing Dependency: kernel-headers >= 2.2.1 for package: glibc-headers
--> Processing Dependency: kernel-headers for package: glibc-headers
--> Running transaction check
---> Package kernel-headers.i386 0:2.6.18-194.el5 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
===============================================================================================================
Package Arch Version Repository Size
===============================================================================================================
Installing:
gcc i386 4.1.2-48.el5 base 5.2 M
Installing for dependencies:
glibc-devel i386 2.5-49 base 2.0 M
glibc-headers i386 2.5-49 base 601 k
kernel-headers i386 2.6.18-194.el5 base 1.0 M
libgomp i386 4.4.0-6.el5 base 70 k
Transaction Summary
===============================================================================================================
Install 5 Package(s)
Upgrade 0 Package(s)
Total download size: 8.9 M
Is this ok [y/N]: y
Downloading Packages:
(1/5): libgomp-4.4.0-6.el5.i386.rpm | 70 kB 00:00
(2/5): glibc-headers-2.5-49.i386.rpm | 601 kB 00:00
(3/5): kernel-headers-2.6.18-194.el5.i386.rpm | 1.0 MB 00:00
(4/5): glibc-devel-2.5-49.i386.rpm | 2.0 MB 00:00
(5/5): gcc-4.1.2-48.el5.i386.rpm | 5.2 MB 00:00
---------------------------------------------------------------------------------------------------------------
Total 14 MB/s | 8.9 MB 00:00
warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID e8562897
base/gpgkey | 1.5 kB 00:00
Importing GPG key 0xE8562897 "CentOS-5 Key (CentOS 5 Official Signing Key) <centos-5-key@centos.org>" from http://172.16.17.140/i386/RPM-GPG-KEY-CentOS-5
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : libgomp 1/5
Installing : kernel-headers 2/5
Installing : glibc-headers 3/5
Installing : glibc-devel 4/5
Installing : gcc 5/5
Installed:
gcc.i386 0:4.1.2-48.el5
Dependency Installed:
glibc-devel.i386 0:2.5-49 glibc-headers.i386 0:2.5-49 kernel-headers.i386 0:2.6.18-194.el5
libgomp.i386 0:4.4.0-6.el5
Complete!
linux一键安装web环境全攻略 在linux系统中怎么一键安装web环境方法
Linux网络基本网络配置方法介绍 如何配置Linux系统的网络方法
Linux下DNS服务器搭建详解 Linux下搭建DNS服务器和配置文件
对Linux进行详细的性能监控的方法 Linux 系统性能监控命令详解
linux系统root密码忘了怎么办 linux忘记root密码后找回密码的方法
Linux基本命令有哪些 Linux系统常用操作命令有哪些
Linux必学的网络操作命令 linux网络操作相关命令汇总
linux系统从入侵到提权的详细过程 linux入侵提权服务器方法技巧
linux系统怎么用命令切换用户登录 Linux切换用户的命令是什么
在linux中添加普通新用户登录 如何在Linux中添加一个新的用户
2012-07-10
CentOS 6.3安装(详细图解教程)
Linux怎么查看网卡驱动?Linux下查看网卡的驱动程序
centos修改主机名命令
Ubuntu或UbuntuKyKin14.04Unity桌面风格与Gnome桌面风格的切换
FEDORA 17中设置TIGERVNC远程访问
StartOS 5.0相关介绍,新型的Linux系统!
解决vSphere Client登录linux版vCenter失败
LINUX最新提权 Exploits Linux Kernel <= 2.6.37
nginx在网站中的7层转发功能