In this Article I will show about how to create VM that will install UBuntu 20.04 on VCenter and this VM will used for be template to clone with tools such as Terraform or Rancher and so on.
Objective
- download ISO image to datastore
- create VM with ISO image
- install UBuntu
- ssh to vm
- install necessary tools
Prerequisite
- have permission for login ,upload images to datastore and create VM
Download ISO image to datastore
- download https://releases.ubuntu.com/20.04.5/ubuntu-20.04.5-live-server-amd64.iso?_ga=2.123094735.572432131.1668958664-1665980284.1657734963 or go to https://ubuntu.com/download/server and find Ubuntu Server 20.04 LTS Button or you can download Ubuntu Server 22.10 LTS
- you will get file ubuntu-20.04.5-live-server-amd64.iso
- select Inventory
- select Storage
- choose your Datastore (check Free Space)
- select Files and UPLOAD FILES
- wait for uploading
- if your can’t upload try to check permission to those datastore or change other datastore
Create VM with ISO image
- from inventory select tab VM and Templates
- select Datacenters or folder
- right click and New Virtual Machine
- fill vm name and selection location or folder
- select compute resource
- select compute storage
- select Compatible with Vsphere version
- select guest os
- select VM Hardware detail
network : uncheck Connect
New CD/DVD Drive : Datastore ISO File
- select your ISO Imange that already download
- connect Drive
- Click Finish
Install UBuntu
- start VM
- wait to start then open web console
- select language and keyboard
- set network interface
- fill your network and save
- Continue without network
- set Storage
- Done and Continue
- fill profile <user_name> and so on
- Install OpenSSH
- wait for install process
- Reboot Now
- change DVD drive to Client Device and Set Network Adapter to Connected then OK
- set Connect At Power On
- set Hot Plug Both CPU and Memory
- press Enter in console
- wait to reboot again
SSH to vm
ssh <user_name>@<vm_address>
Install necessary tools
sudo apt-get update -y
sudo apt-get upgrade -y
#Install docker
curl https://releases.rancher.com/install-docker/20.10.sh | sh
#check docker version
sudo docker version
- add SSH user to group
The SSH user used for node access must be a member of the docker
group on the node:
sudo usermod -aG docker <user_name>
- create ssh private publickey
ssh-keygen -t rsa
ssh-copy-id <user_name>@<vm_address>
- now you can login with don’t fill password
- install resolvconf
sudo apt install resolvconf -y
- update internal dns server
cat <<EOF | sudo tee -a /etc/resolvconf/resolv.conf.d/head
nameserver x.x.x.x
nameserver x.x.x.x
EOF
sudo resolvconf - enable-updates
sudo resolvconf -u
sudo systemctl status resolvconf.service
- test internal domain with nslookup and ping
nslookup <internal-domain>
ping <internal-domain>
- set timezone
sudo timedatectl set-timezone Asia/Bangkok
- install ntp
sudo apt install ntpdate
sudo ntpdate <server-IP>
#make sure can connect with
#date ntpupdate: adjust time server <server-IP> offset -0.048800 sec
# Disable systemd timesyncd service
sudo timedatectl set-ntp off
# Install ntp
sudo apt install ntp -y
- add more your NTP server
sudo vim /etc/ntp.conf
server 10.x.x.x prefer iburst
server 10.x.x.x prefer iburst
#restart ntp
sudo systemctl restart ntp
#verify
ntpq -p
#check status
systemctl is-enabled ntp
systemctl enable ntp
sudo systemctl status ntp
— — — — — — — — — — — — — — — — — — — — — — — — — — — — —
Credit : TrueDigitalGroup
— — — — — — — — — — — — — — — — — — — — — — — — — — — — —
Next Topic