首先安装相关的gcc gcc++,可以直接安装完全开发包.
yum install gcc gcc-c++ kernel-devel
或者
yum groupinstall "Development Tools"
然后我遇到报错:
C header files that match your running kernel
找到安装CentOS的ISO,解压ISO,或者直接在CentOS上挂载ISO:
mkdir /mnt/ISO
mount -o loop CentOS-6.5-x86_64-bin-DVD1.iso /mnt/ISO/
cd到package,在里面找到以ker开头的文件
find . -name 'ker*'
我的电脑显示:
./kernel-devel-2.6.32-431.el6.x86_64.rpm
./kernel-debug-2.6.32-431.el6.x86_64.rpm
./kernel-doc-2.6.32-431.el6.noarch.rpm
./kernel-2.6.32-431.el6.x86_64.rpm
./kernel-abi-whitelists-2.6.32-431.el6.noarch.rpm
./kernel-debug-devel-2.6.32-431.el6.x86_64.rpm
./kernel-firmware-2.6.32-431.el6.noarch.rpm
./kernel-headers-2.6.32-431.el6.x86_64.rpm
复制这些文件出来,然后安装即可解决问题。