Please correct if something is not right, using this I am running all the examples successfully!
1.) install rust Nightly (the compiler)
http://www.rust-lang.org/install.html4 or on mac/linux
curl -sSf https://static.rust-lang.org/rustup.sh | sudo sh -s -- --channel=nightly
2.) install gcc (linux sudo apt-get install gcc
)
3.) clone crust (install git if you don’t have it sudo apt-get install git
on linux)
git clone https://github.com/maidsafe/crust.git
4.) go into the crust folder:
cd crust
5.) install libsodium if you have not yet done so
Unfortunally, there are not libsodium packages for Ubuntu. So, you should download, build and install libsodium as follows:
Download the newer tar archive from Index of /libsodium/releases/ (you can also get the git repository from GitHub - jedisct1/libsodium: A modern, portable, easy to use crypto library.).
Follow the ritual:
tar xzf libsodium-1.0.3.tar.gz
cd libsodium-1.0.3/
./configure
make && make check && sudo make install
Once you have installed you have to reload/rebuild the GNU linkers. A simple sudo ldconfig
is enough.
Now run ./configure
and it should generate the makefile. (I’m assuming you have at least build-essentials package installed).
6.)cd crust
( to run crust_peer)
cargo run --example crust_peer
( to run simple_receiver)
cargo run --example simple_receiver
(open new terminal window)
( to run simple_sender)
cargo run --example simple_sender
culexevilman@ubuntu:~/crust$ cargo run --example crust_peer
Compiling libsodium-sys v0.0.5
Compiling rustc-serialize v0.3.14
Compiling strsim v0.3.0
Compiling libc v0.1.7
Compiling term v0.2.7
Compiling gcc v0.3.5
Compiling byteorder v0.3.9
Compiling regex v0.1.30
Compiling rand v0.3.8
Compiling time v0.1.25
Compiling cbor v0.3.6
Compiling docopt v0.6.64
Compiling sodiumoxide v0.0.4
Compiling crust v0.0.7 (file:///home/culexevilman/crust)
Running target/debug/examples/crust_peer
Listening for new connections on Tcp(V4(127.0.0.1:37810)), and listening for UDP broadcast on port 9999.
Didn't bootstrap to an existing network - this is the first node of a new network.
Enter command (stop | connect | send )>
culexevilman@ubuntu:~/crust$ cargo run --example simple_receiver
Compiling crust v0.0.7 (file:///home/culexevilman/crust)
Running `target/debug/examples/simple_receiver`
Listening for new connections on Tcp(V4(127.0.0.1:8888)), and not listening for UDP broadcasts.
Run the simple_sender example in another terminal to send messages to this node.
New connection made to Tcp(V4(127.0.0.1:43872))
Received "0" from Tcp(V4(127.0.0.1:43872)) - replying with "0"
Received "1" from Tcp(V4(127.0.0.1:43872)) - replying with "1"
Received "2" from Tcp(V4(127.0.0.1:43872)) - replying with "1"
Received "3" from Tcp(V4(127.0.0.1:43872)) - replying with "2"
Received "4" from Tcp(V4(127.0.0.1:43872)) - replying with "3"
Received "5" from Tcp(V4(127.0.0.1:43872)) - replying with "5"
Received "6" from Tcp(V4(127.0.0.1:43872)) - replying with "8"
Received "7" from Tcp(V4(127.0.0.1:43872)) - replying with "13"
Received "8" from Tcp(V4(127.0.0.1:43872)) - replying with "21"
Received "9" from Tcp(V4(127.0.0.1:43872)) - replying with "34"
Received "10" from Tcp(V4(127.0.0.1:43872)) - replying with "55"
Received "11" from Tcp(V4(127.0.0.1:43872)) - replying with "89"
Received "12" from Tcp(V4(127.0.0.1:43872)) - replying with "144"
Lost connection to Tcp(V4(127.0.0.1:43872))
----------
culexevilman@ubuntu:~/crust$ cargo run --example simple_sender
Compiling crust v0.0.7 (file:///home/culexevilman/crust)
Running `target/debug/examples/simple_sender`
New connection made to Tcp(V4(127.0.0.1:8888))
Peer on Tcp(V4(127.0.0.1:8888)) replied with "The Fibonacci number for 0 is 0"
Peer on Tcp(V4(127.0.0.1:8888)) replied with "The Fibonacci number for 1 is 1"
Peer on Tcp(V4(127.0.0.1:8888)) replied with "The Fibonacci number for 2 is 1"
Peer on Tcp(V4(127.0.0.1:8888)) replied with "The Fibonacci number for 3 is 2"
Peer on Tcp(V4(127.0.0.1:8888)) replied with "The Fibonacci number for 4 is 3"
Peer on Tcp(V4(127.0.0.1:8888)) replied with "The Fibonacci number for 5 is 5"
Peer on Tcp(V4(127.0.0.1:8888)) replied with "The Fibonacci number for 6 is 8"
Peer on Tcp(V4(127.0.0.1:8888)) replied with "The Fibonacci number for 7 is 13"
Peer on Tcp(V4(127.0.0.1:8888)) replied with "The Fibonacci number for 8 is 21"
Peer on Tcp(V4(127.0.0.1:8888)) replied with "The Fibonacci number for 9 is 34"
Peer on Tcp(V4(127.0.0.1:8888)) replied with "The Fibonacci number for 10 is 55"
Peer on Tcp(V4(127.0.0.1:8888)) replied with "The Fibonacci number for 11 is 89"
Peer on Tcp(V4(127.0.0.1:8888)) replied with "The Fibonacci number for 12 is 144"
culexevilman@ubuntu:~/crust$
EDIT by @happybeing: changed crust_node to crust peer and updated rustc install command as per post 24