|
| 1 | +--- |
| 2 | +author: |
| 3 | + name: "@Odmin" |
| 4 | +title: Getting started with Storj Testnet on FreeNAS (freeBSD) |
| 5 | +docId: c1df00c3-9e22-43fe-9590-6157c88d2f20 |
| 6 | +metadata: |
| 7 | + title: Getting started with Storj Testnet on FreeNAS (freeBSD) |
| 8 | + description: Would you like to build an app with the Storj network as backend? Let's create a local test network with Storj-Sim on your freeBSD powered FreeNAS! |
| 9 | +redirects: |
| 10 | + - /hc/en-us/articles/360028417332-Getting-started-with-Storj-Testnet-on-FreeNAS-freeBSD |
| 11 | + - /hc/en-us/articles/360028417332 |
| 12 | +--- |
| 13 | +If you want to try it on Linux, you can read the article [https://github.com/storj/storj/wiki/Test-network](https://github.com/storj/storj/wiki/Test-network) |
| 14 | + |
| 15 | +In addition, you can try it on Windows: [Getting started with Storj Testnet on Windows](docId:a1b98770-bb79-4a9d-b0e0-8d3d57106a4d). |
| 16 | + |
| 17 | +Author: Our fellow Community member @Odmin |
| 18 | + |
| 19 | + |
| 20 | +FreeNAS® is an embedded open-source network-attached storage (NAS) operating system based on FreeBSD and released under a [2-clause BSD license](https://opensource.org/licenses/BSD-2-Clause). A NAS has an operating system optimized for file storage and sharing. |
| 21 | + |
| 22 | +FreeNAS® provides a browser-based, graphical configuration interface. The built-in networking protocols provide storage access to multiple operating systems. A plugin system is provided for extending the built-in features by installing additional software. |
| 23 | + |
| 24 | +FreeNAS has independent [hardware recommendations](https://ixsystems.com/documentation/freenas/11.2/intro.html#hardware-recommendations) for newly built system, so before you begin, please make sure that you meet **at least the minimum hardware requirements**. |
| 25 | + |
| 26 | +Once your hardware is ready you can [move forward with installation](https://ixsystems.com/documentation/freenas/11.2/install.html). |
| 27 | + |
| 28 | +# Install Storj inside a FreeNAS Jail |
| 29 | +We will create a ZFS dataset and create a new FreeNAS Jail to run a local Storj test network (Storj-Sim), following the steps outlined below. |
| 30 | + |
| 31 | + |
| 32 | +## Create a new ZFS dataset for store Storj data: |
| 33 | + |
| 34 | + |
| 35 | + |
| 36 | + |
| 37 | + |
| 38 | + |
| 39 | + |
| 40 | +***Figure 1.** Creating a new dataset for storage* |
| 41 | + |
| 42 | +### Specify options for a new dataset - see **Figure 2**. |
| 43 | + |
| 44 | + |
| 45 | + |
| 46 | +***Figure 2.** Options of the new dataset* |
| 47 | + |
| 48 | +Please make sure you have the following settings configured: |
| 49 | + |
| 50 | +* **Name** - `Stojv3_data` |
| 51 | +* **Compression** - `lz4` |
| 52 | +* **Share Type** - `Unix` |
| 53 | +* **Enable atime** - `OFF` |
| 54 | +* **ZFS Deduplication** - `OFF` |
| 55 | + |
| 56 | +Then click on **Advanced Mode**. |
| 57 | + |
| 58 | +Depend on your HDD pool configuration, you can see the default value for Record Size (in our case 32K) - see **Figure 3**. |
| 59 | + |
| 60 | + |
| 61 | + |
| 62 | +***Figure 3.** Record Size for the Pool* |
| 63 | + |
| 64 | +## Create a new FreeNAS Jail |
| 65 | +To activate Pool for Jail Manager, just click **CONFIG**. See **Figure 4**. |
| 66 | + |
| 67 | +  |
| 68 | + |
| 69 | +***Figure 4.** Creation of a new Jail* |
| 70 | + |
| 71 | +Then click **ADD**. Fill in a new Jail name and select the latest FreeBSD release (**Figure 5**) |
| 72 | + |
| 73 | + |
| 74 | + |
| 75 | +  |
| 76 | + |
| 77 | +***Figure 5.** Adding a new Jail with parameters* |
| 78 | + |
| 79 | +Select both options - **DHCP Autoconfiguration IPv4** and **VNET** (**Figure 6**) |
| 80 | + |
| 81 | + |
| 82 | + |
| 83 | +***Figure 6.** DHCP Autoconfiguration IPv4 and VNET* |
| 84 | + |
| 85 | +Check configuration and click **SUBMIT** (**Figure 7**) |
| 86 | + |
| 87 | + |
| 88 | + |
| 89 | +***Figure 7.** Submit configuration of a new Jail* |
| 90 | + |
| 91 | +Wait until the new Jail has been created, then click the three dots on the right side and specify the mount point inside a Jail to store data (**Figure 8**) |
| 92 | + |
| 93 | + |
| 94 | +   |
| 95 | + |
| 96 | +***Figure 8.** Mount point* |
| 97 | + |
| 98 | +Select our dataset (we created it earlier with name `Storjv3_data`) as a source and mount point inside a Jail (which will be `storj_data`) as a destination - see **Figure 9**. |
| 99 | + |
| 100 | + |
| 101 | + |
| 102 | +***Figure 9.** Options of mountpoint* |
| 103 | + |
| 104 | +Here is an example - see **Figure 10**. |
| 105 | + |
| 106 | + |
| 107 | + |
| 108 | +***Figure 10.** Example of options for the mountpoint* |
| 109 | + |
| 110 | +Now you can start a Jail - see **Figure 11**. |
| 111 | + |
| 112 | +  |
| 113 | + |
| 114 | +***Figure 11.** Starting a Jail* |
| 115 | + |
| 116 | +## Configure the FreeNAS Jail |
| 117 | +Select the three dots on the right side and select **Shell** to access the Jail console - see **Figure 12**. |
| 118 | + |
| 119 | + |
| 120 | + |
| 121 | +***Figure 12.** Starting a Jail shell* |
| 122 | + |
| 123 | +Let’s enable SSH access and allow connections to the Jail for your favorite SSH client. See example on **Figure 13**. |
| 124 | + |
| 125 | +```shell |
| 126 | +sysrc sshd_enable="YES" |
| 127 | +``` |
| 128 | + |
| 129 | + |
| 130 | + |
| 131 | +***Figure 13.** Example of the command execution* |
| 132 | + |
| 133 | +## Install useful packages |
| 134 | + |
| 135 | +```shell |
| 136 | +pkg install nano git bash |
| 137 | +``` |
| 138 | + |
| 139 | +Set `PermitRootLogin` to `yes` in the `/etc/ssh/sshd_config`: |
| 140 | + |
| 141 | +```shell |
| 142 | +nano /etc/ssh/sshd_config |
| 143 | +``` |
| 144 | + |
| 145 | +Uncomment `PermitRootLogin` and set to `yes` (see **Figure 14**), then save the file (Press **Ctrl+X** for exit and **Y** for save changes). |
| 146 | + |
| 147 | + |
| 148 | + |
| 149 | +***Figure 14.** Changing PermitRootLogin option in the text editor* |
| 150 | + |
| 151 | +Start the SSH service: |
| 152 | + |
| 153 | +```shell |
| 154 | +service sshd start |
| 155 | +``` |
| 156 | + |
| 157 | +Set a new password for root user: |
| 158 | + |
| 159 | +```shell |
| 160 | +passwd |
| 161 | +``` |
| 162 | + |
| 163 | +Now you can log in via SSH using login: `root` and **your password** (check the Jail section for the IP address) - see **Figure 15**. |
| 164 | + |
| 165 | +  |
| 166 | + |
| 167 | +***Figure 15.** IP address for connections to the Jail* |
| 168 | + |
| 169 | +## Install the latest Go package |
| 170 | + |
| 171 | +```shell |
| 172 | +pkg install go |
| 173 | +``` |
| 174 | + |
| 175 | +Check Go version (**Figure 16**) |
| 176 | + |
| 177 | +```shell |
| 178 | +go version |
| 179 | +``` |
| 180 | + |
| 181 | +***Figure 16.** Check Go version* |
| 182 | + |
| 183 | +```shell |
| 184 | +go env |
| 185 | +``` |
| 186 | + |
| 187 | + |
| 188 | + |
| 189 | +***Figure 17.** Example of environment variables for Go* |
| 190 | + |
| 191 | +Add a new user for Storj with Username `storj` and set shell: `bash` - see **Figure 18**. |
| 192 | + |
| 193 | +```shell |
| 194 | +adduser storj |
| 195 | +``` |
| 196 | + |
| 197 | + |
| 198 | + |
| 199 | +***Figure 18.** Adding a new storj user* |
| 200 | + |
| 201 | +Become a storj user: |
| 202 | + |
| 203 | +```shell |
| 204 | +sudo su storj |
| 205 | +``` |
| 206 | + |
| 207 | +### Setup Go Environment |
| 208 | +Open your `.profile` file and add a global variables as follows at the end of the file. See **Figure 19**. |
| 209 | + |
| 210 | +```shell |
| 211 | +nano /home/storj/.profile |
| 212 | +``` |
| 213 | + |
| 214 | + |
| 215 | + |
| 216 | +***Figure 19.** Adding a global variables to the `.profile`* |
| 217 | + |
| 218 | +Press **Ctrl+X** for exit and **Y** for save changes |
| 219 | + |
| 220 | +### Update the current shell session |
| 221 | + |
| 222 | +```shell |
| 223 | +source ~/.profile |
| 224 | +``` |
| 225 | + |
| 226 | +# Compile Storj from Source |
| 227 | +Connect to the Jail shell and execute: |
| 228 | + |
| 229 | +```shell |
| 230 | +git clone https://github.com/storj/storj.git storj |
| 231 | +cd storj |
| 232 | +go install -race -v storj.io/storj/cmd/storj-sim storj.io/storj/cmd/bootstrap storj.io/storj/cmd/satellite storj.io/storj/cmd/storagenode storj.io/storj/cmd/uplink storj.io/storj/cmd/gateway storj.io/storj/cmd/identity storj.io/storj/cmd/certificates |
| 233 | +``` |
| 234 | + |
| 235 | +check the binary folder |
| 236 | + |
| 237 | +```shell |
| 238 | +ls /home/storj/go/bin/ |
| 239 | +``` |
| 240 | + |
| 241 | +Let´s create a local test network, containing the Satellite, Uplink, S3 gateway and 10 storage nodes and run it. |
| 242 | + |
| 243 | +```shell |
| 244 | +storj-sim network setup |
| 245 | +storj-sim network run |
| 246 | +``` |
| 247 | + |
| 248 | +Now the test network is ready and you can see the output like this - see **Figure 20**. |
| 249 | + |
| 250 | + |
| 251 | + |
| 252 | +***Figure 20.** Example of the output of a local test network* |
| 253 | + |
| 254 | +More information - [Test network](https://github.com/storj/storj/wiki/Test-network) |
| 255 | + |
| 256 | +# See also |
| 257 | +* [S3 Gateway](docId:EGM8O-1xt2Az03eBWT8Rf) |
| 258 | +* [Uplink CLI](docId:TbMdOGCAXNWyPpQmH6EOq) |
| 259 | +* [Libuplink Walkthrough](https://github.com/storj/storj/wiki/Libuplink-Walkthrough) |
0 commit comments