This time I will discuss on how to install CentOS 7 remotely using VNC. There are some differences between installing CentOS 6 and CentOS 7 remotely via VNC due to different versions of grub.
Basically in CentOS 6 you will find this kind of setup for the menu entry (supposed we have boot partition):
title CentOS 6 VNC Installation
root (hd0,0)
kernel /netinstall/vmlinuz vnc vncpassword=12345678 headless ip=10.0.0.10 gateway=10.0.0.1 netmask=255.255.255.0 dns=10.0.0.5 ksdevice=eth0 method=http://mirror.centos.org/centos/6/os/x86_64/ lang=en_US keymap=us
initrd /netinstall/initrd.img
What has changed with CentOS 7?
The following table shows the difference of boot options between CentOS 6 and CentOS 7 for VNC installatons:
CentOS 6 | CentOS 7 |
---|---|
vnc | inst.vnc |
vncpassword= | inst.vncpassword= Note: MUST at least 8 char |
headless | inst.headless |
ip= | ip=ip::gateway:netmask:hostname:interface:none Example: ip=10.0.0.10::10.0.0.1:255.255.255.0:host.example.com:eth0:none or ip=dhcp |
gateway= | See IP above |
netmask= | See IP above |
dns= | nameserver= |
method= | inst.repo= |
lang= | inst.lang= |
keymap= | inst.keymap= |
You can read the whole options on CentOS 7 Boot Options.
VNC Installation Configurations
Make sure if you get the right network configurations for IP Address, Gateway, Netmask, and the network device name.
Download the bootstrap files
yum install wget
cd /boot
wget http://mirror.centos.org/centos/7/os/x86_64/isolinux/vmlinuz -O vmlinuz-7
wget http://mirror.centos.org/centos/7/os/x86_64/isolinux/initrd.img -O initrd-7.img
Creating custom menu entry
The safest thing is we just need to copy menu entry that already exists in /boot/grub2/grub.cfg
.
Example existing menu entry:
menuentry 'CentOS Linux, with Linux 3.10.0-123.el7.x86_64' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-123.el7.x86_64-advanced-ac9e46e0-6de5-4e6f-baf2-cca39dffe49b' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_msdos
insmod ext2
set root='hd0,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint='hd0,msdos1' ac9e46e0-6de5-4e6f-baf2-cca39dffe49b
else
search --no-floppy --fs-uuid --set=root ac9e46e0-6de5-4e6f-baf2-cca39dffe49b
fi
linux16 /vmlinuz-3.10.0-123.el7.x86_64 root=UUID=ac9e46e0-6de5-4e6f-baf2-cca39dffe49b ro vconsole.keymap=us crashkernel=auto vconsole.font=latarcyrheb-sun16 rhgb quiet LANG=en_US.UTF-8
initrd16 /initramfs-3.10.0-123.el7.x86_64.img
}
And than paste it to /etc/grub.d/40_custom
. Modify the menu entry title, the linux16, initrd16..
#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
menuentry 'NetInstall' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_msdos
insmod ext2
set root='hd0,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint='hd0,msdos1' ac9e46e0-6de5-4e6f-baf2-cca39dffe49b
else
search --no-floppy --fs-uuid --set=root ac9e46e0-6de5-4e6f-baf2-cca39dffe49b
fi
linux16 /vmlinuz-7 inst.vnc inst.vncpassword=12345678 inst.headless ip=ip::gateway:netmask::interface:none nameserver=8.8.8.8 inst.repo=http://mirror.centos.org/centos/7/os/x86_64/ inst.lang=en_US inst.keymap=us
initrd16 /initrd-7.img
}
Note: replace the ip=ip::gateway:netmask::interface:none
with yours. eg:
ip=10.0.0.10::10.0.0.1:255.255.255.0::eth0:none
If you are using GPT disk add inst.gpt
option.
linux16 /vmlinuz-7 inst.gpt inst.vnc inst.vncpassword=12345678 inst.headless ip=dhcp nameserver=8.8.8.8 inst.repo=http://mirror.centos.org/centos/7/os/x86_64/ inst.lang=en_US inst.keymap=us
Grub configurations
Make sure it only boot our custom menu entry once. In /etc/default/grub
, change GRUB_DEFAULT=0
to
GRUB_DEFAULT=saved
GRUB_DEFAULT=saved
Save all the configurations.
# rebuilt the grub.cfg
grub2-mkconfig -o /boot/grub2/grub.cfg
# list available menu entry
awk -F' '$1=="menuentry " {print $2}' /etc/grub2.cfg
# verify the default menu entry.
# you can use grub2-set-default 'MenuEntry'
# to change the default boot
grub2-editenv list
# boot our new menu entry for the next reboot.
# We just need to use the menu entry title.
grub2-reboot NetInstall
Double check your current configurations before rebooting your server.
Wait a moments until the setup finished. You can starting your CentOS 7 remote installatons at YOURIP:1
by using VNC.
Note: If the VNC installation not loaded after a few minutes you just need to reboot your server to booting the default menu entry.