How to Install WGET on Embedded FreeNAS ?

FreeNAS Logo

Step 1

Login as root to your FreeNAS.

Step 2

Create a directory for packages on your data partition of FreeNAS. For example, the data partition is called disk1 and I am going to create a folder, called pkg for the packages. Then the command is:-

mkdir /mnt/disk1/pkg

Create a directory as a temporary folder, for example the directory name is tmp and located in disk1.

mkdir /mnt/disk1/tmp

Step 3

Change the permission of that folders into 777.

chmod -R 777 /mnt/disk1/pkg

chmod -R 777 /mnt/disk1/tmp

Step 4

Check your FreeNAS version by running this command:-

uname -a

Once, you ran the command, you will get the output as shown below.

The output tells us that the system is running under FreeBSD 9.0-RELEASE on x64 architecture.

Step 5

Get the URL for the package site based on your system, the URL format:-

ftp://ftp.freebsd.org/pub/FreeBSD/ports/<ARCHITECTURE>/<SYSTEM_VERSION>/Latest/

You might go to ftp://ftp.freebsd.org/pub/FreeBSD/ports to check for the correct URL.

For example the URL of my system would be:-

ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-9.0-release/Latest/

Step 6

Run the following command to set the package site for your system. The package site URL is based on the URL that you got from Step 5.

setenv PACKAGESITE<THE_PACKAGE_SITE_URL>

Thus, the command for my system would be:-

setenv PACKAGESITE ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-9.0-release/Latest/

Step 7

Set the folder that has been created before on Step 2 as a temporary directory.

setenv PKG_TMPDIR /mnt/disk1/tmp

Step 8

Install WGET to your packages directory that has been set before onStep 2.

pkg_add -r wget -P /mnt/disk1/pkg

Step 9

Once the installation is finished, we need to create symlinks of the WGET with our system, thus you need to create a script with the content as followed:-

#!/bin/sh

#Custom Library Symlinks
ln -s /mnt/disk1/pkg/lib/* /usr/lib

#WGET
ln -s /mnt/disk1/pkg/bin/wget /usr/bin/wget

You might change the script based on where you installed the WGET.

Save the script

For example, my script is saved as hooks.sh and then we need to set the permission of the script to be executable:-

chmod +x /mnt/disk1/hooks.sh

Run the script.

Step 10

In order to re-create the symlinks after reboot, open your FreeNAS WebGUI, go to System —> Advanced —> Command scripts.

Add the script that you have created before on Step 9 on the command field:-

/mnt/disk1/hooks.sh

Select the type as PostInit.

Step 11

Test your WGET, if everything is okay, you should see the output as shown below, when you run the WGET.

Leave a comment