Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
linux_wiki:os_install_vm_template [2015/12/17 14:36] 127.0.0.1 external edit |
linux_wiki:os_install_vm_template [2019/05/25 23:50] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== VM Template ====== | + | ====== |
**General Information** | **General Information** | ||
Line 6: | Line 6: | ||
**Checklist** | **Checklist** | ||
- | * Distro: Enterprise Linux 6 or 7 | + | * Distro(s): Enterprise Linux 6 or 7 |
- | * VMware ESXi 5+ | + | * Other: |
---- | ---- | ||
- | ===== Create the Virtual Machine ===== | + | ====== Create the Virtual Machine |
* Create a new virtual machine. | * Create a new virtual machine. | ||
+ | * Virtual Hardware: | ||
+ | * Enable CPU -> CPU Hot Plug -> check " | ||
+ | * Enable Memory -> Memory Hot Plug -> check " | ||
* Install the EL OS. | * Install the EL OS. | ||
* If the screen resolution is too small | * If the screen resolution is too small | ||
Line 21: | Line 24: | ||
---- | ---- | ||
- | ==== Partitioning ==== | + | ===== Partitioning ===== |
+ | |||
+ | Red Hat Recommendations | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
LVM provides a very flexible partitioning layout. The goal is to create a small disk footprint and allow elastic growing for partitions depending upon the type of server being deployed. | LVM provides a very flexible partitioning layout. The goal is to create a small disk footprint and allow elastic growing for partitions depending upon the type of server being deployed. | ||
Line 36: | Line 43: | ||
* LVM Free: 3.5 GB (Available for minor partition expansion) | * LVM Free: 3.5 GB (Available for minor partition expansion) | ||
+ | **NOTE:** Contrary to a lot of online documentation, | ||
+ | |||
+ | \\ | ||
After a CentOS 6.7 minimal install, the disk usage with that partitioning looks like this:\\ | After a CentOS 6.7 minimal install, the disk usage with that partitioning looks like this:\\ | ||
TODO - SCREENSHOT | TODO - SCREENSHOT | ||
+ | |||
+ | After a CentOS 7.2 minimal install, the disk usage with that partitioning looks like this:\\ | ||
+ | TODO - SCREENSHOT | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ====== System Configuration ===== | ||
+ | |||
+ | Modify the OS with changes you want to be included on ALL systems. They should be server role generic. | ||
---- | ---- | ||
Line 83: | Line 102: | ||
**Proceed to " | **Proceed to " | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== CentOS 6: VM Cleanup ===== | ||
+ | |||
+ | Perform any other customizations/ | ||
+ | |||
+ | <code bash> | ||
+ | # Cleanup => Remove ssh host keys (so each deployed VM has a different fingerprint) | ||
+ | rm -f / | ||
+ | |||
+ | # Cleanup => Remove persistent rules and network hw address - prevents eth0 from incrementing | ||
+ | rm -f / | ||
+ | sed -i "/ | ||
+ | sed -i "/ | ||
+ | |||
+ | # Cleanup => Remove some of root's files | ||
+ | rm -f / | ||
+ | |||
+ | # Cleanup => remove tmp files | ||
+ | rm -rf /tmp/* | ||
+ | |||
+ | # Cleanup => stop auditd from logging, remove log files | ||
+ | # Stop any other service that actively logs to sub directories of /var/log | ||
+ | # Recommended to install sysstat (sar) during a post deployment phase. | ||
+ | service auditd stop | ||
+ | rm -rf /var/log/* | ||
+ | mkdir / | ||
+ | |||
+ | # Update locate' | ||
+ | updatedb | ||
+ | |||
+ | # Clear history and shutdown for template cloning | ||
+ | history -c && history -w | ||
+ | shutdown -P now | ||
+ | </ | ||
+ | |||
+ | * Create a VM Template from the powered off system. | ||
---- | ---- | ||
Line 159: | Line 216: | ||
**Proceed to " | **Proceed to " | ||
- | |||
- | ---- | ||
- | |||
- | ===== CentOS 6: VM Cleanup ===== | ||
- | |||
- | Perform any other customizations/ | ||
- | |||
- | <code bash> | ||
- | # Cleanup => Remove ssh host keys (so each deployed VM has a different fingerprint) | ||
- | rm -f / | ||
- | |||
- | # Cleanup => Remove persistent rules and network hw address - prevents eth0 from incrementing | ||
- | rm -f / | ||
- | sed -i "/ | ||
- | sed -i "/ | ||
- | |||
- | # Cleanup => Remove some of root's files | ||
- | rm -f / | ||
- | |||
- | # Cleanup => remove tmp files | ||
- | rm -rf /tmp/* | ||
- | |||
- | # Cleanup => stop auditd from logging, remove log files | ||
- | # Stop any other service that actively logs to sub directories of /var/log | ||
- | # Recommended to install sysstat (sar) during a post deployment phase. | ||
- | service auditd stop | ||
- | rm -rf /var/log/* | ||
- | mkdir / | ||
- | |||
- | # Update locate' | ||
- | updatedb | ||
- | |||
- | # Clear history and shutdown for template cloning | ||
- | history -c && history -w | ||
- | shutdown -P now | ||
- | </ | ||
---- | ---- | ||
Line 232: | Line 253: | ||
</ | </ | ||
- | ---- | + | * Create |
- | + | ||
- | ===== Add/Expand Storage ===== | + | |
- | + | ||
- | After deploying | + | |
- | + | ||
- | - Add an additional hard disk to the VM. (Either from initial deployment or hot add to the VM) | + | |
- | - Verify disk device name to use:< | + | |
- | - Create a new partition on the disk and format it as a “8e” (Linux LVM) type | + | |
- | - fdisk /dev/sdb | + | |
- | - Command: n | + | |
- | - Command action (primary partition): p | + | |
- | - Partition number: 1 | + | |
- | - First cylinder: enter for default of the first | + | |
- | - Last cylinder: enter for default of the last | + | |
- | - Command: t | + | |
- | - Selected partition 1 (message displayed when only 1 partition exists) | + | |
- | - Hex code: 8e (for LVM) | + | |
- | - Command: w | + | |
- | - Create a LVM physical disk from the partition< | + | |
- | - Add the new physical disk to the existing volume group< | + | |
- | - Extend the logical volume that needs the space (/home will be used in this example) | + | |
- | - **Option 1 (Preferred)**: | + | |
- | * This method is preferred because there is a performance hit when a partition spans VMDKs | + | |
- | * <code bash> | + | |
- | lvextend / | + | |
- | - Option 2: Give the logical volume all of the space from the newly added physical volume< | + | |
- | - Option 3: Give the logical volume a specific amount of additional free space from a specific physical volume< | + | |
- | - Option 4: Give the logical volume all of the free space available to the volume group (potentially across multiple physical disks)< | + | |
- | - Verify LVM Allocation | + | |
- | - Logical Volume: <code bash> | + | |
- | - Volume Group: <code bash> | + | |
- | - Physical Volumes: <code bash> | + | |
- | - Grow the file system | + | |
- | - Ext2/ | + | |
- | - XFS<code bash> | + | |
- | - Verify filesystem space< | + | |
---- | ---- | ||