カテゴリー: Linux

  • upgrade from Ubuntu 20.04 to 22.04

    upgrade from Ubuntu 20.04 to 22.04

    You can upgrade from Ubuntu 20.04 to 22.04 by following these steps:

    Step 1: Update Your System

    Before upgrading, ensure your system is fully updated.

    1. Open a terminal (Ctrl + Alt + T) and run:
       sudo apt update && sudo apt upgrade -y
       sudo apt dist-upgrade -y
    1. Remove unused dependencies:
       sudo apt autoremove -y

    Step 2: Ensure update-manager-core is Installed

       sudo apt install update-manager-core -y

    Step 3: Start the Upgrade Process

    1. Run the upgrade tool:
       sudo do-release-upgrade

    If no new release is found, try:

       sudo do-release-upgrade -d
    1. Follow the on-screen instructions, confirming prompts when needed.

    Step 4: Reboot Your System

    Once the upgrade is complete, restart your system:

       sudo reboot

    Step 5: Verify the Upgrade

    After rebooting, check your Ubuntu version:

       lsb_release -a

    Your system should now be on Ubuntu 22.04 LTS. 🚀

  • Ubuntu Data Backup Automation by Ansible

    Ubuntu Data Backup Automation by Ansible


      ---
      - name: Ubuntu Data Backup Automation by Ansible
        hosts: source_servers
        become: yes
        vars:
          source_dir: "/path/to/source"  # Change to the actual folder to back up
          dest_dir: "/path/to/destination"  # Change to the actual backup location on DESTINATION server
          destination_server: "destination_user@destination_server_ip"
          ssh_key: "~/.ssh/id_rsa"  # Change to the correct SSH key
          max_copy_size: "500G"  # Maximum data copy per transfer
          check_interval: "1h"  # Interval between checks
          log_file: "/var/log/backup.log"
        
        tasks:
          - name: Install required packages
            apt:
              name: rsync
              state: present
        
          - name: Ensure SSH key exists for passwordless authentication
            ansible.builtin.copy:
              src: "{{ ssh_key }}.pub"
              dest: "/home/{{ ansible_user }}/.ssh/authorized_keys"
              remote_src: yes
        
          - name: Create backup script
            copy:
              dest: "/usr/local/bin/backup_script.sh"
              mode: "0755"
              content: |
                #!/bin/bash
                LOGFILE={{ log_file }}
                echo "Backup process started at $(date)" >> $LOGFILE
                
                # Check if jobs are running on the cluster
                JOBS_RUNNING=$(some_command_to_check_jobs)  # Replace with actual job-checking command
                if [[ "$JOBS_RUNNING" == "0" ]]; then
                    echo "No jobs running, starting backup..." >> $LOGFILE
                    rsync -az --progress --max-size={{ max_copy_size }} -e 'ssh -i {{ ssh_key }}' {{ source_dir }}/ {{ destination_server }}:{{ dest_dir }}/ >> $LOGFILE 2>&1
                    echo "Backup completed at $(date)" >> $LOGFILE
                else
                    echo "Jobs running, skipping backup." >> $LOGFILE
                fi
        
          - name: Create cron job for periodic backup
            ansible.builtin.cron:
              name: "Automated Cluster Data Backup"
              job: "/usr/local/bin/backup_script.sh"
              minute: "0"
              hour: "*/1"  # Runs every hour
      
    • Ubuntu Data Backup Automation

      Ubuntu Data Backup Automation


      • name: Ubuntu Data Backup Automation
        hosts: from_server
        become: yes
        vars:
        source_dir: “/path/to/source” # Change to the actual folder to back up
        dest_dir: “/path/to/destination” # Change to the actual backup location on TO server
        to_server: “to_server_user@to_server_ip”
        ssh_key: “~/.ssh/id_rsa” # Change to the correct SSH key tasks:
        • name: Install rsync if not present
          apt:
          name: rsync
          state: present
        • name: Ensure SSH key exists for passwordless authentication
          ansible.builtin.copy:
          src: “{{ ssh_key }}.pub”
          dest: “/home/{{ ansible_user }}/.ssh/authorized_keys”
          remote_src: yes
        • name: Create cron job for periodic backup
          ansible.builtin.cron:
          name: “Automated Data Backup”
          minute: “0”
          hour: “*/6” # Runs every 6 hours
          job: “rsync -az –delete -e ‘ssh -i {{ ssh_key }}’ {{ source_dir }}/ {{ to_server }}:{{ dest_dir }}/”
    • Linuxに関する資格試験

      Linuxに関する資格試験

      Linuxに関する資格試験にはいくつかの種類があり、それぞれ目的や難易度が異なります。以下に代表的なLinux資格試験の種類を一覧でまとめ、特徴を簡潔に説明します。これらは日本国内外で認知されている主要な資格です。

      1. LPIC (Linux Professional Institute Certification)

      • 運営団体: Linux Professional Institute (LPI)
      • 概要: 世界中で認知されているLinux技術者認定資格。ベンダーニュートラル(特定のディストリビューションに依存しない)で、Linuxの基礎から上級スキルまでをカバー。
      • レベル:
      • LPIC-1: 初心者向け。基本操作とシステム管理を証明。
      • LPIC-2: 中級者向け。ネットワーク管理やサーバ構築をカバー。
      • LPIC-3: 上級者向け。専門分野(セキュリティ、仮想化、高可用性など)に特化。
      • 難易度: レベル1は初心者でも挑戦可能だが、レベル3は実務経験が必要な場合が多い。
      • 特徴: グローバルに通用する資格で、海外でのキャリアにも有利。

      2. LinuC (Linux技術者認定試験)

      • 運営団体: LPI-Japan
      • 概要: 日本市場向けに最適化されたLinux資格。LPICをベースにしつつ、日本のIT環境に合わせた内容。
      • レベル:
      • LinuC-1: 基礎的なLinux操作と管理。
      • LinuC-2: 仮想化やサーバ構築を含む中級スキル。
      • LinuC-3: 高度な専門知識(セキュリティ、システムアーキテクチャなど)。
      • 難易度: LPICと似ているが、実践的で日本の業務に即した内容。
      • 特徴: 受験者にスコアや項目別の結果を提供し、学習のフィードバックが得やすい。

      3. Linux Foundation 認定資格

      • 運営団体: Linux Foundation
      • 概要: 実技試験を重視し、現場で使えるスキルを証明。国際的な評価が高い。
      • 種類:
      • LFCS (Linux Foundation Certified System Administrator): システム管理の基礎。
      • LFCE (Linux Foundation Certified Engineer): 上級者向けのシステム運用・管理。
      • CKA (Certified Kubernetes Administrator): Kubernetes運用に特化。
      • 難易度: 実技ベースのため、Linux未経験者には難易度が高い。
      • 特徴: クラウドやコンテナ技術を含む現代的な内容。

      4. Red Hat 認定資格

      • 運営団体: Red Hat
      • 概要: Red Hat Enterprise Linux (RHEL)に特化した資格。実技試験で実践力が試される。
      • 種類:
      • RHCSA (Red Hat Certified System Administrator): 基本的なシステム管理。
      • RHCE (Red Hat Certified Engineer): 上級者向けのシステム設計・運用。
      • RHCA (Red Hat Certified Architect): 最高レベルで複数の専門分野を網羅。
      • 難易度: RHELに特化しているため、特定環境での実務経験が有利。
      • 特徴: Red Hat製品を使う企業で特に評価される。

      5. Linux Essentials

      • 運営団体: Linux Professional Institute (LPI)
      • 概要: LPICの入門資格。Linuxの基本知識やオープンソースの理解を証明。
      • 難易度: 初心者向けで、IT全般の基礎学習にも役立つ。
      • 特徴: サーバー管理者を目指す前のステップとして推奨。

      その他の関連資格

      • CompTIA Linux+: ベンダーニュートラルで、Linuxの基礎スキルを証明。初心者向け。
      • Oracle Linux認定: Oracle Linuxに特化した資格で、特定環境向け。

      まとめ

      • 初心者向け: Linux Essentials、LPIC-1、LinuC-1、CompTIA Linux+
      • 中級者向け: LPIC-2、LinuC-2、RHCSA
      • 上級者・専門家向け: LPIC-3、LinuC-3、RHCE、LFCE、CKA

      目的に応じて選択するのが重要です。例えば、グローバルなキャリアを目指すならLPICやLinux Foundation系、日本国内での実践力を重視するならLinuC、Red Hat環境ならRed Hat認定が適しています。どの資格もLinuxスキルの証明としてIT業界で価値があります。

    • パッケージグループの一覧 Rockey Linux @Default

      パッケージグループの一覧 Rockey Linux @Default

      インストールできるEnvironment GroupとGroupの一覧表示

      [user@localhost ~]$ dnf group list
      Last metadata expiration check: 0:01:29 ago on Mon 04 Nov 2024 04:18:17 PM JST.
      Available Environment Groups:
      Server
      Minimal Install
      Workstation
      Custom Operating System
      Virtualization Host
      Installed Environment Groups:
      Server with GUI
      Installed Groups:
      Container Management
      Headless Management
      Available Groups:
      Legacy UNIX Compatibility
      Console Internet Tools
      Development Tools
      .NET Development
      Graphical Administration Tools
      Network Servers
      RPM Development Tools
      Scientific Support
      Security Tools
      Smart Card Support
      System Tools

      InstallされているGroupの一覧を表示する


      [user@localhost ~]$ dnf group list installed
      Last metadata expiration check: 0:02:08 ago on Mon 04 Nov 2024 04:18:17 PM JST.
      Installed Environment Groups:
      Server with GUI
      Installed Groups:
      Container Management
      Headless Management

      InstallされたEnviroment Groupに含まれるGroup

      user@localhost ~]$ sudo dnf group info “Server with GUI”

      Last metadata expiration check: 0:02:20 ago on Mon 04 Nov 2024 04:38:51 PM JST.
      Environment Group: Server with GUI
      Description: An integrated, easy-to-manage server with a graphical interface.

      Mandatory Groups:
      Common NetworkManager submodules
      Container Management
      Core
      Fonts
      GNOME
      Guest Desktop Agents
      Hardware Monitoring Utilities
      Hardware Support
      Headless Management
      Internet Browser
      Multimedia
      Printing Client
      Server product core
      Standard
      base-x

      Optional Groups:
      Basic Web Server
      DNS Name Server
      Debugging Tools
      FTP Server
      File and Storage Server
      Guest Agents
      Infiniband Support
      Mail Server
      Network File System Client
      Network Servers
      Performance Tools
      Remote Desktop Clients
      Remote Management for Linux
      Virtualization Client
      Virtualization Hypervisor
      Virtualization Tools
      Windows File Server

      Otional Groupのインストール方法

      [user@localhost ~]$ sudo dnf groupinstall “Basic Web Server”
      Last metadata expiration check: 0:14:31 ago on Mon 04 Nov 2024 04:38:51 PM JST.
      Dependencies resolved.
      Package Architecture Version Repository Size
      Installing group/module packages:
      httpd x86_64 2.4.57-11.el9_4.1 appstream 44 k
      httpd-manual noarch 2.4.57-11.el9_4.1 appstream 2.2 M
      mod_fcgid x86_64 2.3.9-28.el9 appstream 74 k
      mod_ssl x86_64 1:2.4.57-11.el9_4.1 appstream 108 k
      Installing dependencies:
      apr x86_64 1.7.0-12.el9_3 appstream 122 k
      apr-util x86_64 1.6.1-23.el9 appstream 94 k
      apr-util-bdb x86_64 1.6.1-23.el9 appstream 12 k
      httpd-core x86_64 2.4.57-11.el9_4.1 appstream 1.4 M
      httpd-filesystem noarch 2.4.57-11.el9_4.1 appstream 11 k
      httpd-tools x86_64 2.4.57-11.el9_4.1 appstream 79 k
      rocky-logos-httpd noarch 90.15-2.el9 appstream 24 k
      Installing weak dependencies:
      apr-util-openssl x86_64 1.6.1-23.el9 appstream 14 k
      mod_http2 x86_64 2.0.26-2.el9_4.1 appstream 163 k
      mod_lua x86_64 2.4.57-11.el9_4.1 appstream 58 k
      Installing Groups:
      Basic Web Server
      Transaction Summary
      Install 14 Packages