Skip to content

Instantly share code, notes, and snippets.

@hluker
Last active March 22, 2024 03:33
Show Gist options
  • Select an option

  • Save hluker/141b00613c090de3de325a7cbc61d3ba to your computer and use it in GitHub Desktop.

Select an option

Save hluker/141b00613c090de3de325a7cbc61d3ba to your computer and use it in GitHub Desktop.
How to install LDM

Make sure root has a password set - GCP doesn't do this by default. You can remove afterwords.

hostnamectl set-hostname x.x.x.x
apt update && apt upgrade
apt install pax gcc build-essential zlib* libxml* sshfs fuse3 net-tools bc dc csh python3-pip ssh openssh-server apt-transport-https curl wget sudo vim git fonts-liberation
pip3 install twisted
cd /tmp
git clone https://github.com/akrherz/pyLDM.git
cd pyLDM
python3 setup.py install
[[iptables.md]]
adduser henry --disabled-password
adduser ldm --disabled-password
usermod -aG sudo henry
usermod -aG ldm henry
su ldm
cd
wget https://downloads.unidata.ucar.edu/ldm/6.15.0/ldm-6.15.0.tar.gz
gunzip -c ldm-6.15.0.tar.gz | pax -r '-s:/:/src/:'
cd ldm-6.15.0/src
./configure 
make && make install
(exit / go to sudo user)
make root-actions
su ldm
make clean

Edit your ldmd and pqact as needed

cd /home/ldm/etc/
vi ldmd.conf
vi pqact.conf

.bashrc - this will allow commands like "ldmadmin start" work outside bin directory

export PATH=$HOME/decoders:$HOME/util:$HOME/bin:$PATH
export MANPATH=$HOME/share/man:SysManPath

crontab

0 0 * * * bash -l -c 'if bin/ldmadmin isrunning; then bin/ldmadmin newlog; fi'
0 1,4,7,10,13,16,19,22 * * * bash -l -c 'if bin/ldmadmin isrunning; then bin/ldmadmin scour; fi'
* * * * * bash -l -c 'if bin/ldmadmin isrunning; then bin/ldmadmin addmetrics; fi'
0 0 * * 0 bash -l -c 'if bin/ldmadmin isrunning; then bin/ldmadmin newmetrics; fi'

Start as service

[Unit]
Description=Unidata Local Data Manager
After=network.target remote-fs.target nss-lookup.target

[Service]
Type=forking
ExecStartPre=/home/ldm/etc/scripts/pqrefresh.sh
ExecStartPre=/home/ldm/bin/ldmadmin mkqueue
ExecStart=/home/ldm/bin/ldmadmin start
ExecStop=/home/ldm/bin/ldmadmin stop
PIDFile=/home/ldm/ldmd.pid
Restart=on-failure
SuccessExitStatus=1
User=ldm

[Install]
WantedBy=multi-user.target

systemctl enable ldm
systemctl start ldm

On Updates

su ldm
cd
wget https://downloads.unidata.ucar.edu/ldm/6.14.5/ldm-6.14.5.tar.gz
gunzip -c ldm-6.14.5.tar.gz | pax -r '-s:/:/src/:'
cd ldm-6.14.5/src
./configure 
make && make install
(exit / go to sudo user)
make root-actions
su ldm
make clean
cd
systemctl stop ldm
rm -rf runtime ldm-6.14.5.tar.gz ldm-6.13.16
ln -s ldm-6.14.5 runtime
systemctl start ldm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment