Installation and Updates¶
Swarm is part of the Ethereum stack, the reference implementation is currently at POC3 (proof of concept 3), or version 0.3.
Swarm runs on all major platforms (linux, MacOSX, Windows, also raspberry pi, android OS, iOS).
Note
The swarm package has not been tested on platforms other than linux and OSX.
Installing Swarm binaries¶
THIS SECTION IS MISSING
Installing Swarm from source¶
The source code is found on github: https://github.com/ethersphere/go-ethereum/tree/swarm-network-rewrite/
Prerequisites¶
building the Swarm daemon swarm requires the following packages:
- go: https://golang.org
- git: http://git.org
Grab the relevant prerequisites and build from source.
On linux (ubuntu/debian variants) use apt
to install git
sudo apt install git
and install go with
sudo apt install golang
However, at the time of writing the version of golang that is in the repositories for Ubuntu and Debian is too old. (See below. for instructions on how to get the newer version)
while on Mac OSX you’d use brew
brew install go git
Then you must prepare your go environment as follows
mkdir $HOME/go
export GOPATH=$HOME/go
echo 'export GOPATH=$HOME/go' >> ~/.bashrc
export PATH=$PATH:$GOPATH/bin
echo 'export PATH=$PATH:$GOPATH/bin' >> ~/.bashrc
Ubuntu¶
At the time of writing, the Ubuntu repositories carry an older version of Go. Up to date instruction on how to install the newest version of Go in Ubuntu can always be found here.
Ubuntu users can use the ‘gophers’ PPA to install an up to date version of Go. See https://launchpad.net/~gophers/+archive/ubuntu/archive for more information. Note that this PPA requires adding /usr/lib/go-1.X/bin to the executable PATH. Thus you would install golang 1.10 with
sudo add-apt-repository ppa:gophers/archive
sudo apt-get update
sudo apt-get install golang-1.10-go
and then add /usr/lib/go-1.10/bin
to your PATH
environment variable.
export PATH="$PATH:/usr/lib/go-1.10/bin"
echo 'export PATH=$PATH:/usr/lib/go-1.10/bin' >> ~/.bashrc
You must also set up a go folder and GOPATH
.
mkdir $HOME/go
export GOPATH=$HOME/go
echo 'export GOPATH=$HOME/go' >> ~/.bashrc
export PATH=$PATH:$GOPATH/bin
echo 'export PATH=$PATH:$GOPATH/bin' >> ~/.bashrc
Generic linux¶
The latest version of golang can be found at https://golang.org/dl/
To install it, download the tar.gz file
curl -O https://dl.google.com/go/go1.10.1.linux-amd64.tar.gz
Unpack it to the /usr/local
sudo tar -C /usr/local -xzf go1.10.1.linux-amd64.tar.gz
Set GOPATH and PATH:
Setup a go folder and declare it as the GOPATH
mkdir -p ~/go; echo "export GOPATH=$HOME/go" >> ~/.bashrc
Update your PATH variable to include binaries installed with go
echo "export PATH=$PATH:$HOME/go/bin:/usr/local/go/bin" >> ~/.bashrc
Read the environment variables into current session:
source ~/.bashrc
Compiling and installing¶
Once all prerequisites are met, download the go-ethereum source code
mkdir -p $GOPATH/src/github.com/ethereum
cd $GOPATH/src/github.com/ethereum
git clone https://github.com/ethersphere/go-ethereum
cd go-ethereum
git checkout swarm-network-rewrite
go get github.com/ethereum/go-ethereum
and finally compile the swarm daemon swarm
and the main go-ethereum client geth
.
go install -v ./cmd/geth
go install -v ./cmd/swarm
You can now run swarm to start your Swarm node. Let’s check if the installation of swarm was successful:
swarm version
or, if your PATH is not set and the swarm command can not be found, try:
$GOPATH/bin/swarm version
This should return some relevant information. For example:
Swarm
Version: 0.3
Network Id: 0
Go Version: go1.10.1
OS: linux
GOPATH=/home/user/go
GOROOT=/usr/local/go
Updating your client¶
To update your client simply download the newest source code and recompile.
cd $GOPATH/src/github.com/ethereum/go-ethereum
git checkout master
git pull
go install -v ./cmd/geth
go install -v ./cmd/swarm