View unanswered posts | View active topics It is currently Thu Dec 14, 2017 1:59 am



This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
 Linux:Bash script to create a custom installation 
Author Message

Joined: Wed Mar 18, 2009 1:32 pm
Posts: 455
Location: Sweden
Post Linux:Bash script to create a custom installation
This How-To is made by Spike

The script provided by Varazir
http://code.google.com/p/mkesxiaio/
http://varazir.mine.nu/esxi/
help us to create

1) ISO installation - Create an ISO file with custom files
2) USB installation - Create a bootale USB key as VMWare ESXi Installer with custom files
3) USB boot - Install VMWare ESXi to a USB key
4) USB installation without custom files - Create a bootable USB key as VMWare ESXi Installer without custom files.
5) USB boot without custom files - Create a bootable USB key directly from the VMWare ISO

CHANGE LOG: http://code.google.com/p/mkesxiaio/wiki/Changelog



Prepare the necessary - Linux environment
This has been tested under Ubuntu 10.10 Maverick Meerkat.
If you need a Windows environment how-to, scroll down to the relative paragraph.

1) You need to have
- the ISO (VMware-VMvisor-Installer-4.1.0.update1-348481.x86_64.iso
- the script (mkesxiaio_3.9.6.sh)
- if you don't have internet connection on your system, you need also inetd.conf
- eventually a customized oem.tgz. Be sure there aren't spaces in the filename of the .tgz!!!

2) Make the mkesxiaio script executable
Code:
sudo chmod +x mkesxiaio_3.9.6.sh


3) Execute the script
Code:
sudo ./mkesxiaio_3.9.6.sh




The mkESXiaio script

1) The script will check if everything is installed on the system

Image

2) Select the VMWare ESXi version you are going to modify

Image

3) Choose what you want to do

Image




1) ISO installation

Extra support (wget, rsync, ftp, sftp and ssh)
Remember that the capital letter is the default chioce and if you want to select it just press Enter.
Image

If you select n, the script asks you for every program:

Image

If you select Y, the script downloads everything

Image

If you chose to install the FTP server, the script asks you if you want to edit ProFTPd configuration file:

Image

Then the script asks you if you want to add custom-files from the custom-esx folder (inetd.conf, pci.ids and simple.map)

Image

If you select Y, the script copies everything from the custom-esx folder to esx-oem folder

Image

If you select n, the script carries on.
Now it asks you if you want to edit respectively inetd.conf, pci.ids and simple.map

Image

Finish to create the ISO

Image



2) USB installation
3) USB boot


Extra support (wget, rsync, ftp, sftp and ssh)
Remember that the capital letter is the default chioce and if you want to select it just press Enter.
Image

If you select n, the script asks you for every program:

Image

If you select Y, the script downloads everything

Image

If you chose to install the FTP server, the script asks you if you want to edit ProFTPd configuration file:

Image

Then the script asks you if you want to add custom-files from the custom-esx folder (inetd.conf, pci.ids and simple.map)

Image

If you select Y, the script copies everything from the custom-esx folder to esx-oem folder

Image

If you select n, the script carries on.
Now it asks you if you want to edit respectively inetd.conf, pci.ids and simple.map

Image

It will ask you for the USB device

Image
If you are on Windows and you are virtualizing a linux distribution, insert the USB on the host and tell VMWare Player to passthrough it to the Guest OS.
Update and select your USB device.

Image

USB installation warning: on the device must be at least 700MB free!

Image

USB boot warning: do not use a USB stick under 1GB!

Image

Done!

Image

If you chose USB boot, the script will ask you if you want to create another one

Image



4) USB installation without custom files
5) USB boot without custom files


It will ask you for the USB device

Image
If you are on Windows and you are virtualizing a linux distribution, insert the USB on the host and tell VMWare Player to passthrough it to the Guest OS.
Update and select your USB device.

Image

USB installation without custom files warning: on the device must be at least 700MB free!

Image

USB boot without custom files warning: do not use a USB stick under 1GB!

Image

Done!

Image

If you chose USB boot without custom files, the script will ask you if you want to create another one

Image






Prepare the necessary - Windows environment

If you have a Microsoft Windows OS, I think that the best solution is to install the latest version of VMWare Player (in the moment I'm writing is 3.1.0 build-261024) and to load a linux distibution like Ubuntu Lucid Lynx 10.04.
You just have to create the virtual machine and then load Ubuntu from a CD or from the ISO file. We don't need to install anything, we will limit to use the LiveCD.
If you need to transfer files to Ubuntu, you can share a Windows folder for example.
To connect to it from Ubuntu go to "Places" - "Connect to server...", in "Service Type" select "Windows share", and in "Server" write the IP of your Windows PC.
If we need to copy the VMWare ISO, Ubuntu will notify us that there isn't much free space available to copy the file.
Open "System" - "Administration" - "GParted".
Select "Device" - "Create partition table". Then right click on the "Unollacated space" and select "New" to create a new partition (the disk space that we left to the VM when we created it). Here at leat you can change the file system type (for ex. I changed from ext2 to ext4). Then "Edit" - "Apply All Operations" -> "Apply". Now from the "Places" menu select the disk to mount the partition and inside copy your VMWare files from the Windows share folder. You could have permissions problems, so open a Terminal and type

Code:
sudo chmod 777 /media/f50c2b54-4c9a-4fb3-a95d-708b10cfeeb2

If you have labeled the disk, you will see the label instead of the device UUID.



Custom oem.tgz

To obtain an oem.tgz you have 2 choices:

Method 1: use an already provided one

Use any of the oem.tgz created by forum users and provided here for ESXi 4.x or here for ESXi 3.5

Method 2: driver and PCI ID

Insert driver and device informations during the script execution. All you need to have is:
1) the driver (i.e. dmraid.o ).
Create a new folder called “custom-esx” (without quotation marks) and copy the driver inside. You must have the correct folder path. Like custom-esx/etc/file.cfg to make this work.
2) the PCI ID of your device.
To see the PCI ID, if you are in a linux environment, type
Code:
lspci -nn


If you are in a Windows envorinment, take a look here on how to do it: http://www.intel.com/support/network/sb/cs-012904.htm
If you need to search exact "Vendor Name" and "Device Name", go to http://www.pcidatabase.com/
For detailed explanation, follow How do I find the PCI ID for my storage or network controller? written by Dave.Mishchenko

Then you are ready to follow the next paragraph.

Use customization during the script execution

If you select any of the first three options, you have to add a custom driver.
When the script asks you
Code:
Do you like to edit /home/shares/Condivisi/esx-oem/etc/vmware/pci.ids

answer Y.
As we read at the top of the file, the syntax is
Code:
# Syntax:
# vendor  vendor_name
#       device  device_name                             <-- single tab
#               subvendor subdevice  subsystem_name     <-- two tabs


I needed to add an Intel RAID Controller (ICH10), so in my case I added
Code:
8086  Intel Corporation
      2822 RAID Controller


At question
Code:
Do you like to edit /home/shares/Condivisi/esx-oem/etc/vmware/simple.map

answer Y.
First search if the PCI ID is already listed. If not, adda new string, otherwise change the line already present.
In my example there is already a line with PCI ID of my device, so I needed to change it at line 464 from
Code:
8086:2822 0000:0000 storage ahci.o

to
Code:
8086:2822 0000:0000 storage dmraid.o


Then the script will ask you
Code:
Do you have any extra file in /home/shares/Condivisi/custom-esx  [y/N]

answer Y.
The script will answer
Code:
Copy custom-esx to esx-oem



Multiple oem.tgz

If you have multiple .tgz files, the script wil ask you to decide wich one to choose

Image


Method 1: merge the oem.tgz

As pointed out by VMWare vExpert Dave.Mishchenko in this thread, if you need to customize your installation with multiple oem.tgz, you need to merge them.
In this example, I'm trying to merge driver for Realtek RTL81111 and dmraid. I have the following 2 files:
RTL8111_8168_P55_integr_SATA_Ctrl.(AHCI).oem.tgz
other_driver.zip

Extract both and copy other_driver.o to RTL8111_8168_P55_integr_SATA_Ctrl.(AHCI).oem/usr/lib/vmware/vkmod/
Now from a terminal, go into the RTL8111_8168_P55_integr_SATA_Ctrl.(AHCI).oem folder and compress :

Code:
tar -cvpzf oem.tgz etc/ usr/


Move oem.tgz to the folder where there is the script and the VMWare ISO

Code:
mv oem.tgz ../



Method 2: use a oem.tgz already provided and a driver file

In this case, as we have already explained, put the oem.tgz in the same folder of the script and follow the instructions given in the paragraph “Create oem.tgz”.


Last edited by Varazir on Fri May 08, 2009 8:01 am, edited 9 times in total.



Wed Mar 18, 2009 1:59 pm
Profile WWW
Display posts from previous:  Sort by  
This topic is locked, you cannot edit posts or make further replies.   [ 1 post ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.