Linux server Installation GRUB steps

  • 2020-12-07 04:38:57
  • OfStack

How do I install GRUB for an Linux server

When you are unable to migrate a lower kernel version through the cloud migration tool, the native system bootstrap GRand Unified Bootloader (GRUB) servers with versions below 1.99, for example, CentOS 5 and Debian 7. And when the log file prompts Do Grub Failed, it may be because there is no system boot program GRUB with version 1.99 or higher installed.

This article focuses on how to install GRUB version 1.99 for your source server. Install GRUB version 1.99 and above such as the process of 1.99 and 2.02 to 1, the main difference is that GRUB version of the installation process to download the source code package is different, you can visit https: / / alpha gnu. org/gnu/grub/get the new version of the download address.

Install version 1.99 of GRUB

Log in to the source server.

Run the following command to see the path of the original grub, ES36en-ES37en, and ES38en-ES39en:


which grub
which grub-install
which grub-mkconfig

Use the mv command to rename older versions grub, ES45en-ES46en, and ES47en-ES48en to back up files. You can restore the original name to use the original configuration after migrating the server using the move cloud tool.


mv /sbin/grub /sbin/grub-old
mv /sbin/grub-install /sbin/grub-install-old 
mv /sbin/grub-mkconfig /sbin/grub-mkconfig-old

Run yum ES53en-ES54en bison gcc make to install the bison, gcc, and make tools that GRUB relies on.

Run the following command to install flex.


test -d /root/tools || mkdir -p /root/tools
cd /root/tools
wget https://github.com/westes/flex/releases/download/v2.6.4/flex-2.6.4.tar.gz
tar xzf flex-2.6.4.tar.gz
cd flex-2.6.4
mkdir -p build
cd build
../configure
make && make install
ln -s /usr/local/bin/flex /usr/bin/flex

Run the following command to install GRUB 1.99 dependencies.


test -d /root/tools || mkdir -p /root/tools
cd /root/tools
wget https://alpha.gnu.org/gnu/grub/grub-1.99~rc1.tar.gz
tar xzf grub-1.99~rc1.tar.gz
cd grub-1.99~rc1
mkdir -p build
cd build
../configure
sed -i -e "s/-Werror//" ./grub-core/Makefile
make && make install
ln -s /usr/local/sbin/grub-install /sbin/grub-install
ln -s /usr/local/sbin/grub-mkconfig /sbin/grub-mkconfig

Note: If a -ES72en error occurs during compilation, you can locate the compilation file of the compiled object makefile, remove the -ES74en option and recompile.

Run ES77en-ES78en --version to check if the GRUB version is updated to 1.99.

Next step 1

After successfully updating the system boot program GRUB version 1.99, you can use the Move cloud tool to migrate the server to Aliyun.

(Optional) After the cloud move is successful, run the following command to restore the old version of GRUB:


rm /sbin/grub-install
rm /sbin/grub-mkconfig
rm /boot/grub/grub.cfg
mv /sbin/grub-old /sbin/grub
mv /sbin/grub-install-old /sbin/grub-install


Related articles: