linux_wiki:os_install_vm_template

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
linux_wiki:os_install_vm_template [2016/05/09 22:36]
billdozor [Add/Expand Storage]
linux_wiki:os_install_vm_template [2016/09/28 22:05]
billdozor [Add/Expand Storage]
Line 11: Line 11:
 ---- ----
  
-===== Create the Virtual Machine =====+====== Create the Virtual Machine ======
  
   * Create a new virtual machine.   * Create a new virtual machine.
Line 24: Line 24:
 ---- ----
  
-==== Partitioning ====+===== Partitioning =====
  
 Red Hat Recommendations Red Hat Recommendations
Line 51: Line 51:
 After a CentOS 7.2 minimal install, the disk usage with that partitioning looks like this:\\ After a CentOS 7.2 minimal install, the disk usage with that partitioning looks like this:\\
 TODO - SCREENSHOT TODO - SCREENSHOT
 +
 +----
 +
 +====== System Configuration =====
 +
 +Modify the OS with changes you want to be included on ALL systems. They should be server role generic.
  
 ---- ----
Line 96: Line 102:
  
 **Proceed to "CentOS 6: VM Cleanup" before creating template.** **Proceed to "CentOS 6: VM Cleanup" before creating template.**
 +
 +----
 +
 +===== CentOS 6: VM Cleanup =====
 +
 +Perform any other customizations/installs prior to the following steps.
 +
 +<code bash>
 +# Cleanup => Remove ssh host keys (so each deployed VM has a different fingerprint)
 +rm -f /etc/ssh/ssh_host_*
 +
 +# Cleanup => Remove persistent rules and network hw address - prevents eth0 from incrementing
 +rm -f /etc/udev/rules.d/70-persistent-*
 +sed -i "/HWADDR/d" /etc/sysconfig/network-scripts/ifcfg-eth0
 +sed -i "/UUID/d" /etc/sysconfig/network-scripts/ifcfg-eth0
 +
 +# Cleanup => Remove some of root's files
 +rm -f /root/anaconda-ks.cfg /root/install.log*
 +
 +# 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 /var/log/audit
 +
 +# Update locate's database
 +updatedb
 +
 +# Clear history and shutdown for template cloning
 +history -c && history -w
 +shutdown -P now
 +</code>
 +
 +  * Create a VM Template from the powered off system.
  
 ---- ----
Line 172: Line 216:
  
 **Proceed to "CentOS 7: VM Cleanup" before creating template.** **Proceed to "CentOS 7: VM Cleanup" before creating template.**
- 
----- 
- 
-===== CentOS 6: VM Cleanup ===== 
- 
-Perform any other customizations/installs prior to the following steps. 
- 
-<code bash> 
-# Cleanup => Remove ssh host keys (so each deployed VM has a different fingerprint) 
-rm -f /etc/ssh/ssh_host_* 
- 
-# Cleanup => Remove persistent rules and network hw address - prevents eth0 from incrementing 
-rm -f /etc/udev/rules.d/70-persistent-* 
-sed -i "/HWADDR/d" /etc/sysconfig/network-scripts/ifcfg-eth0 
-sed -i "/UUID/d" /etc/sysconfig/network-scripts/ifcfg-eth0 
- 
-# Cleanup => Remove some of root's files 
-rm -f /root/anaconda-ks.cfg /root/install.log* 
- 
-# 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 /var/log/audit 
- 
-# Update locate's database 
-updatedb 
- 
-# Clear history and shutdown for template cloning 
-history -c && history -w 
-shutdown -P now 
-</code> 
  
 ---- ----
Line 244: Line 252:
 shutdown -P now shutdown -P now
 </code> </code>
 +
 +  * Create a VM Template from the powered off system.
  
 ---- ----
  
-===== Add/Expand Storage =====+====== Add/Expand Storage ======
  
 After deploying a VM from the template, you may need to expand storage on one of the partitions. After deploying a VM from the template, you may need to expand storage on one of the partitions.
Line 268: Line 278:
   - Extend the logical volume that needs the space (/home will be used in this example)   - Extend the logical volume that needs the space (/home will be used in this example)
     - **Option 1 (Preferred)**: Move the physical extents of the logical volume to the new disk, so all of it resides on the same VMDK, and then use all of that new disk's space.     - **Option 1 (Preferred)**: Move the physical extents of the logical volume to the new disk, so all of it resides on the same VMDK, and then use all of that new disk's space.
-      * This method is preferred because there is a performance hit when a partition spans VMDKs +      * This method is preferred because there is a performance hit when a partition spans VMDKs<code bash>pvmove --name lvhome /dev/sda2 /dev/sdb1
-      * <code bash>pvmove --name lvhome /dev/sda2 /dev/sdb1+
 lvextend --resizefs /dev/mapper/vglocal-lvhome /dev/sdb1</code> lvextend --resizefs /dev/mapper/vglocal-lvhome /dev/sdb1</code>
     - Option 2: Give the logical volume all of the space from the newly added physical volume<code bash>lvextend --resizefs --extents +100%PVS /dev/mapper/vglocal-lvhome /dev/sdb1</code>     - Option 2: Give the logical volume all of the space from the newly added physical volume<code bash>lvextend --resizefs --extents +100%PVS /dev/mapper/vglocal-lvhome /dev/sdb1</code>
  • linux_wiki/os_install_vm_template.txt
  • Last modified: 2019/05/25 23:50
  • (external edit)