Skip to content
This repository has been archived by the owner on Aug 20, 2022. It is now read-only.

Commit

Permalink
update to Ubuntu 18.04 (#104)
Browse files Browse the repository at this point in the history
* additional packages for ubuntu18.04

* add path to local user binary directory

* Added vagrantfile for 18.04

* use ubuntu18.04 branch of SIRF-SuperBuild

* remove install of gcc 6

* updates

* remove checkout of ubuntu18.04 SIF-SuperBuild tag

* Use system boost

* use bento box

* Added 50Gb VDI disk image

https://www.virtualbox.org/manual/ch05.html

* builds VM with vagrant

currently doesn't find the system Boost.

* add port forwarding, add 32 Mb video ram, 50 Gb HDD

* use system boost

* delete sirf_disk.vdi

* removed links to specific VM and SuperBuild branches

requires SyneRBI/SIRF-SuperBuild#149 first

* use globbing for resetting *URL and *TAG

* set USE_ITK=ON

* created function find_boost_version

* moved shell provision script to file

closes #114

* install libhdf5-dev

* vram is in modifyvm section

https://www.virtualbox.org/manual/ch08.html

* indentation fix

* removed comment

* separate the install steps

* multi line install

* added bootstrap_ubuntu.sh script

* install missing boost libraries

* removes autosuspend notification

closes #118

* add info on 2.0rc1

* builds ubuntu18.04 SuperBuild

* build ubuntu18.04 branch of superbuild

* removed conflict message

* changed VM name

* uses SuperBuild master

* removed -V command

* checks if user and homedir is already created

* bugfix

* bugfix~~

* fix test dir existence

* install spyder and jupyter in pip script

* force spyder 3.2

* manual configure jupyter

* info on manual step to configure ip for jupyter

* add info on jupyter config

* removed reference to specific branches

* updated VM name

* add new version

* update doc

* clean up
  • Loading branch information
KrisThielemans authored and paskino committed Apr 10, 2019
1 parent c30d2b8 commit 4536ce8
Show file tree
Hide file tree
Showing 9 changed files with 163 additions and 114 deletions.
10 changes: 10 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# ChangeLog

## 2.0.0-rc.1
- upgraded to Ubuntu 18.04
- installs more recent Gadgetron https://github.com/gadgetron/gadgetron/commit/b6191eaaa72ccca6c6a5fe4c0fa3319694f512ab
- add port forwarding (8888 -> 8888 for jupyter)
- install jupyter notebook, with default password
- installs spyder v3.2
- does not install a browser
- add cython for CIL


## 1.1.1
- added nbstripout (https://github.com/kynan/nbstripout) to handle conflicts in SIRF-Exercises

Expand Down
2 changes: 1 addition & 1 deletion VM_version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.1.1
2.0.0-rc.1
59 changes: 34 additions & 25 deletions scripts/INSTALL_prerequisites_with_apt-get.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,67 +8,76 @@
# without asking any questions.
# We use it for the CCP PETMR VM etc.
# Use it with caution.

set -e

#if [ -z "SUDO" ]; then SUDO=sudo; fi

export DEBIAN_FRONTEND=noninteractive
SUDO=sudo
echo "Installing Gadgetron pre-requisites..."

$SUDO apt-get install -y --no-install-recommends libhdf5-serial-dev git-core cmake \
build-essential libfftw3-dev h5utils \
hdf5-tools hdfview liblapack-dev \
libarmadillo-dev libace-dev \
libgtest-dev \
libopenblas-dev libatlas-base-dev \
libxml2-dev libxslt-dev \ # for siemens_to_ismrmrd
cython
# g++-6 gcc-6
# Gadgetron dependencies, not required (yet) by SIRF
# only plplot install once https://github.com/gadgetron/gadgetron/issues/608 fixed
# in the Gadgetron version that we use
# libplplot-dev
APT_GET_INSTALL="$SUDO apt-get install -y --no-install-recommends"
${APT_GET_INSTALL} libhdf5-serial-dev git build-essential libfftw3-dev h5utils hdf5-tools \
hdfview liblapack-dev libarmadillo-dev libace-dev libgtest-dev libopenblas-dev \
libatlas-base-dev libatlas-base-dev libxml2-dev libxslt1-dev cython

echo "Installing boost 1.65 or later"
# first find current boost version (if any)
# the 'tail' makes sure we use the last one listed by apt-cache in case there is more than 1 version
tmp=`apt-cache search libboost|grep ALL|egrep libboost[1-9]|tail -n 1`
boost_major=${tmp:8:1}
boost_minor=${tmp:10:2}
function find_boost_version() {
tmp=`apt-cache search libboost|grep ALL|egrep libboost[1-9]|tail -n 1`
boost_major=${tmp:8:1}
boost_minor=${tmp:10:2}
}

find_boost_version

echo "Found Boost major version ${boost_major}, minor ${boost_minor}"
if [ $boost_major -gt 1 -o $boost_minor -gt 64 ]
then
echo "installing Boost ${boost_major}.${boost_minor} from system apt"
$SUDO apt install -y libboost-dev
$SUDO apt install -y libboost-chrono-dev
$SUDO apt install -y libboost-filesystem-dev
$SUDO apt install -y libboost-thread-dev
$SUDO apt install -y libboost-date-time-dev
$SUDO apt install -y libboost-regex-dev
$SUDO apt install -y libboost-program-options-dev
$SUDO apt install -y libboost-atomic-dev
$SUDO apt install -y libboost-test-dev
$SUDO apt install -y libboost-timer-dev
else
# packaged boost is too old
# we need to find a ppa that has it. This is unsafe and likely prone to falling over
# when the ppa is no longer maintained
$SUDO apt install -y software-properties-common
echo "trying to find boost from ppa:mhier/libboost-latest"
${APT_GET_INSTALL} software-properties-common
$SUDO add-apt-repository -y ppa:mhier/libboost-latest
$SUDO apt update
# get rid of the default installed boost version
$SUDO apt remove -y libboost-all-dev
$SUDO apt auto-remove -y
# TODO: find out which version is in the ppa
$SUDO apt install -y libboost1.68-dev
find_boost_version
echo "installing Boost ${boost_major}.${boost_minor} from system apt"
${APT_GET_INSTALL} libboost${boost_major}.${boost_minor}-all-dev
fi

echo "Installing SWIG..."

$SUDO apt-get install -y --no-install-recommends swig
${APT_GET_INSTALL} --no-install-recommends swig

echo "Installing doxygen related packages"
$SUDO apt-get install -y --no-install-recommends doxygen graphviz
${APT_GET_INSTALL} --no-install-recommends doxygen graphviz

# replaced with pip install
#echo "Installing python libraries etc"
#$SUDO apt-get install -y --no-install-recommends python-scipy python-docopt python-numpy python-h5py python-matplotlib python-libxml2 python-psutil python-tk python-nose

echo "installing glog"
$SUDO apt-get install -y libgoogle-glog-dev
${APT_GET_INSTALL} libgoogle-glog-dev

echo "Installing python APT packages"
# we will use pip for most
# some extra package needed for jupyter
qt=pyqt5
$SUDO apt-get install -y python-dev python-pip python-tk python-${qt} python-${qt}.qtsvg python-${qt}.qtwebkit
${APT_GET_INSTALL} python-dev python-pip python-tk python-${qt} python-${qt}.qtsvg python-${qt}.qtwebkit
echo "Run INSTALL_python_packages.sh after this."
1 change: 1 addition & 0 deletions scripts/INSTALL_python_packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,4 @@ done

$PYTHON -m pip install $PIPOPTIONS --upgrade pip wheel setuptools
$PYTHON -m pip install $PIPOPTIONS --only-binary=numpy,scipy,matplotlib numpy scipy matplotlib nose coverage docopt
$PYTHON -m pip install $PIPOPTIONS jupyter spyder==3.2
21 changes: 10 additions & 11 deletions scripts/UPDATE.sh
Original file line number Diff line number Diff line change
Expand Up @@ -132,17 +132,16 @@ SuperBuild(){

cd buildVM
cmake ../SIRF-SuperBuild \
-DCMAKE_INSTALL_PREFIX=${SIRF_INSTALL_PATH} \
-USIRF_URL -USIRF_TAG -USTIR_URL -USTIR_TAG \
-UGadgetron_URL -UGadgetron_TAG -UISMRMRD_URL \
-UISMRMRD_TAG \
-DUSE_SYSTEM_SWIG=On \
-DUSE_SYSTEM_Boost=On \
-DUSE_SYSTEM_Armadillo=On \
-DUSE_SYSTEM_FFTW3=On \
-DUSE_SYSTEM_HDF5=ON \
-DBUILD_siemens_to_ismrmrd=On \
-DDEVEL_BUILD=OFF
-DCMAKE_INSTALL_PREFIX=${SIRF_INSTALL_PATH} \
-U\*_URL -U\*_TAG \
-DUSE_SYSTEM_SWIG=On \
-DUSE_SYSTEM_Boost=On \
-DUSE_SYSTEM_Armadillo=On \
-DUSE_SYSTEM_FFTW3=On \
-DUSE_SYSTEM_HDF5=ON \
-DBUILD_siemens_to_ismrmrd=On \
-DUSE_ITK=ON \
-DDEVEL_BUILD=OFF
make -j${num_parallel}

if [ ! -f ${SIRF_INSTALL_PATH}/share/gadgetron/config/gadgetron.xml ]
Expand Down
82 changes: 82 additions & 0 deletions scripts/bootstrap_ubuntu.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
#!/bin/bash

set -x
SIRFUSERNAME=sirfuser
SIRFPASS=virtual

# check if user exists. if not create it. Useful for vagrant provision
id -u $SIRFUSERNAME
if [ $? -eq "1" ] ; then
adduser $SIRFUSERNAME
adduser $SIRFUSERNAME sudo
{ echo $SIRFPASS; echo $SIRFPASS; } | passwd $SIRFUSERNAME
fi

# fail hard on any step
set -ex
# update the apt-get database
export DEBIAN_FRONTEND=noninteractive
apt-get update && apt-get upgrade -y -o Dpkg::Options::=--force-confnew
# upgrade the list of packages


#install upgrades
apt-get update && apt-get install -y --no-install-recommends wget git xorg xterm gdm3 menu policykit-1-gnome synaptic gnome-session gnome-panel metacity
apt-get update && apt-get install -y at-spi2-core gnome-terminal gnome-control-center nautilus dmz-cursor-theme network-manager network-manager-gnome

# start gnome display manager
service gdm start

# set the current locale, otherwise the gnome-terminal doesn't start
sudo locale-gen en_GB.UTF-8
sudo locale-gen en_US.UTF-8
sudo locale-gen de_DE.UTF-8
sudo locale-gen fr_FR.UTF-8
sudo locale-gen es_ES.UTF-8
sudo locale-gen it_IT.UTF-8
sudo locale-gen pt_PT.UTF-8
sudo locale-gen pt_BR.UTF-8
sudo locale-gen ja_JP.UTF-8
sudo locale-gen zh_CN.UTF-8
sudo update-locale LANG=en_GB.UTF-8
sudo localectl set-x11-keymap uk
sudo localectl status


# To hide vagrant from login screen:
# 1. Log-in as vagrant
# 2. In /var/lib/AccountsService/users/vagrant change 'SystemAccount=true'
sudo echo '[User]' > vagrant
sudo echo 'SystemAccount=true' >> vagrant
sudo cp -v vagrant /var/lib/AccountsService/users/vagrant

# To remove the Ubuntu user from VM:
#sudo deluser --remove-home ubuntu
# Could add custom logos here: /etc/gdm3/greeter.dconf-defaults

userHOME=/home/$SIRFUSERNAME

if [ ! -d $userHOME/devel ]; then
mkdir $userHOME/devel
fi
cd $userHOME/devel

if [ ! -d $userHOME/devel/CCPPETMR_VM ]; then
git clone https://github.com/CCPPETMR/CCPPETMR_VM.git
cd CCPPETMR_VM
else
cd CCPPETMR_VM
git pull
fi



bash $userHOME/devel/CCPPETMR_VM/scripts/INSTALL_prerequisites_with_apt-get.sh
bash $userHOME/devel/CCPPETMR_VM/scripts/INSTALL_CMake.sh /usr/local
bash $userHOME/devel/CCPPETMR_VM/scripts/INSTALL_python_packages.sh

# port 8888 is forwarded to 8888 so the user can use the host browser
# Therefore no browser is installed on the VM

chown -R $SIRFUSERNAME:users $userHOME
sudo -u $SIRFUSERNAME -H bash $userHOME/devel/CCPPETMR_VM/scripts/UPDATE.sh
3 changes: 3 additions & 0 deletions scripts/configure_gnome.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,7 @@ gsettings set org.gnome.desktop.screensaver lock-enabled false
gsettings set org.gnome.desktop.screensaver idle-activation-enabled false
# enlarge pointer size
gsettings set org.gnome.desktop.interface cursor-size 120
# remove autosuspend notification
gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout '0'
gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-battery-timeout '0'

9 changes: 9 additions & 0 deletions scripts/first_run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,13 @@ location=`dirname $0`

$location/configure_gnome.sh

# configure jupyter notebook
mkdir ~/.jupyter
jupyter notebook --generate-config
# requires to set the following variable manually by editing the file
# jupyter_notebook_config.py
# c.NotebookApp.ip = '0.0.0.0'
jupyter notebook password

$location/zero_fill.sh

90 changes: 13 additions & 77 deletions vagrant/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#=========================================================================

Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/xenial64"
config.vm.box = "bento/ubuntu-18.04"
config.vm.synced_folder '.', '/vagrant', disabled: true

# Disable automatic box update checking. If you disable this, then
Expand All @@ -31,8 +31,10 @@ Vagrant.configure("2") do |config|
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# config.vm.network "forwarded_port", guest: 80, host: 8080

# Forward port for jupyter notebooks
config.vm.network "forwarded_port", guest: 8888, host: 8888

# Create a private network, which allows host-only access to the machine
# using a specific IP.
# config.vm.network "private_network", ip: "192.168.33.10"
Expand All @@ -52,6 +54,7 @@ Vagrant.configure("2") do |config|
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#

config.vm.provider "virtualbox" do |vb|
# Display the VirtualBox GUI when booting the machine
vb.gui = true
Expand All @@ -62,17 +65,17 @@ Vagrant.configure("2") do |config|

vb.customize "pre-boot", [
"storageattach", :id,
"--storagectl", "IDE",
"--storagectl", "IDE Controller",
"--port", "1",
"--device", "0",
"--type", "dvddrive",
"--medium", "emptydrive",
"--medium", "emptydrive"
]
vb.name = "SIRF_1.1.1"
vb.name = "SIRF_2.0.0-rc.1"
vb.customize ["modifyvm", :id,
"--clipboard", "bidirectional"]
#vb.customize [ "modifyvm", :id,
# "--uartmode1", "disconnected" ]
"--clipboard", "bidirectional",
"--vram", "32"]
end

#
Expand All @@ -90,73 +93,6 @@ Vagrant.configure("2") do |config|
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
# documentation for more information about their specific syntax and use.

config.vm.provision "shell", inline: <<-SHELL
SIRFUSERNAME=sirfuser
SIRFPASS=virtual
adduser $SIRFUSERNAME
adduser $SIRFUSERNAME sudo
{ echo $SIRFPASS; echo $SIRFPASS; } | passwd $SIRFUSERNAME
# remove serial port from grub configuration and update configuration
sed -i 's/ console=ttyS0//' /etc/default/grub.d/50-cloudimg-settings.cfg
update-grub
# update the apt-get database
apt-get update
# upgrade the list of packages
apt-get upgrade -y
#install upgrades
apt-get install -y wget git xorg xterm gdm menu gksu synaptic gnome-session gnome-panel metacity --no-install-recommends
apt-get install -y at-spi2-core gnome-terminal gnome-control-center nautilus dmz-cursor-theme network-manager network-manager-gnome
# start gnome display manager
service gdm start
# set the current locale, otherwise the gnome-terminal doesn't start
sudo locale-gen en_GB.UTF-8
sudo locale-gen en_US.UTF-8
sudo locale-gen de_DE.UTF-8
sudo locale-gen fr_FR.UTF-8
sudo locale-gen es_ES.UTF-8
sudo locale-gen it_IT.UTF-8
sudo locale-gen pt_PT.UTF-8
sudo locale-gen pt_BR.UTF-8
sudo locale-gen ja_JP.UTF-8
sudo locale-gen zh_CN.UTF-8
sudo update-locale LANG=en_GB.UTF-8
sudo localectl set-x11-keymap uk
sudo localectl status
# To hide vagrant from login screen:
# 1. Log-in as vagrant
# 2. In /var/lib/AccountsService/users/vagrant change 'SystemAccount=true'
sudo echo '[User]' > vagrant
sudo echo 'SystemAccount=true' >> vagrant
sudo cp -v vagrant /var/lib/AccountsService/users/vagrant
# To remove the Ubuntu user from VM:
sudo deluser --remove-home ubuntu
# Could add custom logos here: /etc/gdm3/greeter.dconf-defaults
userHOME=/home/$SIRFUSERNAME
mkdir $userHOME/devel
cd $userHOME/devel
git clone https://github.com/CCPPETMR/CCPPETMR_VM.git
cd CCPPETMR_VM
#git checkout ubuntu18.04
bash $userHOME/devel/CCPPETMR_VM/scripts/INSTALL_prerequisites_with_apt-get.sh
bash $userHOME/devel/CCPPETMR_VM/scripts/INSTALL_CMake.sh /usr/local
bash $userHOME/devel/CCPPETMR_VM/scripts/INSTALL_python_packages.sh
apt-get install -y firefox
python -m pip install jupyter
python -m pip install spyder
chown -R $SIRFUSERNAME:users $userHOME
sudo -u $SIRFUSERNAME -H bash $userHOME/devel/CCPPETMR_VM/scripts/UPDATE.sh
SHELL
config.vm.provision "shell", path: "../scripts/bootstrap_ubuntu.sh"
end

0 comments on commit 4536ce8

Please sign in to comment.