Compiling Linux Apps from Source
Just wanted to share this great resource with folks. My brother has recently gotten into linux and he’s trying to stick it out because of the difficulty factor. He got very confused, as did we all, about installing applications and understanding how things are separated in open source and not all bundled together like Windows - where in windows your OS/Desktop/Kernel are all known as Microsoft Windows - compared to linux where your kernel, desktop, distributions, applications are all different applications working together.
OK; I’m ranting. Linux Reality is an awesome podcast, which was retired at episode 100. I’ve downloaded all his files and I listen to it periodically. A good replacement would be Going Linux. This one that I’m sharing is about compiling linux application from the provided source.
Downloading the Application
- Visit the developer’s web site, ex: www.openoffice.org, find their download page.
- Some developers host their own files and some use free services, such as www.sourceforge.net.
- The file you’re looking for is called a “tarball”. It’s usually named {application}.tar.gz. Sometimes it’s named {application}.tar or {application}.tar.bz2. No matter what it’s named you are looking for a file that represents an archive or compressed file (kind of like a zip file).
- Download the latest stable version into your directory of choice.
Extracting the Application
Because you’ll need the source files to uninstall the application, it’s suggested that you keep the files when you’re done. I’ll explain.
Graphical Extraction
- If you’re not comfortable with the command-line yet, you can extract the files using your windows manager. Double-click on your Home icon on your desktop and find your file you downloaded.
- Right-click on it and you will see an option to “extract”.
- For the most part, it will extract into a directory named after your tarball, ex: {application} or {application}_{version}.
Text-based Extraction
- If you are more adventurous then you’ll want to extract the contents of your tarball using your terminal.
- Open your terminal of choice and “cd” (change directory) your way to where you saved your file. For example, if you saved it to your “Download” folder in your Home directory then you will type: “cd Download” or “cd /home/{username}/Download”.
- Once you are there you can type “ls” command to see the contents of that folder. When you’re ready to extract, type “tar -xzvf {application}_{version}.tar.gz” (please replace application and version with the actual application name and version).
- “tar” is the application used to compress and decompress files. The options that follow are:
- x = extract
- z = uncompress
- v = verbose - used for you to see what’s going on during extraction
- f = file
- When you’re finished you have the same results as you did from the graphical extraction. The only difference here is that you were man enough to use the terminal window. Good for you!
Keeping Your Source Files
Now that you’ve successfully extracted the files needed to install the application, move the application folder from your /home directory into the “/usr/src” directory. The reason for that is you’ll need to keep that source folder around, in case you want to uninstall that application. When you’re ready to remove that application simply use the terminal and dig down into that folder. Here’ an example with application foobar.
- cd /usr/src/foobar - that will put you into the foobar folder used to install the foobar application.
- make uninstall - this process removes the application from your computer.
Three Basic Commands
- ./configure
- make
- make install
Explaination of Commands
- ./configure - This command is used to setup the configuration to install the application. This is where you can add options to install the application in a different location, etc.
- make - This compiles the necessary files in order to install the application.
- make install - This process moves the necessary application files into the correct directories, such as /usr/lib…
If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!
One Response to “Compiling Linux Apps from Source”
Leave a Reply
You must be logged in to post a comment.

May 26th, 2008 at 8:15 pm
العاب فلاش…
Paula, I was so happy to find your site. I hope you can help. I’ m one of those people that seems to love the background music that I can never find. I know all of the songs in the Transformer Movie, but the music that I really want to find is the mu…