File: cloud-export-oci-prepare-vm.dita

package info (click to toggle)
virtualbox 7.1.12-dfsg-2
  • links: PTS, VCS
  • area: contrib
  • in suites: sid
  • size: 565,672 kB
  • sloc: ansic: 2,330,854; cpp: 2,193,228; asm: 230,777; python: 223,895; xml: 86,771; sh: 25,541; makefile: 8,158; perl: 5,697; java: 5,337; cs: 4,872; pascal: 1,782; javascript: 1,692; objc: 1,131; lex: 931; php: 906; sed: 899; yacc: 707
file content (123 lines) | stat: -rw-r--r-- 5,935 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd">
<topic xml:lang="en-us" id="cloud-export-oci-prepare-vm">
  <title>Preparing a VM for Export to <ph conkeyref="vbox-conkeyref-phrases/oci"/></title>
  
  <body>
    <p><ph conkeyref="vbox-conkeyref-phrases/oci"/> provides the option to import a custom Linux image. Before an <ph
        conkeyref="vbox-conkeyref-phrases/product-name"/> image can be exported to <ph
        conkeyref="vbox-conkeyref-phrases/oci"/>, the custom image needs to be prepared to ensure that instances
      launched from the custom image can boot correctly and that network connections will work. This section provides
      advice on how to prepare a Linux image for export from <ph conkeyref="vbox-conkeyref-phrases/product-name"/>. </p>
    <p>The following list shows some tasks to consider when preparing an Oracle Linux VM for export: </p>
    <ul>
      <li>
        <p><b outputclass="bold">Use DHCP for network
              addresses.</b> Configure the VM to use a DHCP
              server to allocate network addresses, rather than using a
              static IP address. The <ph conkeyref="vbox-conkeyref-phrases/oci"/> instance will then be
              allocated an IP address automatically.
            </p>
      </li>
      <li>
        <p><b outputclass="bold">Do not specify a MAC
              address.</b> The network interface configuration
              for the VM must not specify the MAC address.
            </p>
        <p>Remove the HWADDR setting from the <filepath>/etc/sysconfig/ifcfg-<varname>devicename</varname></filepath>
          network script. </p>
      </li>
      <li>
        <p><b outputclass="bold">Disable persistent network device
              naming rules.</b> This means that the <ph conkeyref="vbox-conkeyref-phrases/oci"/>
              instance will use the same network device names as the VM.
            </p>
        <ol>
          <li>
            <p>Change the GRUB kernel parameters. </p>
            <p>Add <codeph>net.ifnames=0</codeph> and <codeph>biosdevname=0</codeph> as kernel parameter values to the
                <codeph>GRUB_CMDLINE_LINUX</codeph> variable. </p>
          </li>
          <li>
            <p>Update the GRUB configuration. </p>
            <pre xml:space="preserve"># grub2-mkconfig -o /boot/grub2/grub.cfg</pre>
          </li>
          <li>
            <p>Disable any <codeph>udev</codeph> rules for network device naming. </p>
            <p>For example, if an automated <codeph>udev</codeph> rule exists for <codeph>net-persistence</codeph>: </p>
            <pre xml:space="preserve"># cd /etc/udev/rules.d
# rm -f 70-persistent-net.rules
# ln -s /dev/null /etc/udev/rules.d/70-persistent-net.rules</pre>
          </li>
        </ol>
      </li>
      <li>
        <p><b outputclass="bold">Enable the serial
              console.</b> This enables you to troubleshoot the
              instance when it is running on <ph conkeyref="vbox-conkeyref-phrases/oci"/>.
            </p>
        <ol>
          <li>
            <p>Edit the <filepath>/etc/default/grub</filepath> file, as follows: </p>
            <ul>
              <li>
                <p>Remove the <codeph>resume</codeph> setting from the kernel parameters. This setting slows down boot
                  time significantly. </p>
              </li>
              <li>
                <p>Replace <codeph>GRUB_TERMINAL="gfxterm"</codeph> with <codeph>GRUB_TERMINAL="console
                  serial"</codeph>. This configures use of the serial console instead of a graphical terminal. </p>
              </li>
              <li>
                <p>Add <codeph>GRUB_SERIAL_COMMAND="serial --unit=0 --speed=115200"</codeph>. This configures the serial
                  connection. </p>
              </li>
              <li>
                <p>Add <codeph>console=tty0 console=ttyS0,115200</codeph> to the <codeph>GRUB_CMDLINE_LINUX</codeph>
                  variable. This adds the serial console to the Linux kernel boot parameters. </p>
              </li>
            </ul>
          </li>
          <li>
            <p>Regenerate the GRUB configuration. </p>
            <pre xml:space="preserve"># grub2-mkconfig -o /boot/grub2/grub.cfg</pre>
          </li>
          <li>
            <p>To verify the changes, reboot the machine and run the <userinput>dmesg</userinput> command to look for
              the updated kernel parameters. </p>
            <pre xml:space="preserve"># dmesg |grep console=ttyS0</pre>
          </li>
        </ol>
      </li>
      <li>
        <p><b outputclass="bold">Enable paravirtualized device
              support.</b> You do this by adding the
              <codeph>virtio</codeph> drivers to the
              <codeph>initrd</codeph> for the VM.
            </p>
        <ol>
          <li>
            <p>This procedure works only on machines with a Linux kernel of version 3.4 or later. Check that the VM is
              running a supported kernel: </p>
            <pre xml:space="preserve"># uname -a</pre>
          </li>
          <li>
            <p>Use the <codeph>dracut</codeph> tool to rebuild <codeph>initrd</codeph>. Add the <codeph>qemu</codeph>
              module, as follows: </p>
            <pre xml:space="preserve"># dracut –-logfile /var/log/Dracut.log --force --add qemu</pre>
          </li>
          <li>
            <p>Verify that the <codeph>virtio</codeph> drivers are now present in <codeph>initrd</codeph>. </p>
            <pre xml:space="preserve"> # lsinitrd |grep virtio</pre>
          </li>
        </ol>
      </li>
    </ul>
    <p>For more information about importing a custom Linux image into <ph conkeyref="vbox-conkeyref-phrases/oci"/>, see
      also: </p>
    <p>
      <ph>https://docs.cloud.oracle.com/iaas/Content/Compute/Tasks/importingcustomimagelinux.htm</ph>
    </p>
  </body>
  
</topic>