How to compile FreeNAS 8

Status
Not open for further replies.

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
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,994
You can install a Minimum FreeBSD installation, no need to use anything more. As you indicated the building process will download source files to compile FreeNAS.
 

esamett

Patron
Joined
May 28, 2011
Messages
345
what is the benefit to running freenas on a virtual machine? NOOB
 

pauldonovan

Explorer
Joined
May 31, 2011
Messages
76
what is the benefit to running freenas on a virtual machine? NOOB
He's not talking about running FreeNAS on a virtual machine. The instructions are for compiling FreeNAS on a FreeBSD virtual machine. The development environment of FreeNAS is FreeBSD. Not needing a separate PC is clearly an advantage for (most) people who only have one computer apart from their FreeNAS machine.

Paul
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,994
what is the benefit to running freenas on a virtual machine? NOOB
The ONLY advantage I can see to run FreeNAS on a VM it to test the FreeNAS software before you commit it to a server which will give you an idea on how to use it. You need to place it on a machine to reap the benefits of FreeNAS and then test it there to ensure it's stable on you specific platform.
 

jfr2006

Contributor
Joined
May 27, 2011
Messages
174
Ok.. I tried to install the freebsd on a VMware machine, but after installation and reboot, i get an "Invalid partition table" message on boot :(
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,994
Ok.. I tried to install the freebsd on a VMware machine, but after installation and reboot, i get an "Invalid partition table" message on boot :(

Go to How To Guides, then Installation (wish they had Development under this category) and you will find a two part installation guide. Part 1 sets up the VMWare machine with FreeBSD, Part 2 setups up FreeNAS for building/compiling.

-Mark
 

jfr2006

Contributor
Joined
May 27, 2011
Messages
174
Hi:

I found out the problem was with the fact i was using a scsi disk on vmware. Now my problems are network related... Have to do this at home...
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,994
VMWare uses SCSI by default and should have no effect on your VM. I always use the SCSI default. Not sure I understand what you mean by network related. If you like, you can download the FreeBSD Disk 1 iso and install 99% of it from the iso vice using the FTP server for the installation. This makes things fast and you will end up doing an update anyway which will update (as of two days ago) 10 items which occur quickly.
 

jfr2006

Contributor
Joined
May 27, 2011
Messages
174
The network problems are loss of connection, because the network here at my workplace is a piece of sh***. This loss of connection make the compilation process abort. So i have to do this at home.

Regards.
 

jfr2006

Contributor
Joined
May 27, 2011
Messages
174
Finally, after 10 hours compiling, i have a new freenas version. It's convenient to refer that ftp access should be enabled so we can get the compiled file out of the virtual machine :)
 
J

jpaetzel

Guest
While I recommend the amd64 version if you intend to use ZFS, there are plenty of cases where the i386 version makes sense. You can cross compile the i386 version from an amd64 build host. Note that you cannot cross compile amd64 from a i386 host.

# env FREENAS_ARCH=i386 sh build/do_build.sh
# env FREENAS_ARCH=i386 sh build/create_iso.sh
 

jfr2006

Contributor
Joined
May 27, 2011
Messages
174
The version i compiled is FreeNAS-8r6613M-amd64. Where does this place it compared to freenas 8.0 and freenas 8.0.1 beta?

Regards.
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,994
Another folder will be created in the trunk directory called obj.i386 I believe (only did it once and don't like the ZFS performance of the 32 bit builds). Either way, it's clear as day when you look in the directory.
 

jfr2006

Contributor
Joined
May 27, 2011
Messages
174
I think you did not understand my question:

Is my compiled release newer or older than 8.0?

Regards.
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,994
When you look at the revision number, refer to this link https://support.freenas.org/timeline to relate the changes made. I believe 8.0.1-BETA2 is rev 6621. If you were to compile right this second that I'm writing this, you would be compiling rev 6637, well beyond the 8.0 release.

I hope that helps out.
 

jfr2006

Contributor
Joined
May 27, 2011
Messages
174
Yes, that helped! Thanks a lot ;)
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,994
Just one added note... When you're compiling over and over again getting new updates, at some point in time there will be a change in the code which will not produce a product and at that point it's easiest to blow away all the directories in the trunk directory and start from scratch. At least that has been my experience.
 

jfr2006

Contributor
Joined
May 27, 2011
Messages
174
Yes..Once more thanks...I've just done that ;)
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,994
If you use the script I created, it's just easier. Of course you can modify it to your needs as I do.
 
Status
Not open for further replies.
Top