Ubuntu Boostrap

The mainframe & a few other projects are now on Ubuntu machines at Linode, a provider of cloud-hosting and a sponsor-of-podcasts-extraordinaire.

Linode provides comprehensive documentation for getting up & running on their (virtual) hardware, but since I’ll be going through this rigamarole a few times in the near future I figured it was best to have a relatively methodical approach… BEHOLD!

(The script probably contains a few things that you won’t need — PHP and Node — so please don’t copy & paste blindly.)

# https://www.linode.com/docs/security/use-public-key-authentication-with-ssh


mkdir -p ~/.ssh  sudo chmod -R 700 ~/.ssh/
# add node user
sudo adduser node
sudo adduser node sudo


# packages
sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install ruby
sudo apt-get install nodejs
sudo apt-get install npm
sudo apt-get install git
sudo apt-get install clang libicu-dev
sudo apt-get install libpython2.7
sudo apt-get install software-properties-common python-software-properties
sudo apt-get install openssl
sudo apt-get install memcached
sudo apt-get install letsencrypt
sudo apt-get install ufw
sudo apt-get install ack-grep
sudo apt-get install certbot
sudo apt install mailutils
apt-get install opendkim opendkim-tools postfix-policyd-spf-python
sudo apt-get install opendkim opendkim-tools


# profile
mkdir ~/Documents/
mkdir ~/Documents/git
cd ~/Documents/git
git clone https://github.com/davidfmiller/lsemoji.git
git clone https://github.com/davidfmiller/bin.git
git clone https://github.com/davidfmiller/configs.git


# python 
sudo apt-get install python-pip python-dev build-essential
sudo pip install --upgrade pip
sudo pip install Pygments
sudo pip install aws-shell
sudo pip install Pillow
sudo pip install sphinx sphinx-autobuild
sudo pip install recommonmark
sudo pip install pygments-markdown-lexer


# node
cd ~
wget http://nodejs.org/dist/latest-v7.x/node-v7.7.2-linux-x64.tar.gz
mkdir node
tar xvf node-v*.tar.?z --strip-components=1 -C ./node
cd ~
rm -rf node-v*
mkdir node/etc
echo prefix=/usr/local  node/etc/npmrc
sudo mv node /opt/
sudo chown -R root: /opt/node
sudo ln -s /opt/node/bin/node /usr/local/bin/node
sudo ln -s /opt/node/bin/npm /usr/local/bin/npm


npm install -g istanbul
sudo npm i grunt --global
sudo npm install -g pm2
sudo npm install -g snyk
sudo apt-get install nginx
sudo apt-get install nginx-extras
sudo service nginx restart


# yarn
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo deb https://dl.yarnpkg.com/debian/ stable main | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update  sudo apt-get install yarn


# mysql  php
sudo apt-get install mysql-server
sudo mysql_secure_installation
sudo apt-get install php


# ruby
sudo gem update --system
sudo apt-get install -y 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
sudo apt-get install -y libgdbm-dev libncurses5-dev automake libtool bison libffi-dev
curl -L https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
echo source ~/.rvm/scripts/rvm  ~/.bashrc
rvm install 2.3.1
rvm use 2.3.1 --default
ruby -v


# gems
sudo gem install sass
sudo gem install jekyll
sudo apt install ruby-compass


# firewall
sudo ufw allow 80
sudo ufw allow 443
sudo ufw allow ssh # remove this line if ssh keys have been setup
sudo ufw enable


# https://www.linode.com/docs/databases/mysql/install-mysql-on-ubuntu-14-04
# https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-on-ubuntu-12-04