jjstecchino
Contributor
- Joined
- May 29, 2011
- Messages
- 136
I feel appropriate for the first post on the FreeNAS developer thread to be a quick HOWTO on compiling FreeNAS from the latest svn revision. Here is how:
Download the FreeBSD version corresponding to the version of freenas you want to build. At the time of this writing FreeNAS 8 is using FreeBSD 8.2. You can download it from the FreeBSD ftp server Here.
At this point you have to decide if you want to build an x86 (32bit) or an AMD64 (64 bit) system. Download the corresponding version of FreeBSD. If you will be using ZFS, keep in mind ZFS works best with a good amount of RAM (4-8Gb) and a 64 bit OS.
I like to download the bootonly iso and complete the installation of the needed component through ftp.
You can now install a on a dedicated FreeBSD machine or more conveniently on a virtual machine.
The virtual machine is my preferred route. The free VirtualBox from Sun/Oracle works well. VMWare Player 3.0 can now create virtual machines and can be used as well.
If you go the VM route, a single cpu, 2Gb ram, 20Gb hard drive is usually OK.
Now install FreeBSD. Do a "kernel developer" install so you have all the tool needed to compile FreeNAS. Kernel developer installs a kernel source tree, however the FreeNAS build script will re-download the source tree again in the appropriate location. You may be able to compile FreeNAS by installing a simple developer version but I have never tried that. In other words it should work and freebsd install should be quicker but I have not tried that.
During install when asked to enable SSH chose yes.
Once you have FreeBSD installed, log in as root. Add the following packages if you don't have them yet:
pkg_add -r subversion
pkg_add -r nano
pkg_add -r cdrtools
after package installation
rehash
now navigate to /usr/local and run
svn co https://freenas.svn.sourceforge.net/svnroot/freenas/trunk
you will now have the freenas source tree into /usr/local/trunk, navigate into trunk
cd /usr/local/trunk
the build script need the url of the freebsd cvsup rerver into the FREEBSD_CVSUP_HOST variable, so execute
setenv FREEBSD_CVSUP_HOST cvsup10.freebsd.org
If you plan to play around and install a few extra packages on your newly compiled system, the 1Gb default nanobsd build will surely run you out of disk space. Keep in mind that 1 Gb image contains 2 ~512Kb partitions of which only one will be mounted at any given time. Your free space will be 512K - Freebsd size -Freenas size= not a lot ~64K.
To increase the size of the nanobsd image you need to edit nanobsd/freenas-common:
nano nanobsd/freenas-common
look for FlashDevice generic 1g and change it to 2g, 4g or whatever size is the memory stick you will be running freenas from.
now you are ready to build
run
build/do_build.sh
and wait a long time... Once this is done run
build/create_iso.sh
you will have the raw image in the directory obj.yyyy. yyyy is either i386 or amd64 depending on the platform you chose.
The images name will be FreeNAS-8rXXXX-yyyy.full and FreeNAS-8rXXXX-yyyy.full.iso where XXXX is the svn revision and yyyy is as above.
Enjoy
Download the FreeBSD version corresponding to the version of freenas you want to build. At the time of this writing FreeNAS 8 is using FreeBSD 8.2. You can download it from the FreeBSD ftp server Here.
At this point you have to decide if you want to build an x86 (32bit) or an AMD64 (64 bit) system. Download the corresponding version of FreeBSD. If you will be using ZFS, keep in mind ZFS works best with a good amount of RAM (4-8Gb) and a 64 bit OS.
I like to download the bootonly iso and complete the installation of the needed component through ftp.
You can now install a on a dedicated FreeBSD machine or more conveniently on a virtual machine.
The virtual machine is my preferred route. The free VirtualBox from Sun/Oracle works well. VMWare Player 3.0 can now create virtual machines and can be used as well.
If you go the VM route, a single cpu, 2Gb ram, 20Gb hard drive is usually OK.
Now install FreeBSD. Do a "kernel developer" install so you have all the tool needed to compile FreeNAS. Kernel developer installs a kernel source tree, however the FreeNAS build script will re-download the source tree again in the appropriate location. You may be able to compile FreeNAS by installing a simple developer version but I have never tried that. In other words it should work and freebsd install should be quicker but I have not tried that.
During install when asked to enable SSH chose yes.
Once you have FreeBSD installed, log in as root. Add the following packages if you don't have them yet:
pkg_add -r subversion
pkg_add -r nano
pkg_add -r cdrtools
after package installation
rehash
now navigate to /usr/local and run
svn co https://freenas.svn.sourceforge.net/svnroot/freenas/trunk
you will now have the freenas source tree into /usr/local/trunk, navigate into trunk
cd /usr/local/trunk
the build script need the url of the freebsd cvsup rerver into the FREEBSD_CVSUP_HOST variable, so execute
setenv FREEBSD_CVSUP_HOST cvsup10.freebsd.org
If you plan to play around and install a few extra packages on your newly compiled system, the 1Gb default nanobsd build will surely run you out of disk space. Keep in mind that 1 Gb image contains 2 ~512Kb partitions of which only one will be mounted at any given time. Your free space will be 512K - Freebsd size -Freenas size= not a lot ~64K.
To increase the size of the nanobsd image you need to edit nanobsd/freenas-common:
nano nanobsd/freenas-common
look for FlashDevice generic 1g and change it to 2g, 4g or whatever size is the memory stick you will be running freenas from.
now you are ready to build
run
build/do_build.sh
and wait a long time... Once this is done run
build/create_iso.sh
you will have the raw image in the directory obj.yyyy. yyyy is either i386 or amd64 depending on the platform you chose.
The images name will be FreeNAS-8rXXXX-yyyy.full and FreeNAS-8rXXXX-yyyy.full.iso where XXXX is the svn revision and yyyy is as above.
Enjoy