One of my favorite open-source applications, LibreOffice, is getting ready for a new major-point release: v4.0. As it will usually take some time after the official release to make it to the Ubuntu repositories, I have to search for other means to get the latest version on my machine. There is of course a PPA containing a pre-release version. But instead, I went looking for a way to test and install the new LibreOffice without losing my current (stable) LibreOffice setup. Here’s how it’s done.
Getting the LibreOffice Packages
Rather than using the outdated Ubuntu build, go straight to the source and grab the latest LibreOffice from its pre-release downloads page. Currently the newest version is 4.0 RC1 (curiously already tagged with a 184.108.40.206 version number, however).
Next, extract the new LibreOffice to a new folder. You’ll be running it right from there, so select a folder you generally use to hold scripts and other programs (I use ~/bin for this purpose). Use your GUI archive manager, or the following command will do the trick:
tar xzvf [file name].tar.gz
You’ll now have a directory with the same name as the archive you downloaded (mine was “LibreOffice_220.127.116.11_Linux_x86-64_deb”). Beneath this directory, you’ll have two sub-folders: DEBS and readmes. The “DEBS” folder has (naturally) the Debian packages created by the LibreOffice project. You may be tempted to install these directly, but don’t! These have a higher version number then those from the Ubuntu repositories, and installing them will overwrite your stable installation. Instead, we’re going to unpack them without installing them using the normal Debian package tools.
Instead of the usual command (dpkg -i) to install DEB packages, we’re going to be using another of the Debian package management utilities.
dpkg-deb is a command for getting information on DEB-format packages, including inspection of control files (you do remember what these files are, don’t you?) as well as building a DEB file from a properly formatted directory tree. The “-x” flag is what we want here, as it allows us to extract the file tree from within the packages. Go to the directory where you want LibreOffice installed, then run the following command (and run it exactly as is):
for i in [path to where you extracted the LibreOffice archive]/DEBS/*.deb; do dpkg-deb -x $i . ; done
The above is actually a series of Bash commands. Their meaning is as follows:
- The first part (“for i in [path to where you extracted the LibreOffice archive]/DEBS/*.deb”) is telling the shell “for each of the following files, do what comes next.” The “each of the following files” part turns out to be all files with a “.deb” extension in the directory you name. So the next part of the command will be run on every DEB package you unpacked from the archive, by looping and passing the DEB filenames one by one to the next command.
- The next bit (“do dpkg-deb -x $i .”) is telling the shell “for each loop, extract the files from the DEB package to this directory.”
- The last part does exactly what it says … it finishes the command.
When you’re finished with your command you should have a new “opt” folder in your current directory.
You can run the new LibreOffice at this point by travelling down into the “opt/libreoffice4.0/program/” folder, and running the following command:
However, you might want to point this test installation at a new user profile, so you won’t mess up anything with your stable install. Open the “opt/libreoffice4.0/program/bootstraprc” file with a text editor, look for the “UserInstallation=” setting, and replace the “
$SYSUSERCONFIG” portion of it with “
$ORIGIN/..” (which places it in the directory above the base of the LibreOffice install). My profile is placed alongside the “opt/” directory created earlier. This self-contained results will allow you to test and install the new LibreOffice (and don’t forget to submit those bug reports).