compile

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
su -
echo 'jack  ALL=(ALL)    ALL' >> /etc/sudoers
####################################
# 换source
sudo mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
sudo curl -fsS -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
sudo rm -rf /etc/yum.repos.d/epel.repo
sudo yum clean all
sudo yum makecache fast
sudo yum makecache
sudo rpm -qa|grep epel-release |xargs --no-run-if-empty sudo yum remove -y
sudo yum install -y epel-release
####################################
# 编译环境
sudo yum group install "Development Tools" -y
sudo yum install ncurses-devel bison flex elfutils-libelf-devel openssl-devel -y
# sudo yum install -y ncurses-devel make gcc bc bison flex elfutils-libelf-devel openssl-devel grub2
# sudo yum install -y hmaccalc zlib-devel binutils-devel elfutils-libelf-devel
###################################
sudo rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
sudo rpm -Uvh https://www.elrepo.org/elrepo-release-7.0-4.el7.elrepo.noarch.rpm
sudo yum --disablerepo=\* --enablerepo="elrepo-kernel" list available
sudo yum -y --enablerepo=elrepo-kernel install kernel-lt.x86_64 kernel-lt-devel.x86_64
# sudo grub2-set-default  0 && sudo grub2-mkconfig -o /etc/grub2.cfg

###################################

# stable:	
# wget https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.4.10.tar.xz
# longterm:
wget https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.19.94.tar.xz
# yum install aria2
# aria2c -s 10 https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.19.94.tar.xz
aria2c -s 20 https://mirror.tuna.tsinghua.edu.cn/kernel/v4.x/linux-4.19.95.tar.xz
unxz -v linux-4.19.94.tar.xz
tar xvf linux-4.19.94.tar
cd linux-4.19.94

# ls /boot/config*
# cp -v /boot/config-3.10.0-1062.el7.x86_64 .config
# cp -v /boot/config-$(uname -r) .config
cp -v /boot/config-4.4.209-1.el7.elrepo.x86_64 .config

## 打开内核参数
vim .config
# Ensure the following 9P options are enabled in the kernel configuration.

    CONFIG_NET_9P=y
    CONFIG_NET_9P_VIRTIO=y
    CONFIG_NET_9P_RDMA=y
    CONFIG_NET_9P_DEBUG=y (Optional)
    CONFIG_9P_FS=y
    CONFIG_9P_FS_POSIX_ACL=y
    CONFIG_PCI=y
    CONFIG_VIRTIO_PCI=y
# and these PCI and virtio options:

    CONFIG_PCI=y
    CONFIG_VIRTIO_PCI=y
    CONFIG_PCI_HOST_GENERIC=y (only needed for the QEMU Arm 'virt' board)


sh -c 'yes "" | make oldconfig'


# make bzImage
# make modules
make
make modules_install
make install

########################
sudo awk -F \' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg
sudo grub2-editenv list
sudo grub2-set-default 0 && sudo grub2-editenv list

##########
# yum install psmisc lsof htop bind-utils wget curl vim nmap traceroute whois -y
sudo yum install -y traceroute htop whois psmisc bc aria2 nmap openssh-server lsof net-tools curl wget git vim jq socat conntrack ipvsadm ipset sysstat libseccomp gcc gcc-c++ cmake make bzip2 automake autoconf libtool flex bison pcre-devel zlib-devel openssl openssl-devel bridge-utils bind-utils libnfnetlink-devel libnl3 libnl3-devel systemd-devel libuuid-devel device-mapper-persistent-data lvm2 libmnl-devel libnftnl-devel libnetfilter_conntrack-devel libnetfilter_queue-devel libpcap-devel

ref