2023年10月30日月曜日

Rocky linux9.2 インストール powertools epel amdgpu postgres

【Rocky linux 9.3 AMI 作成  新疑似環境用 】
最小構成でインストール後の設定。
timedatectl set-timezone Asia/Tokyo
localectl set-locale LANG=ja_JP.utf8

# nmcli general hostname rocky93

# vi /etc/yum.conf <<__EOF__
proxy=http://10.0.19.2:3128
__EOF__

# dnf install net-tools

if [ "$HOST_NAME" = "AMI_ROCKY_20G" ];then
  VLAN=private_mng_1a
  VLAN_IP=10.0.19.100/24
  VLAN_GW=10.0.19.2
  nmcli c delete $VLAN
  nmcli c add type ethernet ifname $DEVICE con-name "$VLAN"
  nmcli c mod $VLAN ipv4.addresses $VLAN_IP
  nmcli c mod $VLAN ipv4.method manual
  nmcli c mod $VLAN connection.autoconnect yes
  nmcli c mod $VLAN ipv4.gateway $VLAN_GW
  nmcli c up $VLAN
fi

# dnf config-manager --set-enabled crb
# dnf install epel-release

※ epel 有効/無効
# dnf config-manager --enable epel
# dnf config-manager --disable epel      * default 

# dnf install httpd
# dnf install https://repo.zabbix.com/zabbix/6.4/rhel/9/x86_64/zabbix-agent2-6.4.9-release1.el9.x86_64.rpm

# vi /etc/zabbix/zabbix_agent2.d/plugins.d/z99-local.conf

#  vi /etc/zabbix/zabbix_agent2.conf
LogFileSize=1
Server=10.0.19.101
ServerActive=10.0.19.101:10051
HostMetadata=Rockylinux
HostMetadataItem=system.uname
Include=/etc/zabbix/zabbix_agent2.d/*.conf
ControlSocket=/run/zabbix/agent.sock
AllowKey=system.run[*]

※ AllowKeyを設定した場合は、下記も設定
# visudo
# Allows zabbix to run all commands without password.
zabbix ALL=NOPASSWD: ALL

# dnf install policycoreutils-python-utils

# semanage boolean -l | grep zabbix
httpd_can_connect_zabbix       (オフ   ,   オフ)  Allow httpd to can connect zabbix
zabbix_can_network                     (オフ   ,   オフ)  Allow zabbix to can network
zabbix_run_sudo                             (オフ   ,   オフ)  Allow zabbix to run sudo

# setsebool -P httpd_can_connect_zabbix on
# setsebool -P zabbix_can_network on
# setsebool -P zabbix_run_sudo  on

# firewall-cmd --add-port=10050/tcp --zone=public --permanent
# firewall-cmd --reload

# systemctl restart zabbix-agent2
# systemctl enable zabbix-agent2

【Rocky linux9 CUIベースAMI】
# dnf install tar
./put deploy latest
【ERROR】 Could not find a version that satisfies the requirement setuptools>=40.8.0 (from versions: none)

→  vi /etc/profile.d/proxy.sh
PROXY="http://10.0.12.2:3128"
export http_proxy=$PROXY
export HTTP_PROXY=$PROXY
export https_proxy=$PROXY
export HTTPS_PROXY=$PROXY

【ERROR】 RuntimeError: The 'apxs' command appears not to be installed or....
→ dnf install httpd-devel

【ERROR】RuntimeError: Failed to build APR.
→dnf install gcc make

【ERROR】Exception: Can not find valid pkg-config name.  ( mysqlclient==2.2.1)
→ mysqlclient==2.1.0にバージョンダウンで回避。

【ERROR】OSError: mysql_config not found
→mariadb クライアントインストール
# dnf remove mysql*
# dnf remove Mariadb*
# curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash
# dnf  install MariaDB-client MariaDB-common MariaDB-devel MariaDB-shared

※ curl: (6) Could not resolve host: downloads.mariadb.com
# vi /etc/profile.d/proxy.sh
PROXY="http://10.0.12.2:3128"
export http_proxy=$PROXY
export HTTP_PROXY=$PROXY
export https_proxy=$PROXY
export HTTPS_PROXY=$PROXY

※ curl: (6) Could not resolve host: dlm.mariadb.com 
→ vi ~/.curlrc
proxy=http://10.0.12.2:3128

【ERROR】Error: pg_config executable not found.
# dnf -y install https://download.postgresql.org/pub/repos/yum/reporpms/EL-$(rpm -E %{centos})-x86_64/pgdg-redhat-repo-latest.noarch.rpm
# vi /etc/yum.repos.d/pgdg-redhat-all.repo
postgres15以外をenable=0
# dnf install postgresql15-devel
# PATH=/usr/pgsql-15/bin:$PATH;export PATH     ※ env 内に追加

【ERROR】 Python.h: そのようなファイルやディレクトリはありません
→ dnf install python3-devel    ※ rocky linux9 では、python39がpython3のデフォルト

【ERROR】ImportError: Unable to find zbar shared library
# dnf install epel-release
# vi /etc/yum.repos.d/epel.repo
enable=1     ※ 一時的に有効
# dnf install zbar





#------------------------------------------------------------------------------------
timedatectl set-timezone Asia/Tokyo
localectl set-locale LANG=ja_JP.utf8

nmcli general hostname rocky92


nmcli connection modify enp5s0 ipv4.method manual ipv4.addresses 192.168.1.198/24
nmcli connection modify enp5s0 ipv4.dns 8.8.8.8
nmcli connection modify enp5s0 ipv4.gateway 192.168.1.1
#nmcli connection modify enp5s0 ipv4.never-default yes
nmcli connection modify enp5s0 connection.autoconnect yes

systemctl restart NetworkManager

RepositoryrepoidRocky 8Rocky 9
PowerToolspowertoolsYesNo
CRBcrbNoYes

※ PowerTools → crb

# dnf config-manager --set-enabled crb
# dnf install epel-release

※ epel 有効/無効
# dnf config-manager --enable epel
# dnf config-manager --disable epel
 
 # vi  /etc/yum.repos.d/google-chrome.repo <<__EOF__
[google-chrome]
name=google-chrome
baseurl=http://dl.google.com/linux/chrome/rpm/stable/x86_64
enabled=1
gpgcheck=1
gpgkey=https://dl.google.com/linux/linux_signing_key.pub
__EOF__
# dnf update
# dnf install google-chrome-stable 
 
 # dnf install gnome-tweaks
「Gnome 拡張機能 アプリ」で設定


Applications Menu
Backgroud Logo
Places Status Indicator
system-monitor
window List
Places Status Indicator Workspaces Bar
Desktop Icons

 
# dnf install sshpass
# dnf install xfreerdp

# dnf -y install qemu-kvm libvirt virt-install
# systemctl enable --now libvirtd
# dnf  install virt-manager

# dnf install  ntfs-3g ntfsprogs
# dnf install gimp xsane
# dnf install libreoffice
# wget https://github.com/dbeaver/dbeaver/releases/download/23.2.3/dbeaver-ce-23.2.3-stable.x86_64.rpm
# dnf install dbeaver-ce-23.2.3-stable.x86_64.rpm
# dnf  install httpd  httpd-devel  mod_ssl

※日本語が入らない!!
設定→Keyboard 
・日本語(Anthy)追加
・日本語(Anthy)→ Prefferences → 入力タイプ → キーボードレイアウト → jp

# dnf install  https://download.postgresql.org/pub/repos/yum/reporpms/EL-9-x86_64/pgdg-redhat-repo-latest.noarch.rpm
# dnf install postgresql15-server postgresql15-contrib
# PGSETUP_INITDB_OPTIONS='--encoding=UTF-8 --no-locale'
# postgresql-15-setup initdb
# passwd postgres
# vi /var/lib/pgsql/15/data/pg_hba.conf 
#local   all             all                                   peer
local     all             all                                    trust
#host    all             all             127.0.0.1/32            ident
host all all 192.168.0.0/16                     password272E2F/11
# vi /var/lib/pgsql/15/data/postgresql.conf
listen_addresses = '*'          
port = 5432
# firewall-cmd --add-port=5432/tcp --zone=public --permanent
# firewall-cmd --reload
# mkdir  -p /data/postgres/data
# chown  -R postgres:postgres /data/postgres/data
# semanage fcontext -a -t postgresql_db_t "/data/postgres(/.*)?"
# grep -i postgresql /etc/selinux/targeted/contexts/files/file_contexts.local
# restorecon -R -v /data/postgres
# ls -lZR /data/postgres

# systemctl start postgresql-15
# systemctl enable postgresql-15

【AMDGPUー20240109】
# amdgpu-install  --uninstall
# rpm -e amdgpu-install
# rpm -qa|grep -E 'amdgpu|rocm'
amdgpu-dkms-6.2.4.50700-1652687.el9.noarch
# wget https://repo.radeon.com/amdgpu-install/latest/rhel/9.3/amdgpu-install-6.0.60000-1.el9.noarch.rpm
# rpm -Uvh amdgpu-install-6.0.60000-1.el9.noarch.rpm
# amdgpu-install --usecase=graphics --vulkan=amdvlk --opencl=rocr
引数に一致する結果がありません: vulkan-amdgpu
エラー: 一致するものが見つかりません: vulkan-amdgpu
# amdgpu-install --usecase=graphics  --opencl=rocr
# amdgpu-install --usecase=rocm

# dnf reinstall amdgpu-dkms
Error! The module/version combo: amdgpu-6.2.4-1652687.el9 is not located in the DKMS tree.
エラー: %preun(amdgpu-dkms-1:6.2.4.50700-1652687.el9.noarch) スクリプトの実行に失敗しました。終了ステータス 3

# dnf --setopt=tsflags=noscripts remove amdgpu-dkms
# dnf install amdgpu-dkms





【AMDGPU】
# amdgpu-install  --uninstall
# rpm -e amdgpu-install
# rpm -qa|grep -E 'amdgpu|rocm'

# wget https://repo.radeon.com/amdgpu-install/6.0.2/rhel/9.3/amdgpu-install-6.0.60002-1.el9.noarch.rpm 
# rpm -Uvh  amdgpu-install-6.0.60002-1.el9.noarch.rpm

# amdgpu-install --usecase=graphics --vulkan=amdvlk --opencl=rocr --opengl=mesa
# amdgpu-install --usecase=rocm  ←不要?
# rpm -qa|grep -E 'amdgpu|rocm'

 ※(ERROR) package rocm-developer-tools-6.0.2.60002-115.el9.x86_64 from rocm requires rocprofiler = 2.0.60002.60002-115.el9, but none of the providers can be installed
  - package rocprofiler-2.0.60002.60002-115.el9.x86_64 from rocm requires systemd-devel, but none of the providers can be installed


※ 4Kにするとちらついて使い物にならない!!
# dnf reinstall amdgpu-dkms
でなおった!!

【参考】
# rpm -e  amdgpu-install-5.7.50700-1.el9.noarch.rpm
# wget https://repo.radeon.com/amdgpu-install/5.4.6/rhel/9.2/amdgpu-install-5.4.50406-1.el9.noarch.rpm
# wget https://repo.radeon.com/amdgpu-install/5.6.1/rhel/9.2/amdgpu-install-5.6.50601-1.el9.noarch.rpm

※ 参考
# amdgpu-install --usecase=graphics --vulkan=amdvlk --opencl=rocr   --opengl=mesa  --accept-eula
# dnf install -y hip-devel rocm-llvm rocm-device-libs rocm-core
# amdgpu-install -y --accept-eula

※ マルチディスプレイ認識しない。
※ モニター名認識しない。
※ HDMI audioを認識しない。

【その他】
# dnf install sshpass
# dnf install xfreerdp
# dnf install setroubleshoot

※ terminal で拡大/縮小のショートカットが効かない。
  → teminal->設定->ショートカット で再設定する。

【BIOS Version 確認】
# dmidecode

※ hub 10-0:1.0: config failed, hub doesn't have any ports! (err -19)

【GNOME】
# dnf remove gnome-shell.x86_64
# dnf autoremove

# dnf makecache
# dnf install gnome-shell.x86_64

2023年10月29日日曜日

Rocky linux9 KVM インストール (仮想マネージャー)

【20240130 更新】
BIOS設定
# dnf install qemu-kvm qemu-img libvirt virt-manager virt-install virt-viewer libvirt-client
#  lsmod | grep kvm
kvm_intel             479232  0
kvm                  1327104  1 kvm_intel
irqbypass              16384  1 kvm
# systemctl start libvirtd
# systemctl enable libvirtd


virsh net-create <( cat <<__EOF__
<network connections="2">
 <name>private_api_1a</name>
 <uuid>9071da35-895a-415c-a983-925f5f836cb6</uuid>
 <bridge name="virbr4" stp="on" delay="0"/>
 <mac address="52:54:00:e3:83:6a"/>
 <domain name="private_api_1a"/>
 <ip address="10.0.11.1" netmask="255.255.255.0">
 </ip>
</network>
__EOF__
)
virsh net-start           private_api_1a ×
virsh net-autostart private_api_1a     ×
virsh net-destroy private_api_1a

nmcli d  delete  virbr0
nmcli d delete   virbr4
nmcli c delete   enp4s0

# virsh net-list --all









-------------------------------------------------------------------------------------------------------------------
# dnf install qemu-kvm qemu-img libvirt virt-manager virt-install virt-viewer libvirt-client guestfs-tools  bridge-utils virt-top  libguestfs-tools
# dnf install epel-release -y
# dnf install bridge-utils
$  lsmod | grep kvm
kvm_amd               212992  0
kvm                  1327104  1 kvm_amd
irqbypass              16384  1 kvm
ccp                   143360  1 kvm_amd
# systemctl start libvirtd
# systemctl enable libvirtd


# dnf list qemu-kvm qemu-img libvirt virt-manager virt-install virt-viewer libvirt-client guestfs-tools  bridge-utils virt-top  libguestfs-tools
メタデータの期限切れの最終確認: 0:24:57 前の 2023年12月27日 08時56分16秒 に実施しました。
インストール済みパッケージ
bridge-utils.x86_64                     1.7.1-3.el9                                @epel     
guestfs-tools.x86_64                  1.50.1-3.el9                              @appstream
libvirt.x86_64                                 9.5.0-7.el9_3                           @appstream
libvirt-client.x86_64                    9.5.0-7.el9_3                           @appstream
qemu-img.x86_64                        17:8.0.0-16.el9_3.1               @appstream
qemu-kvm.x86_64                       17:8.0.0-16.el9_3.1               @appstream
virt-install.noarch                         4.1.0-4.el9                                @appstream
virt-manager.noarch                    4.1.0-4.el9                                @appstream
virt-top.x86_64                               1.1.1-9.el9                                @appstream
virt-viewer.x86_64                        11.0-1.el9                                  @appstream




# virsh net-destroy private_api_1a

シャットダウン時の後処理 (shutdown)

# vi /etc/systemd/system/drop.service [Unit] Description= stop httpgwd DefaultDependencies=no Before=shutdown.target RefuseManualStart=true ...