{"id":202,"date":"2012-04-28T22:58:32","date_gmt":"2012-04-29T03:58:32","guid":{"rendered":"http:\/\/www.edplese.com\/blog\/?p=202"},"modified":"2012-04-28T22:58:32","modified_gmt":"2012-04-29T03:58:32","slug":"creating-an-ubuntu-12-04-lts-vm-on-smartos","status":"publish","type":"post","link":"https:\/\/www.edplese.com\/blog\/2012\/04\/28\/creating-an-ubuntu-12-04-lts-vm-on-smartos\/","title":{"rendered":"Creating an Ubuntu 12.04 LTS VM on SmartOS"},"content":{"rendered":"<p>Joyent&#8217;s SmartOS, a fairly recent hypervisor for virtualization, provides a number of prebuilt virtual machine images for various operating systems but doesn&#8217;t yet have one available for Ubuntu 12.04 LTS. \u00a0This post provides the steps required to install it manually including the basic SmartOS commands as well as some Ubuntu-specific customizations.<\/p>\n<ol>\n<li> Create a JSON file with the virtual machine parameters. \u00a0Also see the <a href=\"http:\/\/wiki.smartos.org\/display\/DOC\/How+to+create+a+Virtual+Machine+in+SmartOS\">SmartOS Wiki<\/a> for some additional options and details.\n<pre>{\r\n  \"alias\": \"ubuntu12\",\r\n  \"hostname\": \"ubuntu12\",\r\n  \"brand\": \"kvm\",\r\n  \"vcpus\": 1,\r\n  \"autoboot\": false,\r\n  \"ram\": 4096,\r\n  \"resolvers\": [ \"10.1.1.1\" ],\r\n  \"disks\": [\r\n    {\r\n      \"boot\": true,\r\n      \"model\": \"virtio\",\r\n      \"size\": 40960\r\n    }\r\n  ],\r\n  \"nics\": [\r\n    {\r\n      \"nic_tag\": \"admin\",\r\n      \"model\": \"virtio\",\r\n      \"ip\": \"10.1.1.11\",\r\n      \"netmask\": \"255.255.255.0\",\r\n      \"gateway\": \"10.1.1.1\",\r\n      \"primary\": true\r\n    }\r\n  ]\r\n}<\/pre>\n<\/li>\n<li>Create the virtual machine with the <code>vmadm<\/code> command using the JSON file as the input.\n<pre># vmadm create -f ubuntu-12.04.json\r\nSuccessfully created 3b202a79-f148-4c87-bb7f-ff9d64f724ca<\/pre>\n<\/li>\n<li>Copy the Ubuntu 12.04 LTS install ISO to the root dataset for this virtual machine.  This assumes the ISO has already been copied to the <code>\/zones\/isos<\/code> directory on the SmartOS server.\n<pre># cp \/zones\/isos\/ubuntu-12.04-server-amd64.iso \\\r\n     \/zones\/3b202a79-f148-4c87-bb7f-ff9d64f724ca\/root\/.<\/pre>\n<\/li>\n<li>Boot the VM to the ISO.\n<pre># vmadm start 3b202a79-f148-4c87-bb7f-ff9d64f724ca \\\r\n              order=cd,once=d cdrom=\/ubuntu-12.04-server-amd64.iso,ide\r\nSuccessfully started 3b202a79-f148-4c87-bb7f-ff9d64f724ca<\/pre>\n<\/li>\n<li>Get the VNC IP and port from the VM.\n<pre># vmadm info 3b202a79-f148-4c87-bb7f-ff9d64f724ca vnc\r\n{\r\n  \"vnc\": {\r\n    \"host\": \"10.1.1.4\",\r\n    \"port\": 63407,\r\n    \"display\": 57507\r\n  }\r\n}<\/pre>\n<\/li>\n<li>Connect to the VM with VNC and complete the installation as normal, including the reboot at the end.<\/li>\n<li>Enable the serial console in Ubuntu with the steps from the Ubuntu <a href=\"https:\/\/help.ubuntu.com\/community\/SerialConsoleHowto\">SerialConsoleHowto<\/a>. \u00a0This step is optional but adds some nice administration benefits as demonstrated in the next step.\n<ol>\n<li>Paste the following into <code>\/etc\/init\/ttyS0.conf<\/code>.\n<pre># ttyS0 - getty\r\n#\r\n# This service maintains a getty on ttyS0 from the point the system is\r\n# started until it is shut down again.\r\n\r\nstart on stopped rc or RUNLEVEL=[2345]\r\nstop on runlevel [!2345]\r\n\r\nrespawn\r\nexec \/sbin\/getty -L 115200 ttyS0 vt102<\/pre>\n<\/li>\n<li>Ask upstart to start the getty.\n<pre>$ sudo start ttyS0<\/pre>\n<\/li>\n<\/ol>\n<\/li>\n<li>The serial console can then be connected to from the SmartOS host with the <code>vmadm<\/code> tool.  Exiting from this console is done with <code>CTRL-]<\/code>.\n<pre># vmadm console 3b202a79-f148-4c87-bb7f-ff9d64f724ca\r\nUnknown command: console\r\n\r\nUbuntu 12.04 LTS ubuntu12 ttyS0\r\n\r\nubuntu12 login: ed\r\nPassword:\r\nLast login: Sat Apr 28 22:38:41 CDT 2012 from 10.1.1.4 on pts\/0\r\nWelcome to Ubuntu 12.04 LTS (GNU\/Linux 3.2.0-23-generic x86_64)\r\n\r\n * Documentation:  https:\/\/help.ubuntu.com\/\r\n\r\n  System information as of Sat Apr 28 22:39:26 CDT 2012\r\n\r\n  System load:  0.0               Processes:           61\r\n  Usage of \/:   4.1% of 35.92GB   Users logged in:     1\r\n  Memory usage: 1%                IP address for eth0: 10.1.1.11\r\n  Swap usage:   0%\r\n\r\n  Graph this data and manage this system at https:\/\/landscape.canonical.com\/\r\n\r\n9 packages can be updated.\r\n0 updates are security updates.\r\n\r\ned@ubuntu12:~$<\/pre>\n<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>Joyent&#8217;s SmartOS, a fairly recent hypervisor for virtualization, provides a number of prebuilt virtual machine images for various operating systems but doesn&#8217;t yet have one available for Ubuntu 12.04 LTS. \u00a0This post provides the steps required to install it manually including the basic SmartOS commands as well as some Ubuntu-specific customizations. Create a JSON file [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[22,20,21],"_links":{"self":[{"href":"https:\/\/www.edplese.com\/blog\/wp-json\/wp\/v2\/posts\/202"}],"collection":[{"href":"https:\/\/www.edplese.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.edplese.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.edplese.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.edplese.com\/blog\/wp-json\/wp\/v2\/comments?post=202"}],"version-history":[{"count":16,"href":"https:\/\/www.edplese.com\/blog\/wp-json\/wp\/v2\/posts\/202\/revisions"}],"predecessor-version":[{"id":218,"href":"https:\/\/www.edplese.com\/blog\/wp-json\/wp\/v2\/posts\/202\/revisions\/218"}],"wp:attachment":[{"href":"https:\/\/www.edplese.com\/blog\/wp-json\/wp\/v2\/media?parent=202"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.edplese.com\/blog\/wp-json\/wp\/v2\/categories?post=202"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.edplese.com\/blog\/wp-json\/wp\/v2\/tags?post=202"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}