Difference between revisions of "ESXi Stuff"
(28 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
<span style="color: rgb(186, 55, 42); font-size: 36pt;" >WIP...</span> | <span style="color: rgb(186, 55, 42); font-size: 36pt;">WIP... <span style="font-size: 12pt;" >(tho the ship may have sailed now...)</span></span> | ||
= Installation = | = Installation = | ||
<span style="color: rgb(186, 55, 42); font-size: 24pt;">WIP...</span> | |||
= Setup = | = Setup = | ||
<span style="color: rgb(186, 55, 42); font-size: 24pt;">WIP...</span> | |||
== Laying out the Datastores == | |||
I tend to prefer splitting up my storage into at least 3 separate datastores. (On completely separate drives or RAID arrays...) | |||
=== An "Admin" Datastore === | |||
* [[ESXi - Admin Utilities{{!}}Utilities]] | |||
** Utility space for scripts & add-ons & such | |||
* ISOs | |||
** ISO images & such | |||
* [[ESXi - Admin CloneMe{{!}}CloneMe]] | |||
** Baseline VMs for creating new VMs from | |||
* Manager | |||
** A VM just for remoting in & managing the server | |||
=== A "VMs" Datastore === | |||
This is where I install the actual VMs. | |||
=== 1 (or more) "Storage" Datastores === | |||
Secondary (storage) drives for the VMs get built here. | |||
= Maintenance = | = Maintenance = | ||
* SSL Certificates | |||
* ghettoVCB | |||
* Troubleshooting | |||
* [http://www.vmwarearena.com/how-to-copy-files-between-esxi-hosts-using-scp-command/ How to Copy files between ESXi hosts using SCP Command] | |||
* [https://www.firewall.cx/general-topics-reviews/virtualization-vm-backup/1259-vmware-esxi-invalid-status-virtual-machine.html HOW TO FIX VMWARE ESXI VIRTUAL MACHINE 'INVALID STATUS'] | |||
= ESXi from the Command Line = | |||
There are 2 ways to reach the command line under ESXi, at the console & through SSH. | |||
At the console kinda sucks in most cases. (Think about it, standing in front of the rack is never a good day.) | |||
== Basic Concepts == | |||
* ESXi appears to be based on [https://www.busybox.net/ BusyBox] | |||
** So... If you're bashing your head against a wall trying to figure out how do do something low-level, check out the documentation for BusyBox. | |||
** Basically tho... Most of the functionality is very close to typical Linux, so the man pages on a Linux machine will get you very close. | |||
== AvailableESXi Command sets == | |||
ESXi has at least 2 separate command interpreters available at the command line... | |||
* [[ESXi - vim-cmd{{!}}vim-cmd]] | |||
* [[ESXi - esxcli{{!}}esxcli]] | |||
== Usability Fixes == | |||
ESXi has a '''NON-EDITABLE''' shell profile at '''/etc/profile'''. | |||
Luckily, there's an override file at '''/etc/profile.local''' | |||
After any changes you make to this file, | |||
* <code>source /etc/profile.local</code> | |||
enables your changes. | |||
To make the changes persist over a restart of the server: | |||
* <code>/sbin/auto-backup.sh</code> | |||
To tell ESXi to save the changes. | |||
=== The Shell Prompt === | |||
The shell prompt (when you're in a directory on a mounted volume) is fugly & useless. | |||
* <code>vi /etc/profile.local</code> | |||
PS1="[\u@\h \e[1;33m\A \W\e[m]\$ " | |||
(My current preference...) | |||
See [https://www.cyberciti.biz/tips/howto-linux-unix-bash-shell-setup-prompt.html here] or [https://www.cyberciti.biz/faq/bash-shell-change-the-color-of-my-shell-prompt-under-linux-or-unix/ here] for a couple of articles about customising your prompt... | |||
=== Useful Aliases === | |||
* <code>vi /etc/profile.local</code> | |||
alias ll="ls -l" | |||
=== PATH === | |||
By default, the execution PATH is <code>/bin:/usr/bin</code> . This is fine if you don't want to add executables elsewhere. | |||
I tend to put various utility scripts & such in sub-folders of '''/vmfs/volumes/Admin/Utilities''' | |||
This can also be fixed in '''/etc/profile.local''' | |||
* <code>vi /etc/profile.local</code> | |||
PATH=/bin:/usr/bin:/vmfs/volumes/Admin/Utilities/Scripts | |||
(Note that '''/vmfs/volumes/Admin/Utilities/Scripts''' will be specific to your system...) | |||
==== Caveat ==== | |||
Remote execution through SSH does not read the '''/etc/profile.local''' file. | |||
One solution is to put your custom executables in the '''/bin''' folder. '''<big>BUT</big>''', this is not maintainable. It can break on reboot and will DEFINITELY break on upgrades. | |||
A better solution is to put a symbolic link there. | |||
eg.: | |||
* <code>ln -s /vmfs/volumes/Admin/Utilities/Scripts/MyCustomCode.sh /bin</code> | |||
Or... | |||
Just provide the complete path on the command line when running scripts via SSH: | |||
* <code>ssh root@esxi1 /vmfs/volumes/Admin/Utilities/Scripts/MyCustomCode.sh</code> | |||
= Neat Tricks = | |||
== Copying a VM from one server to another == | |||
Start by shutting down the VM... | |||
Then SSH into the originating server. | |||
* <code>ssh root@esxi0</code> | |||
Next, copy the VM to the destination server. | |||
* <code>scp -r /vmfs/volumes/VMs/TinkersVM root@esxi1:/vmfs/volumes/VMs</code> | |||
Wait a while... | |||
Then... let's see if it'll register & run like the restored backups do. | |||
'''w00t!''' | |||
That'd be a '''Yes'''. | |||
== Messing about with the DCUI screen == | |||
* [https://kb.vmware.com/s/article/2046347 Creating a welcome message on the DCUI screen of an ESXi host (2046347)] | |||
* [https://defaultgateway.org/2020/10/13/welcome-message-for-the-direct-console-user-interface-dcui-be6k-7k/ Welcome message for the Direct Console User Interface (DCUI)-BE6K/7K] | |||
* [https://williamlam.com/2010/09/how-to-add-splash-of-color-to-esxi-dcui.html How to add a splash of color to ESXi DCUI Welcome Screen] | |||
= Oddities = | |||
== SCP Copy Stalled and/or rekeyed ciphers == | |||
See:[https://techpress.net/copy-files-between-esxi-hosts-by-using-scp-secure-copy-command-scp-copy-stalled-fix/ Copy Files between ESXi Hosts by using SCP (Secure Copy) Command / SCP Copy Stalled Fix] | |||
But more usefully... See:[http://www.snailbook.com/faq/no-rekeying.auto.html SSH Frequently Asked Questions] | |||
Basically... It really doesn't mean much. | |||
= Older Notes = | = Older Notes (Mostly still on the TinkerNet Wiki) = | ||
[https://www.youtube.com/watch?v=KW1fRVgOoUU&list=PLS2odYzlaogI1B8ejt7itMOovAqpiLkvU Why virtualize your server infrastructure (Morton Hjorth)] | [https://www.youtube.com/watch?v=KW1fRVgOoUU&list=PLS2odYzlaogI1B8ejt7itMOovAqpiLkvU Why virtualize your server infrastructure (Morton Hjorth)] | ||
*[https://docs.vmware.com/en/VMware-Tools/11.1.0/com.vmware.vsphere.vmwaretools.doc/GUID-8B6EA5B7-453B-48AA-92E5-DB7F061341D1.html Open VM Tools] | *[https://docs.vmware.com/en/VMware-Tools/11.1.0/com.vmware.vsphere.vmwaretools.doc/GUID-8B6EA5B7-453B-48AA-92E5-DB7F061341D1.html Open VM Tools] | ||
*[[TinkerWiki:ESXi - Licensing | *[[TinkerWiki:ESXi - Licensing{{!}}Licensing]] | ||
*[[TinkerWiki:ESXi - UPS Handling | *[[TinkerWiki:ESXi - UPS Handling{{!}}UPS Handling]] | ||
*[[TinkerWiki:ESXi from the Command Line]] | *[[TinkerWiki:ESXi from the Command Line{{!}}ESXi from the Command Line]] | ||
*[[TinkerWiki:ESXi - Passwordless SSH | *[[TinkerWiki:ESXi - Passwordless SSH{{!}}Passwordless SSH]] | ||
*[[TinkerWiki:ESXI - WebUI Through a Proxy | *[[TinkerWiki:ESXI - WebUI Through a Proxy{{!}}WebUI Through a Proxy]] | ||
*[[TinkerWiki:ESXi - ghettoVCB | *[[TinkerWiki:ESXi - ghettoVCB{{!}}ghettoVCB]] | ||
*[[TinkerWiki:ESXi - Add cron Job | *[[TinkerWiki:ESXi - Add cron Job{{!}}Add cron Job]] | ||
*Allowing SSH & SCP between ESXi Hosts | *Allowing SSH & SCP between ESXi Hosts | ||
**SSH Client must be enabled in the ESXi firewall (for the outbound connection) | **SSH Client must be enabled in the ESXi firewall (for the outbound connection) | ||
**[https://4sysops.com/archives/how-to-open-and-close-firewall-ports-on-vmware-esxi-hosts/ How to Open and Close Firewall Ports on vmWare ESXi Hosts] | **[https://4sysops.com/archives/how-to-open-and-close-firewall-ports-on-vmware-esxi-hosts/ How to Open and Close Firewall Ports on vmWare ESXi Hosts] | ||
*[[TinkerWiki:ESXi - MQTT client tools | *[[TinkerWiki:ESXi - MQTT client tools{{!}}Making ESXi talk MQTT]] | ||
*[[ | *[[TinkerWiki:ESXi - Troubleshooting{{!}}Troubleshooting]] | ||
*[[TinkerWiki:ESXi - Various Observations | *[[TinkerWiki:ESXi - Various Observations{{!}}Various Observations]] | ||
*[[TinkerWiki:SSL - ESXi | *[[TinkerWiki:SSL - ESXi{{!}}SSL Certificates]] | ||
*[http://www.vmwarearena.com/how-to-copy-files-between-esxi-hosts-using-scp-command/ How to Copy files between ESXi hosts using SCP Command] | *[http://www.vmwarearena.com/how-to-copy-files-between-esxi-hosts-using-scp-command/ How to Copy files between ESXi hosts using SCP Command] | ||
*[https://www.firewall.cx/general-topics-reviews/virtualization-vm-backup/1259-vmware-esxi-invalid-status-virtual-machine.html HOW TO FIX VMWARE ESXI VIRTUAL MACHINE 'INVALID STATUS'] | *[https://www.firewall.cx/general-topics-reviews/virtualization-vm-backup/1259-vmware-esxi-invalid-status-virtual-machine.html HOW TO FIX VMWARE ESXI VIRTUAL MACHINE 'INVALID STATUS'] |
Latest revision as of 14:28, 23 December 2023
WIP... (tho the ship may have sailed now...)
Installation
WIP...
Setup
WIP...
Laying out the Datastores
I tend to prefer splitting up my storage into at least 3 separate datastores. (On completely separate drives or RAID arrays...)
An "Admin" Datastore
- Utilities
- Utility space for scripts & add-ons & such
- ISOs
- ISO images & such
- CloneMe
- Baseline VMs for creating new VMs from
- Manager
- A VM just for remoting in & managing the server
A "VMs" Datastore
This is where I install the actual VMs.
1 (or more) "Storage" Datastores
Secondary (storage) drives for the VMs get built here.
Maintenance
- SSL Certificates
- ghettoVCB
- Troubleshooting
- How to Copy files between ESXi hosts using SCP Command
- HOW TO FIX VMWARE ESXI VIRTUAL MACHINE 'INVALID STATUS'
ESXi from the Command Line
There are 2 ways to reach the command line under ESXi, at the console & through SSH.
At the console kinda sucks in most cases. (Think about it, standing in front of the rack is never a good day.)
Basic Concepts
- ESXi appears to be based on BusyBox
- So... If you're bashing your head against a wall trying to figure out how do do something low-level, check out the documentation for BusyBox.
- Basically tho... Most of the functionality is very close to typical Linux, so the man pages on a Linux machine will get you very close.
AvailableESXi Command sets
ESXi has at least 2 separate command interpreters available at the command line...
Usability Fixes
ESXi has a NON-EDITABLE shell profile at /etc/profile.
Luckily, there's an override file at /etc/profile.local
After any changes you make to this file,
source /etc/profile.local
enables your changes.
To make the changes persist over a restart of the server:
/sbin/auto-backup.sh
To tell ESXi to save the changes.
The Shell Prompt
The shell prompt (when you're in a directory on a mounted volume) is fugly & useless.
vi /etc/profile.local
PS1="[\u@\h \e[1;33m\A \W\e[m]\$ "
(My current preference...)
See here or here for a couple of articles about customising your prompt...
Useful Aliases
vi /etc/profile.local
alias ll="ls -l"
PATH
By default, the execution PATH is /bin:/usr/bin
. This is fine if you don't want to add executables elsewhere.
I tend to put various utility scripts & such in sub-folders of /vmfs/volumes/Admin/Utilities
This can also be fixed in /etc/profile.local
vi /etc/profile.local
PATH=/bin:/usr/bin:/vmfs/volumes/Admin/Utilities/Scripts
(Note that /vmfs/volumes/Admin/Utilities/Scripts will be specific to your system...)
Caveat
Remote execution through SSH does not read the /etc/profile.local file.
One solution is to put your custom executables in the /bin folder. BUT, this is not maintainable. It can break on reboot and will DEFINITELY break on upgrades.
A better solution is to put a symbolic link there.
eg.:
ln -s /vmfs/volumes/Admin/Utilities/Scripts/MyCustomCode.sh /bin
Or...
Just provide the complete path on the command line when running scripts via SSH:
ssh root@esxi1 /vmfs/volumes/Admin/Utilities/Scripts/MyCustomCode.sh
Neat Tricks
Copying a VM from one server to another
Start by shutting down the VM...
Then SSH into the originating server.
ssh root@esxi0
Next, copy the VM to the destination server.
scp -r /vmfs/volumes/VMs/TinkersVM root@esxi1:/vmfs/volumes/VMs
Wait a while...
Then... let's see if it'll register & run like the restored backups do.
w00t!
That'd be a Yes.
Messing about with the DCUI screen
- Creating a welcome message on the DCUI screen of an ESXi host (2046347)
- Welcome message for the Direct Console User Interface (DCUI)-BE6K/7K
- How to add a splash of color to ESXi DCUI Welcome Screen
Oddities
SCP Copy Stalled and/or rekeyed ciphers
See:Copy Files between ESXi Hosts by using SCP (Secure Copy) Command / SCP Copy Stalled Fix
But more usefully... See:SSH Frequently Asked Questions
Basically... It really doesn't mean much.
Older Notes (Mostly still on the TinkerNet Wiki)
Why virtualize your server infrastructure (Morton Hjorth)
- Open VM Tools
- Licensing
- UPS Handling
- ESXi from the Command Line
- Passwordless SSH
- WebUI Through a Proxy
- ghettoVCB
- Add cron Job
- Allowing SSH & SCP between ESXi Hosts
- SSH Client must be enabled in the ESXi firewall (for the outbound connection)
- How to Open and Close Firewall Ports on vmWare ESXi Hosts
- Making ESXi talk MQTT
- Troubleshooting
- Various Observations
- SSL Certificates
- How to Copy files between ESXi hosts using SCP Command
- HOW TO FIX VMWARE ESXI VIRTUAL MACHINE 'INVALID STATUS'