A while ago, I wrote about getting rsync on ESXi: ESXi 5.1 and rsync – damiendebin.net.
Now I needed 7zip on ESXi to make sure I could test unpack some 7zip archives.
This turned out much easier than I thought, thanks to 7Zip for ESXI | Vladimir Lukianov: Заметки who pointed me to the P7ZIP project. P7ZIP actually created three things:
- p7zip (a POSIX 7zip),
- J7ZIP (a Java port of 7zip)
- java_lzma (the Java port of the 7zip lzma SDK which had the first implementation of lzma).
Here are the full steps to get 7zip on ESXi 5.x:
Perform the first 2 steps on a PC or Mac, as ESXi does not support the bz2 compression format. On the other hand, 7zip does not (yet?) support the VMware vmtar compression format.
- Download a an x86 binary version of p7zip (I took p7zip_9.20.1_x86_linux_bin.tar.bz2 from version 9.20.1, as it corresponds to the 9.20 stable version of 7zip).
- Unpack and untar this archive recursively.
- Copy these files to to the /bin directory (or another directory on the path, as /bin gets regenerated at each ESXi reboot): 7z, 7z.so, 7zCon.sfx, 7za, 7zr, Rar29.so (the last one from the Codecs subdirectory).
- Then logon to your ESXi machine (console or ssh), and set the execute permissions on a selected number of files (.so files do not need their execute bit set):
~ # cd /bin /bin # ls -al 7z* -rw-r--r-- 1 root root 562104 Mar 13 2011 7z -rw-r--r-- 1 root root 2860260 Mar 13 2011 7z.so -rw-r--r-- 1 root root 486328 Mar 13 2011 7zCon.sfx -rw-r--r-- 1 root root 1432128 Mar 13 2011 7za -rw-r--r-- 1 root root 953920 Mar 13 2011 7zr /bin # chmod 755 7z 7za 7zr
Now there is one little trick: if you run it from the path, it cannot find the 7z.so
file: you have to specify the full path.
Look at the difference without the fully qualified path you get the error “Can’t load ‘./7z.dll’ (./7z.so: cannot open shared object file: No such file or directory)“:
/vmfs/volumes/50224895-f616e917-b00b-a0369f0e1091/Raid6SSD/7z # 7z t 0.0.CLEAN-EN-XP-SP3.7z 7-Zip 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18 p7zip Version 9.20 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,8 CPUs) Can't load './7z.dll' (./7z.so: cannot open shared object file: No such file or directory) Error: 7-Zip cannot find the code that works with archives.
Workaround: use the fully qualified path:
/vmfs/volumes/50224895-f616e917-b00b-a0369f0e1091/Raid6SSD/7z # /bin/7z t 0.0.CL EAN-EN-XP-SP3.7z 7-Zip 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18 p7zip Version 9.20 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,8 CPUs) Processing archive: 0.0.CLEAN-EN-XP-SP3.7z Testing ... Testing vmware.log Everything is Ok Files: 26 Size: 5288863697 Compressed: 2149440556
Now I can do stuff like looping over many 7z files and test them:
for f in *.7z; do echo "Processing $f file.."; /bin/7z t $f; done
vmtar
Just in case the sf forum link gets lost, some information about vmtar:
- Potential vmtar open source.
- vmtar should be in the open source bits of ESXi4 or in the open source bits of ESXi 5.5.
I’m going to try to see if I can get vmtar to compile on x86.
Some examples where vmtar is used are at
- VMware Front Experience: The anatomy of the ESXi 5.0 installation CD – and how to customize it.
- How to Create and Modify vgz (vmtar) Files on ESXi 3.x/4.x | virtuallyGhetto.
- ESXi : Working with tar, vmtar, vmtgz and ramdisks | Virtually everything.
–jeroen
Filed under: *nix, *nix-tools, ESXi4, ESXi5, ESXi5.1, ESXi5.5, Linux, Power User, SuSE Linux, VMware, VMware ESXi Tagged: 7z, 7zip
