# Installing a pkg on a offline fresh FreeBSD 12.0 machine



## SilentSovereign (Nov 12, 2019)

Hello, I'm fairly new to FreeBSD!
I'm trying to install bash on an offline machine so I can use it as my default shell and run my scripts on it.
To get the bash pkg installed, I looked up a few ways to install pkgs on a offline machine some suggested using the /usr/ports/distfiles/ with the ports tree and others suggested creating a local repo.
I've tried both methods but im running into trouble with both.
How do I go on about installing a package on an offline fresh machine that doesn't even have pkg(ports management pkg) installed yet?


----------



## SirDice (Nov 12, 2019)

Transfer the packages to the destination machine, it doesn't matter where you store them.

Fixing pkg(8) first:

```
cd /tmp
tar -zxvf pkg-1.12.0.tgz
usr/local/sbin/pkg-static add /tmp/pkg-1.12.0.tgz
```
Note the directory for pkg-static, it is relative, not absolute. 

Once pkg(8) has been installed you can do `pkg add <packagename.tgz>` instead of pkg-install(8) to install a locally saved package. Make sure you copy all packages and required package dependencies (it's going to complain if something is missing) and keep everything in the same directory.


----------



## SilentSovereign (Nov 12, 2019)

Nice it worked perfectly, one small thing though, pkg-static was in usr/local/sbin/ instead.


----------



## SirDice (Nov 12, 2019)

SilentSovereign said:


> pkg-static was in usr/local/sbin/ instead.


Already noticed that, just right after I posted it. Was typing from the top of my head without verifying it.


----------

