grub的编译安装比较容易。首先下载grub的源代码,然后解压,查看INSTALL文件,
下面是INSTALL文件的一部分,是有关依赖的:
The Requirements
================
GRUB depends on some software packages installed into your system. If
you don‘t have any of them, please obtain and install them before
configuring the GRUB.
* GCC 4.1.3 or later
* GNU Make
* GNU Bison 2.3 or later
* GNU gettext 0.17 or later
* GNU binutils 2.9.1.0.23 or later
* Flex 2.5.35 or later
* Other standard GNU/Unix tools
... ...
编译安装我们只需要解决上面的部分即可。
gcc、make、binutils一般系统都装有的,可以使用rpm命令查看
#rpm -qa | grep gcc
... ...
查看什么包没装有就用yum装上,一般bison、gettext、flex系统没装有,可以使用yum命令安装:
#yum install bison flex bison
如果是使用本地光盘做源的话,我用的是CentOS6.5,两张DVD,因此若第一张光盘镜像没有,那么请挂载第二张光盘镜像安装。
我这里是grub-2.00版本的源代码,grub-1.98的源代码的INSTALL文件上会要求安装lzo软件,
要使用lzo就得安装lzo-devel,CentOS6.5上lzo在第一张DVD镜像,lzo-devel和其依赖的
lzo-xx(不记得了)在第二张光盘镜像
先挂载第一张光盘镜像安装:
#yum install lzo
再挂载第二张光盘安装
#yum install lzo-devel
这样依赖的软件就安装好了,下面就是按照INSTALL文件
1. Type ‘./configure‘ to configure the package for your system.
If you‘re using `csh‘ on an old version of System V, you might
need to type `sh ./configure‘ instead to prevent `csh‘ from trying
to execute `configure‘ itself.
2. Running `configure‘ takes awhile. While running, it prints some
messages telling which features it is checking for.
3. Type `make‘ to compile the package.
4. Optionally, type `make check‘ to run any self-tests that come with
the package.
5. Type `make install‘ to install the programs and any data files and
documentation.
在grub源码的根目录下:
#./configure
#make
#make install
接下来就是把grub装到MBR了
#grub-install /dev/sda
#update-grub
重启看看效果