RHEL/CentOS

Configure a Postfix Relay through Gmail on CentOS 7

When installing on VMware, add the following line to fix the screen resolution: vga=794

Bare metal and Virtual Machine Provisioning through Foreman Server


Create LVM Volume

# pvcreate /dev/sdb1
# vgcreate opt_vg /dev/sdb1
# lvcreate -n opt_lv -l 100%FREE opt_vg

Using Packer to create a VM in vSphere

{
 "builders": [
   {
     "type": "vsphere-iso",
     "boot_command": [
       "<tab> text ks=hd:fd0:/KS.CFG<enter><wait>"
     ],
     "boot_wait": "10s",
     "vcenter_server": "",
     "username": "[email protected]",
     "password": "",
     "insecure_connection": "true",
     "vm_name": "test-centos7",
     "cluster": "Production",
     "datastore": "vm-storage",
     "guest_os_type": "rhel7_64Guest",
     "ssh_username": "root",
     "ssh_password": "",
     "CPUs": 2,
     "RAM": 2048,
     "RAM_reserve_all": true,
     "disk_controller_type": "pvscsi",
     "disk_size": 32768,
     "disk_thin_provisioned": true,
     "network_card": "vmxnet3",
     "network": "Management",
     "iso_paths": [
       "[ISOs] Linux/CentOS/CentOS-7-x86_64-NetInstall-1804/CentOS-7-x86_64-NetInstall-1804.iso"
     ],
     "floppy_files": [
       "ks.cfg"
     ]
   }
 ],
 "provisioners": [
   {
     "type": "file",
     "source": "CentOS-Base.repo",
     "destination": "/tmp/CentOS-Base.repo"
   },
   {
     "type": "shell",
     "inline": ["rm /etc/yum.repos.d/CentOS-Base.repo && cp /tmp/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo && yum update -y && yum install -y vim bash-completion"]
   }
 ]
}

Install VirtualBox guest additions on CentOS Stream 9:

# dnf -y install gcc make bzip2 tar kernel-devel elfutils-libelf-devel
# mount /dev/cdrom /mnt
# cd /mnt
# ./VBoxLinuxAdditions.sh