How to install and execute Truffle on an Ubuntu 16.04


Install packages

First, update and install packages

sudo apt-get update && sudo apt-get -y upgrade
sudo apt-get -y install curl git vim build-essential

Install NodeJs

Install NodeJs to execute the DAPP

sudo apt-get install curl software-properties-common
curl -sL | sudo bash -
sudo apt-get install nodejs

Install Truffle

Install Truffle packages

sudo npm install -g truffle

Install testrpc

Testprc uses ethereumjs to simulate full client behavior and make developing Ethereum
Install testrpc

#  sudo npm install -g  ganache-cli
# ganache-cli

Create a project

Init Truffle project

# mkdir myproject
# cd myprojet/
# truffle init
# truffle compile

Deploy contracts

testrpc should be launched
Deploy contracts on local chain

# truffle migrate
Listening on localhost:8545
Transaction: 0xc1cbc63cd0644604bc41ebbd9bd9998ce14f5ae2b27cb2e2d3fc5ce823574e62
Contract created: 0xbbdef31b721512c7c9bc05a00e8c24fa4e15e1f6
Gas usage: 139321
Block Number: 0x01

And run migration
Running migration: 1_initial_migration.js
Deploying Migrations...
Migrations: 0xbbdef31b721512c7c9bc05a00e8c24fa4e15e1f6

Create DAPP

To build your frontend, run:

# truffle build
# truffle serve
Serving app on port 8080...
Completed without errors



DevOps/Cloud | 2x AWS Certified | Terraform | Gitlab

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store