Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I need to install netcdf on a SuSE Linux machine but I am having a few problems understanding the usr/local/ folders and my the myusername/local/ folders. What I think I need to do is go into the uncompressed netcdf folder and do

./configure --prefix=/usr/local/netcdf-gfortran

However I need to create this folder, right? and why in usr/local and not in my username/local ...?

Any help would be welcome. Also if you knew a place where the usr vs myusername folder are explained easily for dumb people like me, it would be much appreciated.

share|improve this question
    
Why don't you just grab the official package from software.opensuse.org/package/netcdf ? What version of SUSE Linux are we talking about? –  peterph Oct 8 '13 at 7:47
    
Hi, I am running. openSUSE 11.3 (x86_64) VERSION = 11.3. with regards to the suse netcdf package I cannot do that as it's limited by my sys administrator and I will have to compile other things in the future so I may as well learn ho to do it properly once and for all... –  John Oct 8 '13 at 8:21

2 Answers 2

The usual combo is:

./configure --prefix=... [more options]
make
make install

You probably won't want to use /usr/local since that should require root permissions too, so it's --prefix=$HOME or --prefix=$HOME/programs (or whatever else works better for you).

It might be worthwhile to talk to your sysadmin regarding additional software - you should talk to him anyway, since openSUSE 11.3 is way past its end of life. At least he should upgrade to the 11.4 Evergreen, which receives at least security updates.

As for building the packages, it is usually a good idea to have a look at the .spec files to have some idea of what might be useful configure options, source code patches and building tricks - in your case you'd probably want to check netcdf .spec file for openSUSE:Factory (or any older distribution).

share|improve this answer

Generally speaking, under Linux, /usr is for programs provided by the distribution and managed by its package manager (dpkg/apt, rpm/yum, emerge, etc.) and /usr/local is for programs installed and managed manually by the system administrator. Programs under /usr and /usr/local are installed for all users.

If you want to install programs for your own use, put them somewhere under your home directory.

I recommend using Stow or XStow to keep track of the programs that you install manually. (Use one or the other: they are implementations of the same concept.) When you install programs manually, you have a choice between two inconvenient options:

  • Put all programs in the same directory. Then you'll have a hard time sorting them out, figuring which files belong to which programs, uninstalling programs, etc. On the flip side, all programs are easy to use: you only need to update your PATH and other similar settings once.
  • Put each program in its own directory. Then uninstallation is as easy as rm -r. The downside is that you have to add each program to PATH and so on.

Stow gives you the best of both worlds. This tool maintains symbolic links from a common directory to a per-program directory. You install each program (from source or from a binary package) in its own directory under stow, and Stow creates symbolic links in bin, lib, man, …

So create a directory programs/stow under your home directory. Install netcdf with

./configure --prefix=~/programs/stow/netcdf-gfortran-4.3
make
make install

Then run stow netcdf-gfortran-4.3 from the ~/programs/stow directory to create symbolic links for all the parts of that package.

Edit your .profile (or wherever you put your environment settings) to add ~/programs/bin to your executable search path, ~/programs/lib to your library search path, etc.

PATH="$HOME/programs/bin:$PATH"
if [ -n "$LD_LIBRARY_PATH" ]; then
  export LD_LIBRARY_PATH="$HOME/programs/lib:$LD_LIBRARY_PATH"
else
  export LD_LIBRARY_PATH="$HOME/programs/lib"
fi
if [ -z "$MANPATH" ]; then
  MANPATH=$(manpath)
fi
export MANPATH="$HOME/programs/share/man:$HOME/programs/man:$MANPATH"

When compiling programs, pass --with-cppflags="-I $HOME/programs/include" to configure so that it can find headers in the stow area.

For more information, see Keeping track of programs and What is an effective method for installing up-to-date software on an out-dated production machine?

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.