分類
Linux

Fedora 35 安裝 VirtualBox

沒想到給 Fedora 35 安裝 VirtualBox 會遇到這麼一個坑,所以記錄下。如果你的電腦沒有啓用 EFI Secure Boot 應該不會遇到這個問題。報錯信息如下:

vboxdrv.sh: failed: modprobe vboxdrv failed. Please use 'dmesg' to find out why.

There were problems setting up VirtualBox.  To re-start the set-up process, run
  /sbin/vboxconfig
as root.  If your system is using EFI Secure Boot you may need to sign the
kernel modules (vboxdrv, vboxnetflt, vboxnetadp, vboxpci) before you can load
them. Please see your Linux system's documentation for more information.

如果你不想關閉安全啓動,那麼可以按如下步驟來解決:

1, 安裝 mokutil

sudo dnf update
sudo dnf install mokutil

2, 在新文件夾裏創建 RSA 密鑰

sudo -i
mkdir /root/signed-modules
cd /root/signed-modules
openssl req -new -x509 -newkey rsa:2048 -keyout MOK.priv -outform DER -out MOK.der -nodes -days 36500 -subj "/CN=VirtualBox/"
chmod 600 MOK.priv

3, 準備導入密鑰的密碼,等下重啓電腦後會詢問你設置的密碼。

sudo mokutil --import MOK.der

4, 重啓電腦,電腦會進入一個藍屏,選擇 Enroll MOK --> Continue --> 輸入你剛剛設置的密碼,然後你的電腦會重啓。

5, 進入剛剛的文件夾新建一個腳本。

cd /root/signed-modules
nano sign-virtual-box

腳本內容如下:

#!/bin/bash

for modfile in $(dirname $(modinfo -n vboxdrv))/*.ko; do
  echo "Signing $modfile"
  /usr/src/kernels/$(uname -r)/scripts/sign-file sha256 \
                                /root/signed-modules/MOK.priv \
                                /root/signed-modules/MOK.der "$modfile"
done

如果腳本執行失敗了,可以嘗試運行下面命令,然後根據結果修改上面腳本。

find /usr/src -name signfile

5, 爲腳本增加執行權限並運行。

chmod 700 sign-virtual-box
./sign-virtual-box 

6, 把簽名後的驅動加入內核中就可以了。

modprobe vboxdrv

Ubuntu 用戶可以參考這篇 https://stegard.net/2016/10/virtualbox-secure-boot-ubuntu-fail/。以上解決辦法由 Younes LAB 作答與 Sign virtual box modules (vboxdrv, vboxnetflt, vboxnetadp, vboxpci) Centos 8 - Stack Overflow


從 VirtualBox RPM 源安裝 VirtualBox

由於之前沒有搜到上面的辦法,還以爲是安裝的問題,嘗試了從 VirtualBox RPM 源安裝 VirtualBox,其實是不能解決問題的,但是這裏也記錄一下。

1, 安裝依賴。

sudo dnf -y install @development-tools
sudo dnf -y install kernel-headers kernel-devel dkms elfutils-libelf-devel qt5-qtx11extras

2, 添加VirtualBox RPM 源。

Fedora 36 / Fedora 35:

cat <<EOF | sudo tee /etc/yum.repos.d/virtualbox.repo 
[virtualbox]
name=Fedora $releasever - $basearch - VirtualBox
baseurl=http://download.virtualbox.org/virtualbox/rpm/fedora/35/\$basearch
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://www.virtualbox.org/download/oracle_vbox.asc
EOF

Fedora 34:

cat <<EOF | sudo tee /etc/yum.repos.d/virtualbox.repo 
[virtualbox]
name=Fedora $releasever - $basearch - VirtualBox
baseurl=http://download.virtualbox.org/virtualbox/rpm/fedora/34/\$basearch
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://www.virtualbox.org/download/oracle_vbox.asc
EOF

Fedora 33:

cat <<EOF | sudo tee /etc/yum.repos.d/virtualbox.repo 
[virtualbox]
name=Fedora $releasever - $basearch - VirtualBox
baseurl=http://download.virtualbox.org/virtualbox/rpm/fedora/33/\$basearch
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://www.virtualbox.org/download/oracle_vbox.asc
EOF

3, 導入 VirtualBox GPG 密鑰,確認指紋匹配後按 y。

sudo dnf search virtualbox
Fedora  -  - VirtualBox                                 58  B/s | 181  B     00:03
Fedora  -  - VirtualBox                                906  B/s | 1.7 kB     00:01
Importing GPG key 0x98AB5139:
 Userid     : "Oracle Corporation (VirtualBox archive signing key) <[email protected]>"
 Fingerprint: 7B0F AB3A 13B9 0743 5925 D9C9 5442 2A4B 98AB 5139
 From       : https://www.virtualbox.org/download/oracle_vbox.asc
Is this ok [y/N]: y

4, 安裝 VirtualBox。

sudo dnf install VirtualBox-6.1

5, 把當前用戶添加到 vboxusers 用戶組。

sudo usermod -a -G vboxusers $USER
newgrp vboxusers

然後就可以通過命令 virtualbox 或應用菜單 》System 》Oracle VM VirtualBox來啓動了。但是這個時候還沒有裝 Extension Pack,表現爲虛擬機只支持 USB 1.1,屏幕無法縮放。好在擴展包直接從官網下載就可以,然後直接雙擊就能順利運行安裝。

此安裝教程來自 How To Install VirtualBox 6 on Fedora 36/35/34/33/32 - ComputingForGeeks

分類
Linux

Install Fedora 35 on Dell Inspiron 1525

The Inspiron 1525 is Emanon's first (and only) laptop, which brought almost 13 years ago. When it got laggy and hard to run Adobe software, we brought an Acer desktop. Several years later, we got some video tasks to do, so we gave the Acer desktop to Emanon's sister, who didn't have a desktop. From that on, we started using a Dell desktop in daily life. But we only got one PC, we had to take turns recently. I found the old desktop after a room tidy up and thought maybe it can still run for easy tasks in daily life.

My Inspiron 1525 has a 2 GB Memory, a 2-core CPU, a 120 GB hard disk and a 15.4" screen(which is much bigger than my phone). Fortunately, it meets the minimum hardware of Fedora 35. I use Xfce desktop environment for many years, it's fast and has almost everything I need. So I download Fedora 35 Xfce Desktop and burn it into my old 2 GB flash disk with the official tool Fedora Media Writer.

sudo dnf install mediawriter
mediawriter

Then insert the flash disk into 1525, press power button. When you see the progress bar go to the end, keep hitting F12 then select USB Storage Device. You'll boot into Fedora 35 Xfce in a moment. If you haven't back up your files, you could do it now. If you don't have a wired Internet connection, you should download and copy the two files below for fixing the Wi-Fi later. Run the Install to Hard Drive in the desktop to install Fedora OS. For more details, please refer to Installing Using Anaconda. After that, reboot your laptop and remove the flash disk.

You'll see the Wi-Fi is failed, even after you updated all the software. The good news is there are ways to fix. Download broadcom-wl-6.30.163.46 (backup link), extract it. Run the following commands to get the working driver and copy them to your system.

#sudo yum install b43-fwcutter
sudo b43-fwcutter -w /lib/firmware broadcom-wl-6.30.163.46/broadcom-wl-6.30.163.46.wl_apsta.o
sudo sync
sudo /sbin/modprobe -r b43
sudo /sbin/modprobe b43

Now you can browse the web or do some text work on it. If you want some multimedia pleasure, you might need VLC. And before you install VLC, you need to enable RPM Fusion first.

sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm

本文更新於 2022/03/21。

分類
Linux

Fedora 31 L2TP PSK 連接失敗

有個預共享密鑰的 L2TP VPN,在安卓和 Windows上,不做額外設置的情況下都能連接上。但是 Fedora 31 上卻不行,試着修改下加密選項,也不成功。後來搜索到說是因為自帶的 libreswan 不在支持弱加密導致的。

解決方法

刪除已有的 VPN 配置
dnf remove libreswan
dnf remove strongswan
dnf install strongswan
新建 VPN 配置

錯誤現象

Started the VPN service, PID 17688
Saw the service appear; activating connection
VPN connection: (ConnectInteractive) reply received
VPN plugin: state changed: stopped (6)
VPN service disappeared
VPN connection: failed to connect: 'Remote peer disconnected'

原因

IKE DH algorithm ‘modp1024’ is not supported in libreswan with 5.5.7-200 kernel in FC31.

其他有用信息

#將網絡日誌調至調試級別(更多)
nmcli general logging level DEBUG
#將網絡日誌調至信息級別(默認)
nmcli general logging level INFO
#查看網絡連接日誌
journalctl -u NetworkManager
#服務的啟動與停止
systemctl stop strongswan.service
systemctl stop xl2tpd.service
#查看本機的網絡連接
nmcli con show
#啟動指定 UUID 的網絡連接
nmcli con up uuid 40c58e49-5b99-4432-85ae-a6dc9c1c37a3
#把指定 UUID 網絡連接的日誌保存到 t.txt
journalctl -xe NM_CONNECTION=40c58e49-5b99-4432-85ae-a6dc9c1c37a3 + NM_DEVICE=enp0s3 > t.txt

成功連接的版本信息

strongswan-5.8.2-3.fc31.x86_64
Linux 5.8.17-100.fc31.x86_64 #1 SMP Thu Oct 29 18:58:48 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

參考資料:Cannot Connect to VPN 感謝 nrv 和 insomniacjunkie 的回復。

分類
软件

Linux 使用 Python 操作剪切板

還是那個簡繁轉換的需求, zhconv 似乎不能直接給它傳一段文字來轉換,只能轉換文件或者在 Python 中調用。

Fedora

先安裝 xclip 依賴,再安裝 pyperclip:

sudo dnf install xclip
sudo pip3 install pyperclip

然後新建一個 Python 腳本 /home/[YOURNAME]/scripts/s2t.py:

import pyperclip
from zhconv import convert

clipString = pyperclip.paste()
clipStringTC = convert(clipString, 'zh-hant')
pyperclip.copy(clipStringTC)

最後為了方便使用,給腳本設置一個別名

alias t='python3 /home/[YOURNAME]/scripts/s2t.py'

但是如果想讓別名保存下來,以後每次都能用,Fedora 需要把別名加到家目錄的 .bashrc 文件裏:

nano ~/.bashrc
alias t='python3 /home/[YOURNAME]/scripts/s2t.py'

Termux

Termux 無法使用 pyperclip 來操作剪切板,但是可以通過 Termux API 來操作。對應的 Python 這樣:

import subprocess
from zhconv import convert

clipString = subprocess.getoutput("termux-clipboard-get")
clipStringTC = convert(clipString, 'zh-hant')
subprocess.getoutput("termux-clipboard-set \'"+clipStringTC+"\'")

本文更新於 2022/07/29。

分類
方法

在 Centos 7 上安裝 LNMP

上周更新 php7.3 的時候順手執行了下 yum update 導致無法進入系統,在客服的幫助下複製出了數據,然後自己重裝了系統,記錄下。本文主要參考了G. T. Wang的CentOS 7 安裝 Nginx、MySQL/MariaDB、PHP7,架設 LEMP 網頁伺服器筆記,非常感謝!

安全設置

阻止內核升級

#在 /etc/yum.conf 中加入
exclude=kernel*

上次進不了系統比較懷疑是升級內核後grub沒更新導致的,但是也不確定,為了系統穩定性最好還是禁用內核升級。不過禁止了內核升級也就不能安裝 kernel 相關庫,需要的時候臨時打開就行。

新建 sudo 用戶

# 新增使用者
adduser USERNAME
# 設定密碼
passwd USERNAME
# 將 USERNAME 加入 wheel 群組
usermod -aG wheel USERNAME

設定時區

# 使用 timedatectl 列出可選擇的時區:
timedatectl list-timezones
# 設定時區為亞洲的台北:
sudo timedatectl set-timezone Asia/Shanghai
# 其他常用時區
sudo timedatectl set-timezone Asia/Hong_Kong
sudo timedatectl set-timezone Asia/Taipei
# 查看本機時間
date

防火牆

參考:CentOS Linux 7 以 firewalld 指令設定防火牆規則教學。我這裡只記錄下我的操作。

# 檢查 firewalld 服務狀態
systemctl status firewalld

#啟動 firewalld 服務,默認是有開啟22端口的,
#如果你的 SSH 端口已經更改,啟用防火牆可能會導致 SSH 連不上
systemctl start firewalld

# 停止 firewalld 服務
systemctl stop firewalld

# 重新啟動 firewalld 服務
service firewalld restart

# 設定開機自動啟動 firewalld 服務
systemctl enable firewalld

# 列出預設區域
firewall-cmd --get-default-zone
#一般是public

# 將 http 服務新增至 public 區域中
sudo firewall-cmd --zone=public --add-service=http

# 永久將 http 服務新增至 public 區域中
sudo firewall-cmd --zone=public --permanent --add-service=http

# 開啟 tcp 的 8080 連接埠
sudo firewall-cmd --zone=public --add-port=8080/tcp

# 永久開啟 tcp 的 8080 連接埠
sudo firewall-cmd --zone=public --permanent --add-port=8080/tcp

# 若欲將 ssh 端口改為 20222
firewall-cmd --permanent --direct --add-rule ipv4 filter INPUT_direct 0 -p tcp --dport 20222 -m state --state NEW -m recent --set
# 增加30秒4次的登錄頻率限制
firewall-cmd --permanent --direct --add-rule ipv4 filter INPUT_direct 1 -p tcp --dport 20222 -m state --state NEW -m recent --update --seconds 30 --hitcount 4 -j REJECT --reject-with tcp-reset

# 列出 public 區域永久的服務設定值
sudo firewall-cmd --zone=public --permanent --list-services

# 將 http 服務從 public 區域中移除
sudo firewall-cmd --zone=public --remove-service=http

# 永久將 http 服務從 public 區域中移除
sudo firewall-cmd --zone=public --permanent --remove-service=http

SSH加固

#如果本機沒有~/.ssh/id_rsa.pub
#則應該先生成密鑰對
mkdir -p ~/.ssh
chmod 700 ~/.ssh
ssh-keygen
#問題默認即可
#複製本機 id_rsa.pub 到服務器
ssh-copy-id -i ~/.ssh/id_rsa.pub USER@HOST
#然後嘗試直接密鑰登錄
ssh USER@HOST
#修改 sshd 配置文件 /etc/ssh/sshd_config
#關閉密碼登錄
PasswordAuthentication no
#如果已新建用戶,可以禁止 root 遠程登錄
PermitRootLogin no
#修改端口,注意防火牆應開啟對應端口
Port 42222
#重啟 sshd 服務
sudo systemctl restart sshd

安裝LNMP服務

更新系統套件

#更新下系統套件
sudo yum upgrade
#啟用 EPEL
sudo yum install epel-release
sudo yum update

安裝 Nginx

sudo yum install nginx
#啟動 Nginx 服務
sudo systemctl start nginx
#開機自動啟動 Nginx 服務
sudo systemctl enable nginx

安裝 MariaDB

yum install mariadb-server mariadb
#啟動 MariaDB 服務,並設定開機自動啟動
sudo systemctl start mariadb
sudo systemctl enable mariadb
#強化 MySQL/MariaDB 資料庫設定的安全性
sudo mysql_secure_installation
#修改 /etc/my.cnf 綁定本機 IP
[mysqld]
bind-address = 127.0.0.1

新建數據庫用戶和導入備份的數據可以參考mysql tricks

安裝 PHP 7.3

#開啟 Remi repository
sudo yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
#安裝 yum-utils
sudo yum install yum-utils
#開啟 php 7.3的軟件源
sudo yum-config-manager --enable remi-php73
#或者開啟其他版本 php 的軟件源
sudo yum-config-manager --enable remi-php72
sudo yum-config-manager --enable remi-php71

#安裝常用的 php 庫
sudo yum install php php-mcrypt php-cli php-fpm php-gd php-curl php-mysql php-ldap php-zip php-fileinfo php-xml php-mbstring

#修改 /etc/php-fpm.d/www.conf
listen = 127.0.0.1:9000
user = nginx
group = nginx
#修改 /etc/php.ini
cgi.fix_pathinfo=0
upload_max_filesize = 32M
post_max_size = 32M
max_file_uploads = 50

#啟動 php-fpm 服務,並設定開機自動啟動
sudo systemctl start php-fpm
sudo systemctl enable php-fpm

我的服務器只有1核 CPU 和 512 MB內存,默認的php配置會耗光服務器資源,可以通過修改下面這些值來使服務器穩定。如果有更好的配置方案歡迎留言。

#修改 /etc/php-fpm.d/www.conf
listen.allowed_clients = 127.0.0.1
pm = dynamic
# Total number of processes allowed
pm.max_children = 5
# The number of child processes created on startup 
pm.start_servers = 2
# The minimum number of idle processes
pm.min_spare_servers = 1
# The maximum number of idle processes
pm.max_spare_servers = 2
# The number of seconds an idle process will be alive
pm.process_idle_timeout = 10
# The execution time of each child process and is used to curb memory leaks
pm.max_requests = 200

配置 nginx

#修改 /etc/nginx/nginx.conf
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

include /usr/share/nginx/modules/*.conf;

events {
    worker_connections 1024;
}

http {
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         on;
    keepalive_timeout   65;
    types_hash_max_size 2048;
    client_max_body_size 40M;
    gzip on;

    include             /etc/nginx/mime.types;
    default_type        application/octet-stream;

    include /etc/nginx/conf.d/*.conf;
}
#新增 /etc/nginx/nginx.d/ft.wupo.info.conf
    server {
        listen      443 ssl;
        listen      [::]:443;
        server_name ft.wupo.info ;
        root        /usr/share/nginx/html/ft.wupo.info;
        index       index.php index.html index.htm;

        ssl         on;
        ssl_certificate      /etc/letsencrypt/live/ft.wupo.info/fullchain.pem;
        ssl_certificate_key  /etc/letsencrypt/live/ft.wupo.info/privkey.pem;


        location ~ \.php$ {
    	    fastcgi_pass   127.0.0.1:9000;
    	    fastcgi_index  index.php;
    	    fastcgi_param  SCRIPT_FILENAME   $document_root$fastcgi_script_name;
    	    include        fastcgi_params;
	}
        location / {
                try_files $uri $uri/ /index.php?$args;
        }
    }

	server {
		listen 80;
		server_name ft.wupo.info;
		return 301 https://$server_name$request_uri;
	}
#https://certbot.eff.org/lets-encrypt/centosrhel7-nginx
#啟用 certbot 的源
yum-config-manager --enable rhui-REGION-rhel-server-extras rhui-REGION-rhel-server-optional
#安裝 certbot 
sudo yum install certbot python2-certbot-nginx
#生成證書
certbot -d ft.wupo.info --nginx certonly

如果是首次獲取生成證書,nginx 應該會報錯,因為證書找不到。可以先只打開 80 端口,待證書獲取成功後再打開 443。

本文更新於 2022/07/09。

分類
方法 软件

ffmpeg下載流媒體

Fefora 安裝 ffmpeg

#如果沒有安裝過rpmfusion,需要先安裝之
sudo dnf -y install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
#然後就可以安裝 ffmpeg 了
sudo dnf -y install ffmpeg

保存m3u8類型的流媒體

#首先把m3u8列表保存為ts視頻
ffmpeg -y \
  -v warning \
  -loglevel debug \
  -i "https://domain.com/path/to/manifest.m3u8" \
  -vcodec copy \
  -c copy -f mpegts out.ts
#然後把ts轉換為mp4
ffmpeg -i out.ts -acodec copy -vcodec copy out.mp4
#或者
ffmpeg -i "https://domain.com/path/to/manifest.m3u8" -codec copy file.mp4
#如果mp4容器遇到問題可以嘗試mkv

保存udp、rtmp、rtsp、http類型的流媒體

ffmpeg -i "rtmp://domain.com/path/to/video.mp4" -vcodec copy -acodec copy out.mp4

合併視頻和音頻文件

ffmpeg -i video.mp4 -i audio.m4a -c copy output.mkv

選擇m3u8的清晰度

#m3u8文件可以用文本編輯器打開,內容如:

#EXTM3U
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=276000,RESOLUTION=256x144,CODECS="avc1.66.30, mp4a.40.2",CLOSED-CAPTIONS=NONE
https://vod1-vh.akamaihd.net/i/mp4_hk/tv/2020/GLOBCT2020L03100007.smil/index_250000_av.m3u8?null=0
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=465000,RESOLUTION=432x240,CODECS="avc1.66.30, mp4a.40.2",CLOSED-CAPTIONS=NONE
https://vod1-vh.akamaihd.net/i/mp4_hk/tv/2020/GLOBCT2020L03100007.smil/index_400000_av.m3u8?null=0
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=797000,RESOLUTION=640x360,CODECS="avc1.66.30, mp4a.40.2",CLOSED-CAPTIONS=NONE
https://vod1-vh.akamaihd.net/i/mp4_hk/tv/2020/GLOBCT2020L03100007.smil/index_700000_av.m3u8?null=0
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1232000,RESOLUTION=848x480,CODECS="avc1.66.30, mp4a.40.2",CLOSED-CAPTIONS=NONE
https://vod1-vh.akamaihd.net/i/mp4_hk/tv/2020/GLOBCT2020L03100007.smil/index_1000000_av.m3u8?null=0
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=2478000,RESOLUTION=1280x720,CODECS="avc1.66.30, mp4a.40.2",CLOSED-CAPTIONS=NONE
https://vod1-vh.akamaihd.net/i/mp4_hk/tv/2020/GLOBCT2020L03100007.smil/index_2000000_av.m3u8?null=0

#表示這個文件提供了 5 個清晰度的視頻,通常不制定的話回選擇最好的清晰度
#如果我們要指定 480P 的清晰度,也就是第4個
#(從第 0 個開始數)
#那麼完整的命令就是

ffmpeg -i "https://vod1-vh.akamaihd.net/i/mp4_hk/tv/2020/GLOBCT2020L03100007.smil/master.m3u8" -map p:3 -codec copy 31.mp4

使用 curl-impersonate 繞過瀏覽器驗證

低端影視這樣的網站會檢查客戶端是否是瀏覽器,此時只要使用 curl-impersonate 就可以下載了。

使用時在瀏覽器開發者工具裏找到資源的鏈接,右鍵 > Copy Value > Copy as cURL。然後在命令行裏把 curl 替換成 curl_ff109,並加上 -o MOVIE.mp4 就可以下載了。如:

./curl_ff109 'https://v.ddys.pro/v/movie/Return.to.Dust.mp4' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/115.0' -H 'Accept: video/webm,video/ogg,video/*;q=0.9,application/ogg;q=0.7,audio/*;q=0.6,*/*;q=0.5' -H 'Accept-Language: en-US,en;q=0.5' -H 'Referer: https://ddys.pro/' -H 'Range: bytes=0-' -H 'Origin: https://ddys.pro' -H 'DNT: 1' -H 'Connection: keep-alive' -H 'Sec-Fetch-Dest: video' -H 'Sec-Fetch-Mode: cors' -H 'Sec-Fetch-Site: same-site' -H 'Accept-Encoding: identity' -o 隱入煙塵.mp4

如果中斷了可以加上 -C 斷點續傳。

本文更新於 2024/02/05。

分類
软件

Tiny Tiny RSS

Firefox 今天更新到了 68.2.0,一個比較大的改動是移除了自帶的 RSS 閱讀器。剛好前不久拿到一台免費的 Oracle Cloud,於是搭建 Tiny Tiny RSS 來做閱讀聚合。

MariaDB、php7.2、nginx 和 letsEncrypt 證書生成器的安裝網上資料很多,這裡就不貼了。

然后根据 Tiny Tiny RSS Installation Guide 一步一步来做。我是直接在nginx默認的html文件夾下 git clone 出項目,然後訪問 http://yoursite/tt-rss/install/ 來安裝,下面是遇到的問題。

未安裝 php-intl

sudo yum install php7.2-intl

文件權限不足

#首先修改文件夾權限
cd /usr/share/nginx/html/tt-rss
sudo chown -R nginx:nginx cache lock feed-icons
sudo chmod -R g+w cache lock feed-icons
#如果你的 CentOS 7 系統和我的一樣開啟了 SELinux,還需要
sudo chcon -R unconfined_u:object_r:httpd_sys_rw_content_t:s0 cache feed-icons lock

更新機制

#首先嘗試了 systemctl,沒有成功
#於是用原始的crontab
*/30 * * * * /usr/bin/php72 /usr/share/nginx/html/tt-rss/update.php --feeds --quiet

使用小撇步

  • 在偏好設定》摘要》類別里,可以新建類別。
  • 在 RSS 訂閱上右鍵,編輯摘要里可以單獨設置更新頻率。據說選項里勾上媒體快取可以緩存媒體到服務器(未驗證)。
  • 打開「全部文章」,點擊閱讀頁左上角的RSS標誌,就可以用 RSS 的方式分享自己所有的閱讀聚合。
  • 安卓版客戶端可以從 F-droid 下載,我沒有使用客戶端我使用的是 Readrops。

If it helps, please kindly consider to contribute or donate.






191218更新:Oracle Cloud 的服務器被無預警註銷,沒有通知沒有郵件什麼都沒有。但是啟動盤還在,所以可以再創建一個實例。雖然如此,仍然給人極不靠譜的感覺。新實例會產生新 IP,修改 DNS 後原來的服務就又可以用了。

藉此機會順便升級了下 Tiny Tiny RSS,由於我是通過 Git安裝的,所以需要在安裝文件夾執行下面命令就可以了。

git pull origin master
#如果你不小心改動過項目文件,可以用下面命令忽略之
git reset --hard HEAD 

更新後進入網頁可能會提示需要更新數據庫,點擊更新按鈕後就完成了升級。

本文更新於 2020/10/16。