From 3d43d36c03f76f0950fa2d61d8c773ba7333fa5c Mon Sep 17 00:00:00 2001 From: Jon Proulx Date: Tue, 24 Jun 2014 10:59:45 -0400 Subject: [PATCH] FreeBSD Image Example Adds instructions for building FreeBSD images to Image Guide Change-Id: I383ac7a2378259fd36b32e885d8ef8ced03588cc Closes-Bug: #1332573 --- .../figures/freebsd-partitions.png | Bin 0 -> 6849 bytes doc/image-guide/section_freebsd-example.xml | 278 +++++++++++++++++- 2 files changed, 265 insertions(+), 13 deletions(-) create mode 100644 doc/image-guide/figures/freebsd-partitions.png diff --git a/doc/image-guide/figures/freebsd-partitions.png b/doc/image-guide/figures/freebsd-partitions.png new file mode 100644 index 0000000000000000000000000000000000000000..2e5f49dbbb5155ce6d2199378dd430b12d430d2a GIT binary patch literal 6849 zcmeHscT|&UxBZJW1q5;EgrWmd1?i!KN^jCZx)^DR1nGhVjmRLyPay_SKnD;Jq*oz? zfJl>ofDn2UA|=u!)Px(H_RTlH-(7dD`|r(K$yqsh-sj26Iq%+Q?<8EYG&;#5zybik zNfYDCHUMy}4*=+%96v_O7+82I(83A0v2!p0u)jZg(xGJ71!+m<5EBan=1C@APBGNvtp8JIBPyX;QE5VIxo`jyPCv#~uzN4to!&IloR{ zXwuq-GSZc)9Il7+-Ums-55^EN`@~0BE{5is16xkGB*K;f(1Ur*b`JLj9JaQP<$n0} zJEDkkDXXw2ue>)H5mbnJ7vmm`edC-&O~Q!*gvSXyDX+4l8nyk0BPmn8RiHR;0hAa8ovQB;5_hw+6%iVH=fVRvryBwr85Jb8s- z!fJhw$LQB`_E)&%V}PdbjIW0>$55XXzc|E3!X*ikf_AOrRjV3&y=B{V3JBu?pIa`Y z4w`zO(X6HxDH`ovwet@&UU^uNNMFXdAHm+vqAlgDf|+Ci2(Ht|XIm;v&KAvhEj)am z;oWn;s!*8;Ku$Kr>{EjeJ}ux#-0NAqjNye)BF=+i`LFLeiK{Tb2Q6Zgt*7O^Tm|-Q z0fNOe0HpUe*a5&@df*fo02t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~U~j=ACy(%k->hacQs9X}ICqcvkhq#!UxoQDPU z)0{#Y+~wb|IT=gemt1k~pF}4yEr(*u=V;yuC zO$SI6{Dq&t8=FVr2V~OI*!=Gx`Zo{s_ci~mEBY549x1W^a8Ccq{7;VbbZl~!LwC== z5(Q#!|M0@@BuGrHZd2oHUHlU}g2^~6c4~ET%GRok55g+)v08|cRbADrGXA>7)o3@K z15}0wVM=XCDjp{6QAGL}ul04>^W0T%X6sy7!}*BUYzyhU*>A{oYl7@o~&5UR_~GCfSPMFmTj%Wh%NUC9$a5;x}5Tw6DZ%zTEFJnZ}<*+T?Q>)`5t*zGD9HovCS1Jm&TO~=HqHNggN2A@}%JK zX|LkesuN-=&_3As@J9c3O<3~Vz=HF)N8qV0jcpTa5RaYFw;*(Mko8AU*9E6@IQQ}v z_sojKd(8^lq6pXxj!b`!E7}FJo3qHs+Ip$6MRIk~!4t1H^5aqMraF|qsLx9uom=k3 zl~yITcpbc5;rn(t{58Pg_3pi{RyUwjdbbl6l&t}-eW5qqVI~-yQXcl`BP;6shfG%N zU?8K5fA>iFRB)~FLVA4{&TyndSmluQCo>%aPpWrzO3uQ28IN;x{`mJA*FS&+xOL{+>++HMiOUAU(y`RaI_P0V);{14r%1OAe zrDmBZ&G -
- Example: FreeBSD image - We do not yet have a fully documented example of how to create a - FreeBSD image. - See the bsd-cloudinit - project for information on how to build a FreeBSD VM image that - works with OpenStack. - + +%openstack; +]> +
+ Example: FreeBSD image + This example creates a minimal FreeBSD image that is + compatible with OpenStack and + bsd-cloudinit. The + bsd-cloudinit program is + independently maintained and in active development. The best + source of information on the current state of the project is at + http://pellaeon.github.io/bsd-cloudinit. + KVM with virtio drivers is used as the virtualization platform + because that is the most widely used among OpenStack operators. If + you use a different platform for your cloud virtualization, use + that same platform in the image creation step. + This example shows how to create a FreeBSD 10 image. To create + a FreeBSD 9.2 image, follow these steps with the noted + differences. + + To create a FreeBSD image + + Make a virtual drive: + $ qemu-img create -f qcow2 freebsd.qcow2 1G + The minimum supported disk size for FreeBSD is 1 GB. + Because the goal is to make the smallest possible base image, + the example uses that minimum size. This size is sufficient to + include the optional doc, + games, and lib32 + collections. To include the ports + collection, add another 1 GB. To include + src, add 512 MB. + + + Get the installer ISO: + $ curl ftp://ftp.freebsd.org/pub/FreeBSD/releases\ +/amd64/amd64/ISO-IMAGES/10.0/FreeBSD-10.0-RELEASE-amd64-bootonly.iso >\ +FreeBSD-10.0-RELEASE-amd64-bootonly.iso + + + Launch a VM on your local workstation. Use the same + hypervisor, virtual disk, and virtual network drivers as you + use in your production environment. + The following command uses the minimum amount of RAM, + which is 128 MB: + $ kvm -smp 1 -m 128 -cdrom FreeBSD-10.0-RELEASE-amd64-bootonly.iso \ +-drive if=virtio,file=freebsd.qcow2 \ +-net nic,model=virtio -net user + You can specify up to 1 GB additional RAM to make the + installation process run faster. + This VM must also have Internet access to download + packages. + + By using the same hypervisor, you can ensure that you + emulate the same devices that exist in production. However, + if you use full hardware virtualization instead of + paravirtualization, you do not need to use the same + hypervisor; you must use the same type of virtualized + hardware because FreeBSD device names are related to their + drivers. If the name of your root block device or primary + network interface in production differs than the names used + during image creation, errors can occur. + + You now have a VM that boots from the downloaded install + ISO and is connected to the blank virtual disk that you + created previously. + + + To install the operating system, complete the following + steps inside the VM: + + + When prompted, choose to run the ISO in + Install mode. + + + Accept the default keymap or select an appropriate + mapping for your needs. + + + Provide a host name for your image. If you use + bsd-cloudinit, it overrides + this value with the name provided by OpenStack when an + instance boots from this image. + + + When prompted about the optional + doc, games, + lib32, ports, and + src system components, select only + those that you need. It is possible to have a fully + functional installation without selecting additional + components selected. As noted previously, a minimal system + with a 1 GB virtual disk supports + doc, games, and + lib32 inclusive. The + ports collection requires at least + 1 GB additional space and possibly more if you plan + to install many ports. The src + collection requires an additional 512 MB. + + + Configure the primary network interface to use DHCP. + In this example, which uses a virtio network device, this + interface is named vtnet0. + + + Accept the default network mirror. + + + Set up disk partitioning. + Disk partitioning is a critical element of the image + creation process and the auto-generated default + partitioning scheme does not work with + bsd-cloudinit at this + time. + Because the default does not work, you must select + manual partitioning. The partition editor should list only + one block device. If you use virtio for the disk device + driver, it is named vtbd0. Select this + device and run the create command three + times: + + + Select Create to create a + partition table. This action is the default when no + partition table exists. Then, select GPT + GUID Partition Table from the list. This + choice is the default. + + + Create two partitions: + + First partition: A 64 kB + freebsd-boot partition with + no mount point. + + + Second partition: A + freebsd-ufs partition with + a mount point of / with all + remaining free space. + + + + + The following figure shows a completed partition table + with a 1 GB virtual disk: + + + + + + Select Finish and then + Commit to commit your + changes. + + If you modify this example, the root partition, + which is mounted on /, must be the + last partition on the drive so that it can expand at run + time to the disk size that your instance type provides. + Also note that bsd-cloudinit + currently has a hard-coded assumption that this is the + second partition. + + + + + + Select a root password. + + + Select the CMOS time zone. + The virtualized CMOS almost always stores its time in UTC, + so unless you know otherwise, select UTC. + + + Select the time zone appropriate to your + environment. + + + From the list of services to start on boot, you must + select ssh. + Optionally, select other services. + + + Optionally, add users. + You do not need to add users at this time. The + bsd-cloudinit program adds a + freebsd user account if one does not + exist. The ssh keys + for this user are associated with OpenStack. To customize this + user account, you can create it now. For example, you might + want to customize the shell for the user. + + + Final config + This menu enables you to update previous settings. Check + that the settings are correct, and click + exit. + + + After you exit, you can open a shell to complete manual + configuration steps. Select Yes to make + a few OpenStack-specific changes: + + + Set up the console: + # echo 'console="comconsole,vidconsole"' >> /boot/loader.conf + This sets console output to go to the serial console, + which is displayed by nova consolelog, + and the video console for sites with VNC or Spice + configured. + + + Minimize boot delay: + # echo 'autoboot_delay="1"' >> /boot/loader.conf + + + Download the latest + bsd-cloudinit-installer. The + download commands differ between FreeBSD 10.0 and 9.2 + because of differences in how the fetch + command handles HTTPS URLs. + In FreeBSD 10.0 the fetch command + verifies SSL peers by default, so you need to install the + ca_root_nss package that contains + certificate authority root certificates and tell + fetch where to find them. For FreeBSD + 10.0 run these commands: + # pkg install ca_root_nss +# fetch --ca-cert=/usr/local/share/certs/ca-root-nss.crt \ +https://raw.github.com/pellaeon/bsd-cloudinit-installer/master/installer.sh + FreeBSD 9.2 fetch does not support + peer-verification for https. For FreeBSD 9.2, run this + command: + # fetch https://raw.github.com/pellaeon/bsd-cloudinit-installer/master/installer.sh + + + Run the installer: + # sh ./installer.sh + The installer installs necessary prerequisites and + downloads and installs the latest + bsd-cloudinit. + + + Install sudo and configure the + freebsd user to have passwordless + access: + # pkg install sudo +# echo 'freebsd ALL=(ALL) NOPASSWD: ALL' > /usr/local/etc/sudoers.d/10-cloudinit + + + + + Power off the system: + # shutdown -s now + +