Why?


Search This Blog

Saturday, August 13, 2016

CentOS 7 Install kernel 4.7 from elrepo or from scratch/compile

CentOS 7 Install kernel 4.7 from elrepo or from scratch/compile
----------------------------------------------
Install from elrepo

** Always backup!
** Test this procedure on a vm test image if you can first.

Install private key.
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org

Install the repo.
rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm
Install supporting packages.
yum --enablerepo=elrepo-kernel yum install kernel-ml

reboot

uname -r
3.10.0-327.28.2.el7.x86_64


If you still your old kernel, like above with 3.10.0-327.28.2.el7.x86_64 then:

Change default menu entry

cat /boot/grub2/grub.cfg | grep menuentry

** or

cat /boot/efi/EFI/centos/grub.cfg | grep menuentry

And look for your 4.7 entry. My menu entry is the first one (or 0) so set it to that.

grub2-set-default 0

reboot


Now check version.

uname -r
4.7.0


Be sure and upgrade you btrfs-progs if you work with btrfs-progs

btrfs --version
btrfs-progs v3.19.1


Remove old btrfs-progs, if there, and install new.

yum -y remove btrfs-progs
yum -y install e2fs* libblk* zlib-* liblzo2* lz* asciidoc xmlto git wget
yum -y groupinstall "Development Tools"


cd /root
git clone git://git.kernel.org/pub/scm/linux/kernel/git/kdave/btrfs-progs.git
cd btrfs-progs
./autogen.sh
./configure && make
make install

reboot

btrfs --version
btrfs-progs v4.7



Install Stable 4.7 kernel from scratch/compile

** Always backup!
** Test this procedure on a vm test image if you can first.

yum -y groupinstall "Development Tools"
yum -y install gcc ncurses ncurses-devel wget bc libssl* openssl*
yum update

reboot


Log back into server.

cd /root
wget https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.7.tar.xz
tar -xf linux-4.7.tar.xz -C /usr/src/
cd /usr/src/linux-4.7/
make menuconfig


save and exit.

Now make the kernel.

make 

(or make oldconfig if you want to use your old kernel config)

Now install the kernel.

make modules_install install

reboot

and verify with:

uname -r
3.10.0-327.28.2.el7.x86_64


If you still your old kernel, like above with 3.10.0-327.28.2.el7.x86_64 then:

Change default menu entry

cat /boot/grub2/grub.cfg | grep menuentry

** or

cat /boot/efi/EFI/centos/grub.cfg | grep menuentry

And look for your 4.7 entry. My menu entry is the first one (or 0) so set it to that.

grub2-set-default 0

reboot


Now check version.

uname -r
4.7.0


Be sure and upgrade you btrfs-progs if you work with btrfs-progs

btrfs --version
btrfs-progs v3.19.1


Remove old btrfs-progs, if there, and install new.

yum -y remove btrfs-progs
yum -y install e2fs* libblk* zlib-* liblzo2* lz* asciidoc xmlto git wget
yum -y groupinstall "Development Tools"


cd /root
git clone git://git.kernel.org/pub/scm/linux/kernel/git/kdave/btrfs-progs.git
cd btrfs-progs
./autogen.sh
./configure && make
make install

reboot

btrfs --version
btrfs-progs v4.7









No comments:

Post a Comment