在x86、aarch64架构上,kickstart方式安装openeuler系统。

  • 一个架构

** 环境准备

注意:安装之前,请确保http服务器的防火墙处于关闭状态。关闭防火墙可参照如下命令: iptables -F

  1. httpd的安装与服务启动。

    dnf install httpd -y
    systemctl start httpd
    systemctl enable httpd

  2. tftp的安装与配置。

    dnf install tftp-server -y
    vim /etc/xinetd.d/tftp

   service tftp
{
        socket_type             = dgram
        protocol                = udp
        wait                    = yes
        user                    = root
        server                  = /usr/sbin/in.tftpd
        server_args             = -s /var/lib/tftpboot
        disable                 = no
        per_source              = 11
        cps                     = 100 2
        flags                   = IPv4
}

systemctl start tftp
systemctl enable tftp //开机启动tftp服务
systemctl start xinetd
systemctl status xinetd
systemctl enable xinetd //开机启动xined服务

  1. 安装源的制作。

    kvm上将镜像挂载到CD/DVD上
    mount openEuler-{version}-aarch64-dvd.iso /mnt
    mkdir -p /var/www/html/openEuler
    cp -r /mnt/* /var/www/html/openEuler/

  2. 设置和修改kickstart配置文件 openEuler-ks.cfg。

    mkdir -p /var/www/html/ks
    vim /var/www/html/ks/openEuler-ks.cfg

 ====================================
    ***以下内容根据实际需求进行修改***
#version=DEVEL
#Generated using Blivet version 3.8.2
ignoredisk --only-use=sda
autopart --type=lvm

#Partition clearing information
clearpart --all --initlabel

#Use graphical install
graphical

#Keyboard layouts
keyboard --vckeymap=us --xlayouts='us'
#System language
lang en_US.UTF-8

#Usehttp installation source
url --url=http://172.168.131.5/openEuler/

%post
#enable kdump
sed -i "s/ ro / ro crashkernel=1024M,high /" /boot/efi/EFI/openEuler/grub.cfg
%end

#System timezone
timezone Asia/Shanghai --utc

#Root password
rootpw --iscrypted $y$j9T$VlPRvPwOvKY/AxZbrj3BVvgg$w0033B3Jg9etY/iQDfEjXjqaaTRXb8QFGr3DDyVJfC6
  1. 修改pxe配置文件grub.cfg, 可参考如下内容(注意:openEuler当前不支持bls格式的cfg文件)。

    cp -r /mnt/images/pxeboot/* /var/lib/tftpboot/
    cp /mnt/EFI/BOOT/grubaa64.efi /var/lib/tftpboot/
    cp /mnt/EFI/BOOT/grub.cfg /var/lib/tftpboot/
    ls /var/lib/tftpboot/
    grubaa64.efi grub.cfg initrd.img TRANS.TBL vmlinuz
    vim /var/lib/tftpboot/grub.cfg

set default="0"

    function load_video {
  if [ x$feature_all_video_module = xy ]; then
    insmod all_video
  else
    insmod efi_gop
    insmod efi_uga
    insmod ieee1275_fb
    insmod vbe
    insmod vga
    insmod video_bochs
    insmod video_cirrus
  fi
}

   load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod ext2

   set timeout=5


   ###BEGIN /etc/grub.d/10_linux ###
    menuentry 'Install openEuler {version} ' --class red --class gnu-linux --class gnu --class os {
        set root=(tftp,172.168.131.5)
        linux /vmlinuz ro inst.geoloc=0 console=ttyAMA0 console=tty0 rd.iscsi.waitnet=0 inst.ks=http://172.168.131.5/ks/openEuler-ks.cfg
        initrd /initrd.img
}
  1. DHCP的配置(可以使用dnsmasq代替 )。

    dnf install dhcp -y
    vim /etc/dhcp/dhcpd.conf

#DHCP Server Configuration file.
#see /usr/share/doc/dhcp-server/dhcpd.conf.example
#see dhcpd.conf(5) man page
ddns-update-style interim;
ignore client-updates;
filename "grubaa64.efi";    # pxelinux 启动文件位置;
next-server 172.168.131.5;  # (重要)TFTP Server 的IP地址;
subnet 172.168.0.0 netmask 255.255.0.0 {
option routers 172.168.131.1; # 网关地址
option subnet-mask 255.255.0.0; # 子网掩码
range dynamic-bootp 172.168.131.6 172.168.131.255; # 动态ip范围
default-lease-time 21600;
max-lease-time 43200;
}

systemctl start dhcpd
systemctl enable dhcpd
** 安装系统
1、登录KVM,选择pxe启动,重启系统。
2、进入系统全自动化安装界面。
3、确认系统安装完毕。

  • 两个架构

**环境准备
注意:安装之前,请确保http服务器的防火墙处于关闭状态。关闭防火墙可参照如下命令: iptables -F
1、httpd的安装与服务启动。

 dnf install httpd -y
 systemctl start httpd
 systemctl enable httpd

2、tftp的安装与配置。

 dnf install tftp-server -y
 vim /etc/xinetd.d/tftp
  service tftp
      {
        socket_type             = dgram
        protocol                = udp
        wait                    = yes
        user                    = root
        server                  = /usr/sbin/in.tftpd
        server_args             = -s /var/lib/tftpboot
        disable                 = no
        per_source              = 11
        cps                     = 100 2
        flags                   = IPv4
    }
 systemctl start tftp
 systemctl enable tftp
 systemctl start xinetd
 systemctl status xinetd
 systemctl enable xinetd

3、安装源的制作。

在kvm上分别将aarch64 和x86_64镜像挂载到CD/DVD上,并拷贝到本地。
 mount openEuler-{version}-aarch64-dvd.iso /mnt
 cp -r /mnt/* /var/www/html/openEuler_aarch64/
 mount openEuler-{version}-x86_64-dvd.iso /mnt
 cp -r /mnt/* /var/www/html/openEuler_x86_64/

4、设置和修改kickstart配置文件。
aarch64架构ks的配置文件:

vim  /var/www/html/ks/openEuler-ks_aarch64.cfg
  #version=DEVEL
     #Generated using Blivet version 3.8.2
    ignoredisk --only-use=sda
    autopart --type=lvm

    #Partition clearing information
    clearpart --all --initlabel

    #Use graphical install
    graphical

    #Keyboard layouts
     keyboard --vckeymap=us --xlayouts='us'
    #System language
    lang en_US.UTF-8

    #Usehttp installation source
    url --url=http://172.168.131.5/openEuler_aarch64/

    %post
    #enable kdump
    sed -i "s/ ro / ro crashkernel=1024M,high /" /boot/efi/EFI/openEuler/grub.cfg
    %end
    #System timezone
    timezone Asia/Shanghai --utc
    #Root password
    rootpw --iscrypted     $y$j9T$VlPRvPwOvKY/AxZbrj3BVvgg$w0033B3Jg9etY/iQDfEjXjqaaTRXb8QFGr3DDyVJfC6
x86_64架构ks的配置文件:
vim  /var/www/html/ks/openEuler-ks_x86_64.cfg
  #version=DEVEL
    #Generated using Blivet version 3.8.2
    ignoredisk --only-use=sda
    autopart --type=lvm
    #Partition clearing information
    clearpart --all --initlabel
    #Use graphical install
    graphical
    #Keyboard layouts
    keyboard --vckeymap=us --xlayouts='us'
    #System language
    lang en_US.UTF-8

    #Usehttp installation source
    url --url=http://172.168.131.5/openEuler_x86_64/

    %post
    #enable kdump
    sed -i "s/ ro / ro crashkernel=1024M,high /" /boot/efi/EFI/openEuler/grub.cfg
    %end
    #System timezone
    timezone Asia/Shanghai --utc

    #Root password
    rootpw --iscrypted $y$j9T$VlPRvPwOvKY/AxZbrj3BVvgg$w0033B3Jg9etY/iQDfEjXjqaaTRXb8QFGr3DDyVJfC6

5、修改pxe配置文件grub.cfg, 可参考如下内容.(注意:openEuler当前不支持bls格式的cfg文件)。

cd /var/lib/tftpboot
mkdir -p aarch64
mkdir x86_64
cp -r /var/www/ html/openEuler_aarch64/images/pxeboot/* /var/lib/tftpboot/aarch64
cp /var/www/html/openEuler_aarch64/EFI/BOOT/grubaa64.efi /var/lib/tftpboot/aarch64
cp -r /var/www/html/openEuler_x86_64/EFI/BOOT/grub.cfg /var/lib/tftpboot/x86_64
cp /var/www/html/openEuler_x86_64/EFI/BOOT/grubx64.efi /var/lib/tftpboot/x86_64
ls /var/lib/tftpboot/aarch64/
grubaa64.efi grub.cfg initrd.img vmlinuz
ls /var/lib/tftpboot/x86_64
grub.cfg grubx64.efi initrd.img vmlinuz
vim /var/lib/tftpboot/aarch64/grub.cfg

set default="1"

function load_video {
  if [ x$feature_all_video_module = xy ]; then
    insmod all_video
  else
    insmod efi_gop
    insmod efi_uga
    insmod ieee1275_fb
    insmod vbe
    insmod vga
    insmod video_bochs
    insmod video_cirrus
  fi
}

load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod ext2

set timeout=5
###END /etc/grub.d/00_header ###

menuentry 'Install openEuler' --class red --class gnu-linux --class gnu --class os {
        set root=(tftp,172.168.131.5)
        linux /aarch64/vmlinuz ro inst.geoloc=0 console=ttyAMA0 console=tty0 rd.iscsi.waitnet=0 inst.ks=http://172.168.131.5/ks/openEuler-ks_aarch64.cfg
        initrd /aarch64/initrd.img
}

///////////////////////////////////////////////////////////////////
vim /var/lib/tftpboot/x86_64/grub.cfg

set default="1"

function load_video {
  if [ x$feature_all_video_module = xy ]; then
    insmod all_video
  else
    insmod efi_gop
    insmod efi_uga
    insmod ieee1275_fb
    insmod vbe
    insmod vga
    insmod video_bochs
    insmod video_cirrus
  fi
}

load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod ext2

set timeout=5
###END /etc/grub.d/00_header ###

menuentry 'Install openEuler' --class red --class gnu-linux --class gnu --class os {
        set root=(tftp,172.168.131.5)
        linux /x86_64/vmlinuz ro inst.geoloc=0 console=ttyAMA0 console=tty0 rd.iscsi.waitnet=0 inst.ks=http://172.168.131.5/ks/openEuler-ks_x86_64.cfg
        initrd /x86_64/initrd.img
}

6、DHCP的配置(可以使用dnsmasq代替 )。

vim /etc/dhcp/dhcpd.conf

#
#DHCP Server Configuration file.
#see /usr/share/doc/dhcp-server/dhcpd.conf.example
#see dhcpd.conf(5) man page
ddns-update-style interim;
ignore client-updates;
next-server 172.168.131.5;
subnet 172.168.0.0 netmask 255.255.0.0 {
        option routers 172.168.131.1;
        option subnet-mask 255.255.0.0;
        range dynamic-bootp 172.168.131.6 172.168.131.254;
        default-lease-time 600;
        max-lease-time 43200;
        ##x86_64 architecture
        host x86_64-client-3.10 {
                hardware ethernet 6C:EB:B6:50:C0:A9;
                filename "/x86_64/grubx64.efi";
        }
        host x86_64-client-3.11 {
                hardware ethernet 6C:EB:B6:50:C0:31;
                filename "/x86_64/grubx64.efi";
        }
        #aarch64 architecture
        host aarch64-client-1.6 {
                hardware ethernet 44:67:47:85:F9:DD;
                filename "/aarch64/grubaa64.efi";
        }
        host aarch64-client-1.7 {
                hardware ethernet 84:46:FE:89:BE:20;
                filename "/aarch64/grubaa64.efi";
        }
        host aarch64-client-14.4 {
                hardware ethernet 44:67:47:86:1A:28;
                filename "/aarch64/grubaa64.efi";
        }
}

systemctl start dhcpd
systemctl enable dhcpd
** 安装系统
1、登录KVM,选择pxe启动,重启系统。
2、进入系统全自动化安装界面。
3、确认系统安装完毕。

1 个赞

学习到了。不同的系统架构,使用Kickstart批量安装的方式还不一样。