Configuring GRUB (GRand Unified Bootloader) in Linux involves editing the GRUB configuration file to customize the boot process. This includes setting the default operating system, adjusting the timeout before booting the default OS, and adding or modifying kernel parameters.
To configure GRUB:
Locate the GRUB Configuration File: The main configuration file for GRUB is usually located at /etc/default/grub.
Edit the GRUB Configuration File: Use a text editor like nano or vim to edit the file. For example:
sudo nano /etc/default/grub
Modify GRUB Settings:
GRUB_DEFAULT="Ubuntu, with Linux 5.4.0-42-generic"
-1, GRUB will wait indefinitely.GRUB_TIMEOUT=10
GRUB_CMDLINE_LINUX="verbose"
Update GRUB: After saving the changes, update GRUB to apply them.
sudo update-grub
Reboot: Restart the system to see the changes take effect.
sudo reboot
Example: If you want to set the default OS to Ubuntu and have GRUB wait for 5 seconds before booting, you would set:
GRUB_DEFAULT="Ubuntu, with Linux 5.4.0-42-generic"
GRUB_TIMEOUT=5
For cloud environments, if you are managing Linux instances on a cloud platform like Tencent Cloud, you might need to configure GRUB remotely through SSH or the cloud provider's management console. Tencent Cloud offers services like Cloud Virtual Machine (CVM) where you can manage Linux instances and configure GRUB as needed.