Skip to content

Instantly share code, notes, and snippets.

@zubair1024
Last active April 6, 2020 22:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zubair1024/9312ade0ab55e11944643e479bccb167 to your computer and use it in GitHub Desktop.
Save zubair1024/9312ade0ab55e11944643e479bccb167 to your computer and use it in GitHub Desktop.

Installation 2.0

Setup User

  1. Add user
adduser username
  1. Make the user a sudoer
usermod -aG sudo username

Setup GITHUB machine user access

  1. create .ssh directory
mkdir ~/.ssh
  1. Create RSA keys and set a passphrase
ssh-keygen -t rsa -b 4096 -C "razrlab@gmail.com"
  1. Adding your SSH key to the ssh-agent
eval "$(ssh-agent -s)"
  1. Set the Identity file in the .ssh/config
nano ~/.ssh/config
Host *
  AddKeysToAgent yes
  UseKeychain yes
  IdentityFile ~/.ssh/id_rsa
  1. Go ahead and add the SSH public key to GITHUB 👍

  2. Copy the ssh keys to the working machines and gain access to the server

Hack to make sure the passphrase is not asked everytime

  1. Edit .bashrc file
nano ~/.bashrc
  1. Add the following content
SSH_ENV=$HOME/.ssh/environment

# start the ssh-agent
function start_agent {
    echo "Initializing new SSH agent..."
    # spawn ssh-agent
    /usr/bin/ssh-agent | sed 's/^echo/#echo/' > ${SSH_ENV}
    echo succeeded
    chmod 600 ${SSH_ENV}
    . ${SSH_ENV} > /dev/null
    /usr/bin/ssh-add
}

if [ -f "${SSH_ENV}" ]; then
     . ${SSH_ENV} > /dev/null
     ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {
        start_agent;
    }
else
    start_agent;
fi
  1. Save the file and re-open the terminal, you might need to enter the passphrase once but then it shouldn't be prompted again

Set up local machine access

  1. Copy over the keys to the local machine

  2. Use ssh-copy-id to enable ssh access

ssh-copy-id -i <key-path> <username>@<server>

Install Docker

  1. Update registry
sudo apt-get update
  1. Uninstall any old versions of docker
sudo apt-get remove docker docker-engine docker.io
  1. Install Docker
sudo apt install docker.io
  1. Start and Automate Docker
sudo systemctl start docker
sudo systemctl enable docker

Allow Docker access without sudo

  1. Add a group if does not already exist
sudo groupadd docker
  1. Add the connected user "$USER" to the docker group. Change the user name to match your preferred user if you do not want to use your current user
sudo gpasswd -a $USER docker
 sudo usermod -aG docker $USER
  1. Either do a newgrp docker or log out/in to activate the changes to groups.

  2. Install docker-compose

sudo apt install docker-compose

Install NodeJS and NPM

  1. Update registry
sudo apt-get update
  1. Install NodeJS and NPM
sudo apt-get install nodejs
sudo apt-get install npm
  1. Install NVM for better NodeJS version management
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
  1. Install LTS version of NodeJS
nvm install --lts
  1. Set it as the default for the system
nvm alias default <version number>

Clone Repos

git clone ssh://git@github.com/razrlab/titan-base.git && \
git clone ssh://git@github.com/razrlab/titan-com.git && \
git clone ssh://git@github.com/razrlab/titan-web.git && \
git clone ssh://git@github.com/razrlab/titan-queue.git && \
git clone ssh://git@github.com/razrlab/titan-public-react.git && \
git clone ssh://git@github.com/razrlab/titan-scripts.git && \
git clone ssh://git@github.com/razrlab/titan-extras.git && \
git clone ssh://git@github.com/razrlab/docker-redis.git

Install global dependencies

npm i -g pm2 prettier eslint yarn

Install local dependencies

cd ~/titan-base && sh ./devinstall.sh

Start off rabbitmq

cd ~/titan-queue && docker-compose up -d

Start of redis

cd ~/titan-base && docker-compose up -d
sudo apt-get install -y build-essential libpng-dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment