Install StorjShare on Odroid XU4

How to set up a Storjshare-daemon for Odroid XU4 with Ubuntu OS

Russian Version

This article is intended to get us acquainted with the process of setting up a Storjshare-daemon for Odroid XU4 with Ubuntu 16.04.
The first what we need is to set up a time zone.
(!) Keep it in your mind the operation is running by root.

First, we check current time zone:

# ll /etc/ | grep localtime
lrwxrwxrwx  1 root root       27 May 11 02:17 localtime -> /usr/share/zoneinfo/Etc/UTC

Remove link to the timezone file:

# rm -f /etc/localtime

Set up a new link to the appropriate timezone file:

# ln -s /usr/share/zoneinfo/Europe/Moscow /etc/localtime

Check the new local time and time zone:

# date
Tue Jul 25 11:29:09 MSK 2017

The storjshare-daemon will work under virtual shell and it must not be global, we should to create a new user, also it improves the confidence of the system.
Add user storj. This user will use bash shell. –m parameter forces utility useradd to create user’s directory placed in the /home/ directory. The name of the directory will be the same as user’s name.

# useradd -m -s /bin/bash storj

Check if the appropriate directory is created.

# cd /home
# ll
total 12  
drwxr-xr-x  3 iroot root  4096 Jul 24 07:46 ./  
drwxr-xr-x 21 iroot root  4096 Jul 21 19:30 ../  
drwxr-xr-x  2 storj storj 4096 Jul 24 07:46 storj/

Let’s check if the user storj is added to the list of users

# cat /etc/passwd
iroot:x:0:0:root:/root:/bin/bash  
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin  
bin:x:2:2:bin:/bin:/usr/sbin/nologin  
sys:x:3:3:sys:/dev:/usr/sbin/nologin  
...
...
dnsmasq:x:108:65534:dnsmasq,,,:/var/lib/misc:/bin/false  
sshd:x:109:65534::/var/run/sshd:/usr/sbin/nologin  
storj:x:1000:1000::/home/storj:/bin/bash

Also check if an appropriate group for this user has been created (must be created automatically then user added)

# cat /etc/group
root:x:0:  
daemon:x:1:  
bin:x:2:  
sys:x:3:  
adm:x:4:syslog,storj  
tty:x:5:  
...
...
storj:x:1000:

Set the password for our new user

# passwd storj
Enter new UNIX password:  
Retype new UNIX password:  
passwd: password updated successfully

Then delegate rights to the user to run sudo command.

root@odroid:/# adduser storj sudo  
Adding user `storj' to group `sudo' ...  
Adding user storj to group sudo  
Done.

Now we should to log in via SSH as storj

ssh storj@xxx.xxx.xxx.xxx

Set up the nvm shell

$ wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash

Log out and then log in again as storj

# exit
# ssh storj@xxx.xxx.xxx.xxx

Install the nvm shell

$ nvm install –lts

Log out and log in again

# exit
# ssh storj@xxx.xxx.xxx.xxx

Set up system updates

$ sudo apt-get update && sudo apt-get dist-upgrade

Set up Git and software utilities needed for further compilation

$ sudo apt-get install git python build-essential –y

After the installation you will see the prompt shown below.

Also of process of creation initramfs and initrd appears on the screen.

Well. We have just finished the preparation of the system to set up the storjshare-daemon. Let’s do it

$ npm install --global storjshare-daemon

To be sure that daemon is installed and works properly, run command

$ storjshare -V
daemon: 3.5.5, core: 6.8.0, protocol: 1.1.0

Here you can see the versions of the daemon, protocol and kernel.
Now is hard drives time.

Let’s check what do we have:

$ sudo fdisk -l | grep sd
Disk /dev/sdb: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors  
Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors

Two 1 TB drives, later we will use them to set up nodes.

Create a partition on the first hard drive

$ sudo fdisk /dev/sda 

Welcome screen of fdisk utility appears:
Welcome to fdisk (util-linux 2.27.1).  
Changes will remain in memory only, until you decide to write them.  
Be careful before using the write command.
Device does not contain a recognized partition table.  
Created a new DOS disklabel with disk identifier 0x82e94d28.

Let’s get information about partitions on the drive

Command (m for help): p  
Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors  
Units: sectors of 1 * 512 = 512 bytes  
Sector size (logical/physical): 512 bytes / 512 bytes  
I/O size (minimum/optimal): 512 bytes / 512 bytes  
Disklabel type: dos  
Disk identifier: 0x82e94d28

In our case, we have no any partition on the drive that is why we should do it from the beginning

Command (m for help): n  
Partition type  
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p):
Using default response p.  
Partition number (1-4, default 1):  
First sector (2048-1953525167, default 2048):  
Last sector, +sectors or +size{K,M,G,T,P} (2048-1953525167, default 1953525167):
Created a new partition 1 of type 'Linux' and of size 931.5 GiB.

You should select type of the partition then creation of this partition is done

Command (m for help): t  
Selected partition 1  
Partition type (type L to list all types): L

 0  Empty           24  NEC DOS         81  Minix / old Lin bf  Solaris
 1  FAT12           27  Hidden NTFS Win 82  Linux swap / So c1  DRDOS/sec (FAT-
 2  XENIX root      39  Plan 9          83  Linux           c4  DRDOS/sec (FAT-
 3  XENIX usr       3c  PartitionMagic  84  OS/2 hidden or  c6  DRDOS/sec (FAT-
 4  FAT16 <32M      40  Venix 80286     85  Linux extended  c7  Syrinx
 5  Extended        41  PPC PReP Boot   86  NTFS volume set da  Non-FS data
 6  FAT16           42  SFS             87  NTFS volume set db  CP/M / CTOS / .
 7  HPFS/NTFS/exFAT 4d  QNX4.x          88  Linux plaintext de  Dell Utility
 8  AIX             4e  QNX4.x 2nd part 8e  Linux LVM       df  BootIt
 9  AIX bootable    4f  QNX4.x 3rd part 93  Amoeba          e1  DOS access
 a  OS/2 Boot Manag 50  OnTrack DM      94  Amoeba BBT      e3  DOS R/O
 b  W95 FAT32       51  OnTrack DM6 Aux 9f  BSD/OS          e4  SpeedStor
 c  W95 FAT32 (LBA) 52  CP/M            a0  IBM Thinkpad hi ea  Rufus alignment
 e  W95 FAT16 (LBA) 53  OnTrack DM6 Aux a5  FreeBSD         eb  BeOS fs
 f  W95 Ext'd (LBA) 54  OnTrackDM6      a6  OpenBSD         ee  GPT
10  OPUS            55  EZ-Drive        a7  NeXTSTEP        ef  EFI (FAT-12/16/  
11  Hidden FAT12    56  Golden Bow      a8  Darwin UFS      f0  Linux/PA-RISC b  
12  Compaq diagnost 5c  Priam Edisk     a9  NetBSD          f1  SpeedStor  
14  Hidden FAT16 <3 61  SpeedStor       ab  Darwin boot     f4  SpeedStor  
16  Hidden FAT16    63  GNU HURD or Sys af  HFS / HFS+      f2  DOS secondary  
17  Hidden HPFS/NTF 64  Novell Netware  b7  BSDI fs         fb  VMware VMFS  
18  AST SmartSleep  65  Novell Netware  b8  BSDI swap       fc  VMware VMKCORE  
1b  Hidden W95 FAT3 70  DiskSecure Mult bb  Boot Wizard hid fd  Linux raid auto  
1c  Hidden W95 FAT3 75  PC/IX           bc  Acronis FAT32 L fe  LANstep  
1e  Hidden W95 FAT1 80  Old Minix       be  Solaris boot    ff  BBT  
Partition type (type L to list all types): 83  
Changed type of partition 'Linux' to 'Linux'.

Check if partition was created without mistakes

Command (m for help): p  
Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors  
Units: sectors of 1 * 512 = 512 bytes  
Sector size (logical/physical): 512 bytes / 512 bytes  
I/O size (minimum/optimal): 512 bytes / 512 bytes  
Disklabel type: dos  
Disk identifier: 0x82e94d28

Device     Boot Start        End    Sectors   Size Id Type  
/dev/sda1        2048 1953525167 1953523120 931.5G 83 Linux

Save changes before quit
Command (m for help): w  
The partition table has been altered.  
Calling ioctl() to re-read partition table.  
Syncing disks.

Now we should assign a filesystem to our new partition. I recommend to use ext4.

$ sudo mkfs.ext4 /dev/sda1
mke2fs 1.42.13 (17-May-2015)  
Creating filesystem with 244190390 4k blocks and 61054976 inodes  
Filesystem UUID: fb0b2abd-a3ac-4401-a41a-8d9ca2b637a7  
Superblock backups stored on blocks:  
    32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
    4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
    102400000, 214990848

Allocating group tables: done  
Writing inode tables: done  
Creating journal (32768 blocks): done  
Writing superblocks and filesystem accounting information: done

Make a directory to connect storage

$ mkdir /home/storj/disk1

Mount the drive to the directory

$ sudo mount /dev/sda1 /home/storj/disk1/
[sudo] password for storj:

Please, note!
The same operations must be applied to the second hard drive!
Do not forget to change appropriate letters and digits!

Make folder for log files

cd ~  
$ mkdir storjshare-logs

Now is very important moment – we create a new node! To do it, you should run this command:

storjshare create --storj 0xbFf0e37C6D2AEC703xxxxxxxxxxxxxxxxxxxxdF8 --storage /home/storj/disk1 --size 900GB --rpcaddress 91.105.xxx.151 --rpcport 4000 --maxtunnels 0 --tunnelportmin 0 --tunnelportmax 0 --logdir /home/storj/storjshare-logs/ --verbosity 3
storjshare create

– command to create a new node

--storj 0xbFf0e37C6D2AEC703xxxxxxxxxxxxxxxxxxxxdF8

– is a number of ETH ERC20 compatible wallet.I use MEW.

--storage /home/storj/disk1

– is the early mounted folder for the first node, where renters will place their files.

--size 900GB

– is the size of hard drive’s space allocated to our first node.

--rpcaddress 91.105.xxx.151

– is an external IP of our first node

--rpcport 4000

– is a number of port used by our first node

--maxtunnels 0

– is a quantity of tunnels offered by node to other nodes that use tunnels for the connection to Stroj network

--tunnelportmin 0

– is an initial port number assigned to tunnels (leave 0)

--tunnelportmax 0

– is a final port number assigned to tunnels (leave 0)

--logdir /home/storj/storjshare-logs/
  • is a path to the log’s folder
--verbosity 3

– the level of logging


A node’s config file should be created in the folder
/home/storj/.config/storjshare/configs

To check it we move to the folder and run list command

cd /home/storj/.config/storjshare/configs
$ ll
total 12  
drwxrwxr-x 2 storj storj 4096 Jul 24 11:23 ./  
drwxrwxr-x 5 storj storj 4096 Jul 24 11:08 ../  
-rw-rw-r-- 1 storj storj 3197 Jul 24 11:23 c489612bc87e8c998a213e6f747e0df8fd56af9d.json

The config file was created successfully. Now we should to switch of NAT for our node. Open config file and change the string from:

"doNotTraverseNat": false,

To:

"doNotTraverseNat": true,

The first node is ready to start

storjshare start --config /home/storj/.config/storjshare/configs/c489612bc87e8c998a213e6f747e0df8fd56af9d.json

If you did everything goes right, the node should be started successfully. You can check node’s status by command:

storjshare –status

or

storjshare-status

You should see something like this:

The same procedures apply to the second node.
Well done! Now we have nodes ready to receive and keep files, and earn money for you as well!

Special thanks to Alexandr Goryachev for the translate!

Comments: