顯示具有 dnf 標籤的文章。 顯示所有文章
顯示具有 dnf 標籤的文章。 顯示所有文章

2026/06/17

早上 ntopng 又起不來了

果然又是更新出包 三不五時就來一下

https://packages.ntop.org/centos-stable/9/x86_64/Packages/

先倒回去等個几天吧

暫停更新

在 /etc/dnf/dnf.conf 加上

exclude=cento,n2disk,nprobe,ntap,ntop-license,ntopng,ntopng-data


2025/09/22

今天早上打開看ntopng時發現完全沒有資料

本來以為是mirror有問題

測試了一下

其他的几器使用tcpdump 去看都正常

唯獨這台完全捉不到封包

dmesg發現以下訊息


[    4.618648] ------------[ cut here ]------------

[    4.618940] WARNING: CPU: 3 PID: 671 at net/core/dev.c:603 dev_add_pack+0xaa/0xd0

[    4.618954] Modules linked in: pf_ring(OE+) rfkill bochs drm_vram_helper drm_ttm_helper ttm drm_kms_helper pcspkr virtio_balloon i2c_piix4 joydev drm fuse xfs libcrc32c sr_mod cdrom sg ata_generic ata_piix libata crc32c_intel virtio_net net_failover virtio_blk failover serio_raw

[    4.618969] CPU: 3 PID: 671 Comm: modprobe Tainted: G           OE     -------  ---  5.14.0-570.44.1.el9_6.x86_64 #1

[    4.618971] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.3-0-ga6ed6b701f0a-prebuilt.qemu.org 04/01/2014

[    4.618973] RIP: 0010:dev_add_pack+0xaa/0xd0

[    4.618975] Code: c5 28 11 00 00 eb a0 48 8b 6f 28 48 85 ed 74 15 48 81 c5 18 11 00 00 48 85 d2 74 8b 48 8d aa a8 01 00 00 eb 82 48 85 d2 75 f2 <0f> 0b 5b 5d 41 5c 41 5d e9 99 b7 2b 00 66 c1 c0 08 83 e0 0f 48 c1

[    4.618977] RSP: 0018:ffff983bc076fb58 EFLAGS: 00010246

[    4.618979] RAX: 0000000000000300 RBX: ffffffffc0814da0 RCX: 0000000000000201

[    4.618981] RDX: 0000000000000000 RSI: 0000000000000001 RDI: ffffffffc0814da0

[    4.618981] RBP: 0000000000000000 R08: ffff983bc076fb00 R09: ffff8ae7c72b7860

[    4.618982] R10: ffff8ae7c3c78540 R11: 000000000003a680 R12: 0000000000000000

[    4.618983] R13: 00007f5329cd55ad R14: 000055d97d7be962 R15: ffff983bc076fc20

[    4.618985] FS:  00007f532a75d740(0000) GS:ffff8ae8f7d80000(0000) knlGS:0000000000000000

[    4.618986] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033

[    4.618987] CR2: 00007f5329cd4ff0 CR3: 0000000108956000 CR4: 00000000000006f0

[    4.618992] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000

[    4.618993] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400

[    4.618994] Call Trace:

[    4.618996]  <TASK>

[    4.618998]  ? show_trace_log_lvl+0x1c4/0x2df

[    4.619003]  ? show_trace_log_lvl+0x1c4/0x2df

[    4.619006]  ? __pfx_init_module+0x10/0x10 [pf_ring]

[    4.619020]  ? ring_init+0x29a/0xff0 [pf_ring]

[    4.619030]  ? dev_add_pack+0xaa/0xd0

[    4.619031]  ? __warn+0x7e/0xd0

[    4.619035]  ? dev_add_pack+0xaa/0xd0

[    4.619037]  ? report_bug+0x100/0x140

[    4.619040]  ? handle_bug+0x3c/0x70

[    4.619043]  ? exc_invalid_op+0x14/0x70

[    4.619045]  ? asm_exc_invalid_op+0x16/0x20

[    4.619050]  ? dev_add_pack+0xaa/0xd0

[    4.619052]  ? __pfx_init_module+0x10/0x10 [pf_ring]

[    4.619062]  ring_init+0x29a/0xff0 [pf_ring]

[    4.619072]  do_one_initcall+0x44/0x210

[    4.619077]  do_init_module+0x64/0x230

[    4.619080]  __do_sys_init_module+0x12e/0x1b0

[    4.619084]  do_syscall_64+0x5f/0xe0

[    4.619086]  ? syscall_exit_to_user_mode+0x19/0x40

[    4.619088]  ? do_syscall_64+0x6b/0xe0

[    4.619090]  ? netif_receive_skb_list_internal+0x1e4/0x300

[    4.619094]  ? napi_complete_done+0x6e/0x220

[    4.619096]  ? virtnet_poll+0x1fb/0x2d4 [virtio_net]

[    4.619104]  ? __napi_poll+0x2c/0x170

[    4.619106]  ? net_rx_action+0x29c/0x370

[    4.619109]  ? kvm_sched_clock_read+0xd/0x20

[    4.619111]  ? sched_clock+0xc/0x30

[    4.619114]  ? sched_clock_cpu+0xb/0x190

[    4.619119]  ? irqtime_account_irq+0x3c/0xb0

[    4.619121]  ? handle_softirqs+0x16b/0x270

[    4.619125]  ? __irq_exit_rcu+0x46/0xc0

[    4.619127]  ? common_interrupt+0x43/0xa0

[    4.619129]  entry_SYSCALL_64_after_hwframe+0x78/0x80

[    4.619133] RIP: 0033:0x7f5329f0f51e

[    4.619135] Code: 48 8b 0d fd 98 0e 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa 49 89 ca b8 af 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d ca 98 0e 00 f7 d8 64 89 01 48

[    4.619137] RSP: 002b:00007ffe93d34038 EFLAGS: 00000246 ORIG_RAX: 00000000000000af

[    4.619138] RAX: ffffffffffffffda RBX: 000055d97db21bb0 RCX: 00007f5329f0f51e

[    4.619139] RDX: 000055d97d7be962 RSI: 000000000005e59d RDI: 00007f5329c77010

[    4.619140] RBP: 00007f5329c77010 R08: 000055d97db21e40 R09: 0000000000000000

[    4.619141] R10: 0000000000000005 R11: 0000000000000246 R12: 000055d97d7be962

[    4.619142] R13: 000055d97db21d20 R14: 000055d97db21bb0 R15: 000055d97db21df0

[    4.619144]  </TASK>

[    4.619144] ---[ end trace 0000000000000000 ]---

[    4.619146] [PF_RING] pf_ring initialized correctly

[    4.676410] dca service started, version 1.12.1

[    4.683689] gnss: GNSS driver registered with major 240 


knerlel 更新後 pf_ring 不能用了

只好先倒回去更新前的備分

倒回去後開几就正常了

再來就是先暫停kernel的更新


vi /etc/dnf/dnf.conf

在 [main] 加上 exclude=kernel*
如下

[main]
...
exclude=kernel*

之後再看看如果kernel沒問題再拿掉吧

2025/06/22

今天把oracle linux 8 升到 almalinux 9

首先升到 almalinux 8

dnf update -y

curl -O https://raw.githubusercontent.com/AlmaLinux/almalinux-deploy/master/almalinux-deploy.sh

bash almalinux-deploy.sh


再升到 almalinux 9

dnf -y update

yum install -y http://repo.almalinux.org/elevate/elevate-release-latest-el$(rpm --eval %rhel).noarch.rpm

dnf install -y leapp-upgrade leapp-data-almalinux

leapp preupgrade

查看 log 解決升級會碰到的問題

cpu要改成 x86-64-v2 或以上

leapp upgrade


升完後

dnf -y update 出現以下訊息

warning: Signature not supported. Hash algorithm SHA1 not available.

需要清除有問題的 gpg-pubkey

列出所有 gpg key

rpm -qa gpg-pubkey --qf '%{NAME}-%{VERSION}-%{RELEASE}\t%{SUMMARY}\n'

刪除以下二個  gpg key

gpg-pubkey-ad986da3-5cabf60d    gpg(Oracle OSS group (Open Source Software group) <build@oss.oracle.com>)

gpg-pubkey-ced7258b-6525146f    gpg(AlmaLinux OS 8 <packager@almalinux.org>)

rpm -e gpg-pubkey-ad986da3-5cabf60d
rpm -e gpg-pubkey-ced7258b-6525146f


目前正常
再觀察看看


2025/02/14

今天在 almalinux 9 dnf update出現以下錯誤


Error:

Problem: package iptables-legacy-1.8.10-4.1.el9.x86_64 from @System requires (iptables-libs(x86-64) = 1.8.10-4.el9 or iptables-libs(x86-64) = 1.8.10-4.el9_4), but none of the providers can be installed

- cannot install both iptables-libs-1.8.10-11.el9_5.x86_64 from baseos and iptables-libs-1.8.10-4.el9_4.x86_64 from @System

- cannot install both iptables-libs-1.8.10-4.el9_4.x86_64 from baseos and iptables-libs-1.8.10-11.el9_5.x86_64 from baseos

- cannot install the best update candidate for package iptables-libs-1.8.10-4.el9_4.x86_64

- cannot install the best update candidate for package iptables-legacy-1.8.10-4.1.el9.x86_64

(try to add '--allowerasing' to command line to replace conflicting packages or '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)

本來想把iptables-legacy iptables-libs 都移除 但因為這台跑docker 如果移除會連docker一起移掉

查到官方 forum有人提供解法

dnf --assumeyes swap iptables-legacy iptables-nft


https://forums.almalinux.org/t/almalinux-9-yum-update-iptables-legacy-and-iptables-libs-conflict/3818/2

2024/11/27

記一下在 almalinux 9 上安裝docker後再安裝n8n docker

先裝 docker

dnf install 'dnf-command(config-manager)'

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

dnf install docker-ce docker-ce-cli containerd.io

裝好後設定docker 的 daemon

systemctl start docker
systemctl enable docker


接下來安裝 n8n

先建立放資料的 volume

docker volume create n8n_data

docker pull docker.n8n.io/n8nio/n8n


# Start docker 有些參數要加  以下方為準    官方說明太簡單

docker run -it --name n8n -p 5678:5678 --restart=always -e GENERIC_TIMEZONE="Asia/Taipei" -e TZ="Asia/Taipei" -e N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true -e N8N_SECURE_COOKIE=false -v n8n_data:/home/node/.n8n docker.n8n.io/n8nio/n8n

如果這裡timezone 沒設 每次新建 workflow的時候都要再改 有點煩 而且很容易忘記

再來就可以開browser登入了 http://10.0.0.1:5678


以下步驟是n8n docker 有新版本的更新方式 

docker pull docker.n8n.io/n8nio/n8n

# Get the container ID
docker ps -a

# Stop the container with ID container_id
docker stop [container_id]

# Remove the container with ID container_id
docker rm [container_id]

# Start the container
docker run -it --name n8n -p 5678:5678 --restart=always -e GENERIC_TIMEZONE="Asia/Taipei" -e TZ="Asia/Taipei" -e N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true -e N8N_SECURE_COOKIE=false -v n8n_data:/home/node/.n8n docker.n8n.io/n8nio/n8n

#remove unused image
docker image prune


2024/11/20

今天把ntopng換到 almalinux9

官方說明頁面的步驟是

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

錯了 
要先 dnf install epel-release
才能 dnf config-manager --set-enabled crb


安裝後進管理介面
一直出現這個訊息




















必須在
/etc/ntopng/ntopng.conf
加上

-X=500000

數字依据現實狀況而定

順便改一下這二個值

 -m=10.0.0.0/8,192.168.0.0/16

 -i=eth1


2024/11/04

almalinux 8 預設安裝的php 7.2

記錄一下升級到 php 8.2的步驟

看一下目前使用的版本及系統支援的版本

dnf module list php

Last metadata expiration check: 2:45:04 ago on Mon 04 Nov 2024 09:34:39 AM CST.
AlmaLinux 8 - AppStream
Name     Stream         Profiles                      Summary                  
php      7.2 [d][e]     common [d], devel, minimal    PHP scripting language   
php      7.3            common [d], devel, minimal    PHP scripting language   
php      7.4            common [d], devel, minimal    PHP scripting language   
php      8.0            common [d], devel, minimal    PHP scripting language   
php      8.2            common [d], devel, minimal    PHP scripting language 

Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled

先reset 目前安裝的版本

dnf module reset php -y

再enable php 8.2

dnf module enable php:8.2 -y

接下來 dnf -y update 安裝所有 php8.2 相關套件

確認是否安裝完成

dnf module list php
AlmaLinux 8 - BaseOS                           6.2 MB/s | 7.4 MB     00:01    
AlmaLinux 8 - AppStream                        5.7 MB/s |  14 MB     00:02    
AlmaLinux 8 - Extras                            18 kB/s |  13 kB     00:00    
Extra Packages for Enterprise Linux 8 - x86_64 8.3 MB/s |  14 MB     00:01    
AlmaLinux 8 - AppStream
Name      Stream      Profiles                       Summary                   
php       7.2 [d]     common [d], devel, minimal     PHP scripting language    
php       7.3         common [d], devel, minimal     PHP scripting language    
php       7.4         common [d], devel, minimal     PHP scripting language    
php       8.0         common [d], devel, minimal     PHP scripting language    
php       8.2 [e]     common [d], devel, minimal     PHP scripting language    

提示:預設[d]、已啟用[e]、已停用[x]、已安裝[i]

檢查目前版本

php -v


重開几看看所有服務是否正常


2022/02/10

之前從centos 8 升到 centos 8 stream 的几器最近無法更新

出現以下訊息


 [root@localhost ~]# dnf -y update

Failed to set locale, defaulting to C.UTF-8

CentOS Linux 8 - AppStream                      51  B/s |  38  B     00:00    

Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist


重新執行以下指令

dnf --disablerepo '*' --enablerepo extras swap centos-linux-repos centos-stream-repos

dnf distro-sync

再 dnf -y update 就正常了


2021/08/01

在proxmox上的LXC一直有個問題 今天終於解決了

記錄一下

當部屬完LXC要更新時出現以下的情況


#dnf -y update

Extra Packages for Enterprise Linux 8 - Next - x86_64          0.0  B/s |   0  B     00:00    

Errors during downloading metadata for repository 'epel-next':

  - Curl error (6): Couldn't resolve host name for https://mirrors.fedoraproject.org/metalink?repo=epel-next-8&arch=x86_64&infra=stock&content=centos [Could not resolve host: mirrors.fedoraproject.org]

Error: Failed to download metadata for repo 'epel-next': Cannot prepare internal mirrorlist: Curl error (6): Couldn't resolve host name for https://mirrors.fedoraproject.org/metalink?repo=epel-next-8&arch=x86_64&infra=stock&content=centos [Could not resolve host: mirrors.fedoraproject.org]


檢查一下 /etc/resolv.conf


cat /etc/resolv.conf 

# Generated by NetworkManager

search abc.com


發現沒有設定nameserver


可是這個值在佈署LXC時確實有輸入


後來發現可能是 NetworkManager 的問題

導致proxmox 要修改 /etc/resolv.conf 的時候出問題

本來是想直接用 NetworkManager 來處理

直接 nmtui 

結果預設沒有安裝

只好再自己裝

# dnf install -y NetworkManager-tui

在 nmtui 裡設定好 nameserver 後重開

在 /etc/resolv.conf 裡還是沒看到 nameserver


手動把nameserver 加入/etc/resolv.conf 也沒用

重開後就會消失了


於是決定把 NetworkManager 停掉

# systemctl stop NetworkManager.service

# systemctl disable NetworkManager.service


再安裝使用 network-scripts

# dnf install -y network-scripts

# systemctl enable network


改完後重開

再看一下 /etc/resolv.conf

# cat /etc/resolv.conf 

# --- BEGIN PVE ---

search abc.com

nameserver 8.8.8.8

# --- END PVE ---

醬就正常了


https://forum.proxmox.com/threads/proxmox-6-0-9-dns-host-settings-reset-every-time.59434/

https://www.thegeekdiary.com/how-to-disable-networkmanager-in-centos-rhel-8/


2020/07/16

最近在測一個稽核的設備
只要user經過這台設備就所有動作就可以被錄影
因為就想讓user進設備後再連到一台主机
接下來再連到目的主机
但考慮可能有多人同時使用的情況
又不想要為此再多花費用去購買windows rdp 的授權
所以就想利用xrdp來解決

安裝步驟如下


centos 8 xrdp install

centos 8 安裝時選擇 server with gui

裝好後關閉 selinux
vi /etc/sysconfig/selinux

關閉firewalld
systemctl disable firewalld

disable virbr0

systemctl status libvirtd.service
systemctl disable libvirtd.service

dnf update -y

dnf install epel-release

dnf install xrdp -y

systemctl enable xrdp
systemctl start xrdp

因為只開几個user要給多人共用 所以關閉視窗時要結束 session

同一user不能同時二個登入
不同user可以同時登入

vi /etc/xrdp/sesman.ini

 [Xvnc] 這段加入


param=-MaxDisconnectionTime
param=10

醬user在關視窗後10秒就會結束session


因為連入後還要再連到別台几器
所以安裝remmina給連入的user使用

因為centos 8 預設軟体庫已沒有 remmina
所以使用snap安裝

dnf install snapd

systemctl start snapd
systemctl enable snapd

snap install remmina

重開几

2019/10/16

因為centos 8的php已 經升到7了
所以試看看裝 ocs 2.6有沒有問題

先補一下需要的rpm

dnf --enablerepo=PowerTools install perl-MIME-Types
dnf --enablerepo=PowerTools install perl-Digest-SHA1 -y
dnf --enablerepo=PowerTools install perl-Switch -y

epel-release
make
mariadb
mariadb-server
mod_perl
perl-Apache2-SOA
perl-Apache-DB
perl-Apache-DBI
perl-DBI
perl-Digest-SHA
perl-Net-IP
perl-SOAP-Lite
perl-XML-Entities
perl-XML-Simple
php
php-curl
php-gd
php-json
php-mbstring
php-mysqlnd
php-soap
php-xml
tar
httpd
zlib

大約是這些
如果有漏的
在跑setup時再補一下
centos 8還不錯 所有需要的東西都可以直接用dnf install 來裝

裝好mariadb記得先改一下root的密碼

mysqladmin -u root password 'passwd'

setup跑完後
改以下二個檔的帳號跟密碼

/etc/httpd/conf.d/z-ocsinventory-server.conf

/usr/share/ocsinventory-reports/ocsreports/dbconfig.inc.php

改權限

chmod -R 766 /usr/share/ocsinventory-reports
chown -R apache:apache /usr/share/ocsinventory-reports/
chown -R apache:apache /var/lib/ocsinventory-reports/

登入
http://server-hostname-or-IP/ocsreports
預設是admin admin
記得改掉

php在這個版本有個獨立的daemon

php-fpm

如果在/var/log/httpd/裡沒有看到錯誤
記得到
/var/log/php-fpm
查看看

要重啟daemon要重啟三個

systemctl restart httpd mariadb.service php-fpm.service

2019/10/11

一樣是升級centos 8 postfix 後的問題
這次希望能有判別spam的功能
請出老牌的 spamassassin
網路上的很多文章都提到與mailscanner 或 amavisd-new 整合
但我希望能直接用postfix
做法如下

dnf install spamassassin

好在有放進list可以直接用

加group跟user

groupadd spamd

useradd -g spamd -s /bin/false -d /var/log/spamassassin spamd

改權限
chown spamd:spamd /var/log/spamassassin

再來修改 /etc/postfix/master.cf

找到 
smtp      inet  n       -       n       -       -       smtpd

改成
smtp      inet  n       -       n       -       -       smtpd -o content_filter=spamassassin

在最後加上
spamassassin unix - n n - - pipe flags=R user=spamd argv=/usr/bin/spamc -e /usr/sbin/sendmail -oi -f ${sender} ${recipient}

systemctl restart spamassassin
systemctl restart postfix
systemctl enable spamassassin

更新rule
sa-update -D --nogpg

會出現有缺東西的情況 能補就補
最後有二個dnf也沒法補
目前是不影響功能

Oct 11 07:36:44.595 [24809] dbg: diag: [...] module not installed: Net::Patricia ('require' failed)
Oct 11 07:36:44.595 [24809] dbg: diag: [...] module not installed: Net::DNS::Nameserver ('require' failed)

寫個crontab定時做
1 7,19 * * * /usr/bin/sa-update -D --nogpg;/usr/bin/systemctl restart spamassassin

如果想要能夠學習
建 whitelist , blacklist 二個user 分別把誤判及未判的信轉過去

然後再寫個crontab定時做

#!/bin/bash

/usr/bin/sa-learn --no-sync --ham /home/whitelist/Maildir/{cur,new}
rm -rf /home/whitelist/Maildir/*

/usr/bin/sa-learn --no-sync --spam /home/blacklist/Maildir/{cur,new}
rm -rf /home/blacklist/Maildir/*


2019/10/05

最近把mail server升到 centos 8
可是
預設卻找不到 postgrey
XD

只好手動來了
首先到 https://postgrey.schweikert.ch/ 下載
直接解開就可以用了 不用編譯
只是要補一些東西

dnf install -y perl-NetAddr-IP perl-Net-Server perl-BerkeleyDB

groupadd nogroup
adduser postgrey

mkdir /var/spool/postfix/postgrey
touch /var/spool/postfix/postgrey/socket
chown -R postgrey.nogroup /var/spool/postfix/postgrey

cd /etc/postfix

下載官方白名單
wget https://postgrey.schweikert.ch/pub/postgrey_whitelist_clients

再產生一個 /etc/postfix/postgrey_whitelist_recipients 視需要修改內容

啟動postgrey

./postgrey --unix=/var/spool/postfix/postgrey/socket --delay=60 -d

記得加入 /etc/rc.local開几執行

修改 /etc/postfix/main.cf

在原來的
smtpd_recipient_restrictions =
加上
   check_policy_service unix:/var/spool/postfix/postgrey/socket

重啟postfix
systemctl restart postfix

接下來看看/var/log/maillog 有沒有類似以下的訊息
如果有
就表示ok了

Oct  5 11:21:57 mail postfix/smtpd[10103]: NOQUEUE: reject: RCPT from nedm.ubot.com.tw[125.227.165.70]: 450 4.2.0 <abc@test.com>: Recipient address rejected: Greylisted, see http://postgrey.schweikert.ch/help/mail.nkuht.edu.tw.html; from=<UBOT@nedm.ubot.com.tw> to=<shangpao@mail.nkuht.edu.tw> proto=ESMTP helo=<nedm.ubot.com.tw>

postgrey有一個報表工具 postgreyreport
如果要使用要再補上

dnf install -y perl-Net-DNS

指令如下

Depending on how busy your server is, the report can get quite large. To get only the top 20 sources getting greylisted out - you can use something like this :

cat /var/log/maillog | postgreyreport | awk '{print $1}' | sort | uniq -c | sort -nr | head -n20

To get a list of the top 20 email address that the greylisted sources are sending email to :

cat /var/log/maillog | postgreyreport | awk '{print $4}'  | sort  | uniq -c | sort -nr | head -n20


https://wiki.centos.org/HowTos/postgrey#head-70ed10e62fb7da94deb39a987e1e4e205c2ae2c5