rhel下yum相关知识

卸载原有yum

rpm -aq|grep yum|xargs rpm -e --nodeps

 

 

wget -c http://yum.baseurl.org/download/2.0/yum-2.0.8-1.src.rpm

rpmbuild --rebuild yum-2.0.8-1.src.rpm

cd /usr/src/redhat/RPMS/noarch/

rpm -ivh yum-2.0.8-1.noarch.rpm

 

Yum软件仓库---redhat

网络地址:http://ayo.freshrpms.net/(官网)

 

http://apt.sw.be/

 

http://vault.centos.org/

 

http://ftp.freshrpms.net/redhat/9/

 

http://fedoraproject.org/wiki/EPEL

http://repoforge.org/

http://pkgs.repoforge.org/

http://rpmfusion.org/Configuration/

 

安装地址:http://ayo.freshrpms.net/redhat/9/i386/freshrpms/headers/header.info

更新地址:http://ayo.freshrpms.net/redhat/9/i386/updates/headers/header.info

 

 

资源真的是非常丰富,从Centos到Ubuntu,ISO镜像、升级包,应有尽有,上交的兄弟们真是幸福,羡慕啊。不过还好,我们好歹也算是在教育网内,凑合着也可以沾点光,下载一些。

ftp://ftp.sjtu.edu.cn/

 

yum的命令形式一般是如下:yum [options] [command] [package ...]

其中的[options]是可选的,选项包括-h(帮助),-y(当安装过程提示选择全部为"yes"),-q(不显示安装的过程)等等。[command]为所要进行的操作,[package ...]是操作的对象。

 

自动搜索最快镜像插件:   yum install yum-fastestmirror

安装yum图形窗口插件:    yum install yumex

查看可能批量安装的列表: yum grouplist

 

 

 

虚拟下安装RedHat Linux5.6  [红帽企业Linux.5.6].rhel-server-5.6-i386-dvd

http://lilaili.blog.163.com/blog/static/268436942013022111033103/

 

 

解决This system is not registered with RHN

Redhat之所以会出现这个错误是因为没有注册RHN,我们只需要更新一下yum的源就可以了。使用命令 cd /etc/yum.repos.d/   进入yum的配置目录。

在终端中输入 wget http://docs.linuxtone.org/soft/lemp/CentOS-Base.repo 命令,下载CentOS- Base.repo文件。

 

然后将原有的rhel-debuginfo.repo备份一下,使用命令mv CentOS-Base.repo rhel-debuginfo.repo,将CentOS- Base.repo重命名成rhel-debuginfo.repo。

mv /etc/yum.repos.d/rhel-debuginfo.repo  /etc/yum.repos.d/rhel-debuginfo.repo.bak 

成功以后,使用yum install build-essential安装成功。

 

修改yum源后要执行

yum clean all     #清理yum缓存

yum makecache     #将服务器上的软件包信息缓存到本地,以提高搜索安装软件的速度

yum install vim*  #测试yum是否可用

 

 

配置本地yum仓库篇

1. 编辑yum配置仓库文件vi /etc/yum.repos.d/rhel-debuginfo.repo

 [rhel-yuminstaller]

 name=Red Hat Enterprise Linux $releasever - $basearch – Debug

 baseurl=file:///home/yum

 enabled=1

 gpgcheck=0

 gpgcheck=0不启用签名检查;如果要启用gpgcheck=1需要在以上配置文件末加上

 pgpkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

 并使用rpm –import /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release导入签名文件

 

2.挂载rhel5.6系统光盘并复制光盘/Server目录下所有文件到/home/yum

 mount /dev/cdrom /mnt

 cp –rfv /mnt/Server/* /home/yum

3.安装createrepo.rpm并生成仓库数据库文件

 rpm -ivh /home/yum/createrepo*

 createrepo /home/yum/

 这样本地yum仓库就建立成功,可以使用yum install packagename测试。

 

 

使用yum命令时,出现:

Existing lock /var/run/yum.pid: another copy is running as pid:3355.

Another app is currently holding the yum lock; waiting for it to exit...

    The other application is: yum-updatesd-he

……

主要原因就是yum在自动更新 只要关掉他就可以了

解决方案:

直接输入  rm -f    /var/run/yum.pid
或者:      /etc/init.d/yum-updatesd stop
也可以等更新完了再进行安装

 

 

 

http://repoforge.org/use/

 

  • Use cat /etc/redhat-release to find which release of EL you are using
  • Use uname -a to find your processor architecture
  • Use rpm -ivh package-filename to install the rpmforge-release package (also works with URLs)
  • You can use wget or curl to download the package using one of the above links if needed (for example on a server with no X Window)
  • Then you can use yum to install the available packages from the RepoForge repo, e.g. yum install --enablerepo=rpmforge-extras
  • Afterward, you can disable accidental updates from the repo by setting enabled = 0 in the repo definition file in/etc/yum.repos.d/

 

猜你喜欢

转载自xukenetwork.iteye.com/blog/2145870