How to compile application source code on Ubuntu using terminal
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
How to compile application source code on Ubuntu using terminal
Hello people,
I know there are lot of tutorials on Internet about this topic but I am begging if someone can write step by step here an example how to get some simple .tar.gz arhcived application that is in source code and then how to use GNOME terminal on Ubuntu ( i'm using latest Ubuntu 9.04 "Jaunty Janckalope" to build it and install it?
So, I am just asking someone if he can spare 5-10 minutes and choose application from Sourceforge (some little application like Notepad2 and etc. but please if it can be in .tar.gz) and explain me step by step how to do it on Ubuntu.
I know there are lot of tutorials on Internet about this topic but I am begging if someone can write step by step here an example how to get some simple .tar.gz arhcived application that is in source code and then how to use GNOME terminal on Ubuntu ( i'm using latest Ubuntu 9.04 "Jaunty Janckalope" to build it and install it?
So, I am just asking someone if he can spare 5-10 minutes and choose application from Sourceforge (some little application like Notepad2 and etc. but please if it can be in .tar.gz) and explain me step by step how to do it on Ubuntu.
Thank you.
Sorry, that's like asking "how high is up". Different applications have different methods of installation. Some are very easy...some need you to configure the Makefile first, and others need a configuration file set up. They're all different.
If you open up most source-code tarballs, most likely you'll find installation instructions in it, that you need to follow. Most of the time, it's:
- uncompress tarball into a directory (tar xvfz <whatever name>)
- enter the directory (cd <directory name>)
- type "make"
- type "make install" (as root)
that's it. But again, they're all different, so you just need to read the installation notes.
Sorry, that's like asking "how high is up". Different applications have different methods of installation. Some are very easy...some need you to configure the Makefile first, and others need a configuration file set up. They're all different.
If you open up most source-code tarballs, most likely you'll find installation instructions in it, that you need to follow. Most of the time, it's:
- uncompress tarball into a directory (tar xvfz <whatever name>)
- enter the directory (cd <directory name>)
- type "make"
- type "make install" (as root)
that's it. But again, they're all different, so you just need to read the installation notes.
My personal way. Download the tar.gz or bz2 file and simply do this.
tar vxf <file>
cd <directory name>
ls
Then I look for a few things. First thing I look for is a file named configure. If I find that then I do this.
./configure
make
sudo make install
And hope for no errors. During ./configure it will see if you have all the libraries you need to install this program, if not it will tell you what your missing. Then you have to install that with ether a package manager or download the source and go back.
If no configure file is around I look for a INSTALL file for directions on how to install. If not then I find a README file for the same. If not then I see if there is a Makefile present, and run make make install. Also btw if your getting a permissions error you need to use sudo to run as root.
Also some programs install in one of two places. Ether in /usr/bin or /usr/local/bin. Most likely you want to make sure it installs in /usr/bin. To force that you can do this instead of ./configure
./configure --prefix=/usr
That forces it to use the /usr folder instead of /usr/local folder.
Except that if you install to /usr it will taint your base system. Most times you want to separate the stuff you install by hand to either /usr/local, /opt or your home, unless you are a master dealing with file collisions, which you can expect for sure sooner or later if you go dropping random files in the middle of your OS without any care.
My personal way. Download the tar.gz or bz2 file and simply do this.
tar vxf <file>
cd <directory name>
ls
Then I look for a few things. First thing I look for is a file named configure. If I find that then I do this.
./configure
make
sudo make install
And hope for no errors. During ./configure it will see if you have all the libraries you need to install this program, if not it will tell you what your missing. Then you have to install that with ether a package manager or download the source and go back.
If no configure file is around I look for a INSTALL file for directions on how to install. If not then I find a README file for the same. If not then I see if there is a Makefile present, and run make make install. Also btw if your getting a permissions error you need to use sudo to run as root.
Also some programs install in one of two places. Ether in /usr/bin or /usr/local/bin. Most likely you want to make sure it installs in /usr/bin. To force that you can do this instead of ./configure
./configure --prefix=/usr
That forces it to use the /usr folder instead of /usr/local folder.
-Jessica-
OK but can someone in fact take one application and show me step by step how it is done just because there are various ways it works so when I see one example I can practice it atleast?
Thank you and also can someone tell me how to use sudo to execute config.in as it dosent want to execute?
OK but can someone in fact take one application and show me step by step how it is done just because there are various ways it works so when I see one example I can practice it atleast?
Thank you and also can someone tell me how to use sudo to execute config.in as it dosent want to execute?
You will find a README file , always read that since maybe you need to follow a different procedure for that particular app.
You will find a README file , always read that since maybe you need to follow a different procedure for that particular app.
I just need simple example by application... so I can practice on it
And also, if someone please can tell me how do I execute .txt or that kind of files in terminal? And what when I get "Premission denied" ? How to use sudo to execute it properly so I don't get that message?
And also, if someone please can tell me how do I execute .txt or that kind of files in terminal? And what when I get "Premission denied" ? How to use sudo to execute it properly so I don't get that message?
Thanks.
.txt files are not executable files. You don't execute them, you open them with whatever program suits the file. txt files are usually text files, so you would open them with a text editor (nano, vim, emacs, joe, jed, kata, bluefish, gedit, to name just a few) or use cat, more, less or a similar tool to dump their contents on your screen for a quick review (assuming that's plain text, and not a formatted document).
It's perfectly normal that data file don't have execution permission, there's nothing wrong with that at all. Most desktops (gnome and kde for example) will allow you to open these files by clicking or double clicking on them, but don't be faked, they are still not being executed. It's the desktop who calls the editor for you and open the file using that editor.
sudo has nothing to do here, its purpose is to scale privileges, and you really shouldn't be using it for anything but administrative tasks. If you find yourself using sudo every 5 minutes you are doing something very wrong.
I just need simple example by application... so I can practice on it
Again..they're all different. READ THE INSTRUCTIONS THAT COME WITH THEM. We've all given you examples of what to do, so go download one, read the instructions, and practice.
Quote:
And also, if someone please can tell me how do I execute .txt or that kind of files in terminal? And what when I get "Premission denied" ? How to use sudo to execute it properly so I don't get that message?
Thanks.
You don't execute .txt files. You can display them on the screen with the cat command (read the man page for cat, usage like "cat <file name>"), or open them in an editor (doesn't matter which...gedit, vi, emacs), and read them. If you get permission denied, you can do "sudo cat <file name>", or "su - root", then enter the root password, then read it.
i92guboj - Thank you. You're right. Should just use the defaults in most cases where the file should go. The only time I've had to use --prefix=/usr was during library installs to manually update my libraries (Which should be handled with care because a few times I've broke my system doing that.)
But back to the article. What your asking us to do is install a program from source we may already have installed by a package manager or already have set up exactly the way we want. The best way to learn is to try yourself. I gave you a step by step walkthrough on how I install things from source. If you get a error, try and Google it and learn whats wrong. Sometimes if you get a error, first thing I do is go to the README or INSTALL text file to see if there's a dependency they mention that I don't have. If I cant find it, I will look at the software's Home Page to get that information.
I am not on my Linux box atm so I can't install anything from source, and at home I have a fully set up box configured the way I want with pacman package manager, so I don't want to handle anything that may potentially break my current setup. If you have something you want to install, try installing it! If you can't get it installed and cannot figure out why, then ask on here with the error you got and any information you can give. That's how we can help you. Please try it yourself and come back to us if you have problems.
i92guboj - Thank you. You're right. Should just use the defaults in most cases where the file should go. The only time I've had to use --prefix=/usr was during library installs to manually update my libraries (Which should be handled with care because a few times I've broke my system doing that.)
But back to the article. What your asking us to do is install a program from source we may already have installed by a package manager or already have set up exactly the way we want. The best way to learn is to try yourself. I gave you a step by step walkthrough on how I install things from source. If you get a error, try and Google it and learn whats wrong. Sometimes if you get a error, first thing I do is go to the README or INSTALL text file to see if there's a dependency they mention that I don't have. If I cant find it, I will look at the software's Home Page to get that information.
I am not on my Linux box atm so I can't install anything from source, and at home I have a fully set up box configured the way I want with pacman package manager, so I don't want to handle anything that may potentially break my current setup. If you have something you want to install, try installing it! If you can't get it installed and cannot figure out why, then ask on here with the error you got and any information you can give. That's how we can help you. Please try it yourself and come back to us if you have problems.
-Jessica-
Thanks. Understood
You can close the topic. Thanks on help once again
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.