VMWare Esxi

From FroggDev - En
Jump to: navigation, search
VMware Logo

Esxi - Introduction

VMware ESXi (formerly ESX) is an enterprise-class, type-1 hypervisor developed by VMware for deploying and serving virtual computers. As a type-1 hypervisor, ESXi is not a software application that one installs in an operating system; instead, it includes and integrates vital OS components, such as a kernel.

After version 4.1, VMware renamed ESX to ESXi. ESXi replaces Service Console (a rudimentary operating system) with a more closely integrated OS. ESX/ESXi is the primary component in the VMware Infrastructure software suite.

The name ESX is an abbreviation of Elastic Sky X

ESX runs on bare metal, without running an operating system, unlike other VMware products. It includes its own kernel: A Linux kernel is started first, and is then used to load a variety of specialized virtualization components, including ESX, which is otherwise known as the vmkernel component. The Linux kernel is the primary virtual machine; it is invoked by the service console. At normal run-time, the vmkernel is running on the bare computer, and the Linux-based service console runs as the first virtual machine. VMWare dropped development of ESX at version 4.1, and now uses ESXi, which does not include a Linux kernel.

The vmkernel is a microkernel with three interfaces: hardware, guest systems, and the service console (Console OS).

Esxi - Documentation

https://www.vmware.com/support/pubs/vsphere-esxi-vcenter-server-pubs.html http://pubs.vmware.com/vsphere-50/index.jsp

Esxi - Prepare

Esxi 5.1 USB Key Installation

Esxi - Installation

TODO

Esxi - Update

TODO

Esxi - Configuration

TODO

  • auto démarrage
  • activer ssh
  • ajouter un disque

Esxi - Shell

link to Esxi shell's commands

Change default page

/usr/lib/vmware/hostd/docroot/index.html

Esxi - FTP via SSH

1] activate ssh on your esxi

2] download ncftp linux files at adress ftp://ftp.ncftp.com/ncftp/binaries/ncftp-3.2.5-linux-x86_64-glibc2.3-export.tar.gz or http://pool.wiki.frogg.fr/images/6/69/Linux_Ncftp-3.2.5-x86_64.tar.gz

  • from windows: copy past the url into your web browser

use winrar to extract files

upload bin files to your esxi using SFTP option on a ftp client (SFTP is included in ssh)

  • from esxi

temporary disable firewall

esxcli network firewall set --enable false

get ncftp files

wget {Archive.tgz}

create a folder where tar will be extract

mkdir {TargetFolder}

extract them

tar -C {TargetFolder}  -xvzf {Archive.tgz}

once extracted you can move the bin folder to where you want

3] in esxi ssh go to the bin folder, find ncftpput (the nftp command to upload file) and add execute rights

chmod +x ncftpput

4] disable temporary firewall (due to passive mode)

esxcli network firewall set --enable false

5] upload your file !

./bin/ncftpput -u {user} -p {pass} -v -z -t 5 -E -P 21 {server} {serverPath} {localFilePath}
-v = use progress meter (not really usefull)
-z = resume mode
-t = timeout in secondes
-E = passive mode (-F for active mode)
-P = port

if you dont use passive mode, u can disable only ftppart of the firewall with the command: esxcli network firewall ruleset set -r ftpClient -e true

6] enable firewall

once done, set back on your firewall

esxcli network firewall set --enable true

Esxi - Send mail via SSH

https://en.wiki.frogg.fr/Bash_commands#Send_a_Mail_via_netcat

Esxi - BACKUP via SSH

https://github.com/Fro99666/BASH_froggESXIbackupVM

Esxi - Add a task to crontab

Edit the file /etc/rc.local.d/local.sh (it is a permanent file, it stay after Esxi reboot)

#add to crontab a task
echo "01 00 1,15 * * root /vmfs/volumes/datastore1/script/backupVM.sh" >> /var/spool/cron/crontabs/root
#stop crontab process
kill $(cat /var/run/crond.pid)
#start crontab process
crond

don't forget to set the script as executable

chmod +x /vmfs/volumes/datastore1/script/backupVM.sh

Esxi - VM Convertion

TODO

Esxi - VM - mount a disk from remote Windows

for information a VM in ESXI 5.1+ is compatible with VM Ware Worstation 9+

[TODO HERE]

NFS mount

esxcli storage nfs remove -v {NFS_Name}
esxcli storage nfs add -H {IP} -s {PATH} -v {NFS_Name}

Esxi - VMWare Tools under Linux

In vSphère > Vm > guest > installer VMWare tools this will mount WMWare tools in the cd rom, then

cp /media/cdrom/VMwareTools-9.2.2-893683.tar.gz /usr/local/src

then go to this folder

cd /usr/local/src

Uncompress VMWare tools

tar xzf /usr/local/src/VMwareTools-9.2.2-893683.tar.gz

Then go to the folder extracted

cd /usr/local/src/vmware-tools-distrib/

An launch the installation script

./vmware-install.pl -d

Esxi - VM - Parameters

[ TODO HERE ]

Copy/Paste

To unable copy/paste on a VM in VMWare workstation, power off it, then right click to modify its parameters. In the Option tab, click "general" then set

isolation.tools.copy.disable FALSE
isolation.tools.paste.disable FALSE

To enable copy/paste on a VM in ESXi, log into ESXI in ssh.

To enable SSH on ESXi Start vSphere client and click on the ESXI Adress, then in the right panel, select configuration. In the left menu, click on profil security (in the sofwtare part). Then click on properties (in services). In the opened window select SSH then start it. SSH in this case will be disabled at the next ESXI reboot.

To Enable copy/paste Once loged in SSH into the ESXI (with putty for exemple), then edit /etc/vmware/config

isolation.tools.copy.disable= "FALSE"
isolation.tools.paste.disable= "FALSE"

No need to reboot the ESXI, the changes will be taken at the next VM reboot.

Copy paste will work with text, but not files !

Rename a disk

vmkfstools -E OldFileName.vmdk NewFileName.vmdk

Rename a VM

  • remove it from the inventory
  • rename the disk with the command
vmkfstools -E {OLD}.vmdk {NEW}.vmdk
  • rename the vmx
mv "{OLD}.vmx" "{NEW}.vmx"
  • rename the vmdk
mv "{OLD}.vmdk" "{NEW}.vmdk"
  • rename the vmxf
mv "{OLD}.vmxf" "{NEW}.vmxf"
  • edit {NEW}.vmx change old values to new {OLD}.vmdk & {OLD}.vmxf
  • put it back into inventory

Esxi - VM - Error

VM is not starting

In most of case (if the ressources are enought to start it) just recreate the VM keeping the VM disk with the menu add a VM, manually, and select the main HDD of the inaccessible VM

Secondary disk has been removed

error module disk early power on failed

Solution:

  • recreate a dummy disk with the same name

ou

  • edit .vmx and remove line linked to the removed disk