wget 抓網站檔案,要注意檔名是否正常
有時候用抓檔案, 檔名卻是亂七八糟, 有時候又正常
原來是網站的某個設定造成的, 最後遇到網站檔案名稱亂碼, 乾脆用這招,
wget --content-disposition <https://xxx.xxx.xxx.xxx>
有時候用抓檔案, 檔名卻是亂七八糟, 有時候又正常
原來是網站的某個設定造成的, 最後遇到網站檔案名稱亂碼, 乾脆用這招,
wget --content-disposition <https://xxx.xxx.xxx.xxx>
安裝完Rocky Linux 9, 接著要安裝EPEL(Extra Packages for Enterprise Linux)來源,以及CRB(Code Ready Builder)
dnf -y install epel-release
dnf -y config-manager --enable crb
這樣安裝powertools就方便多了, 以前我在CentOS 8要安裝 aspell 作法如下:
dnf --enablerepo=powertools install aspell
現在不用了, 直接輸入:
dnf install aspell
好久沒安裝mysql了, 我之前都是docker 無腦安裝, 並不需要了解太多, 但是因為我先前安裝的 piwigo docker版本升級不利, 想說手動安裝piwigo看看, 當然第一步就是安裝mariadb囉.
這次RL9預設的mariadb是10.5, 安裝相當簡單
dnf install mariadb-server
接下來就是改密碼,預設console直接可以使用root登入
mysql -p -uroot
跟之前不一樣,我還停留mysql舊時代改密碼方式 update user set password=password(‘you password’) where user=’root’
居然失敗了, 爬了文, 反正就是跟上主流,改用oracle類似的變更方式了
alter user root@localhost identified by 'your password';
flush privileges;
很多相關設定可參考原廠文件
前幾天有同仁反映無法寄信, 錯誤訊息: none of the authentication methods supported by this client are supported by your server.
經過測試, 郵件伺服器使用我自製的 container docker-postfix-ad 2.4 , 這容器基本os為centos 7.9, postfix版本為 2.10.x , 會讓outlook出現沒有適合的加密通訊協定的錯誤.
爬完文發現postfix的master.cf(submission , smtpd) 可加上 -o tls_ssl_options=NO_TICKET 解決問題, 但偏偏postfix 2.11才有此功能, 更悲催的centos 6有2.11.x版本, centos 7只有2.10.x.
現主時,我只好將自製的郵件伺服器, os改成RockyLinux 8.6, postfix 為3.x版本,
好險3.x 與 2.x 差異性不多, 基本上舊main.cf檔案只要加上以下兩行,就能用了.
#backwards-compatible default setting
append_dot_mydomain = yes
compatibility_level = 2
ps. postfix 3.x的 master.cf也不用特別加上 -o tls_ssl_options=NO_TICKET
相關的更新Windows 11 KB5018418 / Windows Server 2019 KB5018419
2022/10/19
—
若無法寄信,請再安裝這兩天的 win10 KB5020435 , win11 KB5020387 ,就可以解決了
這陣子研究清末明初古幣, 於是想起乾脆架設一個照片管理服務器(self hosting), 功能也不用太多, 有hash tag, 搜尋功能也不是很需要, 試用了一款最有名的 https://photoprism.app/ 發現功能太多, 還有AI自動辨識功能, 不符合我的需求.
最後終於找到簡單好用的 https://piwigo.org/ piwigo也有docker版本, 真是太棒了.
我架設了錢幣照片管理網站 – 布書 , 有不輸之意, 布古代為錢之意.
安裝piwigo非常簡單
docker volume create piwigo_config
docker volume create piwigo_gallery
docker run -d --restart always --name=piwigo --link my-mariadb:mysql -e PUID=1000 -e PGID=1000 -e TZ=Asia/Taipei -p 2342:80 -v piwigo_config:/config -v piwigo_gallery:/gallery --restart unless-stopped lscr.io/linuxserver/piwigo:12.3.0
更改預設頁面,例如改成tags, docker 進入container, 修改設定檔案
cd /gallery/local/config
vi /gallery/local/config/config.inc.php
############################
$conf['random_index_redirect'] = array(
PHPWG_ROOT_PATH.'tags.php' => 'return true;',
);
############################
2022/10/15
—
piwigo釋出13.0.0 , 我迫不急待進行升級,結果失敗, 原因應該是我使用非官方的docker版本.
最後只能硬著頭皮,
1. 把舊版(12.3.0) piwigo_images 資料表匯出到新版本(13.0.0)去,
2.並且把舊版本/gallery/_data/i 目錄, 以及/gallery/upload 目錄複製到新版本去, 這樣新版本就告訴你有未處裡的照片, 再自己手動重新建立相本吧, 這也是無可奈何的事情, 希望官方能有解決方案.
網管人員學python, 看到虛擬環境,第六感覺得這很重要
windows:
pip3 install virtualenv
linux:
sudo pip3 install virtualenv
or
sudo apt install python3-virtualenv
virtualenv -p <python程式位置> <虛擬環境名稱>
or
sudo -p <python程式位置> <虛擬環境名稱>
#範例
windows :
virtualenv -p C:\Users\x\AppData\Local\Programs\Python\Python310\python.exe my-env
linux:
sudo virtualenv -p /usr/bin/python3 my-env
Linux:
source ./xxx/bin/activate
william@william-Inspiron-3891:~$ source ./my-env/bin/activate
(my-env) william@william-Inspiron-3891:~$
最近升級moodle到4.0.1版本, 發現有問題, 想用回舊版, 發現舊版的變成 moodle:<none> , 這樣一來不就不能使用舊版了, 後來發現只要知道舊版images id , 就可以改成想要的tag, 也就能繼續使用了
docker tag <images id> <images name>:x.x
docker tag 43b9473f010d bitnami/moodle:3.10
前陣子發現restic備份的好處, 尤其拿來當離線備份.
IT同事進行離線備份時, 有意無意被老闆路過, 看到滿滿備份畫面咻咻跑來跑去, 充滿了儀式感.
老闆開心, IT同仁也有成就感.
restic指令備份, 不夠自動化, 為了讓IT同事做少少的工作, 又讓IT同事與其他路過的同事覺得好專業, 因此寫了簡單的restic backup script , 可以協助掛載來源目錄, 掛載後,進行restic備份.
檔案請到這裡下載, 下載後請看readme.md檔案
先前寫了一篇centos7安裝opendkim+postfix 這只是單一網域, 若要多個網域,實在是很麻煩
google爬文爬到一篇文章,有神人寫了自動產生相關文件的shell script , 我稍微修改一下, 就能很方便產生相關文件.
#centos 7
yum install opendkim
#centos 8 , rocky linux 8
yum install opendkim opendkim-tools
一直以來我都讓postfix使用 sasl 方式處裡寄信認證, 但是連結到多網域主控伺服器的時候, 就會出錯, 很麻煩.
經過測試 dovecot 可以使用多組 userdb , 與passdb , 達到一個mail server 支援多個ldap網域主控.
當然也能省下一個sasl的service
service auth {
...
unix_listener /var/spool/postfix/private/auth {
mode = 0660
# Assuming the default Postfix user and group
user = postfix
group = postfix
}
...
}
#以下設定為了相容outlook系統
auth_mechanisms = plain login
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
# On Debian Wheezy path must be relative and queue_directory defined
#queue_directory = /var/spool/postfix
# and the common settings to enable SASL:
smtpd_sasl_auth_enable = yes
submission inet n - n - - smtpd
-o smtpd_tls_security_level=encrypt
-o smtpd_sasl_auth_enable=yes
-o smtpd_sasl_type=dovecot
-o smtpd_sasl_path=private/auth
-o smtpd_sasl_security_options=noanonymous
-o smtpd_sasl_local_domain=$myhostname
-o smtpd_client_restrictions=permit_sasl_authenticated,reject
-o smtpd_sender_login_maps=hash:/etc/postfix/virtual
-o smtpd_sender_restrictions=reject_sender_login_mismatch
...
參考:
https://doc.dovecot.org/configuration_manual/howto/postfix_and_dovecot_sasl/