源码编译Lustre-2.15.2

2023-02-26 14:49:21 浏览数 (1)

AlmaLinux版本

代码语言:javascript复制
// OS镜像:AlmaLinux-8.7-x86_64-dvd.iso
[root@Lustre-OS ~/Source/zfs]$ uname -a
Linux Lustre-OS 4.18.0-425.3.1.el8.x86_64 #1 SMP Tue Nov 8 14:08:25 EST 2022 x86_64 x86_64 x86_64 GNU/Linux

添加lustre.repo

代码语言:javascript复制
// 需要把这个园添加到节点中,后面源码编译需要这个源安装系统包
[root@Lustre-OS ~/Source/lustre-2.15.2]$ cat /etc/yum.repos.d/lustre.repo 
[lustre-server]
name=lustre-server
baseurl=https://downloads.whamcloud.com/public/lustre/lustre-2.15.2/el8.7/server/
gpgcheck=0


[lustre-client]
name=lustre-client
baseurl=https://downloads.whamcloud.com/public/lustre/lustre-2.15.2/el8.7/client/
gpgcheck=0

[e2fsprogs-wc]
name=e2fsprogs-wc
baseurl=https://downloads.whamcloud.com/public/e2fsprogs/latest/el8/
gpgcheck=0

基于AlmaLinux安装系统依赖

代码语言:javascript复制
/********系统组件依赖**********
[root@Lustre-OS ~]$ yum -y groupinstall "Development Tools"

// 查看内核版本保持和kernel-devel和kernel保持一致,安装完毕后kernel的源码路径呈现在/usr/src/kernels/4.18.0-425.3.1.el8.x86_64路径
[root@Lustre-OS ~]$ rpm -qa|grep kernel
kernel-4.18.0-425.3.1.el8.x86_64
// lustre源中也有 kernel-devel,先尝试自带的kernel-devel安装
[root@Lustre-OS ~]$ yum install kernel-devel-4.18.0-425.3.1.el8.x86_64

[root@Lustre-OS ~]$ yum --nogpgcheck --enablerepo=*  install -y  audit-libs-devel binutils-devel elfutils-devel kabi-dw ncurses-devel newt-devel numactl-devel openssl-devel pciutils-devel perl perl-devel python2 python3-docutils xmlto xz-devel elfutils-libelf-devel libcap-devel libcap-ng-devel llvm-toolset libyaml libyaml-devel kernel-rpm-macros kernel-abi-whitelists uuid libuuid-devel libblkid libblkid-devel libtirpc-devel libtirpc libaio-devel libattr-devel   libffi-devel libudev-devel ncompress python3-cffi python3-devel python3-packaging  libmount libmount-devel make cmake automake gdb gcc

[root@Lustre-OS ~]$ yum --nogpgcheck --enablerepo=powertools  install libyaml-devel

[root@Lustre-OS ~]$ yum --nogpgcheck --disablerepo=* --enablerepo=e2fsprogs-wc  install  e2fsprogs e2fsprogs-devel e2fsprogs-libs libcom_err libcom_err-devel libss libss-devel 

[root@Lustre-OS ~]$ yum install  --disablerepo=*  --enablerepo=lustre-server kernel-debuginfo-common-x86_64.x86_64 -y

安装ZFS

  • 编译阶段
代码语言:javascript复制
/****************zfs****************/

// 开始配置和编译
[root@Lustre-OS ~/Source/zfs]$ git clone https://github.com/openzfs/zfs.git && cd zfs && git checkout zfs-2.1.5 
[root@Lustre-OS ~/Source/zfs]$ sh autogen.sh
[root@Lustre-OS ~/Source/zfs]$ ./configure --with-spec=redhat  --with-linux=/usr/src/kernels/4.18.0-425.3.1.el8.x86_64/

// 开始编译
[root@Lustre-OS ~/Source/zfs]$ make pkg-utils pkg-kmod

// 编译结果查看
[root@Lustre-OS ~/Source/zfs]$ mkdir -p zfs-rpm &&  mv *.rpm zfs-rpm/
[root@Lustre-OS ~/Source/zfs]$ ls zfs-rpm/ -l
total 126072
-rw-r--r--. 1 root root  1577432 Feb  8 20:38 kmod-zfs-2.1.5-1.el8.x86_64.rpm
-rw-r--r--. 1 root root 16429760 Feb  8 20:38 kmod-zfs-debuginfo-2.1.5-1.el8.x86_64.rpm
-rw-r--r--. 1 root root   403868 Feb  8 20:38 kmod-zfs-devel-2.1.5-1.el8.x86_64.rpm
-rw-r--r--. 1 root root    37160 Feb  8 20:34 libnvpair3-2.1.5-1.el8.x86_64.rpm
-rw-r--r--. 1 root root    93268 Feb  8 20:34 libnvpair3-debuginfo-2.1.5-1.el8.x86_64.rpm
-rw-r--r--. 1 root root    32808 Feb  8 20:34 libuutil3-2.1.5-1.el8.x86_64.rpm
-rw-r--r--. 1 root root    64156 Feb  8 20:34 libuutil3-debuginfo-2.1.5-1.el8.x86_64.rpm
-rw-r--r--. 1 root root   234608 Feb  8 20:34 libzfs5-2.1.5-1.el8.x86_64.rpm
-rw-r--r--. 1 root root   584520 Feb  8 20:34 libzfs5-debuginfo-2.1.5-1.el8.x86_64.rpm
-rw-r--r--. 1 root root   384956 Feb  8 20:34 libzfs5-devel-2.1.5-1.el8.x86_64.rpm
-rw-r--r--. 1 root root  1341368 Feb  8 20:34 libzpool5-2.1.5-1.el8.x86_64.rpm
-rw-r--r--. 1 root root  3948900 Feb  8 20:34 libzpool5-debuginfo-2.1.5-1.el8.x86_64.rpm
-rw-r--r--. 1 root root   120496 Feb  8 20:34 python3-pyzfs-2.1.5-1.el8.noarch.rpm
-rw-r--r--. 1 root root 34776594 Feb  8 20:30 zfs-2.1.5-1.el8.src.rpm
-rw-r--r--. 1 root root   673984 Feb  8 20:34 zfs-2.1.5-1.el8.x86_64.rpm
-rw-r--r--. 1 root root  1030124 Feb  8 20:34 zfs-debuginfo-2.1.5-1.el8.x86_64.rpm
-rw-r--r--. 1 root root  2579340 Feb  8 20:34 zfs-debugsource-2.1.5-1.el8.x86_64.rpm
-rw-r--r--. 1 root root    17140 Feb  8 20:34 zfs-dracut-2.1.5-1.el8.noarch.rpm
-rw-r--r--. 1 root root 34772834 Feb  8 20:34 zfs-kmod-2.1.5-1.el8.src.rpm
-rw-r--r--. 1 root root  2208320 Feb  8 20:38 zfs-kmod-debugsource-2.1.5-1.el8.x86_64.rpm
-rw-r--r--. 1 root root 27365996 Feb  8 20:34 zfs-test-2.1.5-1.el8.x86_64.rpm
-rw-r--r--. 1 root root   365848 Feb  8 20:34 zfs-test-debuginfo-2.1.5-1.el8.x86_64.rpm
  • 安装阶段
代码语言:javascript复制
[root@Lustre-OS ~/Source/zfs/zfs-rpm]$ yum localinstall  -y  libuutil*.rpm libnvpair*.rpm zfs-debuginfo*.rpm zfs-debugsource*.rpm 

[root@Lustre-OS ~/Source/zfs/zfs-rpm]$ yum localinstall  -y  libzfs5*.rpm libzfs5*.rpm libzpool5*.rpm  zfs-kmod-debugsource*.rpm

[root@Lustre-OS ~/Source/zfs/zfs-rpm]$ yum localinstall  -y  kmod-zfs*.rpm zfs-2.1.5-1.el8.x86_64.rpm

m


[root@Lustre-OS ~/Source/zfs/zfs-rpm]$ rpm -ivh zfs-2.1.5-1.el8.src.rpm

// 确认下安装的包是否有遗漏
[root@Lustre-OS ~/Source/zfs/zfs-rpm]$ yum localinstall  -y  libuutil*.rpm libnvpair*.rpm  {zfs-[0-9].*,zfs-dracut-[0-9].*,kmod-zfs-[0-9].*,kmod-zfs-devel-[0-9].*,lib*}.*.rpm

// 内核加载zfs
[root@Lustre-OS ~/Source/zfs/zfs-rpm]$ modprobe zfs

安装Lustre Server

  • 编译阶段
代码语言:javascript复制
/**************lustre -server ******/

[root@Lustre-OS ~]$ git clone git://git.whamcloud.com/fs/lustre-release.git
[root@Lustre-OS ~]cd lustre-release && git checkout 2.15.2 
[root@Lustre-OS ~]mv  lustre-release  lustre-2.15.2 && cd ~/Source/lustre-2.15.2
[root@Lustre-OS ~/Source/lustre-2.15.2]$ sh autogen.sh
[root@Lustre-OS ~/Source/lustre-2.15.2]$ make distclean


// 执行configure会报错,需要安装过程中的依赖libnl和libnl3-devel
[root@Lustre-OS ~/Source/lustre-2.15.2]$ wget https://www.infradead.org/~tgr/libnl/files/libnl-3.2.25.tar.gz
[root@Lustre-OS ~/Source/lustre-2.15.2]$ tar zxvf libnl-3.2.25.tar.gz 
[root@Lustre-OS ~/Source/lustre-2.15.2]$ cd libnl-3.2.25 && ./configure && make && make install

[root@Lustre-OS ~/Source/lustre-2.15.2]$ yum --nogpgcheck --enablerepo=*   install -y  libnl3-devel

// 添加用户自定义的lib路径
[root@Lustre-OS ~/Source/lustre-2.15.2]$ cat <<EOF >> /etc/ld.so.conf
/usr/local/lib
/usr/local/lib64
/usr/lib
/usr/lib64
EOF

// 重新加载链接库
[root@Lustre-OS ~/Source/lustre-2.15.2]$ ldconfig



// 支持编译ldiskfs-osd先决条件是安装zfs和kernel-debuginfo-common-x86_64
// 编译zfs-osd和ldiskfs-osd
[root@Lustre-OS ~/Source/lustre-2.15.2]$ rm -rf configure.log && ./configure  --enable-quota --enable-server 
--with-linux=/usr/src/kernels/4.18.0-425.3.1.el8.x86_64  --with-zfs=/usr/src/zfs-2.1.5/  >> configure.log 2>&1 &

[root@Lustre-OS ~/Source/lustre-2.15.2]$ make rpms 
[root@Lustre-OS ~/Source/lustre-2.15.2]$ mkdir -p server-rpm &&mv *.rpm server-rpm/
  • 安装阶段
代码语言:javascript复制
// kmod-lustre安装
[root@Lustre-Server ~/Source/lustre-2.15.2/server-rpm]$ yum localinstall -y kmod-lustre-2.15.2-1.el8.x86_64.rpm kmod-lustre-debuginfo-2.15.2-1.el8.x86_64.rpm   lustre-debuginfo-2.15.2-1.el8.x86_64.rpm lustre-debugsource-2.15.2-1.el8.x86_64.rpm

[root@Lustre-Server ~/Source/lustre-2.15.2/server-rpm]$ yum -y localinstall kmod-lustre-osd-*.rpm  lustre-osd-ldiskfs-mount-2.15.2-1.el8.x86_64.rpm lustre-osd-zfs-mount-2.15.2-1.el8.x86_64.rpm

[root@Lustre-Server ~/Source/lustre-2.15.2/server-rpm]$ yum -y localinstall   lustre-2.15.2-1.el8.x86_64.rpm   lustre-devel-2.15.2-1.el8.x86_64.rpm lustre-iokit-2.15.2-1.el8.x86_64.rpm lustre-osd-zfs-mount-debuginfo-2.15.2-1.el8.x86_64.rpm  lustre-osd-ldiskfs-mount-debuginfo-2.15.2-1.el8.x86_64.rpm

// 查看lustre的加载的内核模块
[root@Lustre-Server ~/Source/lustre-2.15.2/server-rpm]$ modprobe  -v lustre
insmod /lib/modules/4.18.0-425.3.1.el8.x86_64/kernel/net/sunrpc/sunrpc.ko.xz 
insmod /lib/modules/4.18.0-425.3.1.el8.x86_64/extra/lustre/net/libcfs.ko 
insmod /lib/modules/4.18.0-425.3.1.el8.x86_64/extra/lustre/net/lnet.ko 
insmod /lib/modules/4.18.0-425.3.1.el8.x86_64/extra/lustre/fs/obdclass.ko 
insmod /lib/modules/4.18.0-425.3.1.el8.x86_64/extra/lustre/fs/ptlrpc.ko 
insmod /lib/modules/4.18.0-425.3.1.el8.x86_64/extra/lustre/fs/fld.ko 
insmod /lib/modules/4.18.0-425.3.1.el8.x86_64/extra/lustre/fs/fid.ko 
insmod /lib/modules/4.18.0-425.3.1.el8.x86_64/extra/lustre/fs/osc.ko 
insmod /lib/modules/4.18.0-425.3.1.el8.x86_64/extra/lustre/fs/lov.ko 
insmod /lib/modules/4.18.0-425.3.1.el8.x86_64/extra/lustre/fs/mdc.ko 
insmod /lib/modules/4.18.0-425.3.1.el8.x86_64/extra/lustre/fs/lmv.ko 
insmod /lib/modules/4.18.0-425.3.1.el8.x86_64/extra/lustre/fs/lustre.ko

安装Lustre Client

  • 编译阶段
代码语言:javascript复制
/**************lustre client ******/
[root@Lustre-OS ~]$ cd && cd lustre-2.15.2 
[root@Lustre-OS ~/Source/lustre-2.15.2]$ make clean &&  make distclean
[root@Lustre-OS ~/Source/lustre-2.15.2]$  rm -rf configure.log && ./configure   --disable-server --enable-client 
--with-linux=/usr/src/kernels/4.18.0-425.3.1.el8.x86_64 >> configure.log 2>&1 &

[root@Lustre-OS ~/Source/lustre-2.15.2]$ make rpms 
[root@Lustre-OS ~/Source/lustre-2.15.2]$ mkdir -p client-rpm &&mv *.rpm client-rpm/
  • 安装阶段
代码语言:javascript复制
[root@Lustre-Client ~/Source/lustre-2.15.2]$ yum localinstall -y   kmod-lustre-client-2.15.2-1.el8.x86_64.rpm 
 kmod-lustre-client-debuginfo-2.15.2-1.el8.x86_64.rpm          
 lustre-client-2.15.2-1.el8.x86_64.rpm                         
 lustre-client-debuginfo-2.15.2-1.el8.x86_64.rpm               
 lustre-client-debugsource-2.15.2-1.el8.x86_64.rpm             
 lustre-client-devel-2.15.2-1.el8.x86_64.rpm                   
 lustre-iokit-2.15.2-1.el8.x86_64.rpm

0 人点赞