Native install on ubuntu 18.04

This is the script I used to install ODM and NodeODM on ubuntu 18.04
I have processed one small data-set and it seems working fine.

#!/bin/bash


install() {

sudo apt update -y
sudo apt upgrade -y
sudo apt install -y virtualenv curl python-setuptools build-essential gcc g++ cmake python3-dev python-virtualenv binutils libproj-dev git
  
cd /
sudo git clone --depth 1 https://github.com/OpenDroneMap/OpenDroneMap.git code
sudo git clone --depth 1 https://github.com/OpenDroneMap/node-OpenDroneMap.git www

sudo chown $(whoami) -R /www /code

cd /code
    ## Set up library paths
    export PYTHONPATH=$RUNPATH/SuperBuild/install/lib/python2.7/dist-packages:$RUNPATH/SuperBuild/src/opensfm:$PYTHONPATH
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$RUNPATH/SuperBuild/install/lib

    
	## Before installing
    echo "Updating the system"
    sudo add-apt-repository -y ppa:ubuntugis/ubuntugis-unstable
    

    echo "Installing Required Requisites"
    sudo apt-get install -y -qq build-essential \
                         git \
                         cmake \
                         python-pip \
                         libgdal-dev \
                         gdal-bin \
                         libgeotiff-dev \
                         pkg-config \
                         libjsoncpp-dev \
                         python-gdal \
                         grass-core \
                         libssl-dev \
                         liblas-bin \
                         swig3.0 \
                         python-wheel \
                         libboost-log-dev


    echo "Installing OpenCV Dependencies"
    sudo apt-get install -y -qq libgtk2.0-dev \
                         libavcodec-dev \
                         libavformat-dev \
                         libswscale-dev \
                         python-dev \
                         libtbb2 \
                         libtbb-dev \
                         libjpeg-dev \
                         libpng-dev \
                         libtiff-dev \
                         libflann-dev \
                         libproj-dev \
                         libxext-dev \
                         liblapack-dev \
                         libeigen3-dev \
                         libvtk6-dev
						 
	sudo add-apt-repository "deb http://security.ubuntu.com/ubuntu xenial-security main"
    sudo apt-get update
	sudo apt-get install -y -qq libjasper1 \
                         libjasper-dev
	
    echo "Installing OpenSfM Dependencies"
    sudo apt-get install -y -qq libgoogle-glog-dev \
                         libsuitesparse-dev \
                         libboost-filesystem-dev \
                         libboost-iostreams-dev \
                         libboost-regex-dev \
                         libboost-python-dev \
                         libboost-date-time-dev \
                         libboost-thread-dev

    pip install -r "/code/requirements.txt"

    # Fix:  /usr/local/lib/python2.7/dist-packages/requests/__init__.py:83: RequestsDependencyWarning: Old version of cryptography ([1, 2, 3]) may cause slowdown.
    pip install --upgrade cryptography
    python -m easy_install --upgrade pyOpenSSL

    echo "Compiling SuperBuild"
    cd /code/SuperBuild
    mkdir -p build && cd build
    cmake .. && make -j4

    echo "Compiling build"
    cd /code
    mkdir -p build && cd build
    cmake .. && make -j4
	
  sudo ln -s /code/SuperBuild/install/bin/entwine /usr/bin/entwine
  sudo ln -s /code/SuperBuild/install/bin/pdal /usr/bin/pdal	
  cd ~

  sudo curl --silent --location https://deb.nodesource.com/setup_10.x | sudo bash -
  sudo apt install -y nodejs python-gdal
  cd /www
  npm install
  
  sudo useradd -m odm
  sudo groupadd odm
  sudo usermod -aG odm odm
  sudo chown -R odm:odm /code /www /home/odm
  
  sudo systemctl enable /www/services/nodeodm.service
  sudo service nodeodm start

    echo "Configuration Finished"
}

uninstall() {
    echo "Removing SuperBuild and build directories"
    cd /code/SuperBuild
    rm -rfv build src download install
    cd ../
    rm -rfv build
}

reinstall() {
    echo "Reinstalling ODM modules"
    uninstall
    install
}

usage() {
    echo "Usage:"
    echo "bash configure.sh <install|update|uninstall|help> [nproc]"
    echo "Subcommands:"
    echo "  install"
    echo "    Installs all dependencies and modules for running OpenDroneMap"
    echo "  reinstall"
    echo "    Removes SuperBuild and build modules, then re-installs them. Note this does not update OpenDroneMap to the latest version. "
    echo "  uninstall"
    echo "    Removes SuperBuild and build modules. Does not uninstall dependencies"
    echo "  help"
    echo "    Displays this message"
    echo "[nproc] is an optional argument that can set the number of processes for the make -j tag. By default it uses $(nproc)"
}

if [[ $1 =~ ^(install|reinstall|uninstall|usage)$ ]]; then
    RUNPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
    "$1"
else
    echo "Invalid instructions." >&2
    usage
    exit 1
fi

You have to edit /www/services/nodeodm.service and on the line 10 , you have to add “–odm_path /code”
So the line become:
ExecStart=/usr/bin/node index.js --odm_path /code

ODM is installed at /code
NodeODM is installed at /www

Just copy the scrip in home dir , make it executable and run it:
sudo ./configure.sh install

I am far from linux/code guru, so bear with me and use/modify it as you like!

1 Like

Thanks for sharing @rumenchooo!

1 Like