创建RHEL6 和 Centos6 的yum 本地源,不过我平时还是喜欢用source包安装。
1、 yum是否安装
[root@heliy ~]# rpm -qa | grep yum
yum-rhn-plugin-0.9.1-5.el6.noarch
PackageKit-yum-0.5.8-13.el6.i686
yum-metadata-parser-1.1.2-14.1.el6.i686
yum-utils-1.1.26-11.el6.noarch
yum-3.2.27-14.el6.noarch
PackageKit-yum-plugin-0.5.8-13.el6.i686
2、 挂载
[root@heliy ~]# ls /mnt/
C dvd1 dvd2 fat32 ISO ntfs usb
[root@heliy ~]# cat /etc/rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local
mount -t ntfs-3g /dev/sda6 /mnt/fat32
#mkdir /home/fukeyun/centosrpm
#cp /mnt/dvd1/Packages/* /homefukeyun/centosrpm
#cp /mnt/dvd2/Packages/* /homefukeyun/centosrpm
/dev/sda6 是我硬盘安装时划分的一个fat32分区,存放RHEL6的安装文件
3、 制作repo文件
可以用createrepo自动生成repo文件
# cd /mnt/fat32/Packages
#createrepo ./ ##make repomd.xml file
[root@heliy ~]# ls /etc/yum.repos.d/
base.repo centso6.repo
[root@heliy ~]# cat /etc/yum.repos.d/base.repo
[heliypackages]
name = package
baseurl = file:///mnt/fat32/Packages/
enabled=1
gpgcheck=1
gpgkey=file:///mnt/fat32/RPM-GPG-KEY-redhat-release
[heliyHA]
name = HA
baseurl = file:///mnt/fat32/HighAvailability/
enabled=1
gpgcheck=1
gpgkey=file:///mnt/fat32/RPM-GPG-KEY-redhat-release
[heliyLB]
name = LB
baseurl = file:///mnt/fat32/LoadBalancer/
enabled=1
gpgcheck=1
gpgkey=file:///mnt/fat32/RPM-GPG-KEY-redhat-release
[heliyServer]
name = server
baseurl = file:///mnt/fat32/Server/
enabled=1
gpgcheck=1
gpgkey=file:///mnt/fat32/RPM-GPG-KEY-redhat-release
4、监测
[root@heliy ~]# yum repolist
Loaded plugins: refresh-packagekit, rhnpluginThis system is not registered with RHN.RHN support will be disabled.
file:///home/fukeyun/centosrpm/repodata/repomd.xml: [Errno 14] Could not open/read file:///home/fukeyun/centosrpm/repodata/repomd.xml
Trying other mirror.
repo id repo name status
heliyHA HA 24
heliyLB LB 2
heliyServer server 2,646
heliypackages package 2,646
repolist: 5,318
[root@heliy ~]# yum list
报错
Error: Cannot retrieve repository metadata (repomd.xml) for repository: InstallMedia. Please verify its path and try again
用网上的方法:
方法一:删除软件仓库中的 media.repo和/etc/yum.repos.d/packagekit-media.repo (注:如果只删除 packagekit-media.repo是没有用的,之后又会产生新的packagekit-media.repo 文件)
方法二:在/etc/yum.conf增加以下选项
skip_if_unavailable=True
方法三:也可直卸载Packagekit 包,yum remove -y PackageKit 但是这样会把gnome-packagekit等7个包一起删了,其它的包我不知道是做什么用的,但gnome-packagekit删掉后肯定无法使用图形界面的“添加/删除软件”了
再次运行yum list ,出现如下错误:
[root@heliy ~]# yum list
Loaded plugins: refresh-packagekit, rhnplugin
This system is not registered with RHN.
RHN support will be disabled.
file:///home/fukeyun/centosrpm/repodata/repomd.xml: [Errno 14] Could not open/read file:///home/fukeyun/centosrpm/repodata/repomd.xml
Trying other mirror.
Error: Cannot retrieve repository metadata (repomd.xml) for repository: heliypackagesdvd1. Please verify its path and try again
这个错误在repolist就有
解决方法:
#mkdir /home/fukeyun/centosrpm/repodata
# cp /mnt/dvd1/repodata/* /home/fukeyun/centosrpm/repodata/
或者用createrepo
#createrepo -p -d -o /home/fukeyun/centosrpm/repodata /home/fukeyun/centosrpm/repodata
createrepo -p -d -o -C --update 常用参数或者到制定目录下createrepo ./创建
这样启动httpd可做为http源,file作为本地源。
上面是本地源,下面将介绍网络源:
参考了这篇:http://www.linuxde.net/2011/10/1578.html
RHEL6用centos6的源安装
1、 删除RHEL6自带的yum 包
# rpm -aq | grep yum|xargs rpm -e --nodeps
安装centos6的yum包,在这个URL下载安装:http://mirror.centos.org/centos/6.0/os/i386/Packages,我是下载相关yum的文件,rpm -ivh *.rpm安装,会提示一些depense包,再下载到同一个目录下再安装。
centos官网和国内centos yum镜像站点:
http://mirror.centos.org
http://mirrors.163.com
http://mirrors.btte.net/centos/
http://mirrors.ta139.com/centos/
http://mirror.neu.edu.cn/centos/
http://centos.ustc.edu.cn/centos/
http://mirrors.sohu.com/
http://mirror.tuna.tsinghua.edu.cn/ 清华大学开源镜像站
http://mirror.tju.edu.cn/ 天津大学开源镜像站
在这些站点的首页都有help,打开这个页面下载repo文件放入/etc/yum.repos.d下
,把文件里面的$releasever全部替换为版本号,即6 或者6.0(具体看站点目录)。
# yum clean all
# yum makecach 或 yum repolist
[root@heliy /home/fukeyun]#yum makecache
Loaded plugins: fastestmirror
Determining fastest mirrors
base | 3.7 kB 00:00
base/filelists_db | 4.7 MB 00:39
base/primary_db | 3.3 MB 00:28
base/other_db | 1.8 MB 00:15
base/group_gz | 206 kB 00:01
extras | 3.0 kB 00:00
extras/filelists_db | 736 B 00:00
extras/primary_db | 1.9 kB 00:00
extras/other_db | 734 B 00:00
updates | 3.5 kB 00:00
updates/filelists_db | 2.3 MB 00:18
updates/prestodelta | 82 kB 00:00
updates/primary_db | 3.1 MB 00:26
updates/other_db | 347 kB 00:02
[root@heliy /home/fukeyun]#yum check
Loaded plugins: fastestmirror
PackageKit-0.5.8-13.el6.i686 has missing requires of PackageKit-yum = ('0', '0.5.8', '13.el6')
PackageKit-0.5.8-13.el6.i686 has missing requires of PackageKit-yum-plugin = ('0', '0.5.8', '13.el6')
abrt-addon-ccpp-1.1.13-4.0.4.el6.i686 has missing requires of yum-utils
rhn-check-1.0.0-38.0.13.el6.noarch has missing requires of yum-rhn-plugin >= ('0', '0.5.3', '30')
Error: check all
安装PackageKit这些yum图形界面rpm,而rhn 这些包的错误不许要安装,是我们没有注册即没有购买RedHat许可的原因。
==============================================
linux enable telnet
1\ rpm -aq | grep 'telnet'
2\ # rpm -ivh /media/NEW\ VOLUME/Packages/xinetd- 2.3.14-29.el6.i686.rpm
telnet-server-0.17-46.el6.i686.rpm
telnet-0.17-46.el6.i686.rpm
3\ Path: /etc/xinetd.d/telnet
/usr/bin/telnet
4\ vi /etc/xinetd.d/telnet
# disable= yes
5\ /etc/init.d/xinetd restart
6\ port_change
vi /etc/services
telnet 23/tcp
telnet 23/udp