How to install latest 7-zip version on CentOS/RedHat Linux

7-zip is an open source archive which I use both on Windows and Linux because of its speed, strong compression and additional features that are important to me in terms of placing passwords over 7-zip archives and, like other open source software, is available for commercial use.

Best of all – this archiver supports a huge number of archive formats, it can work in multi-threading, for example, the -mmt = 6 parameter will hook 6 CPU cores to make the archiving as quick as possible, and – it  supports…well – almost all operating systems, from Windows, via Linux, Mac to OpenBSD, Solaris and other OS’s.

The installation bellow was done on Red Hat 6 Linux minimal installation – because I already had this OS turned on on my VirtualBox. Additional depending packages –  gcc and gcc-c++ were needed, data compressor bzip2 too, so there it’s a great chance that you already have on your OS – everything ready for this. Installation is done for use in command mode (in server variants) and this installation can pass to all distributions which use yum as a package manager (Red Hat, CentOS, Fedora, OpenSUSE) and for those distributions that do not use yum – please use their own package managers to install compilers. If you do not need the last version, and you only want to have 7-zip, you can do this in CentOS from epel-repository (yum install epel-release ; yum install p7zip).

For testing and trying of Red Het, you do not have to buy a license to try it out, test and use repositories, it’s enough to open a developer account (more about that here).

# Install depend compilers and data compressor
yum install gcc gcc-c++ bzip2

# Creating of dir where we will download latest 7-zip version
mkdir /usr/src/7zip ; cd /usr/src/7zip

# Download it using curl
curl -L -o 7zip.tar.bz2

# Extract, delete of old downloaded archive, and positioning on newly created directory
tar xjvf 7zip.tar.bz2 ; rm -f 7zip.tar.bz2 ; cd $(ls -1t | grep p7zip_ | head -1)

# Creating of main installation file, in this case for 64-bit Linux - makefile.linux_amd64
# For listing of all available packages use: ls -l makefile.*
cp makefile.linux_amd64 makefile.linux

# Test and installation - if you see ALL DONE...everything is OK and installed
# Under brackets are only No of CPU cores (for speedy install)
make -j $(grep processor /proc/cpuinfo | wc -l) all_test

# This step actually only copies libraries, bins, and documents to the usual locations

# Check if the path is where it should be and what is the 7-zip version
which 7za ; 7za | head -2 | xargs

This is the 7-zip installation of cli variants. Commands for creating and unpacking various types of archives by various methods in a further text, if they fall under my control.