Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
NanoPi Neo Skyrig, $200 miner with official scripts.
#1
Heart 
Skywire on Armbian Stretch for NanoPi NEO.
[/url][url=https://ibb.co/cJ1ntzc][Image: Nano-Pi-Neo.png]




Hardware:
NanoPi Neo, our $13 hero: https://www.friendlyarm.com/index.php?ro...uct_id=132
16GB MicroSD
USB UART cable
Heatsink
Or buy the kit for an extra $7: https://www.friendlyarm.com/index.php?ro...uct_id=182

That's right. $20 for an out of the box, ready to party Skywire node.

Software:
Etcher: https://www.balena.io/etcher/
PuTTY: https://www.chiark.greenend.org.uk/~sgta...atest.html

OS:
Armbian Stretch: https://dl.armbian.com/nanopineo/Debian_stretch_next.7z 


--------

Install all the software.

Write the Armbian image to the SD card with Etcher, stick it in the NEO.

If you're like me, I like bed and laptops. Go into your WiFi network settings and share the WiFi connection with your Ethernet port, plug it into the NEO. (Otherwise, plug it into your network, it's got DHCP enabled by default, but I like bed so get comfy)

Connect the UART cable to your PC and check Device Manager to see which COM port it has been assigned, if you change USB ports it will likely change from COM8 to COM9 for example, so keep it in the one port if you can.

Open PuTTY. Serial Connection, COM8 (or whatever yours is). Rate 115200. Connect. Flick the switch on the USB-A end of the UART cable and the Christmas lights should start.

Login: root
Password: 1234

It will prompt you to change the password, read it carefully because it asks for the old password first, then the new one twice. It will prompt you to make a user account too, Ctrl + C will cancel that if you're feeling dangerous.



General housekeeping.

I'm going to give you the basic rundown. I'm assuming you have a small understanding of networking and a little bit of linux experience, it's pretty straight forward. Copy and paste one line at a time, I recommend using the UART USB/Serial cable that comes with the $20 kit. Commands and anything that needs to be inputted will be in italics. Let's do this.

Set the timezone, give the board a unique name.

armbian-config

'Personal' menu is where you will find the Timezone, Locales, Keyboard Layout and Hostname. Enter button to enter the sub menus, left and right to change between OK and Cancel. Tab to move around in certain menus. I think NetworkManager sucks and like to do things manually, so seeing as this is my guide we're gonna do it my way. It's fun and you might learn something. Quit out of the GUI back to the terminal by either using the cancel button or pressing Escape.


Disable NetworkManager.

systemctl disable NetworkManager
nano /etc/network/interfaces


Assign IP addresses.

This is how my file looks. I have the boards on DHCP while I'm tinkering, and come back to this step later to assign them their static IPs. To do this, delete 'dhcp' at the end of line 11 and replace it with static, then remove the #s at the start of the next 4 lines, change the IPs as necessary. In this scenario, this board is Node 3 10.1.1.73, the gateway is my router which is 10.1.1.2. The dns-namesevers are both my router and 8.8.8.8 which is Google's public DNS server, you could also include 8.8.4.4 after it if you wish.


#armbian-config created
source /etc/network/interfaces.d/*

#Local loopback
auto lo
iface lo inet loopback

# Interface eth0
auto eth0
allow-hotplug eth0
iface eth0 inet dhcp
# address 10.1.1.73
# netmask 255.255.255.0
# gateway 10.1.1.2
# dns-nameservers 10.1.1.2 8.8.8.8

Ctrl+X, Y then Enter to save changes and exit. 


Check your DNS.

nano /etc/resolv.conf

The file only needs to have your DNS servers in it, delete any other junk in there. Mine has two lines that match the interfaces file above:

nameserver 10.1.1.2
nameserver 8.8.8.8

Ctrl+X, Y then Enter to save changes and exit.

Reboot the board.

reboot


Log in after it's rebooted and type the following to confirm you're online.

ping http://www.skycoin.net


If you get replies, you're good to go. Ctrl+C to cancel.


Updates, Golang and Skywire Installation.
It'll take a while so let it do it's thing.


Update the operating system. 

sudo apt-get update
sudo apt-get upgrade
y (when it asks to install)


Install the necessities.

sudo apt-get install -y curl git mercurial make binutils gcc bzr bison libgmp3-dev screen gcc build-essential


Download Golang.

curl –sS https://dl.google.com/go/go1.11.4.linux-armv6l.tar.gz > go1.11.4.linux-armv6l.tar.gz
tar xvf go1.11.4.linux-armv6l.tar.gz
rm go1.11.4.linux-armv6l.tar.gz


Make the Skywire Golang directories.

mkdir /usr/local/skywire
sudo mv go /usr/local/skywire/go
sudo ln -s /usr/local/skywire/go/bin/go /usr/local/bin/go
sudo ln -s /usr/local/skywire/go/bin/godoc /usr/local/bin/godoc
sudo ln -s /usr/local/skywire/go/bin/gofmt /usr/local/bin/gofmt
mkdir -p $HOME/go/{bin,pkg,src}


Install Golang

cd ~
nano .bashrc

Add the following lines to the last 4 lines of the document:

export GOROOT=/usr/local/skywire/go
export GOPATH=/root/go
export GOBIN=$GOPATH/bin
export PATH=$PATH:$GOBIN

Ctrl+X, Y, Enter to save and exit.


Initialize the changes you just made.

source ~/.bashrc 


Test it.

go version


Download Skywire.

mkdir -p $GOPATH/src/github.com/skycoin
cd $GOPATH/src/github.com/skycoin
git clone https://github.com/skycoin/skywire.git
cd $GOPATH/src/github.com/skycoin/skywire/cmd
go install -v ./...


If for whatever reason it reboots during this part, it's because the board isn't getting enough amperage. Usually the UART cable is enough, depends on your computer. Plug something into the MicroUSB port as well and try again. (rm -rvf $GOPATH/src/github.com/skycoin, start again)


Testing.

Test your Manager:
(Don't run this on your nodes)

cd $GOPATH/bin

nohup ./manager -web-dir ${GOPATH}/src/github.com/skycoin/skywire/static/skywire-manager > /dev/null 2>&1 &sleep 3


Test your Manager's Node (yes it is all one line so make sure you copy it all in one hit):

nohup ./node -connect-manager -manager-address :5998 -manager-web :8000 -discovery-address discovery.skycoin.net:5999-034b1cd4ebad163e457fb805b3ba43779958bbwherewa49f2c5e1e8b062482904bacdb68 -address :5000 -web-port :6001 > /dev/null 2>&1 &cd /

You should now be able to open your web browser and load the landing page at your.manager.ip.address:8000
Username: root
Password: 1234

Leave this for now, don't log in or change the password, just check that the splash page is loading.


Test your Nodes (yes it is all one line so make sure you copy it all in one hit):
(Don't run this on your manager)

nohup ./node -connect-manager -manager-address 10.1.1.71:5998 -manager-web 10.1.1.71:8000 -discovery-address discovery.skycoin.net:5999-034b1cd4ebad163e457fb805b3ba43779958bbwherewa49f2c5e1e8b062482904bacdb68 -address :5000 -web-port :6001 > /dev/null 2>&1 &cd /

Change the 10.1.1.71 addresses to your Manager's address.


Scripts

Navigate to the script folder.

cd /root/go/src/github.com/skycoin/skywire/static/script


start, stop, node_start, manager_start need the SKYWIRE_UNIX_SCRIPTS line changed to this:


SKYWIRE_UNIX_SCRIPTS=/root/go/src/github.com/skycoin/skywire/static/script


For example:

nano node_start

Make the changes so the line looks like the above.
Ctrl+X, Y, Enter to exit and save changes.

This must be done on all 4 of those files on each board.

In the same directory, skywire.defaults needs...

nano skywire.defaults

the manager IP added/changed:

MANAGER_IP=10.1.1.71

and the Go related variables change too.

# Go related variables
GOROOT=/usr/local/skywire/go
GOPATH=/root/go
PATH="/root/go/bin:/usr/local/skywire/go/bin:${PATH}"

Ctrl+X, Y and Enter to save and exit.

Again, every board needs this changed. I know, it's tedious.


Unix directory fixes.

Same deal as the script folder.

cd /root/go/src/github.com/skycoin/skywire/static/script/unix

check, start and update-skywire need the SKYWIRE_UNIX_SCRIPTS line changed:

SKYWIRE_UNIX_SCRIPTS=/root/go/src/github.com/skycoin/skywire/static/script

nano check.etc (I'm sure you've picked this up by now)

Ctrl+X, Y and Enter to save and exit.

---

Ignore this for now, but I'm making note of it for future revisions.

cd /root/go/src/github.com/skycoin/skywire/static/script/upgrade

Leave this section for now, one_time_upgrade needs a lot of changes made but there's no point setting this up yet.

---

Edit the startup scripts.


cd ${GOPATH}/src/github.com/skycoin/skywire/static/script/upgrade/data

nano skywire-manager.service
or
nano skywire-node.service

[Service] should read like this for the manager:

[Service]
Type=oneshot
ExecStart=/root/go/src/github.com/skycoin/skywire/static/script/manager_start
ExecStop=/root/go/src/github.com/skycoin/skywire/static/script/stop
RemainAfterExit=yes

And the nodes:

[Service]
Type=oneshot
ExecStart=/root/go/src/github.com/skycoin/skywire/static/script/node_start
ExecStop=/root/go/src/github.com/skycoin/skywire/static/script/stop
RemainAfterExit=yes

Ctrl+X, Y and Enter to save and exit.


Copy the startup script to systemd.

Manager only:

cp ${GOPATH}/src/github.com/skycoin/skywire/static/script/upgrade/data/skywire-manager.service /etc/systemd/system/

systemctl enable skywire-manager

systemctl start skywire-manager


Nodes only, manager script starts it's own node:

cp ${GOPATH}/src/github.com/skycoin/skywire/static/script/upgrade/data/skywire-node.service /etc/systemd/system/

systemctl enable skywire-node

systemctl start skywire-node


Fingers crossed, that's job done and it wont throw up any errors. Reboot all the boards and hopefully they all pop up in your web browser with green lights.



Troubleshooting.

On one occasion, I found I had to log into the Manager and do the following to get all the nodes to show up in the web browser (do NOT do this if your key are not backed up, you're waiting to be whitelisted or anything other than setting your system up for the first time. I'm not responsible for lost keys.)

systemctl disable skywire-manager.service
rm -rvf /root/.skywire


Then log into each of the nodes and do the following:

rm -rvf /root/.skywire
reboot


Once the nodes have rebooted (a minute, tops), go back to your manager and enter the following:

systemctl enable skywire-manager.service
reboot


Once the Manager has rebooted, wait a good 5 minutes before proceeding.
Log in with username root and password 1234, you will then be prompted to change the password.
If there are any nodes in the list that are red, edit the node labels so they are blank (not sure if this step is necessary but it's always worked when I've done it) and then delete any that are red. If all has gone well you should see 8 nodes online.


v1.2, TBC.
beer me: WyarSbA1aSCg6LywTEHfnQ1yfuw5cSU1ae

Cheers to everyone who's ever written a DIY guide, you've all helped this come together one way or another.


[Image: 48905075-10156920563389204-4210150655500746752-o.jpg]

[Image: 50005826-10156920563534204-8744418144661012480-n.jpg]
[-] The following 2 users say Thank You to jackazlin for this post:
  • I Am You, skyguy
Reply
#2
glad to see your nano pi's worked out for you!
[-] The following 1 user says Thank You to I Am You for this post:
  • jackazlin
Reply
#3
I've gotta update a decent amount of this guide, after a bit of fiddling and finally getting it working with all 8 nodes correctly, asxtree linked me to a github he was working on with exactly what issues I encountered.

The Golang directories have changed at some point, every single service file has to be changed. It's tedious but it's worth it.

Currently building a second one of these so while my memory is fresh I'll update this....soon.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)