Skip to content

Instantly share code, notes, and snippets.

@hbin
Last active December 21, 2022 13:36
Show Gist options
  • Save hbin/8170699 to your computer and use it in GitHub Desktop.
Save hbin/8170699 to your computer and use it in GitHub Desktop.
Bootstrap scripts

Bootstrap scripts

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install curl git-core python-software-properties

Firewall

sudo apt-get install ufw
sudo ufw enable
sudo ufw allow 22
sudo ufw allow 80

Add deployment user

sudo groupadd admin
sudo adduser deploy --ingroup admin

grant sudo privileges and sudo without password

sudo vim /etc/sudoers
deploy  ALL=(ALL) NOPASSWD: ALL     # Append to the bottom of the file

prevent login with password

sudo passwd -l deploy

dotfiles

curl https://raw.githubusercontent.com/hbin/dotfiles/master/install.sh | bash

ssh login

cat ~/.ssh/id_rsa.pub | ssh deploy@192.168.xxx.xxx 'cat >> ~/.ssh/authorized_keys'
ssh-add -l  # If don't see any keys listed, you can simply run ssh-add
ssh-add

ssh-add -L  # copy this line into a file ~/.ssh/authorized_keys, change this file to permision mode 0600, and the .ssh directory to be 0700.

chmod 700 .ssh
chmod 600 .ssh/authorized_keys

rbenv & Ruby

Ubuntu:

curl -fsSL https://github.com/rbenv/rbenv-installer/raw/master/bin/rbenv-installer | bash
rbenv bootstrap-ubuntu-12-04

Mac:

brew install rbenv

Ruby

rbenv install 2.5.0
rbenv global 2.5.0

gem install bundler --no-ri --no-rdoc

pyenv & Python

Ubuntu:

curl -L https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer | bash

Mac:

brew install pyenv

Python

pyenv install 2.7.9
pyenv global 2.7.9

Nodejs

Ubuntu(NVM):

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

source ~/.bashrc

nvm install v5.10.1
nvm alias default v5.10.1

Ubuntu(PPA):

sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs

Mac:

brew install nodejs

How to install PostgresSQL

Ubuntu(Old):

sudo apt-get install postgresql postgresql-contrib libpq-dev
sudo service postgresql start

Ubuntu(PPA):

sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
wget -q https://www.postgresql.org/media/keys/ACCC4CF8.asc -O - | sudo apt-key add -
sudo apt-get update
sudo apt-get install postgresql postgresql-contrib libpq-dev

Mac:

brew install postgresql
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist

https://www.digitalocean.com/community/tutorials/how-to-install-and-use-postgresql-on-ubuntu-14-04 https://www.digitalocean.com/community/tutorials/how-to-install-and-use-postgresql-on-ubuntu-12-04

How to install Redis

Ubuntu:

sudo apt-get install redis-server
sudo service redis-server start

Mac:

brew install redis
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.redis.plist

How to install Nginx

Ubuntu:

sudo apt-get install nginx

Ubuntu(PPA):

sudo add-apt-repository ppa:nginx/stable
sudo apt-get update
sudo apt-get install nginx

Mac:

brew install nginx

To reload nginx after an upgrade:

launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist

https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-ubuntu-14-04-lts

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