Redhat使用问题记录

【问题1】 使用rpm命令卸载软件的时候报了如下错误:

[root@alessio-hp noarch]# rpm -e jdk1.8.0_101-1.8.0_101-fcs
error: %postun(jdk1.8.0_101-1.8.0_101-fcs.x86_64) scriptlet failed, exit status 2

  • 解决办法:执行下面命令

    yum erase jdk1.8.0_101-1.8.0_101-fcs
    rpm -e –noscripts jdk1.8.0_101-1.8.0_101-fcs

  • 参考链接

    1. Removing an RPM with bad %postun script

【问题2】 Redhat没有注册的时候无法使用yum来安装软件

[root@localhost .config]# yum update
Load plugins: rhnplugin, security
This system is not registered with RHN.
RHN support will be disabled.

解决办法:

  • 卸载redhat自带的yum组件

 rpm -qa|grep yum|xargs rpm -e –nodeps

  • 下载centos yum rpm包 + 安装

    wget http://mirrors.163.com/centos/5/os/x86_64/CentOS/python-iniparse-0.2.3-6.el5.noarch.rpm
    wget http://mirrors.163.com/centos/5/os/x86_64/CentOS/yum-3.2.22-40.el5.centos.noarch.rpm
    wget http://mirrors.163.com/centos/5/os/x86_64/CentOS/yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm
    wget http://mirrors.163.com/centos/5/os/x86_64/CentOS/yum-metadata-parser-1.1.2-4.el5.x86_64.rpm
    rpm -ivh python-iniparse-0.2.3-6.el5.noarch.rpm yum-3.2.22-40.el5.centos.noarch.rpm yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm yum-metadata-parser-1.1.2-4.el5.x86_64.rpm
    注:以上连接时间长了可能会连接不上,通常都是版本升级了,你可以访问他的上一级目录,去找名字相同的最新版本。

  • 下载YUM配置文件

    wget http://sudone.com/download/CentOS-Base.repo -O /etc/yum.repos.d/CentOS-Base.repo
    注:可能下载不下来,可以使用链接拷贝文本到进去

  • 验证yum是否可用

    yum update
    注:碰到这个CRITICAL:yum.cli:Config Error: Parsing file failed: File contains no section headers.错误的时候,请检查/etc/yum.conf

    [main]
    cachedir=/var/cache/yum
    keepcache=0
    debuglevel=2
    logfile=/var/log/yum.log
    distroverpkg=redhat-release
    tolerant=1
    exactarch=1
    obsoletes=1
    gpgcheck=1
    plugins=1
    exclude=php* kernel*
    metadata_expire=1h
  • 参考链接
    1. Force yum update Command To Exclude Certain Packages
    2. yum 失败(This system is not registered with RHN.)解决方法
    3. 修改yum的更新源vi /etc/yum.repos.d/CentOS-Base.repo
    4. 将Centos的yum源更换为国内的阿里云源

【问题3】 使用yum install mysql-server报了[Errno -1] Metadata file does not match checksum错误

[root@localhost yum]# yum install mysql-server
updates/primary_db | 855 kB 00:00
http://mirrors.163.com/centos/5/updates/x86_64/repodata/primary.sqlite.bz2: [Errno -1] Metadata file does not match checksum
Trying other mirror.
Error: failure: repodata/primary.sqlite.bz2 from updates: [Errno 256] No more mirrors to try.

  • 解决办法
    可以参看博客: 解决Metadata file does not match checksum错误

以本机为例:
* #sha1sum primary.sqlite
b7c80f8490b9eb6466fc26d3b63a09bc435c9637 primary.sqlite
* 将sha1值替换repomd.xml中对应primary.sqlite.bz2记录

 <data type="primary">
    <location href="repodata/primary.xml.gz"/>
    <checksum type="sha">e698be95f637a7a9a12a5c2a17ad87472607147echecksum>
    <timestamp>1475526174timestamp>
    <open-checksum type="sha">a5df33d490f6cff4e5edad213faa6fdb07e80b17open-checksum>
  data>

【问题4】 使用yum安装mysql的时候报GPG key retrieval failed:错误错误

Redhat使用问题记录_第1张图片

  • 解决办法
# yum install mysql-server expect --nogpgcheck

你可能感兴趣的:(Linux)