Guide: How To Build FreeNAS (Part 1 Building a FreeBSD Virtual Machine)

Discussion in 'Installation' started by joeschmuck, May 29, 2011.

  1. joeschmuck Old Man

    Member Since:
    May 28, 2011
    Message Count:
    2,073
    Likes Received:
    46
    Trophy Points:
    48
    Occupation:
    Electrical Engineer, Data Analysis, and Management
    Location:
    Virginia
    joeschmuck, May 29, 2011

    This document will guide you through a step by step process to build a FreeBSD Virtual Machine.

    FreeBSD and other unix/linux operating systems are very particular to the way commands are entered. Case matter so I have included quotes “ “ around each item you would be typing.

    The first things you will need are:
    1) VMWare Player – A free virtual machine and more robust than most other free VM software. VMWare Player can be downloaded from www.vmware.com and a simple google search will locate it. You may also use your favorite VM.

    2) FreeBSD 8.2 iso image – You will need the amd64 disc 1 image. You can download this from www.freebsd.org.

    3) Putty – A nice and free telnet program that handles SSH just great. Search google for it.

    4) Filezilla – A nice free FTP program.

    5) System Recommendations: 20GB Hard Drive, 1GB RAM.
    FreeBSD commands to know:
    To turn off the VM properly type “shutdown –p now”.
    To reboot the VM just type “reboot”.

    Install VMWare Player or your favorite VM software.

    Install Putty – Well putty doesn’t really install, it’s a self-running exe file but you must place it somewhere so you can access it.

    Install Filezilla.
    ---
    Install FreeBSD on VMWare Player as follows:
    1) Open up VMWare Player and select Create a New Virtual Machine
    FN1.jpg

    2) Select I will install the operating system later.
    FN2.jpg

    3) Click Next and select Other and FreeBSD 64 bit
    FN3.jpg

    4) Click Next and if desired change the name and path of the virtual machine files locations. The default is normally fine for most people.
    FN4.jpg

    5) Click Next and here you need to setup a 40GB maximum disk size and Store virtual disk as a single file. You will not need 40GB normally but it allows for better partition setup later.
    FN5.jpg

    6) Click Next and then you will see this window
    FN6.jpg

    7) Click Customize Hardware which brings up this window
    FN7.jpg

    8) Now we need to setup our VM settings. For Memory, I have used 1GB with good results.

    9) If you have several processors you might want to use more than the default of 1 but one core is fine.
    10) On the New CD/DVD device, select Use ISO image file and locate your FreeBSD iso file.
    FN10.jpg

    11) Network Adapter: I found the Bridged connection to work better in my computer vice the NAT.
    FN11.jpg

    12) Now click OK and Finish. You should have a VM machine created with the name you gave it. Now click on Play virtual machine. It will run just like a real computer so treat it like one. If VMWare Player starts asking you to install VMWare tools, tell it no and to never bug you again.

    13) IMPORTANT ! To enter the VM Machine you need to click inside the window. To exit the VM Machine you need to hit CTRL+ALT keys.

    14) Select your country
    FN14.jpg

    15) Select Standard for installation
    FN15.jpg

    16) Next you will be greeted with a warning message
    FN16.jpg

    17) Press Enter. The hard drive needs to be configured; too bad it’s not just super easy.
    FN17.jpg

    18) Select “A”, move the blue line to the center and press “S”. It should look like this if you chose 40GB otherwise the drive will indicate a different size.
    FN18.jpg

    19) Now select Q. This will open the Boot Manager window and we will select the default which is Standard and press Enter.
    FN19.jpg

    20) Now this brings up another information window. Press Enter to get past it.
    FN20.jpg

    21) Here is the next intimidating screen. We must assign partition areas next.
    FN21.jpg

    22) Enter “A” to automatically setup the values (Sizes should be similar but not exact).
    FN22.jpg

    23) Hit “Q” and you will be greeted with the Choose Distributions screen.
    FN23.jpg

    24) Roll down to the Minimal and hit the space bar to select, Tab to highlight OK, then press Enter.

    25) Select CD/DVD and OK.
    FN25.jpg

    26) You will get a warning, let’s go for it…
    FN26.jpg

    27) This will take a few minutes copying files from the iso image. Once done you should get this screen…
    FN27.jpg

    28) We need to setup the network so answer Yes
    FN28.jpg

    29) Select the top item (default).
    FN29.jpg

    30) Answer no to IPv6, and I answered yes to DHCP. You can configure this manually if you like but if you have a DHCP then you can worry about manual setup later. Here is my configuration and you do need to enter something into the Host and Domain fields. Enter “Freenas-Dev” into Host, “freenas” into Domain. You could change your IP address here but since we are on DHCP it will not last.
    FN30.jpg

    31) You will be asked some setup questions, here are the answers:
    a. Network gateway NO.
    b. Configure inetd and network services YES (do not edit the inetd configuration file, we will do this later with an easier editor).
    c. Enable SSH Login YES.
    d. Enable anonymous FTP access YES.
    e. NFS server NO.
    f. NFS Client NO.
    g. Customize system console settings NO.
    h. Set Time zone YES.
    i. PS/2 or serial mouse NO.
    j. Thousands of ready to run applications NO.
    k. Initialize an account YES.
    32a) Let’s add one user even though we will use super user all the time for building. Make sure you remember the password.
    FN32a.jpg

    32b) Second image
    FN32b.jpg

    33) Now exit this menu. This will take you to setting the root password. Remember it!
    FN33.jpg

    34) Answer NO to general configuration.

    35) Select Exit Install and confirm. The iso image will be un-mounted automatically so press Enter again. Let the machine reboot. After a few minutes you should see something like this…
    FN35.jpg

    36) Now log in as your user, for me Joe. You get this screen
    FN36.jpg

    37) Type in “su”, then you will need the root password. Notice it states Joe to root and the prompt is obviously different.
    FN37.jpg

    38) Allow root to use ftp as follows:
    a. Type “cd /etc”
    b. Type “ee ftpusers”
    c. Move the cursor to root and place a “#” in front of it. This is a list of users who are blocked from FTP use and root normally should never FTP but in our VM world, it must be done for ease.
    d. Press CTRL “[“ or the ESCape key.
    e. Hit enter to confirm the next two messages and the file is saved.
    FN38.jpg

    39) Now let’s enable the FTP service as follows:
    a. Type ee inetd.conf
    b. Move to ftp stream tcp and remove the #.
    c. Move to ssh stream tcp and remove the #. (NOTE: Update to procedure, step c is not required and will likely cause and an annoying error message "inetd[***]: ssh/tcp: bind : address already in use" which will have no impact on functionality, it's just annoying. But if you find you cannot ssh, come back and perform this step.)
    d. Press CTRL “[“ or the ESCape key.
    e. Hit enter to confirm the next two messages and the file is saved.
    FN39.jpg
    40) Now lets speed up the boot process (not required but probably desired).
    a) Type cd /boot
    b) Type ee loader.conf
    c) Enter autoboot_delay="1"
    d) Press CTRL "[" or ESCape and save the file.
    41) Now let’s reboot the VM by typing “reboot” and hit enter.

    42) You should now test your FTP and SSH. You will need the IP address of the VM so once it’s rebooted you can check it by logging in and typing” ifconfig”. Test your FTP and SSH, they should both work. Before proceeding to the next step ensure you are logged as you did in steps 36 and 37 above.

    43) Now let’s update FreeBSD by typing “freebsd-update fetch install”. You will likely grab a few updates. Once done, type “reboot”. Log back in as root and repeat this step, you are looking for No Updates are available.
    FN42.jpg

    44) To shutdown FreeBSD type “shutdown –p now” and hit enter. This is the proper way to turn off your virtual machine. You don’t have to do this now but you need to know this for later.

    45) Backup your virtual machine hard drive (.vmdk file) because this file is now just under 500MB and in a nice virgin condition. This is the only file you need to rebuild the VM in a few seconds.
  2. parks853 New Member

    Member Since:
    Jul 26, 2011
    Message Count:
    36
    Likes Received:
    0
    Trophy Points:
    0
    parks853, Oct 15, 2011

    Joe,

    I followed your install and ran into the following:

    CPU doesn't support long mode (or something like that).

    To resolve the issue I enabled the VT BIOS setting, then enabled it in the VMWare settings.

    Just point it out incase someone else runs into the same issue, great how-to thanks!
  3. joeschmuck Old Man

    Member Since:
    May 28, 2011
    Message Count:
    2,073
    Likes Received:
    46
    Trophy Points:
    48
    Occupation:
    Electrical Engineer, Data Analysis, and Management
    Location:
    Virginia
    joeschmuck, Oct 16, 2011

    Thanks for the comment and it's a good point.
  4. dannyb78 Member

    Member Since:
    Aug 30, 2011
    Message Count:
    68
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Italy
    dannyb78, Oct 23, 2011

    tested and fully working in my esx5 environnement. It also works on real machine with sata or ide disk.
    It wont works when installing on a usb drive.
  5. vaibhavyagnik Member

    Member Since:
    Aug 26, 2011
    Message Count:
    38
    Likes Received:
    1
    Trophy Points:
    8
    vaibhavyagnik, Nov 1, 2012

    since version 8.3, freenas has moved to Freebsd v 8.3 and ZFS v28. So should i download and install Freebsd8.3 DVD1.iso to compile the latest freenas or 8.2 will also do?
  6. joeschmuck Old Man

    Member Since:
    May 28, 2011
    Message Count:
    2,073
    Likes Received:
    46
    Trophy Points:
    48
    Occupation:
    Electrical Engineer, Data Analysis, and Management
    Location:
    Virginia
    joeschmuck, Nov 1, 2012

    As far as I know it shouldn't make a difference which version of FreeBSD is used to build with as when building you are grabbing specific code off the network (FreeNAS code) and compiling it to form a product. It would make a difference if there was something different in the build/make software between versions but that is likely a rare thing. You might even try loading FreeBSD 9.1 as it should work as well.

Share This Page