Last post we worked on how to pass parameters to the installer.
Now it’s time for the customization you can make after the Operational System is installed.
The %post section will carry on all the commands you want to execute after your ESX has been installed, that means the ESX is loaded and all the ESX’s commands are available too you.
The installation sequence is something like:
1 – installer loads
2 - %pre section loads and you input your parameters
3 – installation occurs based on the %pre section information.
4 – installer executes the commands on %post section
5 – Server reboots
Did you realized the power of this section ?!!?!
You can run all the commands you normally do when configuring your host after installing it, like
esxcfg-firewall command to open/close ports
esxcfg-auth command for the authentication settings
Anything you normally do on a host session. The command syntax is just the same.
So, how to use the %post section ?
Start with the following line after all the %pre section commands
%post --interpreter=bash
Then just place the commands, one per line.
But the trick I can show you, is that you can also copy files to the host, may be the sshd_config file, with your already configured SSH options or even coping rpm packages for agents installations.
How does it work ?
- first you will need to create a folder with all the required files and packages you want to use.
- Then burn a CD with the ESX installation and your new files (we will cover this process on the next post)
Now that your CD is ready with the files you need, let’s configure the %post section
First you will need to mount the cd-rom on the system
mount /dev/cdrom /mnt/cdrom
them you can just copy the files from the cd to the system, like
cp /mnt/cdrom/Custom/sshd_config /etc/ssh/sshd_config
or installing the RPMs on your system, like
rpm –ivh /mnt/cdrom/Custom/agent.rpm
Here’s just a sample of a script to help you start your own
************************************************
%post --interpreter=bash
#mount CDROM
mount /dev/cdrom /mnt/cdrom
#enabling ssh on firewall
esxcfg-firewall -e sshClient
#configuring ssh
mv /etc/ssh/sshd_config /etc/ssh/sshd_config.old
cp /mnt/cdrom/Custom/sshd_config /etc/ssh/sshd_config
chmod 600 /etc/ssh/sshd_config
#unmont cdrom
umount /mnt/cdrom
************************************************
I bet your are anxious to get it working ; )
Thursday, March 17, 2011
ESX Scripted Install – part 3/4
Marcadores:
ESX,
installation,
script,
vSphere 4.1
Who am I

- Eduardo Meirelles da Rocha
- I’m an IT specialist with over 15 years of experience, working from IT infrastructure to management products, troubleshooting and project management skills from medium to large environments. Nowadays I'm working for VMware as a Consulting Architect, helping customers to embrace the Cloud Era and make them successfully on their journey. Despite the fact I'm a VMware employee these postings reflect my own opinion and do not represents VMware's position, strategies or opinions. Reach me at @dumeirell

Most Viewed Posts
-
vRealize Automation 7.1 brings several new features and functionalities, while the community is covering the fanciest...
-
Have you tried to set up or change a root's password for an ESXi host and got the following error message: Weak...
-
If you just install VMware Converter and start running it with it’s default configuration, I’m sure you will be successfully. But, the...
-
During the past few weeks, my NSX partner in crime, the Sr. Consultant Anderson Duboc and I have been working on a NSX Reference Poster...
-
I have to admit since I started playing with PowerCLI I’ve been enjoying it more and more. A few weeks ago I needed to delete 50 VMs from t...
-
Do you know the LUNs on your environment might have different versions ? Yeah, that’s true!! To check tha LUN version, on the configuratio...
-
Once again I was working on a vSphere Site Recovery Manager project using vSphere Replication as a replication technology and had to exp...
-
Most of my time as a Consulting Architect at VMware Professional Services I spend with clients, helping them to create innovative solut...
-
Most of vCloud Director implementations I’ve worked on where multi-cells implementations behind a load balancer to distribute the load a...
-
VMware vSAN 6.2 Stretched Cluster & 2 Node Guide covers greatly all the network topologies supported and the configuration steps invo...

No comments:
Post a Comment