Hi there.
Im currently working on an internship with the Biosystems group, School of Computing University of Leeds. I have learnt many things during my internship and wish to use this blog to share some with you.
I have a background in Python and high level languages and have had to adapt to and learn C++ and C.
I have found it a hard transition so would like to share my experiences with anyone coming from a similar direction to lessen their frustration and pain.
One element of learning C or C++ is that you have to download and compile your own libraries from source, likewise you must do this if you don’t have admin rights. This tutorial aims to help you to be more familiar downloading and installing from source code.
Bluefish is a HTML editor and an example of a program that I wanted to install.
So first off. Installing on my home Ubuntu machine is easy as pie:
sudo apt-get install bluefish
or on Fedora:
sudo yum install bluefish
However when I work on my account at University (a Fedora system) I don’t have sudo.
So to install:
1. Download the source. This can be from svn if you want the very latest version or the latest source release from the program website.
SVN is a very powerful and useful version control system that the developer uses to store the updates he makes allowing you access to cutting edge developments
Example svn checkout command (checks out the latest version):
svn co https://bluefish.svn.sourceforge.net/svnroot/bluefish/trunk/bluefish
When downloading the release from the site be sure to check that the file hasnt corrupted with the command:
md5sum bluefish-2.0.0.tar.bz2
The output should correlate with the md5sum provided by the developer
For the source release extract the tar.bz into your home directory (I usually use the Nautilus GUI’s right click>extract to do this).
cd into the extracted folder
2. I downloaded the latest release source. So now to configure and install.
In linux ./configure is used to change settings for make, this is how you tell make where your libraries are or where you want it to install to and lots of other useful information.
To see the options available type
./configure –help
Now we can see that the –prefix= command is used to specify the prefix install directory this is what we need to change to install without sudo rights as we do not have rights to install to the default /usr/bin or /bin.
So download the necessary libraries and add them to your PATH (see a later tutorial I may write or google) for how to modify BASH environmental variables.
I next created a local directory in my home folder to store my programs installed from source in. Then run:
./configure –prefix=~/local
The ./configure command generates a new makefile with the settings specified. Now run make, this will build the binaries from the sources.
make
make install will need to be run next. make install moves the build files to the correct target directory, somewhere under ~/local. Had we not specified the prefix make install would attempt to write to /bin which would of raised a permissions error.
make install
Bluefish is now successfully installed in ~/local/bin. You now need to add this directory to your PATH to enable you to run the program by typing ‘bluefish’ as opposed to ‘~/local/bin/bluefish’. See google or my later tutorial for details on the environmental variable PATH. The following command will however suffice (run it), it should be added to your ~/.bashrc for the effect to last beyond this session:
export PATH=$PATH:~/local/bin
I hope that you found this guide useful and that you learnt something about building from source in linux. I intend to write more tutorials on similar topics
0 Responses to “Installing programs from source without Sudo rights. A case Study: BlueFish”