Skip to content

Instantly share code, notes, and snippets.

@longle255
Created October 29, 2019 15:42
Show Gist options
  • Save longle255/4a22d6f45e92bfcf63f5677c86108da1 to your computer and use it in GitHub Desktop.
Save longle255/4a22d6f45e92bfcf63f5677c86108da1 to your computer and use it in GitHub Desktop.
#!/bin/bash
###############
# setup-node.sh
#
# Long Le <[email protected]>
# October 29h, 2019
#
# Purpose: install package dependencies for libramcast, set up system config
###############
# show the commands that are run for debugging in /root/setup/setup-node.log
set -x
FLAG="/opt/.firstboot"
SETUPFLAG="/opt/.setup_in_process"
# FLAG will not exist on the *very* fist boot because
# it is created here!
if [ ! -f $FLAG ]; then
sudo touch $FLAG
sudo touch $SETUPFLAG
fi
# install packages
DEBIAN_FRONTEND=noninteractive sudo apt-get update
DEBIAN_FRONTEND=noninteractive sudo apt-get install -y zsh git vim htop cmake openjdk-8-jdk
# install oh-my-zsh
echo "n" | sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
sudo sed -i '1s/^/auth sufficient pam_wheel.so trust group=chsh\n/' /etc/pam.d/chsh
sudo groupadd chsh
sudo usermod -a -G chsh lel
chsh -s $(which zsh)
DEBIAN_FRONTEND=noninteractive sudo apt-get install -y libtool autoconf automake build-essential
DEBIAN_FRONTEND=noninteractive sudo apt-get install -y ibverbs-utils rdmacm-utils infiniband-diags perftest libipathverbs1 libmlx4-1
DEBIAN_FRONTEND=noninteractive sudo apt-get install -y librdmacm-dev libibverbs-dev numactl libnuma-dev libaio-dev libevent-dev
DEBIAN_FRONTEND=noninteractive sudo apt-get install -y libtool rdma-core
# required packages for compiling libmcast, whitebox mcast
DEBIAN_FRONTEND=noninteractive sudo apt-get install -y libglib2.0-dev libmsgpack-dev
NOBODY_USR_GRP="nobody:nogroup"
sudo locale-gen en_US
for module in ib_umad ib_uverbs rdma_cm rdma_ucm ib_qib mlx4_core mlx4_en mlx4_ib; do
echo $module | sudo tee -a /etc/modules
done
REBOOT=yes
# set the amount of locked memory. will require a reboot
cat <<EOF | sudo tee /etc/security/limits.d/90-rmda.conf
* soft memlock unlimited
* hard memlock unlimited
EOF
# setting up required library
mkdir $HOME/apps
cd $HOME/apps
git clone https://bitbucket.org/sciascid/libpaxos.git
mkdir libpaxos/build
cd libpaxos/build
cmake ..
make
sudo make install
cd $HOME/apps
git clone https://bitbucket.org/paulo_coelho/libmcast.git
mkdir libmcast/build
cd libmcast/build
cmake ..
make
sudo make install
cd $HOME/apps
git clone https://github.com/imdea-software/atomic-multicast
cd atomic-multicast
# hack for the incompabability of white-box multicast with libmcast
sudo sed -i.bak 's/^typedef uint64_t m_uid_t;/\/\/ typedef uint64_t m_uid_t;/' /usr/local/include/mcast_types.h
make
sudo rm -f $SETUPFLAG
if [[ "$REBOOT" == "yes" ]]; then
# enact the change to the locked memory limits
sudo reboot
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment