AlmaLinux10.0のクリーンインストールと Systemの作り直し

August 8, 2025 – 12:36 pm

ひと月前、AlmaLinux9.6にUpgradeし、その際、MajorUpdate版のAlmaLinx10への更新を検討するとしていた。

多少逡巡していたが、ここらでOSを更新し、このうえで我が家のサーバYamasNet.comシステムを整理しなおすことにし、AlmaLinux10.0のクリーンインストール、そのうえでシステムの作り直し作業を進めることにした。

これまでに、YamasNet.com上で実現していた諸機能のうち、Mailserver機能以外の、その他すべての機能の移植を終了したので、ここまでの一連の作業記録を記録しておいた。

  • 旧システムのバックアップの作成
    新たに内蔵型SSD(256GB SATA3)をPCに設置し、サーバ上のデータをバックアップ。
    バックアップ用シェル rsync_backup.sh を作成し、ころを用いた:
    rsync_backup.sh:

    #!/bin/bash
    
    BACKUP_DIR="/mnt/backup/system_backup_$(date +%F)"
    mkdir -p "$BACKUP_DIR"
    
    rsync -aAXv --delete \
      --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} \
      / "$BACKUP_DIR"
    
  •  

  • AlmaLinux10をインストール
    AlmaLinuxのダウンロードサイトから AlmaLinux 10.0 minimal isoをダウンロード。
    これから起動用usbメディアを作成。なお、起動用メディアはFederalMediaWriterを用いて作成
    インストーラの指示にしたがい作業をすすめ、インストール終了後USBを取り除き、電源を入れなおすことでAlmaLinux10を起動
  •  

  • サーバの初期設定
    • ネットワーク設定
      旧システムと同じネットワークとするため以下の手続きを実施。以下、nmcliのログを示す(一部編集):

      nmcli connection modify enp5s0 ipv4.address 192.168.11.112/24
      nmcli connection modify enp5s0 ipv4.method manual
      nmcli connection modify enp5s0 ipv4.gateway 192.168.11.1
      nmcli connection down enp5s0; nmcli connection up enp5s0
      nmcli device show enp5s0
      
    • OpenSSH: パスワード認証
      SSHサーバを構成し、作業用端末(Windows11)からサーバに接続し操作するための設定をする
      リモートからのrootでの直接ログインを禁止する設定を行う(
      /etc/ssh/sshd_config を修正
    • SELinuxの無効化
      [root@Server01 ~]# grubby --update-kernel ALL --args selinux=0
      [root@Server01 ~]# reboot
      
    • ファイアウォールに代え nftablesを設定する:
      ファイアウォールの動作を停止
      [root@Server01 ~]# systemctl stop firewalld
      
      自動起動設定を無効にする
      [root@Server01 ~]# systemctl disable firewalld
      
      firewalldをインストールし有効化
      [root@Server01 ~]# systemctl start nftables
      [root@Server01 ~]# systemctl enable nftables
      
      backup していた nftables スクリプトをcopy
         /etc/nftables/server_rule.nft
         ---
      nftablesを再起動:
      [root@Server01 ~]# systemctl restart nftables
      
      サーバ起動時にnftables スクリプトを動作するよう
      /etc/sysconfig/nftables.conf 最終行に以下を追記
      
      include "/etc/nftables/server_rule.nft"
      
  •  

  • LAMP構成に向けた各種Softwear(service)の導入
    • レポジトリーの設定・導入
      有効になっている(した)レポジトリは以下:

      [root@Server01 ~]# dnf repolist
      repo id                                 repo name
      appstream                               AlmaLinux 10 - AppStream
      baseos                                  AlmaLinux 10 - BaseOS
      crb                                     AlmaLinux 10 - CRB
      epel                                    Extra Packages for Enterprise Linux 10 - x86_64
      extras                                  AlmaLinux 10 - Extras
      remi                                    Remi's RPM repository for Enterprise Linux 10 - x86_64
      remi-modular                            Remi's Modular repository for Enterprise Linux 10 - x86_64
      remi-safe                               Safe Remi's RPM repository for Enterprise Linux 10 - x86_64
      rpmfusion-free-updates                  RPM Fusion for EL 10 - Free - Updates
      rpmfusion-nonfree-updates               RPM Fusion for EL 10 - Nonfree - Updates
      
    • 各種ソフトウェア(サービス)のインストール
      dnf historyでソフトウェア(サービス)等のインストール経緯(編集)

      [root@Server01 ~]# dnf history | sort -n
      ---------------------------------------------------------------------------------------------------------------------------------------
      ID     | Command line                                                                                                                    
           1 |                                                                                                                               
           2 | update -y                                                                                                                     
           3 | groupinstall base                                                                                                             
           4 | groupinstall development                                                                                                       
           5 | install epel-release                                                                                                            
           6 | update 
           7 | install https://rpms.remirepo.net/enterprise/remi-release-10.rpm                                                                
           8 | module install php:remi-8.4                                                                                                     
           9 | install httpd                                                                                                                     
          10 | install httpd-devel                                                                                                           
          11 | install mod_ssl                                                                                                                                
          12 | install php                                                                                                                                    
          13 | install php-devel                                                                                                                   
          14 | install php-mysqlnd                                                                                                                            
          15 | install php-gd                                                                                                                    
          16 | install php-pear                                                                                                              
          17 | install composer                                                                                                               
          18 | install php-pecl-apc-devel                                                                                                  
          19 | install mysql8.4                                                                                                            
          20 | install mysql8.4-server                                                                                                  
          37 | install --nogpgcheck https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-10.noarch.rpm                            
          38 | install --nogpgcheck https://mirrors.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-10.noarch.rpm                     
          39 | install ffmpeg ffmpeg-devel                                                                                               
          40 | install certbot                                                                                                           
          41 | install wget curl vim bash-completion net-tools bind-utils traceroute htop iotop strace psmisc sysstat git gcc make patch
      

      レポジトリの設定部を含む

    • インストールしたソフトウェア(サービス)関連の/etc以下にある設定ファイルをダウンロードファイルからコピーするとともに、有効化
  •  

  • その他の旧システムで有効としたものを有効にする(MailServerを除く)
    • Anaconda関連 jupyter lab
    • crontab の設定

   


Post a Comment