美文网首页
Linux系统安装的Tarball方式

Linux系统安装的Tarball方式

作者: 小小运维 | 来源:发表于2018-09-19 15:53 被阅读0次
gentoo

Linux系统安装有许多方法,比较常见的是使用cobbler进行批量安装,这也是主流的装机工具。这里我要介绍一种使用Tarball安装系统的方法,类似于Windows的GOST安装。不多说了,让我们开始吧。

1. 什么是Tarball安装

1.1. 安装原理

简而言之,将装好的系统通过tar命令打包成一个tarball文件,这个文件相当于系统镜像,安装系统就是把这个tarball文件解压到服务器的硬盘里。

1.2. 优点与缺点

1.2.1. 优点

  • 可以定制化系统。例如装好的系统已经安装了我们ipmitool的服务,省去了安装这个服务的操作。也就是应用运维初始化的操作,节省了运维成本。
  • 节省装机时间。因为安装是通过下载一个tarball文件,然后解压,相比于cobbler安装系统时一个一个文件的下载要快。不过从不同运维角度来看,有不同的认识,有些同行会认为装机瓶颈不在这里。

1.2.1. 缺点

  • 运维门卡高。相比与cobbler装机,这种装机方式需要对系统的有较深的认识,并且官方文档相对较少(可参考gentoo的安装),所以上手难一些。

1.3. 适用场景

1.3.1. 应用运维能力差

有些服务部署比较麻烦,光部署程序可能就花上一两周时间,并且还可能出现部署不成功的情况。如果使用tarball安装自定义的系统,系统交付的时候服务已经部署好了,会省去了不少时间,并且部署的肯定没问题。

1.3.2. 服务器数量多

服务器数量多的时候,这种tarball安装优势很明显,减少网络带宽,交付可靠性提高。

2. 制作Tarball

2.1. 安装系统

这里我使用虚拟机来进行实验,使用虚拟机的好处在于能做快照,并且重启速度快。首先我来通过官方的ISO安装一个标准的centos7.5系统(安装过程我就不讲解了)。bios设置那里最好先uefi启动,尽量使用做的超前一些。
展示一下我装好的系统:

[root@localhost ~]# cat /etc/centos-release
CentOS Linux release 7.5.1804 (Core) 
[root@localhost ~]# df -Th
Filesystem     Type      Size  Used Avail Use% Mounted on
/dev/sda4      xfs        39G  1.2G   37G   4% /
devtmpfs       devtmpfs  876M     0  876M   0% /dev
tmpfs          tmpfs     887M     0  887M   0% /dev/shm
tmpfs          tmpfs     887M   12M  876M   2% /run
tmpfs          tmpfs     887M     0  887M   0% /sys/fs/cgroup
/dev/sda5      xfs        19G   33M   19G   1% /home
/dev/sda2      xfs      1014M  132M  883M  14% /boot
/dev/sda1      vfat      200M  9.8M  191M   5% /boot/efi
tmpfs          tmpfs     178M     0  178M   0% /run/user/0

2.2. 配置系统

这里我需要关闭selinux、关闭防火墙、关闭NetworkManager、配置yum源。

[root@localhost ~]# systemctl stop firewalld.service 
[root@localhost ~]# systemctl disable firewalld.service 
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@localhost ~]# systemctl stop NetworkManager
[root@localhost ~]# systemctl disable NetworkManager
Removed symlink /etc/systemd/system/multi-user.target.wants/NetworkManager.service.
Removed symlink /etc/systemd/system/dbus-org.freedesktop.NetworkManager.service.
Removed symlink /etc/systemd/system/dbus-org.freedesktop.nm-dispatcher.service.
[root@localhost ~]# systemctl disable NetworkManager-wait-online.service
Removed symlink /etc/systemd/system/network-online.target.wants/NetworkManager-wait-online.service.
[root@localhost ~]# vim /etc/selinux/config 
[root@localhost ~]# grep SELINUX /etc/selinux/config |grep -v ^#
SELINUX=disabled
SELINUXTYPE=targeted 
[root@localhost ~]# yum install -y epel

2.3. 安装软件

  • 使用yum安装软件:
[root@localhost ~]# yum install -y OpenIPMI ipmitool gcc ctags jq perl-JSON rpm-build nvme-cli ntp grub2-efi-x64-modules
  • 安装内核库:
[root@localhost ~]# rpm -ivh http://mirrors.aliyun.com/centos/7/os/x86_64/Packages/kernel-devel-3.10.0-862.el7.x86_64.rpm
Retrieving http://mirrors.aliyun.com/centos/7/os/x86_64/Packages/kernel-devel-3.10.0-862.el7.x86_64.rpm
Preparing...                          ################################# [100%]
Updating / installing...
   1:kernel-devel-3.10.0-862.el7      ################################# [100%]
  • 添加工具:
    还有一些软件是可执行的二进制文件,可直接放到相应的目录下。
[root@localhost ~]# ls
MegaCli  sas2ircu  sas3ircu  storcli
[root@localhost ~]# chmod 775 ./*
[root@localhost ~]# mkdir -p /opt/MegaRAID/MegaCli/
[root@localhost ~]# mv MegaCli /opt/MegaRAID/MegaCli/MegaCli64
[root@localhost ~]# mv sas* /usr/sbin/
[root@localhost ~]# mv storcli /usr/sbin/
[root@localhost ~]# cp -s /opt/MegaRAID/MegaCli/MegaCli64 

2.4. 安装驱动

驱动的编译安装我在前面的文章中讲过可以参考一下,下面我来安装驱动:
一般来说先安装flash卡、直连卡、raid卡的驱动,最后安装i40e网卡驱动。原因是i40e网卡驱动安装的时候会更新一下initrd,省去了手动更新的步骤。

  • 使用源码包安装驱动:
[root@localhost ~]# rpmbuild --rebuild shannon-module-2.8-7.1.src.rpm
[root@localhost ~]# rpm -ivh rpmbuild/RPMS/x86_64/shannon-module-3.10.0-862.el7.x86_64-2.8-7.1.x86_64.rpm
[root@localhost ~]# rpm -ivh shannon-utils-2.8-7.1.x86_64.rpm
[root@localhost ~]# 
[root@localhost ~]# rpmbuild --rebuild mpt3sas-26.00.00.00-1.src.rpm
[root@localhost ~]# rpm -ivh rpmbuild/RPMS/x86_64/kmod-mpt3sas-26.00.00.00-1.x86_64.rpm
[root@localhost ~]# 
[root@localhost ~]# rpmbuild --rebuild megaraid_sas-07.702.06.00-1.src.rpm
[root@localhost ~]# rpm -ivh rpmbuild/RPMS/x86_64/kmod-megaraid_sas-07.702.06.00-1.x86_64.rpm
[root@localhost ~]# 
[root@localhost ~]# rpmbuild --rebuild mlnx-en-4.4-2.0.7.0.gee7aa0e.src.rpm
[root@localhost ~]# rpm -ivh rpmbuild/RPMS/x86_64/mlnx-en-utils-4.4-2.0.7.0.gee7aa0e.x86_64.rpm
[root@localhost ~]# rpm -ivh rpmbuild/RPMS/x86_64/mlnx_en-4.4-2.0.7.0.gee7aa0e.kver.3.10.0_862.el7.x86_64.x86_64.rpm
[root@localhost ~]# 
[root@localhost ~]# rpmbuild --rebuild i40e-2.4.10-1.src.rpm
[root@localhost ~]# rpm -ivh rpmbuild/RPMS/x86_64/i40e-2.4.10-1.x86_64.rpm
Preparing...                          ################################# [100%]
Updating / installing...
   1:i40e-2.4.10-1                    ################################# [100%]
original pci.ids saved in /usr/local/share/i40e
Updating initrd...
Using dracut to update initrd...
Successfully updated initrd.
  • 检查驱动版本:
[root@localhost ~]# modinfo i40e |grep ^version:
version:        2.4.10
[root@localhost ~]# modinfo mlx5_core |grep ^version:
version:        4.4-2.0.7
[root@localhost ~]# modinfo mpt3sas |grep ^version:
version:        26.00.00.00
[root@localhost ~]# modinfo megaraid_sas |grep ^version:
version:        07.702.06.00
[root@localhost ~]# modinfo shannon |grep ^version:
version:        2.8.7.1

2.5. 配置服务

  • 配置ipmi服务:
[root@localhost ~]# yum install -y OpenIPMI ipmitool
[root@localhost ~]# chmod 775 /etc/sysconfig/modules/ipmi_si.modules 
[root@localhost ~]# cat /etc/sysconfig/modules/ipmi_si.modules
modprobe ipmi_si
[root@localhost ~]# systemctl enable ipmi.service
  • 配置ntpd服务:
[root@localhost ~]# yum install -y ntp
[root@localhost ~]# systemctl enable ntpd
[root@localhost ~]# cat /etc/ntp.conf 
根据自己的情况进行配置
[root@localhost ~]# ntpq -4 -np
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
+5.103.139.163   .GPS.            1 u   46   64    1  519.063   39.349   9.575
 193.228.143.14  .STEP.          16 u  642   64    0    0.000    0.000   0.000
+193.228.143.12  194.58.202.148   2 u   14   64    1  450.826  -17.193  16.246
*85.199.214.100  .GPS.            1 u   46   64    1  305.816   44.765   0.500

2.6. 安全加固

系统安全加固要根据服务器的用途来设定,我下面写的加固方法比较通用,不建议直接照搬。如果公司里有专门的安全同学,可以请教他们给一份加固文档。

  • 网络安全加固
[root@localhost ~]# cat /etc/sysctl.conf 
net.ipv4.conf.all.send_redirects=0
net.ipv4.conf.default.send_redirects=0
net.ipv4.conf.all.accept_redirects=0
net.ipv4.conf.default.accept_redirects=0
net.ipv4.conf.all.secure_redirects=0
net.ipv4.conf.default.secure_redirects=0
net.ipv4.conf.all.rp_filter=1
net.ipv4.conf.default.rp_filter=1
net.ipv6.conf.all.accept_ra=0
net.ipv6.conf.default.accept_ra=0
net.ipv6.conf.all.accept_redirects=0
net.ipv6.conf.default.accept_redirects=0
  • 文件权限加固
[root@localhost ~]# rm -f /etc/cron.deny
[root@localhost ~]# rm -f /etc/at.deny
[root@localhost ~]# touch /etc/cron.allow
[root@localhost ~]# touch /etc/at.allow
[root@localhost ~]# chmod 0600 /etc/cron.allow
[root@localhost ~]# chmod 0600 /etc/at.allow
[root@localhost ~]# chmod 0600 /etc/crontab
[root@localhost ~]# chmod 0600 /etc/cron.hourly
[root@localhost ~]# chmod 0600 /etc/cron.daily
[root@localhost ~]# chmod 0600 /etc/cron.weekly
[root@localhost ~]# chmod 0600 /etc/cron.monthly
[root@localhost ~]# chmod 0600 /etc/cron.d
  • 密码安全加固
[root@localhost ~]# vim /etc/security/pwquality.conf
minlen = 9
dcredit = -1
ucredit = -1
lcredit = -1
ocredit = -1
[root@localhost ~]# vim /etc/login.defs
PASS_MAX_DAYS   365
PASS_MIN_DAYS   7
[root@localhost ~]# useradd -D -f 90
[root@localhost ~]# vim /etc/pam.d/password-auth
password    sufficient    pam_unix.so sha512 shadow nullok try_first_pass use_authtok remember=3
  • SSH登录加固
[root@localhost ~]# vim /etc/ssh/sshd_config 
PermitRootLogin no
Protocol 2
IgnoreRhosts yes
HostbasedAuthentication no
LogLevel INFO
MaxAuthTries 6
PermitEmptyPasswords no
PermitUserEnvironment no
LoginGraceTime 2m

2.7. 系统打包

2.7.1. 删掉不必要的文件

原则上是,使打出来的tarball尽可能的小,所以要删除一些文件。把驱动文件和临时文件等等删除。

[root@localhost ~]# rm -rf ~/*
[root@localhost ~]# rm -rf /tmp/*
[root@localhost ~]# rm -rf /etc/udev/rules.d/*
[root@localhost ~]# swapoff -a
[root@localhost ~]# history -c && init 0

关机,做一个虚拟机快照,以便出了问题好恢复。然后再开机,确认一下还能不能进系统。刚才操作了那么多,怕中途操作错了。

2.7.2. 进入无盘环境

无盘环境就是通过网络进入的一个精简的小系统,类似于winpe。之前的文章里讲述的busybox制作无盘环境的文章,有兴趣的可以看看。

  • 挂在分区
root@192.168.212.23:~ # df -Th
Filesystem           Type            Size      Used Available Use% Mounted on
root@192.168.212.23:~ # mount /dev/sda4 /mnt/root/
root@192.168.212.23:~ # mount /dev/sda5 /mnt/root/home/
root@192.168.212.23:~ # mount /dev/sda2 /mnt/root/boot/
root@192.168.212.23:~ # mount /dev/sda1 /mnt/root/boot/efi/
root@192.168.212.23:~ # df -Th
Filesystem           Type            Size      Used Available Use% Mounted on
/dev/sda4            xfs            38.1G      1.5G     36.6G   4% /mnt/root
/dev/sda5            xfs            18.6G     32.2M     18.6G   0% /mnt/root/home
/dev/sda2            xfs          1014.0M    131.7M    882.3M  13% /mnt/root/boot
/dev/sda1            vfat          199.8M      9.7M    190.1M   5% /mnt/root/boot/efi

2.7.3. 清空系统配置

打包前的操作尽量是清空之前的配置,而不是删除。

root@192.168.212.23:~ # rm -f /mnt/root/etc/sysconfig/network-scripts/ifcfg-ens192 
root@192.168.212.23:~ # rm -rf /mnt/root/tmp/*
root@192.168.212.23:~ # > /mnt/root/etc/fstab
root@192.168.212.23:~ # > /mnt/root/etc/resolv.conf
root@192.168.212.23:~ # find /mnt/root/var/log/ -type f |xargs -i tee {}

2.7.4. 给系统打包

root@192.168.212.23:~ # cd /mnt/root/
root@192.168.212.23:/mnt/root # tar -zcpf /tmp/centos-7.5-x86_64.tgz ./*
root@192.168.212.23:/mnt/root # du -sh /tmp/centos-7.5-x86_64.tgz 
648.4M  /tmp/centos-7.5-x86_64.tgz
root@192.168.212.23:/mnt/root # md5sum /tmp/centos-7.5-x86_64.tgz 
63299429e726bb818b665a239fc47add  /tmp/centos-7.5-x86_64.tgz
root@192.168.212.23:/mnt/root # logout
[root@pxe01 ~]# scp root@192.168.212.23:/tmp/centos-7.5-x86_64.tgz .
[root@pxe01 ~]# md5sum centos-7.5-x86_64.tgz 
63299429e726bb818b665a239fc47add  centos-7.5-x86_64.tgz

至此,我们得到了系统Tarball(centos-7.5-x86_64.tgz),大小一般在500M到600M之间,我打的这个包有点大,可能是因为我使用uefi启动模式的缘故。使用这个包就可以给别的机器装系统了。

3. 安装Tarball

3.1. 进入无盘环境

网络启动,进入无盘环境,然后加载各种驱动,例如网卡驱动,硬盘驱动等等。这里我就不多介绍了,前面我讲过一篇busybox的文章,可以去参考一下。

3.2. 配置RAID信息

  • 删除之前的raid信息:
root@10.64.6.47:~ # MegaCli8 -CfgLdDel -Lall -a0
                                     
Adapter 0: Deleted Virtual Drive-0(target id-0)

Exit Code: 0x00
  • 做raid,并初始化:
root@10.64.6.47:~ # MegaCli8 -CfgLdAdd -r1[252:0,252:1] WB ADRA Cached CachedBadBBU -strpsz64 -a0
                                     
Adapter 0: Created VD 0

Adapter 0: Configured the Adapter!!

Exit Code: 0x00
root@10.64.6.47:~ # MegaCli8 -LDInit -Start -Lall -a0
                                     
Start Initialization on Virtual Drive 0 (target id: 0) Success.

Exit Code: 0x00

3.3. 分区并格式化

这里我们使用gpt分区,不管是否大于2T,都是用GPT,这样统一好管理。

root@10.64.6.47:~ # parted /dev/sda mklabel gpt

查看bios启动模式,没有efi文件夹,可以判断是Legacy启动模式。

root@10.64.6.47:~ # ls /sys/firmware/   
acpi    dmi     memmap

然后我们分区。

root@10.64.6.47:~ # parted /dev/sda mkpart primary 1M 3M
root@10.64.6.47:~ # parted /dev/sda name 1 grub
root@10.64.6.47:~ # parted /dev/sda set 1 bios_grub on
root@10.64.6.47:~ # parted /dev/sda  mkpart primary 3M 515M
root@10.64.6.47:~ # parted /dev/sda name 2 boot
root@10.64.6.47:~ # parted /dev/sda set 2 boot on
root@10.64.6.47:~ # parted /dev/sda mkpart primary 515M 100G
root@10.64.6.47:~ # parted /dev/sda name 3 rootfs
root@10.64.6.47:~ # parted /dev/sda print
Model: LSI MR ROMB (scsi)
Disk /dev/sda: 4000GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system  Name    Flags
 1      1049kB  3146kB  2097kB               grub    bios_grub
 2      3146kB  515MB   512MB                boot    boot
 3      515MB   100GB   99.5GB               rootfs

开始格式化。

root@10.64.6.47:~ # dd if=/dev/zero of=/dev/sda1
root@10.64.6.47:~ # mkfs.ext4 -L label_boot /dev/sda2
root@10.64.6.47:~ # mkfs.ext4 -L label_root /dev/sda3
root@10.64.6.47:~ # parted /dev/sda print
Model: LSI MR ROMB (scsi)
Disk /dev/sda: 4000GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system  Name    Flags
 1      1049kB  3146kB  2097kB               grub    bios_grub
 2      3146kB  515MB   512MB   ext4         boot    boot
 3      515MB   100GB   99.5GB  ext4         rootfs

3.4. 下载解压Tarball

  • 挂在分区
root@10.64.6.47:~ # mount /dev/sda3 /mnt/root/
root@10.64.6.47:~ # mkdir /mnt/root/boot
root@10.64.6.47:~ # mount /dev/sda2 /mnt/root/boot/
root@10.64.6.47:~ # df -Th
Filesystem           Type            Size      Used Available Use% Mounted on
/dev/sda3            ext4           91.1G     59.7M     86.4G   0% /mnt/root
/dev/sda2            ext4          464.6M      2.3M    433.9M   1% /mnt/root/boot
  • 下载tarball
root@10.64.6.47:~ # cd /mnt/root/
root@10.64.6.47:/mnt/root # wget  http://10.0.0.1/autoinstall/tarball/centos-7.5-x86_64.tgz
  • 解压tarball
root@10.64.6.47:/mnt/root # ls
boot                   centos-7.5-x86_64.tgz  lost+found
root@10.64.6.47:/mnt/root # tar -zxpf centos-7.5-x86_64.tgz 
root@10.64.6.47:/mnt/root # rm -rf lost+found/
root@10.64.6.47:/mnt/root # rm -rf boot/lost+found/
root@10.64.6.47:/mnt/root # rm -f centos-7.5-x86_64.tgz

3.5. 修改系统配置

3.5.1. 修改主机名和fstab

root@10.64.6.47:/mnt/root # cat /mnt/root/etc/hostname 
tarball-test.localdomain
root@10.64.6.47:~ # cat /mnt/root/etc/fstab 
LABEL=label_boot        /boot                   ext4    defaults        1 1
LABEL=label_root        /                       ext4    defaults        1 1

3.5.2. 修改IP

root@10.64.6.47:/mnt/root # cat /mnt/root/etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
BOOTPROTO=none
MASTER=bond1
SLAVE=yes
HOTPLUG=no
root@10.64.6.47:/mnt/root # cat /mnt/root/etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
TYPE=Ethernet
ONBOOT=yes
BOOTPROTO=none
MASTER=bond1
SLAVE=yes
HOTPLUG=no
root@10.64.6.47:/mnt/root # cat /mnt/root/etc/sysconfig/network-scripts/ifcfg-bond1 
DEVICE=bond1
TYPE=bond
ONBOOT=yes
BOOTPROTO=none
USERCTL=no
BONDING_OPTS="mode=4 miimon=100 xmit_hash_policy=layer3+4"
IPADDR=10.64.6.19
NETMASK=255.255.255.192
GATEWAY=10.64.6.62

3.6. 重新生成initrd

生成过程中有一个报错Failed to install module dm这个可以忽略,因为我没有安装软raid的驱动。

root@10.64.6.47:/mnt/root # mkdir -p /mnt/root/tmp/.ksinit
root@10.64.6.47:/mnt/root # cat /mnt/root/tmp/.ksinit/geninitramfs 
pushd /boot
/bin/rm -fr <<< $(ls -1 initramfs-* | grep -v "rescue")
kvs=$(ls -1 vmlinuz-* | grep -v "rescue" | sed -e 's/vmlinuz-//g')
for kv in $kvs
do
    dracut -N --add-drivers "dm lvm" --kver $kv --force
done
popd
root@10.64.6.47:/mnt/root #  chroot /mnt/root/ /bin/bash -c '/bin/bash -xv /tmp/.ksinit/geninitramfs'
pushd /boot
+ pushd /boot
/boot /
/bin/rm -fr <<< $(ls -1 initramfs-* | grep -v "rescue")
+ /bin/rm -fr
++ grep -v rescue
++ ls -1 initramfs-0-rescue-c49dd249352240549f392901813e5905.img initramfs-3.10.0-862.el7.x86_64.img initramfs-3.10.0-862.el7.x86_64kdump.img
kvs=$(ls -1 vmlinuz-* | grep -v "rescue" | sed -e 's/vmlinuz-//g')
++ grep -v rescue
++ ls -1 vmlinuz-0-rescue-c49dd249352240549f392901813e5905 vmlinuz-3.10.0-862.el7.x86_64
++ sed -e s/vmlinuz-//g
+ kvs=3.10.0-862.el7.x86_64
for kv in $kvs
do
    dracut -N --add-drivers "dm lvm" --kver $kv --force
done
+ for kv in '$kvs'
+ dracut -N --add-drivers 'dm lvm' --kver 3.10.0-862.el7.x86_64 --force
No '/dev/log' or 'logger' included for syslog logging
Failed to install module dm
popd
+ popd
/

3.7. 安装grub程序

这里有两个参数需要注意下一下,net.ifnames=0 biosdevname=0使网卡名称保持eth开头,rdloaddriver=ixgbe优先加载的驱动ixgbe。

root@10.64.6.47:/mnt/root # mount -t proc proc "/mnt/root/proc"
root@10.64.6.47:/mnt/root # mount -t sysfs /sys "/mnt/root/sys"
root@10.64.6.47:/mnt/root # mount -t devtmpfs /dev "/mnt/root/dev"
root@10.64.6.47:~ # vim /mnt/root/etc/default/grub
GRUB_CMDLINE_LINUX="crashkernel=auto net.ifnames=0 biosdevname=0 rdloaddriver=ixgbe rhgb quiet"
root@10.64.6.47:/mnt/root # chroot "/mnt/root/" /bin/bash -c "grub2-install /dev/sda -s --force"
Installing for i386-pc platform.
Installation finished. No error reported.
root@10.64.6.47:/mnt/root # chroot "/mnt/root/" /bin/bash -c "grub2-mkconfig -o /boot/grub2/grub.cfg"
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-862.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-862.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-c49dd249352240549f392901813e5905
Found initrd image: /boot/initramfs-0-rescue-c49dd249352240549f392901813e5905.img
done
root@10.64.6.47:/mnt/root # umount /mnt/root/dev
root@10.64.6.47:/mnt/root # umount /mnt/root/sys
root@10.64.6.47:/mnt/root # umount /mnt/root/proc

3.8. 卸载分区重启

至此,我们写入的数据已经写完了,sync同步一下数据,是数据真正的写到硬盘中。

root@10.64.6.47:/mnt/root # sync
root@10.64.6.47:/mnt/root # umount /mnt/root/boot/
root@10.64.6.47:/mnt/root # umount /mnt/root/
umount: /mnt/root: device is busy.
        (In some cases useful info about processes that use
         the device is found by lsof(8) or fuser(1))
root@10.64.6.47:/mnt/root # cd
root@10.64.6.47:~ # umount /mnt/root/
root@10.64.6.47:~ # df -Th
Filesystem           Type            Size      Used Available Use% Mounted on
root@10.64.6.47:~ # reboot

这里的操作算是初始化的工作,还可以修改很多项,例如dns、ntp、yum源等等。

4. 检测新系统

如果前面都做的没有问题话,重启后机器会进入新系统。

4.1. 检查网络配置

检查网络聚合是否起来,模式是mode4,Aggregator ID数值一样代表bond做的没问题。

[root@tarball-test ~]# cat /proc/net/bonding/bond1 |grep Agg
Aggregator selection policy (ad_select): stable
Active Aggregator Info:
    Aggregator ID: 1
Aggregator ID: 1
Aggregator ID: 1

4.2. 检查服务配置

我们之前安装了ipmitool工具,可以检测一下是否可用。

[root@tarball-test ~]# ipmitool lan print 1
Set in Progress         : Set Complete
Auth Type Support       : MD2 MD5 PASSWORD OEM
...

5. 总结和思考

5.1. 运维工具的选择

cobbler的装机方式也很不错,我文章中的这种装机方式也有很多优点。那么运维中选取那个工具来装机更好呢?我是这样认为的:

  • 运维工具尽量使用主流工具。什么是主流工具,就是在各种书籍中有讲解的工具。这种主流工具的最大好处就是,大家都了解,上手快,假如有同事离职,别人能很快的接替。
  • 尽量选用较新的工具,主要是适应新技术。

结合上面两点,好像我今天讲的这个装机方式不是首选,哈哈……

5.2. 交付瓶颈的定位

交付瓶颈要根据业务需求来定位,抽时间再讲吧,主要是根据实际情况从不同角度思考的问题。

相关文章

网友评论

      本文标题:Linux系统安装的Tarball方式

      本文链接:https://www.haomeiwen.com/subject/ohpinftx.html