Difference between revisions of "Local installs"

From Peyton Hall Documentation
Jump to navigation Jump to search
(New page: {{oldfaq|NUM=170}} Here's a trick which I've started doing on my Mac, and you can do on any other machine to make it simple to install software without needing administrative privileges (...)
 
(Took out examples, provided link to dotfiles article instead.)
 
(8 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{oldfaq|NUM=170}}
+
Even with the amount of software available on the network, sometimes you can't live without a certain program.  Or maybe you want to install it on your laptop, but don't want to have to bother with putting it in a "normal" system location (and having to be root or an administrator to deal with it).  Here's a trick which I've started doing on my Mac, and you can do on any other machine to make it simple to install software without needing administrative privileges (and it's easy to clean up if you reinstall/remove the software later on, too!)
  
Here's a trick which I've started doing on my Mac, and you can do on any other machine to make it simple to install software without needing administrative privileges (and it's easy to clean up if you reinstall/remove the software later on, too!)
+
# Create a directory where your software installs will live.
 +
#: <tt>mkdir ~/Installs</tt>
 +
# Create a directory named for the program you wish to install.
 +
#: <tt>mkdir ~/Installs/FooGram</tt>
 +
# Download the source to that directory.  Uncompress it as usual.
 +
#: This will normally create a directory called ~/Installs/FooGram/FooGram-1.2.3 for example.  This directory contains the source.
 +
# Add a prefix command to your '<tt>./configure</tt>' command.
 +
#: <tt>./configure --prefix=~/Installs/FooGram</tt>
 +
#: This tells configure that you want to install the software not in the normal /usr/bin or /usr/local/bin location, but in a directory tree based from ~/Installs/FooGram.
 +
# When done compiling and installing, you will probably have directories like ~/Installs/FooGram/bin, ~/Installs/FooGram/lib and ~/Installs/FooGram/share, perhaps more.
 +
# Tell your shell where to look, so you can run the program just like any other.
 +
#: Have a look at the [[Dotfiles|dotfiles]] article for information on setting this up and links to examples.
  
First, create a directory where your software installs will live. I call mine "Installs", so
+
Later on, if you decide to remove the program, you need only delete the entire ~/Installs/FooGram directory and it's gone - no more hunting in multiple shared/bin/sbin/lib/man directories to find all the files that go with some bit of software. Or you can move the directory out of the way, install a newer version, and then remove the old one when you're sure it's working as expected.
  
  mkdir ~/Installs
+
'''''NOTE:'''''
 +
: You should not install a program to your network home directory. /u is backed up regularly, and storing a program there is wasteful (and expensive).  Instead, install programs to scratch disks, which are still accessible by most of the machines in the building.  The above example is written if you're looking to install things on a laptop or home machine, but it's not difficult to adapt the instructions to a [[Scratch disks|scratch disk]] install.
  
is the command to run. Now, let's say the program you want to install is called FooGram. I create a directory called ~/Installs/FooGram, and download the source to that directory. Uncompress it like usual, which will normally create a directory called ~/Installs/FooGram/FooGram-1.2.3 for example. This directory contains the source. Go to compile as you normally would, however if the program uses 'configure' as the first step, use the following:
+
[[Category:Software]]
 
 
./configure --prefix=~/Installs/FooGram
 
 
 
This tells configure that you want to install the software not in the normal /usr/bin or /usr/local/bin location, but in a directory tree based from ~/Installs/FooGram. When done compiling and installing, you will probably have directories like this:
 
 
 
~/Installs/FooGram/bin
 
~/Installs/FooGram/lib
 
~/Installs/FooGram/share
 
 
 
..and perhaps others. Now, to tell your shell how to handle these things, so that you can run the program just like any other. For bash, I have the following in my ~/.bashrc:
 
 
 
for D in ~/Installs/* ; do
 
        if [ -d $D/bin ]; then export PATH=$PATH:$D/bin ; fi
 
        if [ -d $D/man ]; then export MANPATH=$MANPATH:$D/man ; fi
 
done
 
 
 
Now, for each of the directories in which I have software installed, the proper PATH value is appended to my normal $PATH. So I can just run "foogram" from a prompt, instead of running "~/Installs/FooGram/bin/foogram". Also, since $MANPATH is updated, I can type 'man foogram' and have it work. Note that after a new install, you will have to logout and login again for the change to be noticed - but that's a pretty small price to pay.
 
 
 
Later on, if you decide to remove the program, you need only delete the entire ~/Installs/FooGram directory and it's gone - no more hunting in multiple shared/bin/sbin/lib/man directories to find all the files that go with some bit of software. Or you can move the directory out of the way, install a newer version, and then remove the old one when you're sure it's working as expected.
 

Latest revision as of 19:11, 2 February 2010

Even with the amount of software available on the network, sometimes you can't live without a certain program. Or maybe you want to install it on your laptop, but don't want to have to bother with putting it in a "normal" system location (and having to be root or an administrator to deal with it). Here's a trick which I've started doing on my Mac, and you can do on any other machine to make it simple to install software without needing administrative privileges (and it's easy to clean up if you reinstall/remove the software later on, too!)

  1. Create a directory where your software installs will live.
    mkdir ~/Installs
  2. Create a directory named for the program you wish to install.
    mkdir ~/Installs/FooGram
  3. Download the source to that directory. Uncompress it as usual.
    This will normally create a directory called ~/Installs/FooGram/FooGram-1.2.3 for example. This directory contains the source.
  4. Add a prefix command to your './configure' command.
    ./configure --prefix=~/Installs/FooGram
    This tells configure that you want to install the software not in the normal /usr/bin or /usr/local/bin location, but in a directory tree based from ~/Installs/FooGram.
  5. When done compiling and installing, you will probably have directories like ~/Installs/FooGram/bin, ~/Installs/FooGram/lib and ~/Installs/FooGram/share, perhaps more.
  6. Tell your shell where to look, so you can run the program just like any other.
    Have a look at the dotfiles article for information on setting this up and links to examples.

Later on, if you decide to remove the program, you need only delete the entire ~/Installs/FooGram directory and it's gone - no more hunting in multiple shared/bin/sbin/lib/man directories to find all the files that go with some bit of software. Or you can move the directory out of the way, install a newer version, and then remove the old one when you're sure it's working as expected.

NOTE:

You should not install a program to your network home directory. /u is backed up regularly, and storing a program there is wasteful (and expensive). Instead, install programs to scratch disks, which are still accessible by most of the machines in the building. The above example is written if you're looking to install things on a laptop or home machine, but it's not difficult to adapt the instructions to a scratch disk install.