Back Midas Rome Roody Rootana
  Midas DAQ System  Not logged in ELOG logo
Message ID: 3188     Entry time: 09 Jan 2026
Author: Stefan Ritt 
Topic: Forum 
Subject: MIDAS installation 
Since we have no many RaspberryPi based control systems running at our lab with midas, I want to 
streamline the midas installation, such that a non-expert can install it on these devices. 

First, midas has to be cloned under "midas" in the user's home directory with

git clone https://bitbucket.org/tmidas/midas.git --recurse-submodules

For simplicity, this puts midas right into /home/<user>/midas, and not into any "packages" subdirectory 
which I believe is not necessary.

Then I wrote a setup script midas/midas_setup.sh which does the following:

- Add midas environment variables to .bashrc / .zschenv depending on the shell being used

- Compile and install midas to midas/bin

- Load an initial ODB which allows insecure http access to port 8081

- Install mhttpd as a system service and start it via systemctl

Since I'm not a linux system expert, the current file might be a bit clumsy. I know that automatic shell 
detection can be made much more elaborate, but I wanted a script which can easy be understood even by 
non-experts and adapted slightly if needed.

If you know about shell scripts and linux administration, please have a quick look at the attached script 
and give me any feedback.

Stefan
Attachment 1: midas_setup.sh  1 kB  | Hide | Hide all
#!/bin/sh

#
# Change environment
#

f="$HOME/.bashrc"
[ -f "$HOME/.zshenv" ] && f="$HOME/.zshenv"

grep -q '>>> MIDAS >>>' "$f" 2>/dev/null || cat >>"$f" <<'EOF'

# >>> MIDAS >>>
export PATH="$HOME/midas/bin:$PATH"
export MIDASSYS="$HOME/midas"
export MIDAS_DIR="$HOME/online"
export MIDAS_EXPT_NAME="Online"
# <<< MIDAS <<<
EOF

. "$f"

printf '\033[1;33m★\033[0m %s\n' "Environment variables written to $f"

#
# Compile MIDAS
#
printf '\033[1;33m★\033[0m %s\n' "Compiling and installing MIDAS"

mkdir -p "$HOME/midas/build"
cd "$HOME/midas/build"
cmake ..
make install
cd "$HOME/midas"

#
# Load initial ODB, opens port 8081 for mhttpd
#
printf '\033[1;33m★\033[0m %s\n' "Loading initial ODB"

mkdir -p "$HOME/online"
odbedit -c "load midas_setup.odb" > /dev/null

#
# Installing mhttpd servcice
#
printf '\033[1;33m★\033[0m %s\n' "Installing mhttpd service"

sudo cp mhttpd.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable mhttpd
sudo systemctl start mhttpd

printf '\033[1;33m★\033[0m %s\n' "Finished MIDAS setup"


ELOG V3.1.4-2e1708b5