devb logo reorder
view_headline

Devb Papers

Installations and Setups

AWS Bitnami Ready and Local Linux Setups

A lot of folks asked us on how to get their Laptops ready for Ubuntu 16.04 LTS. Here's a representative list.

Unless specified, the installs should work for both Xenial 16.04 (LTS) and Trusty 14.04 (LTS). I have not tried their Yakkety 16.10 and Zesty 17.04 versions yet.

Open a Terminal Window and add the necessary software:

assignment_turned_inInstall Chromium

Please check out the Chromium website - https://www.chromium.org/

sudo apt-get update
sudo apt-get install chromium-browserls

assignment_turned_inWine for Ubuntu 16.04

Wine (originally an acronym for "Wine Is Not an Emulator") is a compatibility layer capable of running Windows applications on several POSIX-compliant operating systems, such as Linux, Mac-OS and BSD. Instead of simulating internal Windows logic like a virtual machine or emulator, Wine translates Windows API calls into POSIX calls on-the-fly, eliminating the performance and memory penalties of other methods and allowing you to cleanly integrate Windows applications into your desktop. CrossOver is a polished version of Wine provided by CodeWeavers. CrossOver makes it easier to use Wine and CodeWeavers provides excellent technical support to its users. All purchases of CrossOver are used to directly fund the developers working on Wine. So CrossOver is both a great way to get support in using Wine and to support the Wine Project.

Please check the following websites - https://www.winehq.org/ and https://www.codeweavers.com/products/crossover-linux/

sudo add-apt-repository ppa:wine/wine-builds
sudo dpkg --add-architecture i386

assignment_turned_inGCC Install

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-4.9

assignment_turned_inJava and Eclipse

sudo apt-get install openjdk-8-jdk

assignment_turned_inDownload Eclipse Oxygen

Please check out the Eclipse website for additional information - http://www.eclipse.org/

sudo mv eclipse-inst-linux64.tar.gz /opt
cd /opt
sudo tar -xvf eclipse-inst-linux64.tar.gz
sudo gedit /usr/share/applications/eclipse.desktop
cd eclipse-installer
./eclipse-inst

assignment_turned_inSetting up Cinnamon

The Cinnamon desktop environment is based on the GTK+ 3 toolkit and was first released in 2011 having started as a fork of the GNOME Shell; it has come to be one of the most popular desktop environments in the Linux world. The desktop environment has a simple UI with small icons by default. Its applications menu is different from that of Ubuntu’s Unity in that it has all the applications categorized and displayed when you hover over the major categories.

sudo add-apt-repository ppa:embrosyn/cinnamon
sudo apt-get update
sudo apt-get install cinnamon

assignment_turned_inNode-Red amd Node-JS Installation

Node-JS 8

Node-RED is a programming tool for wiring together hardware devices, APIs and online services in new and interesting ways. It provides a browser-based editor that makes it easy to wire together flows using the wide range of nodes in the palette that can be deployed to its run-time in a single-click.

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs
sudo npm install -g --unsafe-perm node-red
sudo npm install -g node-red-contrib-python-function

assignment_turned_inInstalling PIP and PIP3

Python is a programming language that lets you work quickly and integrate systems more effectively. If you do not have Python installed and you are considering using it, heres a good place to start. https://wiki.python.org/moin/Python2orPython3 . Ubuntu comes bundled with Python. The installation is more on the auxiliaries.

sudo apt install python-pip
sudo apt install python3-pip
pip install --upgrade pip

assignment_turned_inInstall Flask

Flask is a microframework for Python based on Werkzeug and Jinja 2 to create REST services. It has a built in development server and debugger.

sudo pip3 install flask

assignment_turned_inVisual Studio Code (Debian)

Visual Studio Code is a lightweight but powerful source code editor which runs on your desktop and is available for Windows, Mac-OS and Linux. It comes with built-in support for JavaScript, TypeScript and Node.js and has a rich ecosystem of extensions for other languages (such as C++, C#, Python, PHP, Go) and runtimes (such as .NET and Unity).

Download VSCode from https://code.visualstudio.com as a code editor of choice.

assignment_turned_inInstall Docker CE

Docker is a software container platform. Developers use Docker to eliminate “works on my machine” problems when collaborating on code with co-workers. Operators use Docker to run and manage apps side-by-side in isolated containers to get better compute density.

sudo apt-get remove docker docker-engine docker.io
sudo apt-get update
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88

sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
sudo apt-get update
sudo apt-get install docker-ce

apt-cache madison docker-ce

Test it

sudo docker run hello-world

assignment_turned_inInstalling Hyperledger Composer

Hyperledger is an open source collaborative effort created to advance cross-industry blockchain technologies. It is a global collaboration, hosted by The Linux Foundation, including leaders in finance, banking, IoT, supply chain, manufacturing and technology.

curl -O https://hyperledger.github.io/composer/prereqs-ubuntu.sh
chmod u+x prereqs-ubuntu.sh
./prereqs-ubuntu.sh

assignment_turned_inInstalling Hyperledger Composer development tools

npm install -g composer-cli
npm install -g generator-hyperledger-composer
npm install -g composer-rest-server
npm install -g yo

assignment_turned_inStarting Hyperledger Fabric

docker kill $(docker ps -q)
docker rm $(docker ps -aq)
docker rmi $(docker images dev-* -q)

In a directory of your choice (will assume ~/fabric-tools) get the zip file that contains the tools

mkdir ~/fabric-tools && cd ~/fabric-tools
curl -O https://raw.githubusercontent.com/hyperledger/composer-tools/master/packages/fabric-dev-servers/fabric-dev-servers.zip
unzip fabric-dev-servers.zip
or install from tar-gz
mkdir ~/fabric-tools && cd ~/fabric-tools
curl -O https://raw.githubusercontent.com/hyperledger/composer-tools/master/packages/fabric-dev-servers/fabric-dev-servers.tar.gz
tar xvzf fabric-dev-servers.tar.gz

export FABRIC_VERSION=hlfv0.6
export FABRIC_VERSION=hlfv1

A typical sequence for Hyperledger Composer use would be

cd ~/fabric-tools
./downloadFabric.sh
./startFabric.sh
./createComposerProfile.sh

Then at the end of your development session

cd ~/fabric-tools
./stopFabric.sh
./teardownFabric.sh

assignment_turned_inSetting up Hyperledger Fabric with Go Client on MacOS

$ export GOPATH=$HOME/go
$ export GOBIN=$HOME/go/bin
$ export PATH=$PATH:$GOBIN

$ brew install libtool

$ go get -u github.com/hyperledger/fabric-sdk-go
$ cd $GOPATH/src/github.com/hyperledger/fabric-sdk-go/
$ go get -x -u github.com/axw/gocov/...
$ go get -x -u github.com/AlekSi/gocov-xml
$ go get -x -u github.com/client9/misspell/cmd/misspell
$ go get -x -u github.com/golang/lint/golint
$ go get -x -u golang.org/x/tools/cmd/goimports
$ go get -x -u github.com/golang/mock/mockgen
$ go get -x -u github.com/golang/dep/cmd/dep

$ make depend-install

Hyperledger Composer Node-RED

npm install node-red-contrib-composer

npm makes it easy for JavaScript developers to share and reuse code, and it makes it easy to update the code that you're sharing. If you're using OS X or Windows, the best way to install Node.js is to use one of the installers from the Node.js download page. If you're using Linux, you can use the installer, or you can check NodeSource's binary distributions to see whether or not there's a more recent version that works with your system.

assignment_turned_inCheck NPM and Latest Node RED

npm install npm@latest -g
npm -v
sudo npm cache clean
sudo npm install -g --unsafe-perm node-red
cd ~/.node-red
npm outdated
npm update # to update all nodes, or
npm update foo

Flow-based programming for the Internet of Things

Install nodes

cd ~/.node-red
npm install node-red-contrib-composer
npm i node-red-node-serialport
npm install node-red-contrib-aws

npm install node-red-node-mysql
npm install node-red-node-weather-underground
npm install node-red-node-aws
npm install node-red-node-delicious
npm install node-red-node-google

Install Lerna

npm install -g lerna
lerna init
lerna bootstrap
lerna run test

assignment_turned_inMacOS Installation

Install using homebrew

brew install node

Check if npm and node are installed

npm -v
node -v

assignment_turned_inSetting up the AWS LightSail or EC2 Bitnami LAMP/Node Instance

Name-based Virtual Hosting

One of the big challenges with Apache 2.x is in configuring the server to manage multiple hosts.

There are many articles that describe this. You will also find documentation in httpd.apache.org. This article actually fixes the problems that we in Devb have encountered with 5-6 instances managing 10 domain names.

Here's what you need to do:

Change the bitnami.conf file $ sudo nano /opt/bitnami/apache2/conf/bitnami/bitnami.conf

When it opens in the nano editor, under <VirtualHost> section, ensure the ServerName is listed.

Example:

Listen 80
<VirtualHost _default_:80>
  ServerName www.naksya.com
  ServerAlias naksya.com *.naksya.com
  DocumentRoot "/opt/bitnami/apache2/htdocs/naksya"
</VirtualHost>

<VirtualHost _default_:80>
  ServerName www.devb.com
  ServerAlias devb.com *.devb.com
  DocumentRoot "/opt/bitnami/apache2/htdocs"
</VirtualHost>