new to linux, help with installation paths

1,498 Views | 10 Replies | Last: 9 yr ago by bmks270
bmks270
How long do you want to ignore this user?
AG
To what directory am I supposed to install different programs? Is there a file path that is comparable to c/program files? Or just c? If it helps, on windows some programs I preferred to install right in the C directory instead of program files for simplicity.

So do I use

/usr/bin
/usr/local/bin

Something else?

When do I use sbin vs bin, and when do I use the local path vs only using the use path?

I have a program I installed to usr/local/bin, but this program says it requires the Oracle release of Java, but now I'm confused on where to install the Java files. The Oracle version isn't available in the app store and I do already have some open jdk 7 or something installed thst was in the app store, but now I need the Oracle version.


Are there different paths if I want a program only to available to a specific user?
I'm using linux mint cinnamon.
Ronniecoleman30
How long do you want to ignore this user?
AG
Unless you have your hard drive partitioned with program files separately. Just install the programs to the default location.
bmks270
How long do you want to ignore this user?
AG
quote:
Unless you have your hard drive partitioned with program files separately. Just install the programs to the default location.


There is no default location.

I download the install file, and I have to specify the installation path in the terminal.

The hard drive is not partitioned.
kb2001
How long do you want to ignore this user?
AG
Install programs to the default locations. For anything that isn't installed in a package, you want to install to /opt. You'll notice when you install chrome, it will install to /opt/google/chrome

For getting Oracle java installed, you have two options. The first is to download the .rpm package, and use alien to convert it to a debian package.

sudo apt-get install alien
sudo alien -i <java.rpm>

The second option, which I prefer to do, is to get the jdk and install it manually to /opt/. The advantage of this is that those specific programs which require oracle java can be run in that way with a few env variables, and everything else will use open-jdk. It adds another element to keep track of, but I deal with java apps at work all the time, so this way is easier to me. The disadvantage is you've added some complexity that will be hard to find help online with.

download it here: http://www.oracle.com/technetwork/java/javase/downloads/index.html

Stick with java7 for now. I think you have to have an account to download the JDK. Get the .tar.gz file.

cd /opt/
sudo cp </path/to/jdkdownload.tar.gz> /opt
sudo tar xvfz <jdkdownload.tar.gz>

Now, java should be installed to something like /opt/jdk1.7.0_71/. Create a symlink to /opt/java, this makes upgrades easier. You won't have to change all your launch scripts to a new jdk path, just update the symlink to point to the new jdk instead

sudo ln -s /opt/jdk1.7.0_71/ java

For your specific programs that require oracle java, launch it with a script instead. You need to set a couple variables and run it that way. The app you're trying to run is already launching from a script probably, you just need to set JAVA_HOME and make sure it uses the binary you want it to use


As an example, here is how I launched one version of minecraft

#!/bin/bash
JAVA_HOME=/opt/java
JAVA_BIN=${JAVA_HOME}/bin/java

cd /opt/games/minecraft
${JAVA_BIN} -Xmx1024M -Xms1024M -jar launcher_FTB_Launcher.jar



Watch out for your classpath and ELF class, these can cause problems depending on how the app you're trying to run was built. It also may prefer you to use /opt/java/jre/bin/java instead of /opt/java/bin/java. If this is the case, you need to update JAVA_HOME to point to /opt/jave/jre/ instead


bmks270
How long do you want to ignore this user?
AG
Thank you kb2001, very helpful... i had already downloaded the tar.gz.

So do I install all programs to opt?

What is the usr/local/bin and usr/bin for?

Searching online I have seen instructions some that say opt, some that say usr for the same program.

Also, what is a sym link?
bmks270
How long do you want to ignore this user?
AG
Is there a specific reason to keep using the open-jdk as oppose to using the Oracle for everything? I was expecting to remove the open jdk and use only oracle, but I see now I can use both if desired, but what is the purpose?
kb2001
How long do you want to ignore this user?
AG
Some things are built using open-jdk, and there can be some incompatibilities with the oracle version. Specifically, newer versions of minecraft and several other games can have issues with the oracle awt libraries and need open-jdk. I've run into a few others as well, it's generally not an issue.

You can try it out, you'll want to download the .rpm and use alien to convert it to a debian package. It will probably be easier for you in the long run, I prefer the method above just because I'm much more familiar with that kind of setup from work.


So do I install all programs to opt?
If you're installing from a package, it will put it in /usr/bin or /usr/local/bin usually. If you're installing manually, you should install to /opt. That is precisely what /opt is for. Some apps will install on their own to /opt, as they probably should. Anything from google and a lot of games will install to /opt, as they really should.

What is the usr/local/bin and usr/bin for?
This is where system level binaries, and package installed binaries go. Things in /usr/ are very tightly managed by your package manager, better not to start playing around in there unless you want to create problems. /opt exists to install your own stuff. Specifically, it stands for "Options", a place to put stuff and not interfere with the system libraries and binaries.Searching online I have seen instructions some that say opt, some that say usr for the same program.
People who don't know the difference. Also, some people don't know how to update their PATH, and will stick stuff in /usr/bin or /usr/local/bin so that it works. You'll see a lot of problems "solved" in the forums by doing something like that, when it comes from somebody who doesn't under the basics

Also, what is a sym link?
man ln


Honestly, if you have this many questions about UNIX basics, you should just download the java .rpm file and install like this

sudo apt-get install alien
sudo alien -i <java.rpm>


Let me know if anything else comes up. I can help, but I can't teach you a decade of lessons learned in a forum
bmks270
How long do you want to ignore this user?
AG
Thanks a ton. Im a complete linux newb just trying to install my first program thst wasnt in the mint app manager. You've answered all of my questions much more clearly than I was able to find other places online through searches.

I'm just trying to understand exactly what I am doing and why, because if I just follow the instructions on these how to's and enter the commands in the terminal I won't really be understanding what I am doing. It's confusing when I find 3 how to's for the same thing that all have very different instructions and say to install to different places.

I noticed that Mozilla is the only folder within the /opt directory at this point and I'll put everything I install manually there for simplicity.
biobioprof
How long do you want to ignore this user?
linux standard paths explained.

I've been using linux for years (first Red Hat, then CentOS, now Ubuntu) and I still find it confusing, partly because unix and linux can work with things in nonstandard places, and because sometimes the different distros use slightly different paths. For example, I've seen web stuff go in /var/www/ directly or in /var/www/htdocs or /srv. MySQL usually goes in /usr/local.

These days most things I want to install I do via a package manager. On Mint, I think you can probably do a lot with apt. Not everything is available via the packaging systems, so sometimes you still need to do it the way you are doing it. Sometimes the direct install is better than the packaging system; I never install Wordpress using apt, even though it's there.
bmks270
How long do you want to ignore this user?
AG
I am trying to edit the .sh file that launches the program to change where it searches for java, but when I click save I get an access denied message. I am doing this from the GUI.

I'm trying to go from this:

# Uncomment the following line to override the JVM search sequence
# INSTALL4J_JAVA_HOME_OVERRIDE=

To this:

# Uncomment the following line to override the JVM search sequence
INSTALL4J_JAVA_HOME_OVERRIDE="/opt/java/current-oracle-java"

And I'm not even sure if my syntax is correct with the quotes... is that correct? current-oracle-java is a sym-link to the oracle java directory.

How do I edit the .sh file and save changes?
bmks270
How long do you want to ignore this user?
AG
I feel like I need a linux 101 class, nothing is intuitive.
bmks270
How long do you want to ignore this user?
AG
I figured out opening and editing the file with

sudo gedit
Refresh
Page 1 of 1
 
×
subscribe Verify your student status
See Subscription Benefits
Trial only available to users who have never subscribed or participated in a previous trial.