Skip to content

Instantly share code, notes, and snippets.

@Shipu
Last active July 23, 2018 19:08
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Shipu/e08ded4b770a92e3b5859aa1d0f5042c to your computer and use it in GitHub Desktop.
Save Shipu/e08ded4b770a92e3b5859aa1d0f5042c to your computer and use it in GitHub Desktop.
Ubuntu Startup (Test on 17.10)
#!/usr/bin/env bash
# nginx
# php 7.2 & php 5.6
# mysql 5.7
# postgresql 9.4
# phpmyadmin
# node js stable
# docker ( ce )
# go (stable)
# composer
# laravel installer
# tld resolver
# oh-my-zsh
# zsh-syntax-highlighting
# sublime text 3
# VS Code
# zeal
# heroku
# insomnia
# swaggymnia
#docker
sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu zesty stable"
sudo apt-get update
sudo apt-get install -y docker-ce
# nodejs
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs
sudo npm install n -g
sudo n stable
node --version
sudo apt-get update && sudo apt-get autoremove
# php , nginx & mysql
sudo apt-get install -y zip openssh-server
sudo apt-get install -y nginx
sudo apt-get install -y mysql-server mysql-client
sudo mysql_secure_installation
sudo apt-get install -y php-fpm php-common php-mbstring php-xmlrpc php-soap php-gd php-xml php-intl php-mysql php-cli php-mcrypt php-ldap php-zip php-curl
sudo add-apt-repository ppa:ondrej/php
# sublime text 3
wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add -
sudo apt-get install apt-transport-https
echo "deb https://download.sublimetext.com/ apt/stable/" | sudo tee /etc/apt/sources.list.d/sublime-text.list
# zeal
sudo add-apt-repository ppa:zeal-developers/ppa
#postgesql
sudo add-apt-repository "deb https://apt.postgresql.org/pub/repos/apt zesty-pgdg main"
wget --quiet -O - https://postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
# heroku
sudo add-apt-repository "deb https://cli-assets.heroku.com/branches/stable/apt ./"
curl -L https://cli-assets.heroku.com/apt/release.key | sudo apt-key add -
# vs code
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
# Add to sources
echo "deb https://dl.bintray.com/getinsomnia/Insomnia /" \
| sudo tee -a /etc/apt/sources.list.d/insomnia.list
# Add public key used to verify code signature
wget --quiet -O - https://insomnia.rest/keys/debian-public.key.asc \ | sudo apt-key add -
sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list'
sudo apt-get update
sudo apt-get install -y build-essential
# php 5.6
sudo apt-get install -y php5.6 php5.6-mbstring php5.6-mcrypt php5.6-mysql php5.6-xml php5.6-intl php5.6-intl php5.6-mbstring php5.6-cli php5.6-gd php5.6-curl php5.6-sqlite3
# composer
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
sudo chown -R $USER $HOME/.composer
composer global require hirak/prestissimo
#postgresql
sudo apt-get install -y postgresql-9.4
# phpmyadmin
sudo apt-get install -y phpmyadmin php-gettext
sudo ln -s /usr/share/phpmyadmin /var/www/html
# laravel installer
sudo composer global require "laravel/installer"
# vue cli
sudo npm install -g vue-cli
# oh-my-zsh
sudo apt-get install -y zsh
# sublime-text
sudo apt-get install -y sublime-text
# zeal
sudo apt-get install -y zeal
# heroku
sudo apt-get install -y heroku
# oh-my-zsh font
sudo apt-get install -y fonts-powerline
# vs code
sudo apt-get install -y code # or code-insiders
# insomnia
sudo apt-get install -y insomnia
# golang
snap install --classic go
sudo apt-get update && sudo apt-get autoremove
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git
# composer global
echo 'export PATH="$PATH:$HOME/.composer/vendor/bin"' >> ~/.zshrc
# development alias
echo 'alias ssh-key="cat ~/.ssh/id_rsa.pub"' >> ~/.zshrc
echo 'alias pa="php artisan"' >> ~/.zshrc
echo 'alias pas="php artisan serve"' >> ~/.zshrc
echo 'alias gs="git status"' >> ~/.zshrc
echo 'alias gco="git checkout"' >> ~/.zshrc
echo 'alias ginit="git init"' >> ~/.zshrc
echo 'alias gpull="git pull"' >> ~/.zshrc
echo 'alias gpullo="git pull origin"' >> ~/.zshrc
echo 'alias gpulldev="git pull origin dev"' >> ~/.zshrc
echo 'alias gpush="git push"' >> ~/.zshrc
echo 'alias gpusho="git push origin"' >> ~/.zshrc
echo 'alias gpushod="git push origin dev"' >> ~/.zshrc
echo 'alias gpushom="git push origin master"' >> ~/.zshrc
echo 'alias gclone="git clone"' >> ~/.zshrc
echo 'alias glog="git log"' >> ~/.zshrc
echo 'alias gmv="git mv"' >> ~/.zshrc
echo 'alias gb="git branch"' >> ~/.zshrc
echo 'alias gadd="git add"' >> ~/.zshrc
echo 'alias gadda="git add ."' >> ~/.zshrc
echo 'alias grm="git rm --cached"' >> ~/.zshrc
echo 'alias gcommit="git commit -m"' >> ~/.zshrc
echo 'alias gcommita="git commit -am"' >> ~/.zshrc
source ~/.zshrc
echo "source ${(q-)PWD}/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ${ZDOTDIR:-$HOME}/.zshrc
source ./zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
# oh-my-sh tool installation
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
# tld-resolver for auto hosting domain
git clone https://github.com/mnishihan/dev-tld-resolver.git
cd dev-tld-resolver/src && make
sudo make install
cd ~
# nginx_ensite
git clone https://github.com/perusio/nginx_ensite.git
cd nginx_ensite
sudo make install
cd ~
sudo git clone https://github.com/powerline/fonts.git --depth=1
cd fonts
./install.sh
cd ..
sudo rm -rf fonts
# https://github.com/mlabouardy/swaggymnia
wget https://s3.amazonaws.com/swaggymnia/1.0.0-beta/linux/swaggymnia
sudo chmod +x ./swaggymnia
@Shipu
Copy link
Author

Shipu commented Mar 30, 2018

It's very important that you run the make install command as root or using sudo, otherwise installation will fail.

  • As root (or in super user mode with sudo) also edit /etc/environment using a text editor of your choice and export a global environment variable named DEV_TLD_DOMAINS with comma separated list of Top Level Domains (tld) that you want to resolve to 127.0.0.1 automatically. For example, if you want .dev, .wp, .dpl top level domains to be resolved by dev-tld-resolver, your /etc/environment should have following line within it somewhere.
DEV_TLD_DOMAINS=dev,wp,dpl

Above step is optional if you don't need dev-tld-resolver to resolve top level domains other than .dev, which is the default

  • Lastly as root (or in super user mode with sudo) edit /etc/nsswitch.conf file and append dev_tld to the line starting with hosts:.

If you have following line starting with hosts: in /etc/nsswitch.conf file

hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4

then you should change it to look like

hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4 dev_tld

If you experience some sort of delay while resolving a host name, you should try to move dev_tld before dns, as follows

hosts: files mdns4_minimal [NOTFOUND=return] dev_tld dns mdns4
  • Now logout or reboot your system and login again. After logging in into the system, open a command line and type following command
ping test.dev

If ping is successful, then dev-tld-resolver is installed & configured correctly.

@Shipu
Copy link
Author

Shipu commented Mar 30, 2018

@Shipu
Copy link
Author

Shipu commented Apr 15, 2018

GoLang:
change go-1.10 to your go lang version. To find your install version you can check to run snap info go in terminal .

echo 'export PATH=/usr/lib/go-1.10/bin/:$PATH' >> ~/.zshrc
source ~/.zshrc
go version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment