Skip to content

AWS Linux on Premises

在ESXi上安装AWS Linux要注意

  • AWS Linux通过seed.iso进行初始化,要附加这个镜像到虚拟机

  • AWS Linux内置没有启用SSH的密码登陆,需要更改/etc/ssh/sshd_config

在不用vCenter的时候如果要克隆VM

  • 首先复制对应的vmdk文件到目标文件夹

  • 精简制备的磁盘此时会占用全部空间

  • 执行dd if=/dev/zero bs=1048576 of=/zero ; sync ; rm -rf /zero给空余空间置0

  • 到ESXi主机上执行vmkfstools -K *disk_name*.vmdk释放置0的空间

To create the seed.iso boot disc
  1. Create a new folder named seedconfig and navigate into it.

  2. Create the meta-data configuration file.

  3. Create a new file named meta-data.

  4. Open the meta-data file using your preferred editor and add the following.

    local-hostname: `vm_hostname` # eth0 is the default network interface enabled in the image. You can configure static network settings with an entry like the following. network-interfaces: | auto eth0 iface eth0 inet static address 192.168.1.10 network 192.168.1.0 netmask 255.255.255.0 broadcast 192.168.1.255 gateway 192.168.1.254

    Replace vm_hostname with a VM host name of your choice, and configure the network settings as required.

  5. Save and close the meta-data configuration file.

For an example meta-data configuration file that specifies a VM hostname (amazonlinux.onprem), configures the default network interface (eth0), and specifies static IP addresses for the necessary network devices, see the sample Seed.iso file.

  1. Create the user-data configuration file.

  2. Create a new file named user-data.

  3. Open the user-data file using your preferred editor and add the following.

    #cloud-config #vim:syntax=yaml users: # A user by the name `ec2-user` is created in the image by default. - default chpasswd: list: | ec2-user:`plain_text_password` # In the above line, do not add any spaces after 'ec2-user:'.

    Replace plain_text_password with a password of your choice for the default ec2-user user account.

  4. (Optional) By default, cloud-init applies network settings each time the VM boots. Add the following to prevent cloud-init from applying network settings at each boot, and to retain the network settings applied during the first boot.

    # NOTE: Cloud-init applies network settings on every boot by default. To retain network settings # from first boot, add the following ‘write_files’ section: write_files: - path: /etc/cloud/cloud.cfg.d/80_disable_network_after_firstboot.cfg content: | # Disable network configuration after first boot network: config: disabled

  5. Save and close the user-data configuration file.

You can also create additional user accounts and specify their access mechanisms, passwords, and key pairs. For more information about the supported directives, see Module reference. For an example user-data file that creates three additional users and specifies a custom password for the default ec2-user user account, see the sample Seed.iso file.

  1. Create the seed.iso boot image using the meta-data and user-data configuration files.

For Linux, use a tool such as genisoimage. Navigate into the seedconfig folder, and run the following command.

`$` genisoimage -output seed.iso -volid cidata -joliet -rock user-data meta-data

For macOS, use a tool such as hdiutil. Navigate one level up from the seedconfig folder, and run the following command.

`$` hdiutil makehybrid -o seed.iso -hfs -joliet -iso -default-volume-name cidata seedconfig/