先要装一个旧版本的Centos 7.9,然后开始新装系统

步骤 1: 使用 GParted 分割现有分区

工具选择:GParted 是图形化分区工具,支持在线分区操作,适合 Linux 系统。

操作步骤:

  1. 下载 GParted Live:
    # cd /mnt
    # wget https://sourceforge.net/projects/gparted/files/gparted-live-stable/1.7.0-12/gparted-live-1.7.0-12-amd64.iso
  2. 使用GRUB将GParted Live安装到硬盘,创建 grub2 自定义文件 /etc/grub.d/40_custom,内容如下:
    menuentry "Gparted live" {
      set isofile="/mnt/gparted-live-1.7.0-12-amd64.iso"
      loopback loop $isofile
      linux (loop)/live/vmlinuz boot=live config union=overlay username=user components noswap noeject vga=788 ip= net.ifnames=0 toram=filesystem.squashfs findiso=$isofile
      initrd (loop)/live/initrd.img
    }
  3. 更新您的 grub2 配置:
    # grub2-mkconfig -o /boot/grub2/grub.cfg
  4. 分区操作(尽量将iso安装分区弄到最后一个分区,也就是分区4):
    • 选择要分割的主分区(如 /dev/sda2)。
    • 右键点击分区 → Resize/Move。
    • 调整分区大小,释放出至少 2GB 未分配空间。
    • 点击 Resize/Move → Apply。
    • 重启
  5. 格式化新分区并挂载:
    mkfs.ext4 /dev/vda4 # 格式化为 ext4 文件系统
    mkdir /mnt/iso_install
    mount /dev/vda4 /mnt/iso_install

步骤 2: 分配目录并下载 ISO 文件

将 Rocky Linux 10 的 ISO 镜像下载到刚刚创建的新分区挂载点。

  1. 下载 ISO:
    cd /mnt/iso_install
    # 请确认 Rocky Linux 10.1 已正式发布,目前最新版可能是 10 Beta 或其他版本。
    # 假设该链接有效:
    wget https://download.rockylinux.org/pub/rocky/10/isos/x86_64/Rocky-10.1-x86_64-minimal.iso

步骤 3: 修改 GRUB 启动 ISO

这是最复杂且最容易出错的一步。您需要修改当前系统的引导加载程序 GRUB,使其在下次启动时引导 ISO 文件中的安装内核,而不是当前系统。

定位 GRUB 配置文件: 通常在 /etc/default/grub/boot/grub/grub.cfg

创建自定义 GRUB 配置条目:

  1. 使用lsblk获得uuid, 使用fdisk获得分区类型(msdos或者gpt)以及第几分区:
    # lsblk -f
    NAME   FSTYPE LABEL UUID                                 MOUNTPOINT
    vda
    ├─vda1 ext4         c8b5b2da-5565-4dc1-b002-2a8b07573e22 /
    ├─vda2 ext4         8f0484e1-9f99-4932-8639-1fcb32417376
    ├─vda3 ext4         3556fbff-c61b-4e9c-864c-dc5c1d772277
    └─vda4 ext4         e15d6a20-ac3e-4385-a784-2914ab270a85 /mnt/iso_install
    
    # fdisk -l
    
    Disk /dev/vda: 42.9 GB, 42949672960 bytes, 83886080 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk label type: dos
    Disk identifier: 0x000edc45
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/vda1   *        2048    79691775    39844864   83  Linux
    /dev/vda2        79691776    79693823        1024   83  Linux
    /dev/vda3        79693824    79695871        1024   83  Linux
    /dev/vda4        79695872    83886079     2095104   83  Linux
  2. /etc/grub.d/40_custom 文件末尾添加一个新的启动项。
    vi /etc/grub.d/40_custom
  3. 添加以下内容(根据您的分区和 ISO 文件名调整, 新分区的 UUID,并替换上述 [YOUR_VDA4_UUID]):
    menuentry "Install Rocky Linux 10 via ISO Final" {
        set isofile="/Rocky-10.1-x86_64-minimal.iso"
        
        # 查找 UUID 为 [YOUR_VDA4_UUID] 的分区
        search --no-floppy --fs-uuid [YOUR_VDA4_UUID] --set=root
    
        # 挂载 ISO 文件
        loopback loop ($root)$isofile
    
        # !! 使用正确的路径 /images/pxeboot/vmlinuz !!
        # inst.stage2 参数告诉安装程序去哪里找安装文件
        linux (loop)/images/pxeboot/vmlinuz inst.stage2=hd:UUID=[YOUR_VDA4_UUID]:/ rhgb quiet
    
        # !! 使用正确的路径 /images/pxeboot/initrd.img !!
        initrd (loop)/images/pxeboot/initrd.img
    }
  4. 更新 GRUB 配置: 运行命令生成新的 grub.cfg。
    grub2-mkconfig -o /boot/grub2/grub.cfg
    # 如果您的系统使用旧版 GRUB: update-grub
  5. 重启 VPS
    reboot

进入安装界面: 重启后,您通常需要通过 VPS 提供商的 VNC 或 Web 控制台快速进入 GRUB 菜单,选择您刚刚添加的 “Install Rocky Linux 10 via ISO” 选项。

执行安装: 按照 Rocky Linux 安装程序的提示进行安装。在分区步骤,确保您将旧的系统分区格式化,并正确配置新的挂载点。

步骤 4: 回收 ISO 分区

  1. 使用 fdisk 删除 vda4 并创建新的 Swap 分区
    # fdisk /dev/vda
    
    Welcome to fdisk (util-linux 2.40.2).
    Changes will remain in memory only, until you decide to write them.
    Be careful before using the write command.
    
    This disk is currently in use - repartitioning is probably a bad idea.
    It's recommended to umount all file systems, and swapoff all swap
    partitions on this disk.
    
    Command (m for help): p
    
    Disk /dev/vda: 40 GiB, 42949672960 bytes, 83886080 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disklabel type: dos
    Disk identifier: 0x000edc45
    
    Device     Boot    Start      End  Sectors  Size Id Type
    /dev/vda1  *        2048  2099199  2097152    1G 83 Linux
    /dev/vda2        2099200 71723007 69623808 33.2G 83 Linux
    /dev/vda4       79695872 83886079  4190208    2G 83 Linux
    
    Command (m for help): d
    Partition number (1,2,4, default 4): 4
    
    Partition 4 has been deleted.
    
    Command (m for help): p
    Disk /dev/vda: 40 GiB, 42949672960 bytes, 83886080 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disklabel type: dos
    Disk identifier: 0x000edc45
    
    Device     Boot   Start      End  Sectors  Size Id Type
    /dev/vda1  *       2048  2099199  2097152    1G 83 Linux
    /dev/vda2       2099200 71723007 69623808 33.2G 83 Linux
    
    Command (m for help): n
    Partition type
       p   primary (2 primary, 0 extended, 2 free)
       e   extended (container for logical partitions)
    Select (default p): p
    Partition number (3,4, default 3):
    First sector (71723008-83886079, default 71723008): 75916900
    Last sector, +/-sectors or +/-size{K,M,G,T,P} (75916900-83886079, default 83886079):
    
    Created a new partition 3 of type 'Linux' and of size 3.8 GiB.
    
    Command (m for help): t
    Partition number (1-3, default 3):
    Hex code or alias (type L to list all): 82
    
    Changed type of partition 'Linux' to 'Linux swap / Solaris'.
    
    Command (m for help): w
    The partition table has been altered.
    Syncing disks.
  2. 重启系统

    分区表修改后,您必须重启系统才能使内核识别新的分区布局。

    reboot

    重启后,通过 VNC 重新连接。

  3. 格式化并启用 Swap 分区

    现在 /dev/vda3 应该是一个 Swap 分区了。

    mkswap /dev/vda3
    swapon /dev/vda3
  4. 永久挂载 Swap

    编辑 /etc/fstab 文件,使 Swap 在每次启动时自动挂载。

    vi /etc/fstab

    在文件末尾添加以下行:

    /dev/vda3   swap    swap    defaults        0 0
  5. 扩展 vda2 文件系统(最复杂的一步)
    # fdisk /dev/vda
    
    Welcome to fdisk (util-linux 2.40.2).
    Changes will remain in memory only, until you decide to write them.
    Be careful before using the write command.
    
    This disk is currently in use - repartitioning is probably a bad idea.
    It's recommended to umount all file systems, and swapoff all swap
    partitions on this disk.
    
    Command (m for help): p
    
    Disk /dev/vda: 40 GiB, 42949672960 bytes, 83886080 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disklabel type: dos
    Disk identifier: 0x000edc45
    
    Device     Boot    Start      End  Sectors  Size Id Type
    /dev/vda1  *        2048  2099199  2097152    1G 83 Linux
    /dev/vda2        2099200 71723007 69623808 33.2G 83 Linux
    /dev/vda3       75916900 83886079  7969180  3.8G 82 Linux swap / Solaris
    
    Command (m for help): e
    Partition number (1-3, default 3): 2
    
    New <size>{K,M,G,T,P} in bytes or <size>S in sectors (default 35.2G):
    
    Partition 2 has been resized.
    
    Command (m for help): p
    Disk /dev/vda: 40 GiB, 42949672960 bytes, 83886080 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disklabel type: dos
    Disk identifier: 0x000edc45
    
    Device     Boot    Start      End  Sectors  Size Id Type
    /dev/vda1  *        2048  2099199  2097152    1G 83 Linux
    /dev/vda2        2099200 75916899 73817700 35.2G 83 Linux
    /dev/vda3       75916900 83886079  7969180  3.8G 82 Linux swap / Solaris
    
    Command (m for help): F
    
    Unpartitioned space /dev/vda: 0 B, 0 bytes, 0 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    
    Command (m for help): w
    The partition table has been altered.
    Syncing disks.
    
    # 扩展文件系统到最大可用空间
    sudo xfs_growfs /dev/vda2
    
    #  验证扩容结果
    df -hT /dev/vda2
    文件系统       类型  大小  已用  可用 已用% 挂载点
    /dev/vda2      xfs    36G  1.8G   34G    6% /

至此全新Rocky Linux 10已经安装完毕,剩下就是标准配置了.

想要通过IPMI自定义风扇转速, 首先需要设置成Full模式, 进入IPMI设置界面, 在 Configuration 菜单下的 Fan Mode 设置成 Full 模式.

X9DR3-F的配置风扇风扇转速设置指令

; fan1-6的PWM设置指令, 设置范围是0到255, 这里的 0x6f 是 111 即 43.5%.
# ipmitool raw 0x30 0x91 0x5A 0x3 0x10 0x6f

; fana-b的PWM设置指令, 设置范围是0到255, 这里的 0x9f 是 159 即 62.3%.
# ipmitool raw 0x30 0x91 0x5A 0x3 0x11 0x9f

X11SSH-LN4F的配置风扇风扇转速设置指令

; fan1-4的PWM设置指令, 设置范围是0到100, 这里的 0x3c 即 60%.
# ipmitool raw 0x30 0x70 0x66 0x01 0x00 0x3c

; fana的PWM设置指令, 设置范围是0到100, 这里的 0x3c 即 60%.
# ipmitool raw 0x30 0x70 0x66 0x01 0x01 0x3c

以上就是IPMI直接设置风扇的调速指令, 现在建立一个服务使其开机自动设置.

$ sudo vi /etc/systemd/system/adjust-fanpwm.service
[Unit]
Description=Power on automatically adjusts fan PWM Service
After=network.target
 
[Service]
Type=simple
# fan1-6
# ipmitool raw 0x30 0x91 0x5A 0x3 0x10 0x6f
# fana-b
# ipmitool raw 0x30 0x91 0x5A 0x3 0x11 0x9f
ExecStart=/bin/bash -c 'sudo ipmitool raw 0x30 0x91 0x5A 0x3 0x10 0x6f && sudo ipmitool raw 0x30 0x91 0x5A 0x3 0x11 0x9f'
Restart=on-failure
 
[Install]
WantedBy=multi-user.target

设置成开机自动启动

$ sudo systemctl enable adjust-fanpwm.service

执行开机调节风扇PWM服务

$ sudo systemctl start adjust-fanpwm.service

查看执行情况

$ sudo systemctl status adjust-fanpwm.service

1. 查找Docker Hub上的mysql镜像

$ sudo docker search mysql
NAME                              DESCRIPTION                                     STARS               OFFICIAL            AUTOMATED
mysql                             MySQL is a widely used, open-source relation…   8922                [OK]
mariadb                           MariaDB is a community-developed fork of MyS…   3135                [OK]
mysql/mysql-server                Optimized MySQL Server Docker images. Create…   659                                     [OK]
percona                           Percona Server is a fork of the MySQL relati…   462                 [OK]
centos/mysql-57-centos7           MySQL 5.7 SQL database server                   65
centurylink/mysql                 Image containing mysql. Optimized to be link…   61                                      [OK]
mysql/mysql-cluster               Experimental MySQL Cluster Docker images. Cr…   59
deitch/mysql-backup               REPLACED! Please use http://hub.docker.com/r…   41                                      [OK]
bitnami/mysql                     Bitnami MySQL Docker Image                      35                                      [OK]
tutum/mysql                       Base docker image to run a MySQL database se…   34
schickling/mysql-backup-s3        Backup MySQL to S3 (supports periodic backup…   28                                      [OK]
prom/mysqld-exporter                                                              23                                      [OK]
linuxserver/mysql                 A Mysql container, brought to you by LinuxSe…   22
centos/mysql-56-centos7           MySQL 5.6 SQL database server                   17
circleci/mysql                    MySQL is a widely used, open-source relation…   16
mysql/mysql-router                MySQL Router provides transparent routing be…   14
arey/mysql-client                 Run a MySQL client from a docker container      13                                      [OK]
openshift/mysql-55-centos7        DEPRECATED: A Centos7 based MySQL v5.5 image…   6
fradelg/mysql-cron-backup         MySQL/MariaDB database backup using cron tas…   4                                       [OK]
genschsa/mysql-employees          MySQL Employee Sample Database                  3                                       [OK]
devilbox/mysql                    Retagged MySQL, MariaDB and PerconaDB offici…   2
ansibleplaybookbundle/mysql-apb   An APB which deploys RHSCL MySQL                2                                       [OK]
jelastic/mysql                    An image of the MySQL database server mainta…   1
monasca/mysql-init                A minimal decoupled init container for mysql    0
widdpim/mysql-client              Dockerized MySQL Client (5.7) including Curl…   0                                       [OK]

2. 选择centos 7下的 mysql-57

$ sudo docker pull centos/mysql-57-centos7

3. 创建mysql数据库目录

$ sudo mkdir /data/mysql57
$ sudo chown mysql:mysql /data/mysql57
$ sudo chcon system_u:object_r:mysqld_db_t:s0 /data/mysql57

4. 使用mysql镜像

$ sudo docker run -p 3306:3306 --name mysql57 \
--volume=/data/mysql57/:/var/lib/mysql/data/ \
--restart=always \
-e MYSQL_ROOT_PASSWORD=123456 -d centos/mysql-57-centos7

5. 连接docker mysql

$ sudo docker exec -ti -u root mysql57 bash

  在RHEL 8/CentOS 8上安装Docker和Docker Compose的文章已经很多了, 不过都是要求禁用firewalld, 因为默认安装的 firewalld 会导致Docker容器DNS解析失败, 其实只需要修改一下 firewalld 的配置就可以正常工作的.

  在CentOS 8上安装Docker CE的步骤如下:

  1. 准备工作,CentOS 8的工作实例和具有sudo特权的用户

  2. 添加必要的Docker存储库

  我们将使用dnf config-manager实用程序添加Docker存储库。

$ sudo dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo

  3. 直接安装Docker CE会失败, 因为其要求 containerd.io 版本比较高, 然后会CentOS 8默认安装冲突, 所以需要手动安装 containerd.io 。

$ sudo dnf install https://download.docker.com/linux/centos/7/x86_64/stable/Packages/containerd.io-1.2.10-3.2.el7.x86_64.rpm

  4. 这时候就可以直接安装Docker CE了。

$ sudo dnf install docker-ce

  5. 为了强制DNS解析在Docker容器中起作用,必须禁用firewalld。

$ sudo systemctl disable firewalld

  6. 启用docker守护进程

$ sudo systemctl enable --now docker

  7. 为了无需使用 sudo 来启动 docker 我们需要把当前用户加入 docker 组.

$ sudo usermod -aG docker $USER

  以上就是CentOS 8上安装Docker CE的方法,不过这里面有个步骤就是要禁用firewalld,但是这个在生产环境下是绝对不可以的, 经查资料发现只需要开启伪装IP的功能就可以, 无需禁用firewalld。

$ sudo firewall-cmd --zone=public --add-masquerade --permanent
$ sudo firewall-cmd --reload
$ sudo systemctl restart docker

  正常安装未禁用firewalld下在Docker容器中无法解析域名.

$ docker run -it  --rm centos

[root@7ec3691c37d7 /]# ping 192.168.0.5
PING 192.168.0.5 (192.168.0.5) 56(84) bytes of data.
64 bytes from 192.168.0.5: icmp_seq=1 ttl=63 time=0.283 ms
^C
--- 192.168.0.5 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.283/0.283/0.283/0.000 ms

[root@7ec3691c37d7 /]# ping www.baidu.com
ping: www.baidu.com: Name or service not known

  启用伪装IP后即可正常访问.

$ docker run -it  --rm centos
[root@7ec3691c37d7 /]# ping www.baidu.com
PING www.a.shifen.com (14.215.177.38) 56(84) bytes of data.
64 bytes from 14.215.177.38 (14.215.177.38): icmp_seq=1 ttl=54 time=22.3 ms
64 bytes from 14.215.177.38 (14.215.177.38): icmp_seq=2 ttl=54 time=21.9 ms
^C
--- www.a.shifen.com ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 2ms
rtt min/avg/max/mdev = 21.915/22.122/22.330/0.255 ms

1. 安装lm_sensors

$ sudo yum install lm_sensors

2. 配置探头信息

$ sudo sensors-detect

3. 在 /etc/sensors3.conf 中的配置传感器参数

$ sudo vi /etc/sensors3.conf
chip "it8782-*"

    label in0 "VCore"
    label in1 "+5V"
    label in2 "+12V"
    label in3 "+3.3V"
    label in4 "5VSB"
    label fan1 "SYS Fan 1"
    label fan2 "SYS Fan 2"

    ignore in7

    compute in0 ((3/10) +1)*@ ,   @/((3/10) +1)
    compute in1 ((6.8/10)+1)*@ ,  @/((6.8/10)+1)
    compute in2 ((30/10) +1)*@ ,  @/((30/10) +1)
    compute in4 ((6.8/10)+1)*@ ,  @/((6.8/10)+1)

    set in0_min 0.91
    set in0_max 1.21

    set in1_min 5 * 0.95 
    set in1_max 5 * 1.05

    set in2_min 12 * 0.95 
    set in2_max 12 * 1.05

    set in3_min 3.3 * 0.95 
    set in3_max 3.3 * 1.05

    set in4_min 5 * 0.95 
    set in4_max 5 * 1.05

    set fan1_min 0
    set fan2_min 0

4. 输出示例

it8782-isa-0a40
Adapter: ISA adapter
VCore: +1.04 V (min = +0.92 V, max = +1.21 V)
+5V: +5.05 V (min = +4.76 V, max = +5.24 V)
+12V: +11.90 V (min = +11.39 V, max = +12.61 V)
+3.3V: +3.33 V (min = +3.14 V, max = +3.47 V)
5VSB: +5.08 V (min = +4.76 V, max = +5.24 V)
Vbat: +3.22 V
SYS Fan 1: 0 RPM (min = 0 RPM)
SYS Fan 2: 0 RPM (min = 0 RPM)
temp1: +36.0°C (low = +8.0°C, high = -64.0°C) ALARM sensor = thermal diode
temp2: +36.0°C (low = +20.0°C, high = +0.0°C) ALARM sensor = thermal diode
intrusion0: ALARM

I. 安装时启动黑屏的问题

1. 安装程序启动时按TAB键盘编辑启动命令行,尾处添加 rdblacklist=gma500_gfx 禁用gma500_gfx驱动.

II. 更新最新内核(3.10.0-327.36.3)后启动卡死问题

1. 修改 /etc/default/grub 默认启动参, 添加 initcall_blacklist=clocksource_done_booting 参数.

aaaaaa

2. 执行 grub2-mkconfig –output /boot/grub2/grub.cfg 重新生成 grub2 启动配置.

III. 启动黑屏问题

1. 把gma500_gfx列入黑名单

vi /etc/modprobe.d/blacklist.conf
blacklist gma500_gfx

2. 重编initramfs

dracut -f

IV.附加

sv3-26026

电源接线图示

说明书: SV3-26026 User Manual