Skip to content

Instantly share code, notes, and snippets.

@johnrees
Last active November 29, 2021 01:42
Show Gist options
  • Select an option

  • Save johnrees/1985879 to your computer and use it in GitHub Desktop.

Select an option

Save johnrees/1985879 to your computer and use it in GitHub Desktop.

Revisions

  1. johnrees revised this gist Mar 26, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion _ubuntu_steps.sh
    Original file line number Diff line number Diff line change
    @@ -9,7 +9,7 @@ echo 'export LC_ALL="en_US.UTF-8"' >> ~/.bashrc
    source ~/.bashrc

    # Install Rails Requirements
    sudo apt-get install build-essential zlib1g-dev curl git-core python-software-properties libssl-dev openssl libreadline-dev -y
    sudo apt-get install build-essential zlib1g-dev curl git-core python-software-properties software-properties-common libssl-dev openssl libreadline-dev -y
    # useful extras: libgeoip-dev

    # Add Deployment User
  2. johnrees revised this gist Mar 25, 2017. No changes.
  3. johnrees revised this gist Mar 25, 2017. 3 changed files with 6 additions and 6 deletions.
    2 changes: 1 addition & 1 deletion node.sh
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    # Install Node
    curl -sL https://deb.nodesource.com/setup | sudo bash -
    curl -sL https://deb.nodesource.com/setup_6.x | sudo bash -
    sudo apt-get update -y
    sudo apt-get install nodejs -y
    4 changes: 2 additions & 2 deletions postgres.sh
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,8 @@
    # Install Postgres 9.4
    # Install Postgres 9.6
    sudo sh -c "echo 'deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main' > /etc/apt/sources.list.d/pgdg.list"
    wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add -
    sudo apt-get update -y --fix-missing
    sudo apt-get install -y libpq-dev postgresql-9.4
    sudo apt-get install -y libpq-dev postgresql-9.6

    sudo -u postgres psql
    \password # enter a root user password
    6 changes: 3 additions & 3 deletions ruby.sh
    Original file line number Diff line number Diff line change
    @@ -5,12 +5,12 @@ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.profile
    echo 'eval "$(rbenv init -)"' >> ~/.profile
    exec $SHELL -l

    # Install Ruby 2.2.2
    # Install Ruby 2.4.1
    git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
    rbenv rehash
    rbenv install 2.2.2
    rbenv install 2.4.1
    # ^ go and get a coffee, rbenv install takes a while
    rbenv global 2.2.2
    rbenv global 2.4.1

    # Check installation went OK
    ruby -v
  4. johnrees revised this gist Dec 10, 2015. 1 changed file with 13 additions and 5 deletions.
    18 changes: 13 additions & 5 deletions letsencrypt_nginx.sh
    Original file line number Diff line number Diff line change
    @@ -2,11 +2,19 @@ git clone https://github.com/letsencrypt/letsencrypt
    cd letsencrypt
    ./letsencrypt-auto certonly

    # edit nginx conf
    listen 443 ssl;
    server_name youdomain.com;
    ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem;
    ssl_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem;
    # edit nginx conf (e.g. /etc/nginx/sites-enabled/default)
    server {
    listen 443 ssl;
    server_name YOURDOMAIN.COM;
    ssl_certificate_key /etc/letsencrypt/live/YOURDOMAIN.COM/privkey.pem;
    ssl_certificate /etc/letsencrypt/live/YOURDOMAIN.COM/fullchain.pem;

    # root /var/www/html;
    # index index.html index.htm index.nginx-debian.html;
    # location / {
    # try_files $uri $uri/ =404;
    # }
    }

    # every 90 days
    ./letsencrypt-auto certonly
  5. johnrees revised this gist Dec 10, 2015. 1 changed file with 12 additions and 0 deletions.
    12 changes: 12 additions & 0 deletions letsencrypt_nginx.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    git clone https://github.com/letsencrypt/letsencrypt
    cd letsencrypt
    ./letsencrypt-auto certonly

    # edit nginx conf
    listen 443 ssl;
    server_name youdomain.com;
    ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem;
    ssl_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem;

    # every 90 days
    ./letsencrypt-auto certonly
  6. johnrees revised this gist Nov 21, 2015. 3 changed files with 9 additions and 13 deletions.
    13 changes: 0 additions & 13 deletions ubuntu_steps.sh → _ubuntu_steps.sh
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,4 @@
    # As root user

    sudo su

    # Update the OS
    @@ -13,18 +12,6 @@ source ~/.bashrc
    sudo apt-get install build-essential zlib1g-dev curl git-core python-software-properties libssl-dev openssl libreadline-dev -y
    # useful extras: libgeoip-dev

    # Install latest stable Nginx
    sudo add-apt-repository ppa:nginx/stable
    sudo apt-get update -y

    sudo apt-get install nginx -y
    service nginx restart

    # Install Node
    curl -sL https://deb.nodesource.com/setup | sudo bash -
    sudo apt-get update -y
    sudo apt-get install nodejs -y

    # Add Deployment User
    groupadd admin
    adduser deployer --ingroup admin
    5 changes: 5 additions & 0 deletions nginx.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    # Install latest stable Nginx
    sudo add-apt-repository ppa:nginx/stable
    sudo apt-get update -y
    sudo apt-get install nginx -y
    service nginx restart
    4 changes: 4 additions & 0 deletions node.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    # Install Node
    curl -sL https://deb.nodesource.com/setup | sudo bash -
    sudo apt-get update -y
    sudo apt-get install nodejs -y
  7. johnrees revised this gist Nov 21, 2015. 7 changed files with 49 additions and 56 deletions.
    3 changes: 3 additions & 0 deletions capistrano.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    # capistrano 3 (to run locally)
    cap production deploy:setup_config
    cap production deploy
    4 changes: 4 additions & 0 deletions java8.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    # java 8
    sudo apt-add-repository ppa:webupd8team/java
    sudo apt-get update
    sudo apt-get install oracle-java8-installer
    3 changes: 3 additions & 0 deletions mysql.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    sudo apt-get install mysql-server
    sudo mysql_install_db
    sudo mysql_secure_installation
    11 changes: 11 additions & 0 deletions postgres.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    # Install Postgres 9.4
    sudo sh -c "echo 'deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main' > /etc/apt/sources.list.d/pgdg.list"
    wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add -
    sudo apt-get update -y --fix-missing
    sudo apt-get install -y libpq-dev postgresql-9.4

    sudo -u postgres psql
    \password # enter a root user password
    create user <appname> with password 'secret';
    create database <appname>_production owner <appname>;
    \q
    21 changes: 21 additions & 0 deletions ruby.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@

    # Install rbenv
    git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
    echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.profile
    echo 'eval "$(rbenv init -)"' >> ~/.profile
    exec $SHELL -l

    # Install Ruby 2.2.2
    git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
    rbenv rehash
    rbenv install 2.2.2
    # ^ go and get a coffee, rbenv install takes a while
    rbenv global 2.2.2

    # Check installation went OK
    ruby -v

    # Install Bundler
    echo "gem: --no-ri --no-rdoc" > ~/.gemrc
    gem install bundler
    rbenv rehash
    56 changes: 0 additions & 56 deletions ubuntu_steps.sh
    Original file line number Diff line number Diff line change
    @@ -25,14 +25,6 @@ curl -sL https://deb.nodesource.com/setup | sudo bash -
    sudo apt-get update -y
    sudo apt-get install nodejs -y

    # Install Firewall
    apt-get install ufw -y
    ufw enable
    # enable ssh, either on default 22 or a port you change it to
    ufw allow 22
    # enable http etc...
    ufw allow 80

    # Add Deployment User
    groupadd admin
    adduser deployer --ingroup admin
    @@ -47,57 +39,9 @@ su deployer
    # Say hello to git (expect response: Permission denied (publickey).)
    ssh git@github.com

    # Install rbenv
    git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
    echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.profile
    echo 'eval "$(rbenv init -)"' >> ~/.profile
    exec $SHELL -l

    # Install Ruby 2.2.2
    git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
    rbenv rehash
    rbenv install 2.2.2
    # ^ go and get a coffee, rbenv install takes a while
    rbenv global 2.2.2

    # Check installation went OK
    ruby -v

    # Install Bundler
    echo "gem: --no-ri --no-rdoc" > ~/.gemrc
    gem install bundler
    rbenv rehash

    # ...
    # Install postgres, redis, varnish etc



    # Install Postgres 9.4
    sudo sh -c "echo 'deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main' > /etc/apt/sources.list.d/pgdg.list"
    wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add -
    sudo apt-get update -y --fix-missing
    sudo apt-get install -y libpq-dev postgresql-9.4

    sudo -u postgres psql
    \password # enter a root user password
    create user <appname> with password 'secret';
    create database <appname>_production owner <appname>;
    \q

    # generate ssh keys for github if private repo
    ssh-keygen -t rsa -b 4096 -C "YOUR_EMAIL"
    eval "$(ssh-agent -s)"
    ssh-add ~/.ssh/id_rsa
    cat ~/.ssh/id_rsa.pub # paste in https://github.com/settings/ssh
    ssh -T git@github.com

    # capistrano 3
    cap production deploy:setup_config
    cap production deploy


    # java 8
    sudo apt-add-repository ppa:webupd8team/java
    sudo apt-get update
    sudo apt-get install oracle-java8-installer
    7 changes: 7 additions & 0 deletions ufw.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    # Install Firewall
    apt-get install ufw -y
    ufw enable
    # enable ssh, either on default 22 or a port you change it to
    ufw allow 22
    # enable http etc...
    ufw allow 80
  8. johnrees revised this gist Nov 21, 2015. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions ubuntu_steps.sh
    Original file line number Diff line number Diff line change
    @@ -95,3 +95,9 @@ ssh -T git@github.com
    # capistrano 3
    cap production deploy:setup_config
    cap production deploy


    # java 8
    sudo apt-add-repository ppa:webupd8team/java
    sudo apt-get update
    sudo apt-get install oracle-java8-installer
  9. johnrees revised this gist May 29, 2015. 1 changed file with 11 additions and 0 deletions.
    11 changes: 11 additions & 0 deletions ubuntu_steps.sh
    Original file line number Diff line number Diff line change
    @@ -84,3 +84,14 @@ sudo -u postgres psql
    create user <appname> with password 'secret';
    create database <appname>_production owner <appname>;
    \q

    # generate ssh keys for github if private repo
    ssh-keygen -t rsa -b 4096 -C "YOUR_EMAIL"
    eval "$(ssh-agent -s)"
    ssh-add ~/.ssh/id_rsa
    cat ~/.ssh/id_rsa.pub # paste in https://github.com/settings/ssh
    ssh -T git@github.com

    # capistrano 3
    cap production deploy:setup_config
    cap production deploy
  10. johnrees revised this gist May 29, 2015. 1 changed file with 9 additions and 1 deletion.
    10 changes: 9 additions & 1 deletion ubuntu_steps.sh
    Original file line number Diff line number Diff line change
    @@ -71,8 +71,16 @@ rbenv rehash
    # ...
    # Install postgres, redis, varnish etc

    # postgres 9.4


    # Install Postgres 9.4
    sudo sh -c "echo 'deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main' > /etc/apt/sources.list.d/pgdg.list"
    wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add -
    sudo apt-get update -y --fix-missing
    sudo apt-get install -y libpq-dev postgresql-9.4

    sudo -u postgres psql
    \password # enter a root user password
    create user <appname> with password 'secret';
    create database <appname>_production owner <appname>;
    \q
  11. johnrees revised this gist May 29, 2015. 1 changed file with 19 additions and 10 deletions.
    29 changes: 19 additions & 10 deletions ubuntu_steps.sh
    Original file line number Diff line number Diff line change
    @@ -9,12 +9,16 @@ sudo apt-get update -y
    echo 'export LC_ALL="en_US.UTF-8"' >> ~/.bashrc
    source ~/.bashrc

    # Install Rails Requirements w/ NGINX & NODE repo
    sudo apt-get install build-essential zlib1g-dev curl git-core libgeoip-dev python-software-properties libssl-dev openssl libreadline-dev -y
    # Install Rails Requirements
    sudo apt-get install build-essential zlib1g-dev curl git-core python-software-properties libssl-dev openssl libreadline-dev -y
    # useful extras: libgeoip-dev

    # Install latest stable Nginx
    sudo add-apt-repository ppa:nginx/stable
    sudo apt-get update -y

    # Install Nginx
    sudo apt-get install nginx -y
    sudo service nginx restart
    service nginx restart

    # Install Node
    curl -sL https://deb.nodesource.com/setup | sudo bash -
    @@ -24,19 +28,23 @@ sudo apt-get install nodejs -y
    # Install Firewall
    apt-get install ufw -y
    ufw enable
    # enable ssh, either on default 22 or a port you change it to
    ufw allow 22
    # enable http etc...
    ufw allow 80

    # Add Deployment User
    groupadd admin
    adduser deployer --ingroup admin
    su deployer

    # logout
    # ssh-copy-id keys to server (brew install ssh-copy-id)
    # login as deployer
    # (logout)

    # brew install ssh-copy-id
    # ssh-copy-id deployer@SERVER_IP
    # ssh deployer@SERVER_IP

    # Say hello to git
    # Say hello to git (expect response: Permission denied (publickey).)
    ssh git@github.com

    # Install rbenv
    @@ -45,10 +53,11 @@ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.profile
    echo 'eval "$(rbenv init -)"' >> ~/.profile
    exec $SHELL -l

    # Install Ruby build
    # Install Ruby 2.2.2
    git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
    rbenv rehash
    rbenv install 2.2.2
    # ^ go and get a coffee, rbenv install takes a while
    rbenv global 2.2.2

    # Check installation went OK
    @@ -66,4 +75,4 @@ rbenv rehash
    sudo sh -c "echo 'deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main' > /etc/apt/sources.list.d/pgdg.list"
    wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add -
    sudo apt-get update -y --fix-missing
    sudo apt-get install -y libpq-dev postgresql-9.4
    sudo apt-get install -y libpq-dev postgresql-9.4
  12. johnrees revised this gist May 15, 2015. 1 changed file with 7 additions and 1 deletion.
    8 changes: 7 additions & 1 deletion ubuntu_steps.sh
    Original file line number Diff line number Diff line change
    @@ -60,4 +60,10 @@ gem install bundler
    rbenv rehash

    # ...
    # Install postgres, redis, varnish etc
    # Install postgres, redis, varnish etc

    # postgres 9.4
    sudo sh -c "echo 'deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main' > /etc/apt/sources.list.d/pgdg.list"
    wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add -
    sudo apt-get update -y --fix-missing
    sudo apt-get install -y libpq-dev postgresql-9.4
  13. johnrees revised this gist May 15, 2015. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions ubuntu_steps.sh
    Original file line number Diff line number Diff line change
    @@ -12,10 +12,11 @@ source ~/.bashrc
    # Install Rails Requirements w/ NGINX & NODE repo
    sudo apt-get install build-essential zlib1g-dev curl git-core libgeoip-dev python-software-properties libssl-dev openssl libreadline-dev -y

    # Add Nginx and Node
    # Install Nginx
    sudo apt-get install nginx -y
    sudo service nginx restart

    # Install Node
    curl -sL https://deb.nodesource.com/setup | sudo bash -
    sudo apt-get update -y
    sudo apt-get install nodejs -y
    @@ -32,7 +33,7 @@ adduser deployer --ingroup admin
    su deployer

    # logout
    # ssh-copy-id keys to server
    # ssh-copy-id keys to server (brew install ssh-copy-id)
    # login as deployer

    # Say hello to git
    @@ -54,8 +55,7 @@ rbenv global 2.2.2
    ruby -v

    # Install Bundler
    vim ~/.gemrc
    gem: --no-ri --no-rdoc
    echo "gem: --no-ri --no-rdoc" > ~/.gemrc
    gem install bundler
    rbenv rehash

  14. johnrees revised this gist May 15, 2015. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions ubuntu_steps.sh
    Original file line number Diff line number Diff line change
    @@ -47,8 +47,8 @@ exec $SHELL -l
    # Install Ruby build
    git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
    rbenv rehash
    rbenv install 2.0.0-p247
    rbenv global 2.0.0-p247
    rbenv install 2.2.2
    rbenv global 2.2.2

    # Check installation went OK
    ruby -v
  15. johnrees revised this gist May 15, 2015. 1 changed file with 7 additions and 6 deletions.
    13 changes: 7 additions & 6 deletions ubuntu_steps.sh
    Original file line number Diff line number Diff line change
    @@ -3,22 +3,23 @@
    sudo su

    # Update the OS
    apt-get update -y
    sudo apt-get update -y

    # Add this to ~/.bashrc to remove timezone warnings
    echo 'export LC_ALL="en_US.UTF-8"' >> ~/.bashrc
    source ~/.bashrc

    # Install Rails Requirements w/ NGINX & NODE repo
    apt-get install build-essential zlib1g-dev curl git-core libgeoip-dev python-software-properties libssl-dev openssl libreadline-dev -y
    sudo apt-get install build-essential zlib1g-dev curl git-core libgeoip-dev python-software-properties libssl-dev openssl libreadline-dev -y

    # Add Nginx and Node
    add-apt-repository ppa:nginx/stable
    add-apt-repository ppa:chris-lea/node.js
    apt-get update
    apt-get install nginx nodejs -y
    sudo apt-get install nginx -y
    sudo service nginx restart

    curl -sL https://deb.nodesource.com/setup | sudo bash -
    sudo apt-get update -y
    sudo apt-get install nodejs -y

    # Install Firewall
    apt-get install ufw -y
    ufw enable
  16. johnrees revised this gist Dec 5, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ubuntu_steps.sh
    Original file line number Diff line number Diff line change
    @@ -6,7 +6,7 @@ sudo su
    apt-get update -y

    # Add this to ~/.bashrc to remove timezone warnings
    export LC_ALL="en_US.UTF-8"
    echo 'export LC_ALL="en_US.UTF-8"' >> ~/.bashrc
    source ~/.bashrc

    # Install Rails Requirements w/ NGINX & NODE repo
  17. johnrees revised this gist Sep 6, 2013. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions ubuntu_steps.sh
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,6 @@ sudo su

    # Update the OS
    apt-get update -y
    apt-get upgrade -y

    # Add this to ~/.bashrc to remove timezone warnings
    export LC_ALL="en_US.UTF-8"
    @@ -60,4 +59,4 @@ gem install bundler
    rbenv rehash

    # ...
    # Install postgres etc
    # Install postgres, redis, varnish etc
  18. johnrees revised this gist Aug 11, 2013. 1 changed file with 3 additions and 2 deletions.
    5 changes: 3 additions & 2 deletions ubuntu_steps.sh
    Original file line number Diff line number Diff line change
    @@ -6,8 +6,9 @@ sudo su
    apt-get update -y
    apt-get upgrade -y

    # Setup TimeZone
    dpkg-reconfigure tzdata
    # Add this to ~/.bashrc to remove timezone warnings
    export LC_ALL="en_US.UTF-8"
    source ~/.bashrc

    # Install Rails Requirements w/ NGINX & NODE repo
    apt-get install build-essential zlib1g-dev curl git-core libgeoip-dev python-software-properties libssl-dev openssl libreadline-dev -y
  19. johnrees revised this gist Aug 5, 2013. 1 changed file with 9 additions and 6 deletions.
    15 changes: 9 additions & 6 deletions ubuntu_steps.sh
    Original file line number Diff line number Diff line change
    @@ -4,17 +4,15 @@ sudo su

    # Update the OS
    apt-get update -y
    apt-get dist-upgrade -y
    apt-get upgrade -y

    # Setup Hostname & TimeZone
    echo "{{HOSTNAME}}" > /etc/hostname
    hostname -F /etc/hostname
    # Setup TimeZone
    dpkg-reconfigure tzdata

    # Install Rails Requirements w/ NGINX & NODE repo
    apt-get install build-essential zlib1g-dev curl git-core libgeoip-dev python-software-properties libssl-dev openssl libreadline-dev -y

    # Add Nginx and Node
    add-apt-repository ppa:nginx/stable
    add-apt-repository ppa:chris-lea/node.js
    apt-get update
    @@ -32,9 +30,11 @@ groupadd admin
    adduser deployer --ingroup admin
    su deployer

    # logout
    # ssh-copy-id keys to server
    # login as deployer

    # Setup GIT
    # Say hello to git
    ssh git@github.com

    # Install rbenv
    @@ -56,4 +56,7 @@ ruby -v
    vim ~/.gemrc
    gem: --no-ri --no-rdoc
    gem install bundler
    rbenv rehash
    rbenv rehash

    # ...
    # Install postgres etc
  20. johnrees revised this gist Aug 4, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ubuntu_steps.sh
    Original file line number Diff line number Diff line change
    @@ -13,7 +13,7 @@ hostname -F /etc/hostname
    dpkg-reconfigure tzdata

    # Install Rails Requirements w/ NGINX & NODE repo
    apt-get install build-essential zlib1g-dev curl git-core libgeoip-dev python-software-properties -y
    apt-get install build-essential zlib1g-dev curl git-core libgeoip-dev python-software-properties libssl-dev openssl libreadline-dev -y

    add-apt-repository ppa:nginx/stable
    add-apt-repository ppa:chris-lea/node.js
  21. johnrees revised this gist Aug 4, 2013. 1 changed file with 13 additions and 18 deletions.
    31 changes: 13 additions & 18 deletions ubuntu_steps.sh
    Original file line number Diff line number Diff line change
    @@ -12,11 +12,8 @@ echo "{{HOSTNAME}}" > /etc/hostname
    hostname -F /etc/hostname
    dpkg-reconfigure tzdata

    # Install Rails Requirements
    apt-get install build-essential zlib1g-dev curl git-core libgeoip-dev -y

    # Install NGINX & NODE
    apt-get install python-software-properties -y
    # Install Rails Requirements w/ NGINX & NODE repo
    apt-get install build-essential zlib1g-dev curl git-core libgeoip-dev python-software-properties -y

    add-apt-repository ppa:nginx/stable
    add-apt-repository ppa:chris-lea/node.js
    @@ -40,19 +37,17 @@ su deployer
    # Setup GIT
    ssh git@github.com

    # Install Ruby (RBENV) as per http://bit.ly/yr6Sw6
    curl -L https://raw.github.com/fesplugas/rbenv-installer/master/bin/rbenv-installer | bash
    vi ~/.bash_profile
    export RBENV_ROOT="${HOME}/.rbenv"
    if [ -d "${RBENV_ROOT}" ]; then
    export PATH="${RBENV_ROOT}/bin:${PATH}"
    eval "$(rbenv init -)"
    fi
    alias b='bundle exec'
    source ~/.bash_profile
    rbenv bootstrap-ubuntu-12-04
    rbenv install 1.9.3-p327
    rbenv global 1.9.3-p327
    # Install rbenv
    git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
    echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.profile
    echo 'eval "$(rbenv init -)"' >> ~/.profile
    exec $SHELL -l

    # Install Ruby build
    git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
    rbenv rehash
    rbenv install 2.0.0-p247
    rbenv global 2.0.0-p247

    # Check installation went OK
    ruby -v
  22. johnrees revised this gist Dec 10, 2012. 1 changed file with 5 additions and 4 deletions.
    9 changes: 5 additions & 4 deletions ubuntu_steps.sh
    Original file line number Diff line number Diff line change
    @@ -43,15 +43,16 @@ ssh git@github.com
    # Install Ruby (RBENV) as per http://bit.ly/yr6Sw6
    curl -L https://raw.github.com/fesplugas/rbenv-installer/master/bin/rbenv-installer | bash
    vi ~/.bash_profile
    if [[ -d $HOME/.rbenv ]]; then
    export PATH="$HOME/.rbenv/bin:$PATH"
    export RBENV_ROOT="${HOME}/.rbenv"
    if [ -d "${RBENV_ROOT}" ]; then
    export PATH="${RBENV_ROOT}/bin:${PATH}"
    eval "$(rbenv init -)"
    fi
    alias b='bundle exec'
    source ~/.bash_profile
    rbenv bootstrap-ubuntu-12-04
    rbenv install 1.9.3-p194
    rbenv global 1.9.3-p194
    rbenv install 1.9.3-p327
    rbenv global 1.9.3-p327

    # Check installation went OK
    ruby -v
  23. johnrees revised this gist Aug 28, 2012. 1 changed file with 18 additions and 17 deletions.
    35 changes: 18 additions & 17 deletions ubuntu_steps.sh
    Original file line number Diff line number Diff line change
    @@ -1,36 +1,37 @@
    # As root user

    sudo su

    # Update the OS
    apt-get update
    apt-get upgrade
    apt-get dist-upgrade
    apt-get update -y
    apt-get dist-upgrade -y
    apt-get upgrade -y

    # Setup Hostname & TimeZone
    echo "{{HOSTNAME}}" > /etc/hostname
    hostname -F /etc/hostname
    dpkg-reconfigure tzdata

    # Install Rails Requirements
    sudo apt-get install build-essential zlib1g-dev curl git-core libgeoip-dev
    apt-get install build-essential zlib1g-dev curl git-core libgeoip-dev -y

    # Install NGINX
    apt-get install python-software-properties
    add-apt-repository ppa:nginx/stable
    apt-get update
    apt-get install nginx
    sudo service nginx restart
    # Install NGINX & NODE
    apt-get install python-software-properties -y

    # Install NodeJS
    add-apt-repository ppa:nginx/stable
    add-apt-repository ppa:chris-lea/node.js
    apt-get update
    apt-get install nodejs
    apt-get install nginx nodejs -y
    sudo service nginx restart

    # Install Firewall
    apt-get install ufw
    apt-get install ufw -y
    ufw enable
    ufw allow 22
    ufw allow 80

    # Add Deployment User
    groupadd admin
    adduser deployer --ingroup admin
    su deployer

    @@ -48,9 +49,9 @@ vi ~/.bash_profile
    fi
    alias b='bundle exec'
    source ~/.bash_profile
    rbenv bootstrap-ubuntu-10-04
    rbenv install 1.9.3-p0
    rbenv global 1.9.3-p0
    rbenv bootstrap-ubuntu-12-04
    rbenv install 1.9.3-p194
    rbenv global 1.9.3-p194

    # Check installation went OK
    ruby -v
    @@ -59,4 +60,4 @@ ruby -v
    vim ~/.gemrc
    gem: --no-ri --no-rdoc
    gem install bundler
    rbenv rehash
    rbenv rehash
  24. johnrees revised this gist Jul 27, 2012. 1 changed file with 14 additions and 49 deletions.
    63 changes: 14 additions & 49 deletions ubuntu_steps.sh
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,8 @@
    # As root user
    # Update the OS
    sudo apt-get update
    sudo apt-get upgrade
    sudo apt-get dist-upgrade
    apt-get update
    apt-get upgrade
    apt-get dist-upgrade

    # Setup Hostname & TimeZone
    echo "{{HOSTNAME}}" > /etc/hostname
    @@ -13,16 +13,16 @@ dpkg-reconfigure tzdata
    sudo apt-get install build-essential zlib1g-dev curl git-core libgeoip-dev

    # Install NGINX
    sudo apt-get install python-software-properties
    sudo add-apt-repository ppa:nginx/stable
    sudo apt-get update
    sudo apt-get install nginx
    apt-get install python-software-properties
    add-apt-repository ppa:nginx/stable
    apt-get update
    apt-get install nginx
    sudo service nginx restart

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

    # Install Firewall
    apt-get install ufw
    @@ -31,38 +31,16 @@ ufw allow 22
    ufw allow 80

    # Add Deployment User
    useradd -m -g staff -s /bin/bash deploy
    passwd deploy
    sudo vim /etc/sudoers (add %staff ALL=(ALL) ALL)
    # Setup Public Key Access
    mkdir -p ~/.ssh
    exit
    scp ~/.ssh/id_rsa.pub deploy@{{SERVER_IP}}:.ssh/authorized_keys2
    adduser deployer --ingroup admin
    su deployer

    # edit sshd_config to have the following settings
    sudo vi /etc/ssh/sshd_config
    RSAAuthentication yes
    PubkeyAuthentication yes
    ChallengeResponseAuthentication no
    PasswordAuthentication no
    UsePAM no
    PermitRootLogin no

    # reload your ssh settings
    sudo /etc/init.d/ssh reload

    # Connect as Deployment User
    ssh deploy@{{SERVER_IP}}
    # ssh-copy-id keys to server

    # Setup GIT
    ssh-keygen -t rsa
    cat ~/.ssh/id_rsa.pub # copy this output and paste in your github keys
    ssh git@github.com
    git config --global user.name "{{YOUR NAME}}"
    git config --global user.email "{{YOUR EMAIL}}"

    # Install Ruby (RBENV) as per http://bit.ly/yr6Sw6
    sudo curl -L https://raw.github.com/fesplugas/rbenv-installer/master/bin/rbenv-installer | bash
    curl -L https://raw.github.com/fesplugas/rbenv-installer/master/bin/rbenv-installer | bash
    vi ~/.bash_profile
    if [[ -d $HOME/.rbenv ]]; then
    export PATH="$HOME/.rbenv/bin:$PATH"
    @@ -82,16 +60,3 @@ vim ~/.gemrc
    gem: --no-ri --no-rdoc
    gem install bundler
    rbenv rehash

    # TODO add Varnish cache, mod GeoIP, *SQL, nginx settings (la $HOME/$APP/current/config/nginx.conf), unicorn settings (la $HOME/$APP/current/config/unicorn.rb), monit

    # NB mongo goes onto two seperate 64bit 11.* boxes as a replicated set

    # REDIS
    # # /etc/apt/sources.list
    # deb http://packages.dotdeb.org stable all
    # deb-src http://packages.dotdeb.org stable all
    # wget http://www.dotdeb.org/dotdeb.gpg
    # cat dotdeb.gpg | sudo apt-key add -
    # sudo aptitude update
    # sudo aptitude install redis-server
  25. johnrees revised this gist Mar 8, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ubuntu_steps.sh
    Original file line number Diff line number Diff line change
    @@ -81,7 +81,7 @@ ruby -v
    vim ~/.gemrc
    gem: --no-ri --no-rdoc
    gem install bundler

    rbenv rehash

    # TODO add Varnish cache, mod GeoIP, *SQL, nginx settings (la $HOME/$APP/current/config/nginx.conf), unicorn settings (la $HOME/$APP/current/config/unicorn.rb), monit

  26. johnrees revised this gist Mar 7, 2012. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions ubuntu_steps.sh
    Original file line number Diff line number Diff line change
    @@ -69,6 +69,7 @@ vi ~/.bash_profile
    eval "$(rbenv init -)"
    fi
    alias b='bundle exec'
    source ~/.bash_profile
    rbenv bootstrap-ubuntu-10-04
    rbenv install 1.9.3-p0
    rbenv global 1.9.3-p0
  27. johnrees revised this gist Mar 6, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ubuntu_steps.sh
    Original file line number Diff line number Diff line change
    @@ -82,7 +82,7 @@ vim ~/.gemrc
    gem install bundler


    # TODO add Varnish, mod GeoIP, *sql, nginx settings, unicorn settings
    # TODO add Varnish cache, mod GeoIP, *SQL, nginx settings (la $HOME/$APP/current/config/nginx.conf), unicorn settings (la $HOME/$APP/current/config/unicorn.rb), monit

    # NB mongo goes onto two seperate 64bit 11.* boxes as a replicated set

  28. johnrees created this gist Mar 6, 2012.
    96 changes: 96 additions & 0 deletions ubuntu_steps.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,96 @@
    # As root user
    # Update the OS
    sudo apt-get update
    sudo apt-get upgrade
    sudo apt-get dist-upgrade

    # Setup Hostname & TimeZone
    echo "{{HOSTNAME}}" > /etc/hostname
    hostname -F /etc/hostname
    dpkg-reconfigure tzdata

    # Install Rails Requirements
    sudo apt-get install build-essential zlib1g-dev curl git-core libgeoip-dev

    # Install NGINX
    sudo apt-get install python-software-properties
    sudo add-apt-repository ppa:nginx/stable
    sudo apt-get update
    sudo apt-get install nginx
    sudo service nginx restart

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

    # Install Firewall
    apt-get install ufw
    ufw enable
    ufw allow 22
    ufw allow 80

    # Add Deployment User
    useradd -m -g staff -s /bin/bash deploy
    passwd deploy
    sudo vim /etc/sudoers (add %staff ALL=(ALL) ALL)
    # Setup Public Key Access
    mkdir -p ~/.ssh
    exit
    scp ~/.ssh/id_rsa.pub deploy@{{SERVER_IP}}:.ssh/authorized_keys2

    # edit sshd_config to have the following settings
    sudo vi /etc/ssh/sshd_config
    RSAAuthentication yes
    PubkeyAuthentication yes
    ChallengeResponseAuthentication no
    PasswordAuthentication no
    UsePAM no
    PermitRootLogin no

    # reload your ssh settings
    sudo /etc/init.d/ssh reload

    # Connect as Deployment User
    ssh deploy@{{SERVER_IP}}

    # Setup GIT
    ssh-keygen -t rsa
    cat ~/.ssh/id_rsa.pub # copy this output and paste in your github keys
    ssh git@github.com
    git config --global user.name "{{YOUR NAME}}"
    git config --global user.email "{{YOUR EMAIL}}"

    # Install Ruby (RBENV) as per http://bit.ly/yr6Sw6
    sudo curl -L https://raw.github.com/fesplugas/rbenv-installer/master/bin/rbenv-installer | bash
    vi ~/.bash_profile
    if [[ -d $HOME/.rbenv ]]; then
    export PATH="$HOME/.rbenv/bin:$PATH"
    eval "$(rbenv init -)"
    fi
    alias b='bundle exec'
    rbenv bootstrap-ubuntu-10-04
    rbenv install 1.9.3-p0
    rbenv global 1.9.3-p0

    # Check installation went OK
    ruby -v

    # Install Bundler
    vim ~/.gemrc
    gem: --no-ri --no-rdoc
    gem install bundler


    # TODO add Varnish, mod GeoIP, *sql, nginx settings, unicorn settings

    # NB mongo goes onto two seperate 64bit 11.* boxes as a replicated set

    # REDIS
    # # /etc/apt/sources.list
    # deb http://packages.dotdeb.org stable all
    # deb-src http://packages.dotdeb.org stable all
    # wget http://www.dotdeb.org/dotdeb.gpg
    # cat dotdeb.gpg | sudo apt-key add -
    # sudo aptitude update
    # sudo aptitude install redis-server