# Install FreeNAS Initiator

##### When the cluster is used a convergent model with TrueNAS, the patches need to be installed for the FreeNAS Initiator to show under the storage dialogue

[GitHub Repo](https://github.com/TheGrandWazoo/freenas-proxmox)

#### Option 1

---

##### Connect to each node and install the following keys

```
curl <a class="external free" href="https://ksatechnologies.jfrog.io/artifactory/ksa-repo-gpg/ksatechnologies-release.gpg" rel="nofollow">https://ksatechnologies.jfrog.io/artifactory/ksa-repo-gpg/ksatechnologies-release.gpg</a> -o /etc/apt/trusted.gpg.d/ksatechnologies-release.gpg
curl <a class="external free" href="https://ksatechnologies.jfrog.io/artifactory/ksa-repo-gpg/ksatechnologies-repo.list" rel="nofollow">https://ksatechnologies.jfrog.io/artifactory/ksa-repo-gpg/ksatechnologies-repo.list</a> -o /etc/apt/sources.list.d/ksatechnologies-repo.list
```

##### Then issue the following to install the package

<p class="callout info">Line 3 may now be in the code after I put in the GitHub issue. [Link](https://github.com/TheGrandWazoo/freenas-proxmox/issues/109#issuecomment-1367527917)</p>

```
apt update
apt install freenas-proxmox -y
systemctl restart pvescheduler.service
```

#### Option 2

---

This is the manual way to do this. However, I don't do it this way now that there is a package to install. The benefit to the package is that once Proxmox is updated, the TrueNAS configurations are not overwritten.

Let's create the SSH keys on the Proxmox boxes. (The IP must match your iSCSI Portal IP) You only need to create the keys on one node if they are clustered as the keys will replicate to the other nodes.

```bash
$portal_ip=192.168.2.252
mkdir /etc/pve/priv/zfs
ssh-keygen -f /etc/pve/priv/zfs/$portal_ip_id_rsa
ssh-copy-id -i /etc/pve/priv/zfs/$portal_ip_id_rsa.pub root@$portal_ip
```

##### <span id="bkmrk--3"></span><span class="mw-headline" id="bkmrk-enable-%22log-in-as-ro-1">Enable "Log in as root with password" under Services -&gt; SSH on the FreeNAS box.</span>

<span class="mw-headline" id="bkmrk-make-an-ssh-connecti-1">Make an SSH connection from every node to the iSCSI Portal IP</span>

```bash
ssh -i /etc/pve/priv/zfs/$portal_ip_id_rsa root@$portal_ip
```

##### <span class="mw-headline" id="bkmrk-install-the-rest-cli-1">Install the REST client on every node</span>

```bash
apt-get install librest-client-perl git
```

##### <span class="mw-headline">Download the patches on every Proxmox node</span>

```bash
git clone https://github.com/TheGrandWazoo/freenas-proxmox
```

##### <span class="mw-headline" id="bkmrk--5"></span>

##### <span class="mw-headline" id="bkmrk-install-the-patches--1">Install the patches on every Proxmox node</span>

<p class="callout info"><span class="mw-headline">These can be run all at once but it is harder to see the output</span></p>

```bash
cd freenas-proxmox
patch -b /usr/share/pve-manager/js/pvemanagerlib.js < pve-manager/js/pvemanagerlib.js.patch
patch -b /usr/share/perl5/PVE/Storage/ZFSPlugin.pm < perl5/PVE/Storage/ZFSPlugin.pm.patch
patch -b /usr/share/pve-docs/api-viewer/apidoc.js < pve-docs/api-viewer/apidoc.js.patch
cp perl5/PVE/Storage/LunCmd/FreeNAS.pm /usr/share/perl5/PVE/Storage/LunCmd/FreeNAS.pm
```

##### <span class="mw-headline" id="bkmrk-restart-the-pve-serv-1">Restart the PVE services</span>

```bash
systemctl restart pvedaemon
systemctl restart pveproxy
systemctl restart pvestatd
```

If you are using a cluster restart the following services as well.

```bash
systemctl restart pve-ha-lrm
systemctl restart pve-ha-crm
systemctl restart pvescheduler.service
```

Reload the PVE webgui. Now FreeNAS-API should be available as an iSCSI provider.