Greengrass only supports Ubuntu Linux and AWS Linux, so we need an environment in which we can install the Linux OS.
Vagrant is a way to start a virtualized environment with just a few commands. First, we need to download Vagrant from https://www.vagrantup.com/downloads.html. We can then run the following script from the command console:
$ vagrant init ubuntu/xenial64
$ vagrant up
$ vagrant ssh
Vagrant will mount the current directory to the /vagrant directory so that we can easily access the greengrass directory and copy the contents to a local folder:
$ sudo cp -R /vagrant/greengrass /greengrass
We can now unpack our resources and runtime into a local folder, such as aws-greengrass-home. From Ubuntu's console, we need to run the following commands:
$ tar -zxvf *-setup.tar.gz
$ tar -zxvf greengrass-linux-x86-*.tar.gz
The next step is to configure the certificates and the configuration file, config.json:
$ cd /greengrass/certs/
$ sudo wget -O root.ca.pem http://www.symantec.com/content/en/us/enterprise/verisign/roots/VeriSign-Class%203-Public-Primary-Certification-Authority-G5.pem
$ cp root.ca.pem certs/
$ cp certs/* greengrass/certs/
$ cp config/* greengrass/config/
We also need to add the ggc group and the user. From command console, run the following commands:
$ sudo adduser --system ggc_user
$ sudo addgroup --system ggc_group
After that, we need to install Node.js 6.x on the device. From the command console, run the following commands:
$ curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
$ sudo apt-get install -y nodejs
$ sudo ln -s /usr/bin/node /usr/bin/nodejs6.10
Finally, we can start Greengrass with the following commands:
$ cd /greengrass/ggc/core
$ sudo ./greengrassd start