Flexible Blender Installation for Linux System
09.05.11
Kategori: Blender
"Inspired" by FOSSGrafis.com, I think my posts here will be mainly in English from now on :D Though I still won't promote it...
With newer official and experimental versions keep on coming frequently, keeping up with Blender development maybe a bit overwhelming to some Blenderheads. Most, I believe, will use whatever latest Blender version available, but sometimes, some of our Blender project will rely on an experimental or obsolete feature of an older Blender version. Such a situation demands a flexible way for us to:
- Install whatever Blender version we like,
- As many as we like,
- Access all of them relatively easily,
- Decide whichever version as default,
- Works for a renderfarm network.
Tough, eh? Not when your operating system is Linux.
01. Symbolic and Hard Links
There's the kernel of our solution: links. Basically, a symbolic link is just a shortcut, a reference to the name of another file in another location. The difference with Windoze's .lnk or freedesktop.org's .desktop file shortcut is that we can actually treat this referencing file like the real one, up to a point. "Deleting or overwriting the actual file from a symbolic link?"... not really. But we can open and execute a program from a symbolic link to it, and that's what really matters here.
A hard link, to complement our understanding of links in general, is an additional directory entry for an existing file in the same filesystem. Symbolic links can contain arbitrary filename, even for non-existing filenames, in arbitrary partitions, but not so for a hard link.
One way to make a link to a file, is to use the following command, omitting --symbolic to create a hard link:
ln --symbolic TARGET LINK_NAME
An arguably easier way to create a link is through a GUI, like using GNOME's file manager Nautilus where you only have to drag a file using middle mouse button to a destination and choose "Link Here", as illustrated here:
02. A bin in our own home
(Please excuse the lame section title :)
My experience of Linux distros being limited to some Debian-based ones, mainly Ubuntu, I observe that all new Ubuntu installation doesn't make a home/USERNAME/bin directory, for whatever USERNAME we're using. One less directory for a new user to care about is better, I guess.
But actually, ~/bin is an easy way for us to install any program we like, without having to constantly shifting to root user. Fortunately, Ubuntu is prepared for this kind of program management, for this code exists in ~/.profile (you can check for yourself):
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
Just create a bin directory in your home directory, and you're good to go. Just extract a particular version of Blender wherever you like, such as /media/disk1/progs/blender-2.57-linux-glibc27-x86_64, make a link to blender executable there in ~/bin. So, an example installation scheme would be:
~/bin/blender249blinking to/usr/bin/blender(system-wide install).~/bin/blender254linking to/media/disk1/progs/blender-2.54-linux-glibc27-x86_64/blender~/bin/blender257linking to/media/disk1/progs/blender-2.57-linux-glibc27-x86_64/blender~/bin/blenderCycleslinking to~/bin/blender25_cycles/blender
... with executable permission for each ~/bin/blender* files.
03. Executables naming and its effect to an existing system
Now, how will it affect any existing Blender installation? A short peek at the previous code snippet in ~/.profile confirms that user's bin directory ($HOME/bin) is prioritized over all other preexisting search paths ($PATH). If you're installing Blender through the OS's standard software distribution line, like Ubuntu's Synaptic, it's likely that an invocation of the command "blender" will execute Blender 2.49b (the latest "stable" version up until recently, before 2.57).
Using the multiple links we've created in ~/bin/, we can easily override that setting, such that clicking a .blend file will open it in any Blender version of our choosing: simply rename or copy one of those link files to blender!
Managing multiple Blender installations this way is applicable in a renderfarm setting, where absent graphical user interface, we can still extract Blender distribution archives and manage symbolic links through secure shell.