apt-get update -y apt-get install nfs-common -y ifconfig eth1 up # != 192.168.0.1 ip addr add 192.168.0.2/24 dev eth1 mkdir /mnt/share mount 192.168.0.1:/opt/share /mnt/share # install require package apt-get update -y apt-get install build-essential checkinstall -y apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev -y # download and install Python 3.5.2 cd /usr/src wget "https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tgz" tar xzf Python-3.5.2.tgz cd /usr/src/Python-3.5.2 ./configure make altinstall python3.5 -V pip3.5 -V # Install git apt-get install git -y # Install node apt-get update apt-get install curl software-properties-common -y curl -sL https://deb.nodesource.com/setup_10.x | bash - apt-get install -y nodejs node -v # Install pm2 npm install pm2 -g pm2 list # chown ubuntu:ubuntu /home/ubuntu/.pm2/rpc.sock /home/ubuntu/.pm2/pub.sock # Init git hook mkdir /var/code mkdir /var/code/medusa_slave.git -p mkdir /var/code/medusa_slave_src -p cd /var/code/medusa_slave.git git init --bare touch /var/code/medusa_slave.git/hooks/post-receive chmod 755 /var/code/medusa_slave.git/hooks/post-receive echo "#!/bin/bash" >> /var/code/medusa_slave.git/hooks/post-receive echo "echo 'post-receive: Triggered.'" >> /var/code/medusa_slave.git/hooks/post-receive echo "echo 'post-receive: git check out…'" >> /var/code/medusa_slave.git/hooks/post-receive echo "git --git-dir=/var/code/medusa_slave.git --work-tree=/var/code/medusa_slave_src checkout deploy-crawler -f" >> /var/code/medusa_slave.git/hooks/post-receive echo "echo 'post-receive: install project…'" >> /var/code/medusa_slave.git/hooks/post-receive echo "cd /var/code/medusa_slave_src/Crawler && pip3.5 install --user -r requirement.txt && pm2 start slave.py --interpreter=python3.5 --name=Slave" >> /var/code/medusa_slave.git/hooks/post-receive