[SOLVED] Where to put a manually installed program in Ubuntu
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
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.
Where to put a manually installed program in Ubuntu
Hi there,
QUESTION 1:
Where, in general, would be the most logical place to put a manually installed program in Ubuntu (Ubuntu in general, but I'm using very old 10.04).
QUESTION 2:
Could you give me an example using the following.
I have installed the last version of Firefox that uses GTK2 for my Ubuntu 10.04 system. Works like a charm. I installed it manually.
Right now, to launch the program, I open a terminal and type the following
Code:
/home/user/Downloads/firefox/firefox
Where (as an example) would be the most logical place to place my "firefox" directory (the firefox directory is in the Download folder at the present time).
QUESTION 3:
Once the above is done, how can I make it so that from any place in the terminal (whether I'm in "/home/user" "/home/user/Dowloads" or "/media/truecrypt5", i.e., regardless of which folder I'm in) I can simply type "firefox" and get this version of firefox to launch (and any other programs that I install manually)? i.e. the easiest, most practical method without tweaking or manually doing things for each program.
Thanks,
RM
Last edited by rm_-rf_windows; 09-09-2017 at 05:33 AM.
In general any program that is in a user's path environment can be executed by just typing in the application name. That said /usr/local/bin is typically for programs not managed by the distribution and is already in the path environment.
However, if a program already exists with the same name then whichever is found first in the path is executed.
However, do you know the answer to any of my questions? Where to put the new firefox folder? How to generate an entry in menus? How to make it so typing the program name in the terminal finds it and opens it?
If you type
echo $PATH
you can see all the locations where Linux will look for a program. On my system that has /usr/local/bin and even /home/davod/bin. Using one of those locations will ensure that it can run with just the command "firefox".
As far as the menu goes, that depends on your GUI. I can right-click on the menu icon and select "edit menu"; I suspect that will work with Ubuntu 10.
... if I added /opt to my path and put the "firefox" folder in /opt, the launcher file would be this file and path: /opt/firefox/firefox ... and so this wouldn't work because the launcher file is not in /opt, it is in /opt/firefox. Now I could create a launcher in /opt... but I would have to do that with all manually installed applications. What I want to know is.. What is the correct "protocol" for doing such a thing? What is generally done? What is the standard procedure? Is there a method to get things done more automatically or efficiently or a "cleaner" way to do this?
Perhaps there is a place to place programs? And another to place all launchers? Like, perhaps, creating an /opt/apps folder and an /opt/bin folder (I don't think this is the answer, but there is perhaps something similar to this that needs to be done...)
Perhaps there are two main ways, one for programs used exclusively for a specific user, in which case the program would be placed in the home folder and perhaps create a /home/user/bin folder. Another so that the programs can be used by all users?
Many thanks again for the tip on editing the menu. I didn't know you could do that.
RM
Last edited by rm_-rf_windows; 09-09-2017 at 12:16 PM.
If it's a *.deb file and you install it with gdebi with root privileges, gdebi normally puts it and its libraries, if any, in the same places that apt-get would put them.
If you are compiling from sources as user, "make install" will install it to your /home. If you compile from sources as root, the program and libraries will normally be installed as above.
I've encountered very few programs that by default install to /opt. XAMPP does and I think Seamonkey and Vivaldi do, at least on some systems.
Those thoughts assume that no special parameters are passed to the package at time of installation.
Maybe I'm not clear, or maybe my question is a non-question!
Perhaps what I need to do doesn't have a standard procedure.
I can open the program by doing /home/user/firefox/firefox.
I have downloaded a folder that allows me to open the program.
I did not use dpkg -i, which installs programs automatically (not available for Firefox).
The program already exists.
Where should I put the "firefox" folder, the firefox folder which contains an icon called "firefox" which I use to launch the program?
I could place the folder anywhere. In fact, I placed a copy of the "firefox" folder in /opt. I can also launch the program by doing /opt/firefox/firefox.
There is no need to "install" the program. It's already working via the above.
Perhaps I am looking for something that doesn't exist.
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,680
Rep:
I agree with wherever was suggested that /opt is the place to put Firefox -- that's also, as it happens, where Google applications tend to be put when installed.
When I ran a manually installed Firefox I would put it in /opt then put a link in /usr/bin to the firefox executable (after removing the default firefox instance with apt). That way Firefox works as expected and can be set as default browser and so on.
I also tend to chown things installed in /opt to root so that normal user accounts can't modify the executables. That does mean, though, that Firefox ahs to be run as root now and again for its automatic update to take place.
My thinking behind the permissions is that it's probably safer to open Firefox as root only to update (of course never to browse) then run it as a normal user unable to modify its own executable than to run it as a normal user all the time with the potential risk of a maliciously written site being able to cause the user to modify Firefox. I could be wrong in thinking that but it seems to fit with the way Linux sets permissions in general.
I have already done "sudo apt-get remove firefox" to remove the older version of Firefox.
I have moved the firefox folder to /opt using "sudo," and so the owner of all is "root." All that seems okay.
Just one last question. It might seem like an obvious thing, but could you be more specific regarding this:
Quote:
put a link in /usr/bin to the firefox executable
I could google "links," etc. I've done it before, but how would you create the link so that permissions, ownership, etc. are properly done and so that the type of link corresponds more or less (more "more" than "less") in form to links already in /usr/bin?
The google-chrome entry was done via dkpg, and perhaps corresponds most to what we want, I imagine. What's the command to get it right? (reminder, to launch the present version I do "/opt/firefox/firefox")
Many thanks again, 273, you're just a number, but you answered my specific question, many thanks!
RM
Last edited by rm_-rf_windows; 09-10-2017 at 04:13 AM.
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,680
Rep:
You're welcome.
You can safely ignore the permissions of the link itself, you'll need to create it as root and the permissions will sort themselves. To create the link (as root) go to /usr/bin and type:
Code:
ln -s /opt/firefox/firefox
I would suggest using tab completion when typing the path to Firefox (eg typing "/opt/fire" then pressing <Tab> apologies if you know this but thought I'd be clear) that way you know things are in the right place as you're doing it.
Once you're done you might have to manually set things like default web browser in your desktop environment's GUI control centre but this should be straightforward and I found some things just work once the link in /usr/bin is in place.
software from source tends to default to /usr/local/, which may not be in your $PATH.
software from distros tends to default to /usr/, which IS in your $PATH. ----- $(./configure --prefix=/usr).
$ which firefox
$ ls -l $(which firefox)
You'll find that most times the /usr/bin/$PROGRAM is a symlink (for the larger / popular programs). Probably to /etc/alternatives/ which is another symlink to the "REAL" program. You can change that manually in /usr/bin/ or /etc/alternatives/ to point at your "OTHER" executable.
Is ONE way to accomplish what it sounds like you want to accomplish. Without a lot of UNDO steps if that doesn't work for you. Otherwise the thing you download probably has an INSTALL file which is a plain text file, or README file. If you actually read those, they should outline the popular way to install the thing.
In terms of more official ways, there's $(update-alternatives) which manages /etc/alternatives/ symlinks. But that assumes that the thing you installed was packaged in some way for that distro. Otherwise it gets a bit more involved and it's just simpler to take the previous shortcut.
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,680
Rep:
I tend to find that using /opt for third-party applications is easier because to remove them it's a matter of simply deleting the directory within /opt and the simlink. The explanation here suggests that for self-contained packages like Firefox (and some others I use) I am correct to install them there.
Yeah, I've used the ln command before, but was a little unsure (and still am) as to the different subtleties between hard and symbolic links, and you also get a different result if you run the command directly from the directory where you want to place the link using only one parameter, which I noticed by running "ls -al" and comparing various different commands).
I had to add "sudo" to your command, but it all worked out, like a charm.
Thanks to you, I'm going to mark this thread "SOLVED."
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,680
Rep:
Glad to hear it's sorted!
Funnily enough the reason I said to run the command in the /usr/bin directory is that I can never remember whether the place to be linked to or the location the link is to be placed comes first. For what it's worth unless you know you need a hard link, and you know it will work, then they're not really used much and aren't really worth worrying about. If you need a hard link you'll know about it if not then just use the "-s" to be on the safe side.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.