My steps for Linux Virtual Machine for running Go-Ethereum CLI + Ethereum.js + Chrome (Windows 7)

SilentCiceroSilentCicero Toronto, CAMember Posts: 159 ✭✭✭
edited February 2015 in Geth - Go Implementation
Here are my steps for setting up a VMWare Player 7/Ubuntu 14.04 32Bit Virtual Machine with Go-Ethereum/Ethereum.js/HTTpServer/Chrome (tested on Windows 7) working as of Wed, Feb 11, 2015. I had a tone of trouble getting all of this going, it all seems straight forward when you read the posts/comments, but its the little things that end up killing your time. This is not a guide for installing MIST proper, just Go Ethereum CLI and Ethereum.js. This guide is a combination of sources, comments and install guides. This guide is super extensive, so you may just want to use this as a resource rather than a guide if you kinda get the gist of installing Ubuntu and Go-Ethereum or working with HTML/JS files.

Step 1: Install VMWARE Player Trial from the VMWARE website ("Try for Free", then select the appropriate addition)
http://www.vmware.com/ca/en/products/player

Step 2: Download Ubuntu 14.04 32Bit LTS ISO (I used 32bit, as 64Bit had trouble with my64Bit Windows 7 OS)
http://www.ubuntu.com/download/desktop

Step 3: From KenK [5]
-Once VMware is downloaded open the file and follow the installation instructions. Run the program and select File> New and create a virtual machine. Choose to create it from a 'disc or image' and select the Ubuntu ISO you downloaded previoulsy. Choose install and setup your vm as you would like it. make sure you specify the VM has at least 2GB of memory or the build of alethzero will fail.
-You can modify the VM machines ram allocation by opening up VM machine settings and moving the ram up from 2GB to say 4GM.
-Once ubuntu is installed you will want to update your package manager. Open the terminal and type:
sudo apt-get update && sudo apt-get upgrade
-Now return to your host sytem and find the vmware window go to Virtual Machine > install VMWare tools. This will mount a cd containing files needed by linux to use the hosts sytems hardware and copy paste between your host system and your vm. Go back to your vm and navigate to the drive marked vmware tools extract the vmware tar ball to the desktop. Then return to the terminal and input:
cd Desktop/vmware-tools-distrib
sudo ./vmware-install.pl -d

Step 4: From KenK Again [5]
- Shutdown and take a snaphot of your vm to revert to later.
- **Note, you can take a snapshot by copying the Ubuntu directory in your Virtual Machines folder (found in My Documents) and naming it something else like "Ubuntu Backup 1". You should do this after every few steps just in case something goes wrong (although these backups are like 6 Gigs, so be moderate).
- Start-up your vm and you should now find that you can alter the size of the screen and copy paste between your host and the vm. If you cant google vmware tools and see if you can trouble shoot what went wrong. You now have the base to install the dependencies for Alethzero. Start by entering the below in the terminal:
sudo apt-get install build-essential g++-4.8 git cmake libgmp-dev
sudo apt-get install libboost-all-dev automake unzip libtool libleveldb-dev yasm libminiupnpc-dev
sudo apt-get install libreadline-dev scons libncurses5-dev qtbase5-dev qt5-default qtdeclarative5-dev
sudo apt-get install libqt5webkit5-dev
sudo apt-get install libcurl4-openssl-dev libjsoncpp-dev libargtable2-dev libboost-test-dev cmake

Step 5: Install Go, Make Go DIR and GO SRC/Github Folders and $GOPath, add $GOPATH and $GOROOT to $PATH in .bashrc
sudo apt-get install golang
mkdir -p ~/go; echo "export GOPATH=$HOME/go" >> ~/.bashrc
mkdir ~/go/src
mkdir ~/go/src/github.com
echo "export PATH=$PATH:$HOME/go/bin:/usr/local/go/bin" >> ~/.bashrc
source ~/.bashrc

Step 6: Check that Go is working (you should get something like "go version go1.2.1 linux/###")
go version

Step 7: Install GPM and Readline
sudo apt-get install -y libgmp3-dev libreadline6-dev

Step 8: Install some Go Imports that are Needed for Go Ethereum CLI
go get golang.org/x/crypto/pbkdf2
go get code.google.com/p/go-uuid/uuid
go get gopkg.in/fatih/set.v0

Step 9: Install Software Properties Common and PPA Ethereum and Ethereum DEV:
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ethereum/ethereum
sudo add-apt-repository ppa:ethereum/ethereum-dev
sudo apt-get update

Step 10: Clone Go-Ethereum "Develop" branch from Github and build/install just the CMD/Ethereum:
mkdir ~/go/src/github.com/ethereum
cd ~/go/src/github.com/ethereum
git clone https://github.com/ethereum/go-ethereum
cd go-ethereum
git checkout develop
cd cmd/ethereum
go build
go install
** Note, I did not do this step in this way (even though it should work in this way). I installed Go-Ethereum via "go get github.com/ethereum/go-ethereum", then I deleted the Ethereum build in the ~/go/bin folder and the Go-Ethereum work folder in ~/go/src/ethereum/go-ethereum and then did the steps above (minus the mkdir ethereum. You may need to do this if you get build errors making cmd/ethereum with go build or go install.
** once this step is done you should be able to do ethereum -rpc -mine, you can try this to see if its working, to shut it off just do CTRL+C.


Step 11: Install Chrome Web Browser Stable (follow the instructions)
**Note, Chrome should open up in Software Manager, Hit install.
https://www.google.com/intl/en-US/chrome/browser/


Step 12: Install NodeJS, NMP, NodeJS-Legacy
** Note, this will create a node_modules folder in the HOME dir.
sudo apt-get update
sudo apt-get install nodejs
sudo apt-get install npm
sudo apt-get install nodejs-legacy

Step 13: Get Ethereum.JS Files
npm install ethereum.js

Step 14: Open a new terminal and start a basic HTTP Server to serve the HTML files via python's SimpleHTTPServer
** Note, make sure you use a port like 9000 or something that is not the port of the JSON RPC Eth CLI server.
** This will start a basic HTTP Server in the Ethereum.js DIR, so that you can serve Ethereum.JS files
cd ~/node_modules/ethereum.js
python -m SimpleHTTPServer 9000

Step 15: Check to see if the basic HTTPServer is working, open up Chrome and type in the URL
http://localhost:9000
If you see a list of files, the local HTTPServer is working.

Step 16: Goto Ethereum.JS examples and Modify "balance.html" HTTPSync and JS Include File locations
cd ~/node_modules/ethereum.js/example/
gedit balance.html
** My JSON RPC server port was 8545
** This should open up GEdit (an text editing program), from here you need to modify a few locations.
Change this line:
<script type="text/javascript" src="js/bignumber.js/bignumber.min.js"></script>
To this:
<script type="text/javascript" src="../node_modules/bignumber.js/bignumber.min.js"></script>
and this line:
web3.setProvider(new web3.providers.HttpSyncProvider('http://localhost:8080'));
to this:
web3.setProvider(new web3.providers.HttpSyncProvider('http://localhost:8545')); // or what ever your JSON RPC port is
Once you have done that, hit "save" in GEdit
** Basically you are just setting the right (pre Ethereum.js build) dependency paths and HTTPSyncProvider locations (i.e. the right local port number). All JS files must include bignumber.min.js and ethereum.js.

Step 17: Open a new terminal and then start up the Go Ethereum CLI with JSON RPC and Mining On
ethereum -rpc -mine

Step 18: Open up "balance.html" in Chrome and check your balance
By opening http://localhost:9000/example/balance.html in Chrome and then clicking "watch balance" if you get something like "original balance: ### watching" then you are all setup for Ethereum.js/Go Ethereum on Ubuntu 14.04 VMWare on Windows 7 test net.


Cheers,
Hope this helps.
SC.

Sources/Resources:
1. https://github.com/ethereum/go-ethereum
2. https://github.com/ethereum/ethereum.js
3. Taylor Gerring. https://github.com/ethereum/go-ethereum/wiki/Installing-Go
4. Viorel Stirbu. https://github.com/ethereum/cpp-ethereum/wiki/Building-on-Ubuntu
5. @KenK. https://forum.ethereum.org/discussion/comment/6909/#Comment_6909
6. @StephanTual. https://forum.ethereum.org/discussion/305/go-code-build-faq#latest
7. Taylor Gerring. https://github.com/ethereum/go-ethereum/wiki/Instructions-for-getting-the-Go-implementation-of-Ethereum-and-the-Mist-browser-installed-on-Ubuntu-14.04-(trusty)
8. @wemeetagain; @Eicosapentaenoic. https://forum.ethereum.org/discussion/581/go-getting-specific-github-branch-of-go-ethereum-or-what-to-run-on-osx
Post edited by SilentCicero on

Comments

  • SilentCiceroSilentCicero Toronto, CAMember Posts: 159 ✭✭✭
    edited February 2015
    Apologies, went over the build again, there are a few extras I forgot.

    New Step 8:
    sudo apt-get install Mercurial
    go get -u golang.org/x/crypto/pbkdf2
    go get -u gopkg.in/fatih/set.v0
    go get -u github.com/syndtr/goleveldb/leveldb/iterator
    go get -u github.com/syndtr/gosnappy/snappy
    go get -u github.com/obscuren/otto
    go get -u code.google.com/p/go.net/websocket
    go get -u bitbucket.org/kardianos/osext
    go get -u github.com/ethereum/serpent-go
    go get -u github.com/rakyll/globalconf
    go get -u code.google.com/p/go.crypto/scrypt
    go get -u code.google.com/p/go.crypto/ripemd160
    go get -u code.google.com/p/go-uuid/uuid
    go get -u github.com/obscuren/ecies
    go get -u github.com/jackpal/go-nat-pmp
    Post edited by SilentCicero on
  • taramanictaramanic Member Posts: 24
    Thank you very much for sharing this @SilentCicero, this is very helpful.
  • fit949fit949 Member Posts: 1
    Thank you for this informative guide. I have a question I do not see any graphic drivers installed Catalyst or Nvidia.
  • Crypt1xCrypt1x The BlockchainMember Posts: 52
    Excellent job although I do not have tested the guide myself.
  • bmkrishbmkrish Member Posts: 14
    Hi ,
    I 'm using windows7 and installed in the windows itself .
    1.Run the geth --rpc --rpcport 8545 rpccorsdomain="*"
    2.Run the ethereum.js>python -m http.server 9000
    3.Listed all the HTML files,if I click the balance.html it is not sowing any results .


    But I am able to see the results in the MIX IDE of the balance.

    Please let me know if I'm missing something ,this is really bit urgent .

    Thanks,
    bala


Sign In or Register to comment.