Setup Ubuntu 16.04 LTS on an Amazon Lightsail instance

Get ready for things you may want to do afterward.

Below softwares are not installed by default.

  • C Compiler
  • Java and other interpreter languages
  • Upstart
  • Apache, Nginx
  • Docker
  • Emacs

Install Compiler and dev libraries

sudo apt-get install build-essential zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev libssl-dev

Install programming languages

Install anyenv

Follow the instruction below

https://github.com/riywo/anyenv

Install Python, Ruby, Node.js

Install Python

anyenv install pyenv 
exec $SHELL -l
pyenv install -l # to find the latest version
pyenv install 3.6.0 # and install the found one
pyenv global 3.6.0

Install Ruby

anyenv install rbenv
exec $SHELL -l
rbenv install -l # to find the latest version
rbenv install 2.3.3 # and install the found one
rbenv global 2.3.3

Install Node.js

anyenv install ndenv
exec $SHELL -l
ndenv install -l # to find the latest version
ndenv install 7.3.0 # and install the found one
ndenv global 7.3.0

Install JDK

sudo apt-get install default-jdk

Install Docker

Follow the instruction below,

https://docs.docker.com/engine/installation/linux/ubuntulinux/#/install-the-latest-version

Install Docker Compose

pip install docker-compose

If you use docker-compose from non-root account(Username: ubuntu for lightsail Ubuntu VPS), do not forget to add the user(ubuntu) to docker group.

Install and Run Nginx

There is an option to run Nginx

  • Setup and run Nginx inside Ubuntu
  • Setup and run Nginx inside Docker container

I installed docker and docker-compose already, and it is usually a better option to run a service inside a container since it is easier to do the same on other server(s) in this cloud age.

You can run the same service(with the same configuration) on Linux/macOS/Windows, using docker, and it easily scales, too.

Run Nginx from docker command

$ docker run --name some-nginx -v /some/content:/usr/share/nginx/html:ro -d nginx

For more details, please refer to,https://hub.docker.com/_/nginx/

Run Nginx from docker-compose

Prepare a docker-compose.yml file, then run docker-compose up -d


version: '2'
services:
 nginx:
   image: nginx
   ports:
   - "80:80"
   volumes:
   - /usr/share/nginx/html:/usr/share/nginx/html:ro
 
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s