004 Ubuntu上安装truffle

truffle的网址:http://truffleframework.com/

1、安装条件

需要安装Nodejs5以上版本,安装请参考之前文章, http://blog.csdn.net/zxs9999/article/details/79029044

切换到root用户执行以下命令。

NodeJS 5.0+ recommended.

2、安装truffle

切换到root用户下执行以下命令

npm install -g truffle
运行结果

root@jack:~# npm install -g truffle
/usr/lib/nodejs/node-v9.3.0/bin/truffle -> /usr/lib/nodejs/node-v9.3.0/lib/node_modules/truffle/build/cli.bundled.js
+ [email protected]
updated 1 package in 14.889s
测试安装成功
root@jack:~# truffle --version
Truffle v4.0.4 - a development framework for Ethereum

Usage: truffle  [options]

Commands:
  init      Initialize new Ethereum project with example contracts and tests
  compile   Compile contract source files
  migrate   Run migrations to deploy contracts
  deploy    (alias for migrate)
  build     Execute build pipeline (if configuration present)
  test      Run Mocha and Solidity tests
  debug     Interactively debug any transaction on the blockchain (experimental)
  opcode    Print the compiled opcodes for a given contract
  console   Run a console with contract abstractions and commands available
  develop   Open a console with a local TestRPC
  create    Helper to create new contracts, migrations and tests
  install   Install a package from the Ethereum Package Registry
  publish   Publish a package to the Ethereum Package Registry
  networks  Show addresses for deployed contracts on each network
  watch     Watch filesystem for changes and rebuild the project automatically
  serve     Serve the build directory on localhost and watch for changes
  exec      Execute a JS module within this Truffle environment
  unbox     Unbox Truffle project
  version   Show version number and exit

See more at http://truffleframework.com/docs

3、创建新项目

mkdir myproject
cd myproject
truffle init
        生成目录结构说明

contracts/:  合同目录
migrations/: 可编写脚本的部署文件目录
test/:       用于测试的应用程序和合同的测试文件目录
truffle.js: Truffle配置文件
4、通过unbox下载项目

mkdir MetaCoin
cd MetaCoin
truffle unbox metacoin





你可能感兴趣的:(004 Ubuntu上安装truffle)