Octave in home directory: Difference between revisions

From Octave
Jump to navigation Jump to search
m (update version number from 3.8.0 to 3.8.2)
(8 intermediate revisions by 3 users not shown)
Line 1: Line 1:
Installing in Userland is a methode to install GNU Octave next to your repository installation at the same time. This works with every Linux distribution and is especially for old Ubuntu LTS versions very profitable!
Installing in your home directory is a method to install GNU Octave next to your repository installation at the same time. This works with every Linux distribution and is especially for old Ubuntu LTS versions very useful!


One advantage is that you do not clutter your system by running ''sudo make install''.
One advantage is that you do not clutter your system by running ''sudo make install''.
Another advantage is that you can keep your octave installation that is provided by your distribution.
Another advantage is that you can keep your Octave installation that is provided by your distribution.


== 1. Install dependencies ==  
== 1. Install dependencies ==  
Line 12: Line 12:
== 2. Download Octave Sourcecode ==
== 2. Download Octave Sourcecode ==


Take a release from ftp.gnu.org, e.g. 3.8.0.
Take a release from ftp.gnu.org, e.g. 3.8.2.


   wget ftp://ftp.gnu.org/gnu/octave/octave-3.8.0.tar.bz2
   wget ftp://ftp.gnu.org/gnu/octave/octave-3.8.2.tar.bz2
   tar xfvj octave-3.8.0.tar.bz2
   tar xfvj octave-3.8.2.tar.bz2
   cd octave-3.8.0/
   cd octave-3.8.2/


or clone current stable branch
or clone current development branch


   hg clone http://hg.octave.org/octave/
   hg clone http://hg.octave.org/octave/
Line 31: Line 31:
Now it's time to run ./configure with a prefix that points to a directory in your home directory. E.g., my username is ''maxpower'' and I want to install Octave to ''~/.octave38/''
Now it's time to run ./configure with a prefix that points to a directory in your home directory. E.g., my username is ''maxpower'' and I want to install Octave to ''~/.octave38/''
  ./configure --prefix=/home/maxpower/.octave38/
  ./configure --prefix=/home/maxpower/.octave38/
Pay attention to the configure summary at the end (See chapter 1).  
 
An alternative is presented in section 6. Use it if you intent to compile from yourself many packages.
 
Pay attention to the configure summary at the end (See chapter 1), install missing required packages if any.  


== 4. make & make install ==
== 4. make & make install ==


After you have successful configured octave without errors ''(warnings may be okey)'', you can run ''make''. If you have a dual core cpu, you can run make with two threads like that (increase -j number if you have more cpu cores).
After you have successful configured octave without errors ''(warnings may be okay)'', you can run ''make''. If you have a dual core CPU, you can run make with two threads like that (increase -j number if you have more CPU cores).
  make -j2
  make -j2
This may take now ~30-300 Minutes (depends on the speed of your cpu and the size of your RAM) :)  
This may take now ~30-300 Minutes (depends on the speed of your cpu and the size of your RAM)


Feel free to run ''make check'' too.
Feel free to run ''make check'' too.
Line 43: Line 46:
When ''make -j2'' finished without errors, simply run '''without''' sudo/root permissions
When ''make -j2'' finished without errors, simply run '''without''' sudo/root permissions
  make install
  make install
Octave will now be installed to /home/maxpower/.octave38/
Octave will now be installed to either /home/maxpower/.octave38/, either ${HOME}/usr




Line 52: Line 55:


If you simply enter ''octave'', you'll start your repository installation provided by your distribution. But when you enter ''octave38'', you'll start your new snappy octave version installed to your home directory.
If you simply enter ''octave'', you'll start your repository installation provided by your distribution. But when you enter ''octave38'', you'll start your new snappy octave version installed to your home directory.
== 6. Managing your own program hierarchy (optional) ==
If you intend to compile for yourself a lot of utilities, you may use a specific "usr" hierachy into your own dir (Linux from scratch way). Go back to step 2, and configure octave as:
./configure --prefix=${HOME}/usr
The other steps (make; make install) do not change. In order to use your own hierachy, you should set a few environment variables in your .profile:
  # set LD_LIBRARY_PATH if not set
  (echo $LD_LIBRARY_PATH | grep -q lib) || export LD_LIBRARY_PATH="/usr/local/lib:$HOME/usr/lib:$HOME/usr/local/lib"
  # set PATH so it includes user's private bin if it exists
  if [ -d "$HOME/bin" ] ; then
        (echo $PATH | grep -q $HOME/usr/bin) || export PATH="$HOME/bin:$HOME/usr/bin:$HOME/usr/local/bin:$PATH"
  fi
 
  # set MANPATH so it includes user's private bin if it exists
  if [ -d "$HOME/usr/share/man" ] ; then
    (echo $MANPATH | grep -q $HOME/usr/share/man) || export MANPATH="$HOME/usr/local/share/man:$HOME/usr/share/man:`manpath -q`"
  fi
 
  if [ -d "$HOME/usr/share/info" ]; then
    export INFOPATH="$INFOPATH:$HOME/usr/share/info"
  fi
 
  if [ -d "$HOME/usr/lib/python" ]; then
    (echo $PYTHONPATH | grep -q $HOME/usr/lib/python) || export PYTHONPATH="$HOME/usr/local/lib/python:$HOME/usr/lib/python"
  fi
 
  if [ -d "$HOME/usr/lib/pkgconfig" ]; then
    (echo $PKG_CONFIG_PATH | grep -q $HOME/usr/lib/pkgconfig) || export PKG_CONFIG_PATH="$HOME/usr/lib/pkgconfig"
  fi
This way, most ordinary commands like "man octave", "info octave", or launching octave itself, will first explore your own hierachy.


== Uninstall ==
== Uninstall ==


==== Methode A ====
==== Method A ====


If you're still have the compiled source folder, just do ''make uninstall'' from it. And don't forget to remove the ''alias octave38'' entry in your ''~/.bashrc''.
If you're still have the compiled source folder, just do ''make uninstall'' from it. And don't forget to remove the ''alias octave38'' entry in your ''~/.bashrc''.


==== Methode B ====
==== Method B ====


Just delete (e.g. ''rm -rf ~/.octave38/'') the install folder and remove the ''alias octave38'' entry from your ''~/.bashrc''.
Just delete (e.g. ''rm -rf ~/.octave38/'') the install folder and remove the ''alias octave38'' entry from your ''~/.bashrc''.

Revision as of 13:43, 25 January 2015

Installing in your home directory is a method to install GNU Octave next to your repository installation at the same time. This works with every Linux distribution and is especially for old Ubuntu LTS versions very useful!

One advantage is that you do not clutter your system by running sudo make install. Another advantage is that you can keep your Octave installation that is provided by your distribution.

1. Install dependencies

Take a look at Building for Linux systems and Building.

General information you can gather from the `./configure` summary or read the INSTALL.OCTAVE file that comes distributed with Octave.

2. Download Octave Sourcecode

Take a release from ftp.gnu.org, e.g. 3.8.2.

 wget ftp://ftp.gnu.org/gnu/octave/octave-3.8.2.tar.bz2
 tar xfvj octave-3.8.2.tar.bz2
 cd octave-3.8.2/

or clone current development branch

 hg clone http://hg.octave.org/octave/
 cd octave/
 

3. configure

Only if you want to install from mercurial (hg.octave.org), you have to do first:

./bootstrap

Now it's time to run ./configure with a prefix that points to a directory in your home directory. E.g., my username is maxpower and I want to install Octave to ~/.octave38/

./configure --prefix=/home/maxpower/.octave38/

An alternative is presented in section 6. Use it if you intent to compile from yourself many packages.

Pay attention to the configure summary at the end (See chapter 1), install missing required packages if any.

4. make & make install

After you have successful configured octave without errors (warnings may be okay), you can run make. If you have a dual core CPU, you can run make with two threads like that (increase -j number if you have more CPU cores).

make -j2

This may take now ~30-300 Minutes (depends on the speed of your cpu and the size of your RAM)

Feel free to run make check too.

When make -j2 finished without errors, simply run without sudo/root permissions

make install

Octave will now be installed to either /home/maxpower/.octave38/, either ${HOME}/usr


5. create a smart bashrc entry

echo "alias octave38='~/.octave38/bin/octave'" >> ~/.bashrc
. ~/.bashrc # this will update your bashrc without doing logout and login!

If you simply enter octave, you'll start your repository installation provided by your distribution. But when you enter octave38, you'll start your new snappy octave version installed to your home directory.


6. Managing your own program hierarchy (optional)

If you intend to compile for yourself a lot of utilities, you may use a specific "usr" hierachy into your own dir (Linux from scratch way). Go back to step 2, and configure octave as:

./configure --prefix=${HOME}/usr

The other steps (make; make install) do not change. In order to use your own hierachy, you should set a few environment variables in your .profile:

 # set LD_LIBRARY_PATH if not set
 (echo $LD_LIBRARY_PATH | grep -q lib) || export LD_LIBRARY_PATH="/usr/local/lib:$HOME/usr/lib:$HOME/usr/local/lib"

 # set PATH so it includes user's private bin if it exists
 if [ -d "$HOME/bin" ] ; then
       (echo $PATH | grep -q $HOME/usr/bin) || export PATH="$HOME/bin:$HOME/usr/bin:$HOME/usr/local/bin:$PATH"
 fi
 
 # set MANPATH so it includes user's private bin if it exists
 if [ -d "$HOME/usr/share/man" ] ; then
   (echo $MANPATH | grep -q $HOME/usr/share/man) || export MANPATH="$HOME/usr/local/share/man:$HOME/usr/share/man:`manpath -q`"
 fi
 
 if [ -d "$HOME/usr/share/info" ]; then
   export INFOPATH="$INFOPATH:$HOME/usr/share/info"
 fi
 
 if [ -d "$HOME/usr/lib/python" ]; then
   (echo $PYTHONPATH | grep -q $HOME/usr/lib/python) || export PYTHONPATH="$HOME/usr/local/lib/python:$HOME/usr/lib/python"
 fi
 
 if [ -d "$HOME/usr/lib/pkgconfig" ]; then
   (echo $PKG_CONFIG_PATH | grep -q $HOME/usr/lib/pkgconfig) || export PKG_CONFIG_PATH="$HOME/usr/lib/pkgconfig"
 fi

This way, most ordinary commands like "man octave", "info octave", or launching octave itself, will first explore your own hierachy.

Uninstall

Method A

If you're still have the compiled source folder, just do make uninstall from it. And don't forget to remove the alias octave38 entry in your ~/.bashrc.

Method B

Just delete (e.g. rm -rf ~/.octave38/) the install folder and remove the alias octave38 entry from your ~/.bashrc.