By: Jason Lambert in Linux Tutorials on 2011-03-02
Some software is distributed in "Source form". This means you download a file containing all the source code for the application you want to install, unpack it, and compile it on your system. Compiling is the process of turning the source code into an executable binary. The common myth and newbie assumption is that this is very hard todo, or it is only for programmers. Wrong. It is a fairly straight forward process, and you will find that a lot of software you install will need to be built from source.
Typically applications you must compile from source will come as a ".tar.gz", ".tar.bz2", or ".zip" file.
For organisational purposes, I like to save my source zip file to /usr/local/src/, but this is totally up to you. For the rest of this section we will assume you have downloaded your zip file to /usr/local/src/. If you do not have a /usr/local/src directory, you can create it with the following "mkdir" (make directory) command:
So, we have our source package in /usr/local/src/.
Change to the /usr/local/src/ directory with the "cd" (change directory) command like so:
Use the "ls" (list directory contents) command, to see the file is present:
We now need to unzip the zipped file, this is done differently depending on the file extension.
for files ending in .tar.gz, use:
tar -zxvf <filename>
(replacing <filename> with the name of the file).
for files ending in .tar.bz2, use:
for files ending in .zip, use:
You should now have a new directory, containing all of the source files. To confirm it exists, and to get its name, use the "ls" command again.
we now need to go into the new directory, so use the cd command:
This is where things will differ. Some packages will have an INSTALL or README file which will contain installation instructions. use "ls" to see if the software has an install or readme file. If it does have one, you can use the "more" command to read it, like so:
Generally, the final 3 stages are as follows:
- Configure the installation
- Compile the software
- Install the binaries
The pre-installation configuration is done by executing ./configure:
This will perform some requirements testing on your system, and create a "Makefile" which will explain to the "make" utility how the software should be compiled. If you receive any error messages during this stage, you may wish to search the forums to see if they have been found and resolved by someone else already, if not, feel free to post a question on the forums - Please include all of the output including any error messages, and some details about your system - what distro you are using, what are you trying to install etc etc
The next stage is to compile the software, this is done using "make". When you run "make" it will read the instructions in the Makefile and build the application binaries.
The final stage is to install these binaries, ie, copy them to a more permanent location. Typically only the "root" user can do this, so you will need to swich to the root user with the "su" command:
Once you are root, install the binaries using the "make" command, followed by "install", like so:
That is it!. Check the user documentation of the software you installed for details of how to run the application.
Remember that if you have any problems, please post in the most relevant section of the forums. - When posting, remember to include as much info as possible, including all output and error messages.
This policy contains information about your privacy. By posting, you are declaring that you understand this policy:
- Your name, rating, website address, town, country, state and comment will be publicly displayed if entered.
- Aside from the data entered into these form fields, other stored data about your comment will include:
- Your IP address (not displayed)
- The time/date of your submission (displayed)
- Your email address will not be shared. It is collected for only two reasons:
- Administrative purposes, should a need to contact you arise.
- To inform you of new comments, should you subscribe to receive notifications.
- A cookie may be set on your computer. This is used to remember your inputs. It will expire by itself.
This policy is subject to change at any time and without notice.
These terms and conditions contain rules about posting comments. By submitting a comment, you are declaring that you agree with these rules:
- Although the administrator will attempt to moderate comments, it is impossible for every comment to have been moderated at any given time.
- You acknowledge that all comments express the views and opinions of the original author and not those of the administrator.
- You agree not to post any material which is knowingly false, obscene, hateful, threatening, harassing or invasive of a person's privacy.
- The administrator has the right to edit, move or remove any comment for any reason and without notice.
Failure to comply with these rules may result in being banned from submitting further comments.
These terms and conditions are subject to change at any time and without notice.
Most Viewed Articles (in Linux )
Latest Articles (in Linux)
- Data Science
- React Native
- Cloud Computing
- Java Beans
- Mac OS X
- Office 365
- Tech Reviews