You have two popular methods to install the latest octave. One is fast while other is slow. Installing from the binaries is fast. While installing from the source is rather complex and lengthy. Here both are here.
From Source
Open command terminal using this key CTRL+ALT+T
Type these commands
wget -c ftp://ftp.gnu.org/gnu/octave/octave-4.0.0.tar.gz
tar xzvf octave-4.0.0.tar.gz
cd octave-4.0.0
.configure
make
make install
Default installation location of octave is /usr/local/lib/octave
Default command location is /usr/local/bin/octave
you can see the help using this command
./configure --help
There is already file for installation instruction octave.installation in the source directory.
From Binaries using repository.
use these command to install the octave from binaries. It is fast and easy.
If you don't have java JDK and want to install the java JDK7. Then, use this command.
sudo apt-get install gcc g++ gfortran make libblas-dev liblapack-dev libpcre3-dev libarpack2-dev libcurl4-gnutls-dev epstool libfftw3-dev transfig libfltk1.3-dev libfontconfig1-dev libfreetype6-dev libgl2ps-dev libglpk-dev libreadline-dev gnuplot libgraphicsmagick++1-dev libhdf5-serial-dev openjdk-7-jdk libsndfile1-dev llvm-dev lpr texinfo libglu1-mesa-dev pstoedit libjack0 libjack-dev portaudio19-dev libqhull-dev libqrupdate-dev libqscintilla2-dev libqt4-dev libqtcore4 libqtwebkit4 libqt4-network libqtgui4 libsuitesparse-dev zlib1g-dev libxft-dev autoconf automake bison flex gperf gzip librsvg2-bin icoutils libtool perl rsync tar libosmesa6-dev libqt4-opengl-dev
if you have java and don't want to install the java then use this command to install the necessary tools.
sudo apt-get install gcc g++ gfortran make libblas-dev liblapack-dev libpcre3-dev libarpack2-dev libcurl4-gnutls-dev epstool libfftw3-dev transfig libfltk1.3-dev libfontconfig1-dev libfreetype6-dev libgl2ps-dev libglpk-dev libreadline-dev gnuplot libgraphicsmagick++1-dev libhdf5-serial-dev libsndfile1-dev llvm-dev lpr texinfo libglu1-mesa-dev pstoedit libjack0 libjack-dev portaudio19-dev libqhull-dev libqrupdate-dev libqscintilla2-dev libqt4-dev libqtcore4 libqtwebkit4 libqt4-network libqtgui4 libsuitesparse-dev zlib1g-dev libxft-dev autoconf automake bison flex gperf gzip librsvg2-bin icoutils libtool perl rsync tar libosmesa6-dev libqt4-opengl-dev
Add the PPA using this command.
sudo apt-add-repository ppa:octave/stable
Update the local repository
sudo apt-get update
You can see the octave packges in the local repository
sudo apt-cache search "octave"
You will see the list which containing the octave. Install the latest the GNU octave using this command.
sudo apt-get install octave
Note You can also use the aptitude instead of apt-get. Aptitude command is more intelligent than the apt-get