LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This 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


Reply
  Search this Thread
Old 09-09-2017, 05:21 AM   #1
rm_-rf_windows
Member
 
Registered: Jun 2007
Location: Europe
Distribution: Ubuntu
Posts: 292

Rep: Reputation: 27
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.
 
Old 09-09-2017, 07:07 AM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,700

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
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.
 
Old 09-09-2017, 07:42 AM   #3
rm_-rf_windows
Member
 
Registered: Jun 2007
Location: Europe
Distribution: Ubuntu
Posts: 292

Original Poster
Rep: Reputation: 27
Thanks for your reply.

I DO want to remove my old Firefox version.

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?

Thanks for your reply.

RM
 
Old 09-09-2017, 11:58 AM   #4
DavidMcCann
LQ Veteran
 
Registered: Jul 2006
Location: London
Distribution: PCLinuxOS, Debian
Posts: 6,140

Rep: Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314
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.
 
Old 09-09-2017, 12:13 PM   #5
rm_-rf_windows
Member
 
Registered: Jun 2007
Location: Europe
Distribution: Ubuntu
Posts: 292

Original Poster
Rep: Reputation: 27
Thank you DavidMcCann for your reply.

Thank you for the info on "Edit menu" via a right-click. I didn't know that.

Someone told me that /opt is a good place to put manually installed programs. But... - and I'm thinking out loud...

Here is my path:
Code:
user@user-laptop:~$ echo $PATH
/home/user/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin
user@user-laptop:~$
... 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.
 
Old 09-09-2017, 09:34 PM   #6
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,323
Blog Entries: 28

Rep: Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141
How are you planning to install this program?

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.

Last edited by frankbell; 09-09-2017 at 09:37 PM.
 
Old 09-10-2017, 03:27 AM   #7
rm_-rf_windows
Member
 
Registered: Jun 2007
Location: Europe
Distribution: Ubuntu
Posts: 292

Original Poster
Rep: Reputation: 27
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.

Many thanks for your patience.

RM
 
Old 09-10-2017, 03:41 AM   #8
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,680

Rep: Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373
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.
 
Old 09-10-2017, 04:10 AM   #9
rm_-rf_windows
Member
 
Registered: Jun 2007
Location: Europe
Distribution: Ubuntu
Posts: 292

Original Poster
Rep: Reputation: 27
Thanks 273!

You've answered all of my questions. Many thanks.

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?

I've consulted some examples:
Code:
-rwxr-xr-x  1 root   root      629044 2010-06-24 22:33 gedit
lrwxrwxrwx  1 root   root           8 2010-11-09 01:44 gemtopbm -> gemtopnm
...
lrwxrwxrwx  1 root   root          65 2010-10-16 19:42 getnonfreefonts -> ../share/texmf-texlive/scripts/getnonfreefonts/getnonfreefonts.pl
...
lrwxrwxrwx  1 root   root          16 2011-10-25 21:36 gnome-panel-screenshot -> gnome-screenshot
...
lrwxrwxrwx  1 root   root          32 2017-09-09 21:27 google-chrome -> /opt/google/chrome/google-chrome
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.
 
Old 09-10-2017, 04:32 AM   #10
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,680

Rep: Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373
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.
 
Old 09-10-2017, 04:58 AM   #11
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 4,137
Blog Entries: 1

Rep: Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874
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.

$ sudo ln -s /usr/bin/firefox /home/user/Downloads/firefox/firefox

It'll fail because it already exist. But I like having it in history before I remove the OLD one.

$ sudo rm /usr/bin/firefox
(it's a symlink so you're not actually deleting the program)

$ sudo ln -s /usr/bin/firefox /home/user/Downloads/firefox/firefox

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.

Last edited by Shadow_7; 09-10-2017 at 05:03 AM.
 
Old 09-10-2017, 05:01 AM   #12
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 4,137
Blog Entries: 1

Rep: Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874
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.
 
Old 09-10-2017, 05:06 AM   #13
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,680

Rep: Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373
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.
 
Old 09-10-2017, 08:35 AM   #14
rm_-rf_windows
Member
 
Registered: Jun 2007
Location: Europe
Distribution: Ubuntu
Posts: 292

Original Poster
Rep: Reputation: 27
Many thanks 273,

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."

Happy Sunday!

RM
 
Old 09-10-2017, 08:55 AM   #15
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,680

Rep: Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] uninstalling software installed manually rkrara Linux - Newbie 4 12-08-2012 11:24 AM
OpenSSL installed manually, but apt-get still wants to install it [Ubuntu 9.04] you-bunt-too? Linux - Newbie 2 08-29-2009 02:03 PM
where is my installed program in ubuntu? nahid.a Linux - Newbie 13 04-14-2009 12:45 AM
Removal of a Manually Installed Application metallica1973 Linux - Software 3 11-11-2008 03:26 PM
Just installed my first program manually, how do I open it? (Ubuntu) xLunatiK Linux - Newbie 4 01-31-2006 12:35 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:15 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration