在使用unrar e file.rar 解压时报错,需要安装rar

1.安装流程

1.1 用户

如果是root用户则不需要进行切换用户,否则 切换到root用户下【权限问题】

例如:$su root

1.2 下载

cd 指定路径,eg: cd /export/software
wget http://www.rarlab.com/rar/rarlinux-3.8.0.tar.gz

注:当我们使用 wget命令下载不安全的https 域名下的内容时会提示:

ERROR: cannot verify www.rarlab.com's certificate, issued by ‘/C=US/O=Let'sEncrypt/CN=R3’
 Issued certificate has expired. ... 

解决方法:sudo yum install -y ca-certificates,然后再重新wget下载 

1.3 安装

tar -zxvf rarlinux-3.8.0.tar.gz
cd rar
make
make install 

2.解决bug

2.1 报错1:

-bash: /usr/local/bin/unrar: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory

是因为64位系统中安装了32位程序
解决方法:

yum install glibc.i686

 2.2 报错2 :

unrar: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory

 解决方法:

执行如下命令

yum install libstdc++.so.6

 2.3 报错3

在安装libstdc++.so.6时,会出现多版本问题。

Error:  Multilib version problems found. This often means that the root
       cause is something else and multilib version checking is just
       pointing out that there is a problem. Eg.:
       
         1. You have an upgrade for libstdc++ which is missing some
            dependency that another package requires. Yum is trying to
            solve this by installing an older version of libstdc++ of the
            different architecture. If you exclude the bad architecture
            yum will tell you what the root cause is (which package
            requires what). You can try redoing the upgrade with
            --exclude libstdc++.otherarch ... this should give you an error
            message showing the root cause of the problem.
       
         2. You have multiple architectures of libstdc++ installed, but
            yum can only see an upgrade for one of those architectures.
            If you don't want/need both architectures anymore then you
            can remove the one with the missing update and everything
            will work.
       
         3. You have duplicate versions of libstdc++ installed already.
            You can use "yum check" to get yum show these errors.
... ...

解决办法: 运行

yum install --setopt=protected_multilib=false libstdc++

 (最后的libstdc++可根据库的不同修改,如 libaio libgcc等)

最后,再次下载安装

yum install libstdc++.so.6 

3. 解决 rea.rar is not RAR archive 报错

[root@node1 python_scripts]# unrar e rea.rar 

UNRAR 3.80 freeware      Copyright (c) 1993-2008 Alexander Roshal

rea.rar is not RAR archive
No files to extract

经过检查是因为 unrar 的版本太低导致的,升级新版本后修复该问题

从这里下载最新版本到本地

WinRAR archiver, a powerful tool to process RAR and ZIP files

# 删掉原来的rar
cd /export/server
rm -rf rar

# 将下载的最新版本rar上传到linux上,解压安装
cd /export/software
tar -zxvf rarlinux-x64-611.tar.gz -C /export/server/

cd /export/server/rar
make 
make install

最后解决问题

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐