How to install 7-Zip 16.02 on Ubuntu 16.04

sudo apt-get install -y make gcc build-essential p7zip p7zip-full p7zip-rar

mkdir -p "$HOME/tmp/tar_bz2"
cd "$HOME/tmp/tar_bz2"
if [[ ! -f "$HOME/tmp/tar_bz2/p7zip_16.02_src_all.tar.bz2" ]]; then
  wget -O "$HOME/tmp/tar_bz2/p7zip_16.02_src_all.tar.bz2" "https://sourceforge.net/projects/p7zip/files/p7zip/16.02/p7zip_16.02_src_all.tar.bz2"
fi
rm -rf "p7zip_16.02"
tar xf "$HOME/tmp/tar_bz2/p7zip_16.02_src_all.tar.bz2"
cd "p7zip_16.02"
make clean
make distclean
make sfx
make 7z
make 7zr
make all
make all2
make all3

sudo rm -f "/usr/local/bin/7z"
sudo rm -f "/usr/local/bin/7z.so"
sudo rm -f "/usr/local/bin/7za"
sudo rm -f "/usr/local/bin/7zCon.sfx"
sudo rm -f "/usr/local/bin/7zr"
sudo rm -f "/usr/local/bin/Rar.so"
sudo rm -f "/usr/local/bin/Codecs/Rar.so"
sudo rmdir "/usr/local/bin/Codecs/"

sudo mkdir -p "/usr/local/lib/p7zip/"
sudo cp "p7zip_16.02/bin/7z" "/usr/local/lib/p7zip/"
sudo cp "p7zip_16.02/bin/7z.so" "/usr/local/lib/p7zip/"
sudo cp "p7zip_16.02/bin/7za" "/usr/local/lib/p7zip/"
sudo cp "p7zip_16.02/bin/7zCon.sfx" "/usr/local/lib/p7zip/"
sudo cp "p7zip_16.02/bin/7zr" "/usr/local/lib/p7zip/"
sudo mkdir -p "/usr/local/lib/p7zip/Codecs/"
sudo chmod 0755 "/usr/local/lib/p7zip/Codecs/"
sudo cp "p7zip_16.02/bin/Codecs/Rar.so" "/usr/local/lib/p7zip/"
sudo cp "p7zip_16.02/bin/Codecs/Rar.so" "/usr/local/lib/p7zip/Codecs/"
sudo ldconfig

echo '#! /bin/sh' | sudo tee "/usr/local/bin/7z"
echo 'exec /usr/local/lib/p7zip/7z "$@"' | sudo tee -a "/usr/local/bin/7z"
sudo chown root:root "/usr/local/bin/7z"
sudo chmod 0755 "/usr/local/bin/7z"

echo '#! /bin/sh' | sudo tee "/usr/local/bin/7za"
echo 'exec /usr/local/lib/p7zip/7za "$@"' | sudo tee -a "/usr/local/bin/7za"
sudo chown root:root "/usr/local/bin/7za"
sudo chmod 0755 "/usr/local/bin/7za"

echo '#! /bin/sh' | sudo tee "/usr/local/bin/7zr"
echo 'exec /usr/local/lib/p7zip/7zr "$@"' | sudo tee -a "/usr/local/bin/7zr"
sudo chown root:root "/usr/local/bin/7zr"
sudo chmod 0755 "/usr/local/bin/7zr"

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.