Ubuntu Development Setup

Install Git

sudo apt-get -y install git

Setup Git

  1. Name and Email
git config --global user.name "Md. Atiqul Islam"
git config --global user.email "[email protected]"
  1. Shortcut
git config --global alias.co checkout
git config --global alias.br branch
git config --global alias.ci commit
git config --global alias.st status
git config --global credential.https://github.com.username atiq1589

Setup SSH

SOURCE

  1. Generate ssh key
    • go to ~/.ssh
    cd ~/.sshIf you do not have .ssh folder create itmkdir ~/.ssh && cd $\_+ run below command and follow the stepsssh-keygen -t rsa -b 4096 -C "[email protected]"
  2. turn on ssh-agenteval "$(ssh-agent -s)"
  3. Add your SSH key to the ssh-agentssh-add ~/.ssh/your_file_name
  4. Copy .pub content (xclip is not working by the time i write this document)cat ~/.ssh/your_file_name.pub with xclipxclip -sel clip < ~/.ssh/id_rsa.pub
  5. Go to github settings page and add this key
  6. test your ssh connectionssh -T [email protected] ***Hi atiq1589! You’ve successfully authenticated, but GitHub does not provide shell access.***

automatically add ssh key for win bash

SOURCE

  1. Add below command in ~/.bashrc fileif [ -z "$SSH_AUTH_SOCK" ] ; then eval `ssh-agent -s` ssh-add fi
  2. install expectsudo apt-get -y install expect
  3. make a script#!/usr/bin/expect -f spawn ssh-add /home/user/.ssh/id_rsa expect "Enter passphrase for /home/user/.ssh/id_rsa:" send "passphrase\n"; interact For my local pc: ***./mnt/e/work/Resources/bash-command/add-ssh.sh***

Install Docker

SOURCE

echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" | sudo tee /etc/apt/sources.list.d/docker.list

Install Ruby

SOURCE

sudo apt-get install -y ruby

or

sudo apt-get install -y ruby-full

latest ruby

SOURCE

sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev
cd
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exec $SHELL

git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
exec $SHELL

rbenv install 2.3.1
rbenv global 2.3.1
ruby -v

Install LAMP

SOURCE

Install Apache

sudo apt-get install apache2

Install MySQL

sudo apt-get install mysql-server

Install PHP

sudo apt-get install php5 libapache2-mod-php5

Restart Server

sudo /etc/init.d/apache2 restart

or

sudo service apache2 {command [restart, start, stop]}

Check PHP

php -r 'echo "\n\nYour PHP installation is working fine.\n\n\n";'

Install xclip

sudo apt-get -y install xclip

Install NVM (Node Version Manager)

SOURCE

Curl

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.32.1/install.sh | bash

Wget

wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.32.1/install.sh | bash

Test

nvm -v 

Use node version per folder

  1. Need to create .nvmrc file in that folder
  2. put version number on that file (.nvmrc)
$ echo "5.9" > .nvmrc

$ echo "lts/*" > .nvmrc # to default to the latest LTS version
  1. then run
nvm use
  1. Automatically load node version.
# place this after nvm initialization!
autoload -U add-zsh-hook
load-nvmrc() {
  local node_version="$(nvm version)"
  local nvmrc_path="$(nvm_find_nvmrc)"

  if [ -n "$nvmrc_path" ]; then
    local nvmrc_node_version=$(nvm version "$(cat "${nvmrc_path}")")

    if [ "$nvmrc_node_version" = "N/A" ]; then
      nvm install
    elif [ "$nvmrc_node_version" != "$node_version" ]; then
      nvm use
    fi
  elif [ "$node_version" != "$(nvm version default)" ]; then
    echo "Reverting to nvm default version"
    nvm use default
  fi
}
add-zsh-hook chpwd load-nvmrc
load-nvmrc

Install Node

SOURCE

  1. Install NVM
  2. Install Node
nvm install node 

or 
nvm install #version

nvm install 6.9.1

Test

node -v

or 
Check NPM

npm -v

Install Bower

SOURCE

 npm install -g bower

Install python

There is aleardy python2 installed

install pip

sudo apt-get install python-pip

Check pip

pip --version

install Coffee scripts

SOURCE

npm install -g coffee-script

Install Nonemon

SOURCE github

npm install -g nodemon

Install PostgreSQL

  1. Install postgresql
sudo apt-get install postgresql postgresql-contrib
  1. Change password
sudo -i -u postgres
psql
\password postgres

Follow instruction 3. quite

\q
  1. Restart
sudo service postgresql restart

Install Redis

SOURCE

wget http://download.redis.io/redis-stable.tar.gz
tar xvzf redis-stable.tar.gz
cd redis-stable
make
sudo ln -s path/to/redis-stable/src/redis-server /usr/bin

Install ZSH

sudo apt-get install zsh

Install oh-my-zsh

SOURCE Curl

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

wget

sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"

Install Theme

SOURCE

Add ZSH_THEME="gnzh" in ~/.zshrc

or

match="robbyrussell"
sed -i -e 's/'$match'/gnzh/g' .zshrc

To Enable ZSH in windows 10 bash add

# Launch Zsh
if [ -t 1 ]; then
exec zsh
fi

in ~/.bashrc file 
It has some problem to start other commands. Need to fix that first


Helpful Supporting package

  1. Dev package
sudo apt-get install libffi-dev
sudo apt-get install libssl-dev
sudo apt-get install python-dev

Helpful custom function

  1. To access drive directly add below command in ~/.bashrc file
drive(){
    cd /mnt/$1;
}

and run

source ~/.bashrc

Leave a Reply

Your email address will not be published. Required fields are marked *