For rails developer who working on Ubuntu 20.04 LTS.
-
Copy the below script and save it as
rails_tools.sh
-
Change the file permission to be executable by using the command
chmod +x rails_tools.sh
#!/bin/bash
#
# Install needed Rails local tools on ubuntu 20.04 LTS
# Create=d by Astm Ali | https://github.com/astmdesign
#
clear
echo "## Update apt ###########################################################"
sudo apt-get update -y
# Terminator
if ! [ -x "$(command -v terminator)" ]; then
echo "## Install Terminator #################################################"
sudo add-apt-repository ppa:gnome-terminator -y
sudo apt-get install terminator -y
fi
# ZSH
if ! [ -x "$(command -v zsh)" ]; then
echo "## Install ZSH ########################################################"
sudo apt-get install zsh -y
chsh -s $(which zsh)
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
fi
# Docker
if ! [ -x "$(command -v docker)" ]; then
echo "## Install Docker #####################################################"
sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release software-properties-common -y
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get install docker-ce docker-ce-cli containerd.io -y
apt-cache madison docker-ce
docker -v
# Docker permissions
sudo groupadd docker
sudo usermod -aG docker user-name # replace user-name with your user name
su - user-name
id -nG
fi
# Docker compose
if ! [ -x "$(command -v docker-compose)" ]; then
echo "## Remove old Docker compose #####################################################"
sudo apt remove docker-compose
sudo rm /usr/local/bin/docker-compose
echo "## Install Docker compose #####################################################"
sudo curl -L "https://github.com/docker/compose/releases/download/1.28.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
docker-compose -v
fi
# PostMan
if ! [ -x "$(command -v postman)" ]; then
echo "## Install PostMan ####################################################"
sudo snap install postman
fi
# Atom
if ! [ -x "$(command -v atom)" ]; then
echo "## Install Atom #######################################################"
sudo apt install software-properties-common apt-transport-https wget
wget -q https://packagecloud.io/AtomEditor/atom/gpgkey -O- | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://packagecloud.io/AtomEditor/atom/any/ any main"
fi
# Sublime-text-3
if ! [ -x "$(command -v subl)" ]; then
echo "## Install Sublime ####################################################"
sudo apt install dirmngr gnupg apt-transport-https ca-certificates software-properties-common
curl -fsSL https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add -
sudo add-apt-repository "deb https://download.sublimetext.com/ apt/stable/"
sudo apt install sublime-text
fi
# Skype
if ! [ -x "$(command -v skypeforlinux)" ]; then
echo "## Install Skype ######################################################"
wget https://go.skype.com/skypeforlinux-64.deb
sudo apt install ./skypeforlinux-64.deb -y
sudo apt update -y
sudo apt upgrade -y
fi
# Slack
if ! [ -x "$(command -v slack)" ]; then
echo "## Install Slack ######################################################"
sudo snap install slack --classic
fi
# Git
if ! [ -x "$(command -v git)" ]; then
echo "## Install Git ########################################################"
sudo apt install git-all -y
git --versionsublime-text
fi
# RVM
if ! [ -x "$(command -v rvm)" ]; then
echo "## Install RVM ########################################################"
curl -sSL https://rvm.io/mpapis.asc | gpg --import -
curl -sSL https://rvm.io/pkuczynski.asc | gpg --import -
curl -sSL https://get.rvm.io | bash -s stable
source ~/.bashrc
rvm list known
rvm install ruby-2.1.6
fi
# Rbenv
if ! [ -x "$(command -v rbenv)" ]; then
echo "## Install Rbenv ######################################################"
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
sudo apt install rbenv -y
fi
# Ruby
if ! [ -x "$(command -v ruby)" ]; then
echo "## Install Ruby 2.1.6 #################################################"
rbenv install --list # check availabe versions
rbenv install 2.1.6 # change it with the needed version-get
rbenv global 2.1.6
rbenv rehash
rbenv versions
fi
# Nodejs
if ! [ -x "$(command -v node)" ]; then
echo "## Install Nodejs #####################################################"
sudo apt install yarn nodejs -y
fi
# Rails
if ! [ -x "$(command -v rails)" ]; then
echo "## Install Rails ######################################################"
sudo apt install ruby-devel
sudo apt install ruby-full -y
gem install rails -v 4.2.6
fi
# Redis
if ! [ -x "$(command -v redis-server)" ]; then
echo "## Install Redis ######################################################"
sudo apt install redis-server -y
sudo systemctl restart redis.service
sudo systemctl status redis
fi
# pgadmin4
if ! [ -x "$(command -v psql)" ]; then
echo "## Install pgadmin4 ###################################################"
sudo curl https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo apt-key add
sudo sh -c 'echo "deb https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/$(lsb_release -cs) pgadmin4 main" > /etc/apt/sources.list.d/pgadmin4.list && apt update'
sudo apt install pgadmin4 -y
fi
# workbench
if ! [ -x "$(command -v workbench)" ]; then
echo "## Install workbench ###################################################"
sudo snap install mysql-workbench-community
fi
# Thunderbird
if ! [ -x "$(command -v thunderbird)" ]; then
echo "## Install Thunderbird ###################################################"
sudo apt install thunderbird
fi
# Commands & tools
echo "## Install Commands & tools #############################################"
if ! [ -x "$(command -v htop)" ]; then; sudo apt-get install htop -y; fi
if ! [ -x "$(command -v vim)" ]; then; sudo sudo apt-get install vim -y; fi
if ! [ -x "$(command -v vlc)" ]; then; sudo snap install vlc; fi
# Summary
echo "## Summary ##############################################################"
if ! [ -x "$(command -v terminator)" ]; then echo '## Error: Terminator is not installed.'
else echo "#####--> $(terminator -v)"; fi
if ! [ -x "$(command -v zsh)" ]; then echo '## Error: Zsh is not installed.'
else echo "#####--> $(zsh --version)"; fi
if ! [ -x "$(command -v docker)" ]; then echo '## Error: Docker is not installed.'
else echo "#####--> $(docker -v)"; fi
if ! [ -x "$(command -v docker-compose)" ]; then echo '## Error: Docker compose is not installed.'
else echo "#####--> $(docker-compose -v)"; fi
if ! [ -x "$(command -v postman)" ]; then echo '## Error: Postman is not installed.'
else echo "#####--> Postman $(postman -v)"; fi
if ! [ -x "$(command -v atom)" ]; then echo '## Error: Atom is not installed.'
else echo "#####--> $(atom -v | grep Atom)"; fi
if ! [ -x "$(command -v subl)" ]; then echo '## Error: Sublime is not installed.'
else echo "#####--> $(subl -v)"; fi
if ! [ -x "$(command -v skypeforlinux)" ]; then echo '## Error: Skype is not installed.'
else echo "#####--> Skype $(skypeforlinux -v)"; fi
if ! [ -x "$(command -v slack)" ]; then echo '## Error: Slack is not installed.'
else echo "#####--> Slack $(slack)"; fi
if ! [ -x "$(command -v git)" ]; then echo '## Error: Git is not installed.'
else echo "#####--> $(git --version)"; fi
if ! [ -x "$(command -v rvm)" ]; then echo '## Error: Rvm is not installed.'
else echo "#####--> $(rvm -v)"; fi
if ! [ -x "$(command -v rbenv)" ]; then echo '## Error: Rbenv is not installed.'
else echo "#####--> $(rbenv -v)"; fi
if ! [ -x "$(command -v ruby)" ]; then echo '## Error: Ruby is not installed.'
else echo "#####--> $(ruby -v)"; fi
if ! [ -x "$(command -v node)" ]; then echo '## Error: Nodejs is not installed.'
else echo "#####--> Nodejs $(node -v)"; fi
if ! [ -x "$(command -v gem)" ]; then echo '## Error: Gem is not installed.'
else echo "#####--> Gem $(gem -v)"; fi
if ! [ -x "$(command -v rails)" ]; then echo '## Error: Rails is not installed.'
else echo "#####--> $(rails -v)"; fi
if ! [ -x "$(command -v bundle)" ]; then echo '## Error: Bundle is not installed.'
else echo "#####--> $(bundle -v)"; fi
if ! [ -x "$(command -v redis-server)" ]; then echo '## Error: Redis is not installed.'
else echo "#####--> $(redis-server --version)"; fi
if ! [ -x "$(command -v psql)" ]; then echo '## Error: Pgadmin4 is not installed.'
else echo "#####--> $(psql --version)"; fi
if ! [ -x "$(command -v workbench)" ]; then echo '## Error: workbench is not installed.'
else echo "#####--> $(workbench --version)"; fi
if ! [ -x "$(command -v thunderbird)" ]; then echo '## Error: Thunderbird is not installed.'
else echo "#####--> $(thunderbird -v)"; fi
if ! [ -x "$(command -v htop)" ]; then echo '## Error: Htop is not installed.'
else echo "#####--> $(htop -v)"; fi
# if ! [ -x "$(command -v vim)" ]; then echo '## Error: Vim is not installed.'
# else echo "#####--> Vim $(vim -v)"; fi
if ! [ -x "$(command -v vlc)" ]; then echo '## Error: Vlc is not installed.'
else echo "#####--> Vlc $(vlc -v)"; fi
Terminator, ZSH, Atom, Sublime, Postman,
Git, Rvm, Rbenv, Ruby ruby-2.1.6, Rails 4.2.6, Nodejs,