I needed to convert a rar file to a zip file on a CentOS 7 Linux system. But when I tried installing an unrar package with yum, the package manager on the system, I found none was available from any of the software repositories the system was configured to check for packages.
# yum install unrar Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: centos.firehosted.com * epel: mirror.us.leaseweb.net * extras: centos.aol.com * updates: mirror.umd.edu No package unrar available. Error: Nothing to do # yum install rar Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: centos.firehosted.com * epel: mirror.us.leaseweb.net * extras: centos.aol.com * updates: mirror.umd.edu No package rar available. Error: Nothing to do #
I had previously installed support for the Extra Packages for Enterprise Linux (EPEL) repository, but though I thought the unrar package might be found there, it wasn't found. I did find an RPM file for the software, howerver, at RPM CentOS 7 unrar 5.0.12 x86_64 rpm. I downloaded that file with wget and, since yum can be used to install RPM files, installed it with yum.
wget ftp://ftp.pbone.net/mirror/ftp5.gwdg.de/pub/opensuse/repositories/home:/Ken zy:/modified:/C7/CentOS_7/x86_64/unrar-5.0.12-2.1.x86_64.rpm # yum install unrar-5.0.12-2.1.x86_64.rpm Loaded plugins: fastestmirror, langpacks Examining unrar-5.0.12-2.1.x86_64.rpm: unrar-5.0.12-2.1.x86_64 Marking unrar-5.0.12-2.1.x86_64.rpm to be installed Resolving Dependencies --> Running transaction check ---> Package unrar.x86_64 0:5.0.12-2.1 will be installed --> Finished Dependency Resolution Dependencies Resolved ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: unrar x86_64 5.0.12-2.1 /unrar-5.0.12-2.1.x86_64 270 k Transaction Summary ================================================================================ Install 1 Package Total size: 270 k Installed size: 270 k Is this ok [y/d/N]: y Downloading packages: Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : unrar-5.0.12-2.1.x86_64 1/1 Verifying : unrar-5.0.12-2.1.x86_64 1/1 Installed: unrar.x86_64 0:5.0.12-2.1 Complete! #
The information for version 5.0.12, which is the version I installed on the system, is shown below:
# rpm -qi unrar Name : unrar Version : 5.0.12 Release : 2.1 Architecture: x86_64 Install Date: Sun 26 Mar 2017 03:18:50 PM EDT Group : Applications/Archiving Size : 276944 License : Freeware with further limitations Signature : DSA/SHA1, Wed 21 Jan 2015 09:18:00 AM EST, Key ID 0d9c9dcfa9d6e8ec Source RPM : unrar-5.0.12-2.1.src.rpm Build Date : Wed 21 Jan 2015 09:17:48 AM EST Build Host : cloud123 Relocations : (not relocatable) Vendor : obs://build.opensuse.org/home:Kenzy URL : http://www.rarlab.com/rar_add.htm Summary : Utility for extracting, testing and viewing RAR archives Description : The unrar utility is a freeware program for extracting, testing and viewing the contents of archives created with the RAR archiver version 1.50 and above. #
The unrar utility was installed in the /bin
directory. If
you wish to see the available commands and the syntax of commands, you can
just issue the command unrar
.
# which unrar /bin/unrar $ unrar UNRAR 5.00 freeware Copyright (c) 1993-2013 Alexander Roshal Usage: unrar <command> -<switch 1> -<switch N> <archive> <files...> <@listfiles...> <path_to_extract\> <Commands> e Extract files without archived paths l[t[a],b] List archive contents [technical[all], bare] p Print file to stdout t Test archive files v[t[a],b] Verbosely list archive contents [technical[all],bare] x Extract files with full path <Switches> - Stop switches scanning @[+] Disable [enable] file lists ad Append archive name to destination path ag[format] Generate archive name using the current date ai Ignore file attributes ap<path> Set path inside archive c- Disable comments show cfg- Disable read configuration cl Convert names to lower case cu Convert names to upper case dh Open shared files ep Exclude paths from names ep3 Expand paths to full including the drive letter f Freshen files id[c,d,p,q] Disable messages ierr Send all messages to stderr inul Disable all messages kb Keep broken extracted files n<file> Additionally filter included files n@ Read additional filter masks from stdin n@<list> Read additional filter masks from list file o[+|-] Set the overwrite mode or Rename files automatically ow Save or restore file owner and group p[password] Set password p- Do not query password r Recurse subdirectories sl<size> Process files with size less than specified sm<size> Process files with size more than specified ta<date> Process files modified after <date> in YYYYMMDDHHMMSS format tb<date> Process files modified before <date> in YYYYMMDDHHMMSS format tn<time> Process files newer than <time> to<time> Process files older than <time> ts<m,c,a>[N] Save or restore file time (modification, creation, access) u Update files v List all volumes ver[n] File version control vp Pause before each volume x<file> Exclude specified file x@ Read file names to exclude from stdin x@<list> Exclude files listed in specified list file y Assume Yes on all queries $
Once I had installed the unrar utility, I could use unrar x
to extract the contents of the .rar file. The x
option preserves
the directory paths stored in the rar file. I could then use the zip command
with the -r
option to recursively store the contents of the
directory, mods
in this case, into which the contents of the
rar file had been extracted, in a .zip file.
$ unrar x ../mods.rar $ zip -r mods.zip mods/*
Download locations for unrar-5.0.12-2.1.x86_64.rpm:
ftp.gwdg.de |
ftp.pbone.net |
MoonPoint Support |