ubuntu安裝Calibre
想在ubuntu上看電子書,翻了下推介,選擇裝Calibre。
訪問官網(wǎng)
推薦二進(jìn)制安裝。
于是ctrl+alt+t
sudo -v && wget -nv -O- https://download.calibre-ebook.com/linux-installer.sh | sudo sh /dev/stdin
把命令貼進(jìn)去,回車。
報(bào)錯(cuò)
Using python executable: /usr/bin/python3
2024-12-05 08:48:32 URL:https://download.calibre-ebook.com/linux-installer.sh [35050/35050] -> "-" [1]
You are missing the system library libxcb-cursor.so.0. Try installing packages such as libxcb-cursor0 or xcb-cursor
看樣子是缺系統(tǒng)庫(kù)。
丟給AI,獲得提示:
sudo apt-get update
sudo apt-get install libxcb-cursor0
再貼到終端,執(zhí)行。
bash
$ sudo apt-get install libxcb-cursor0
正在讀取軟件包列表... 完成
正在分析軟件包的依賴關(guān)系樹... 完成
正在讀取狀態(tài)信息... 完成
下列【新】軟件包將被安裝:
libxcb-cursor0
升級(jí)了 0 個(gè)軟件包,新安裝了 1 個(gè)軟件包,要卸載 0 個(gè)軟件包,有 52 個(gè)軟件包未被升級(jí)。
需要下載 10.7 kB 的歸檔。
解壓縮后會(huì)消耗 39.9 kB 的額外空間。
獲取:1 http://mirrors.tuna.tsinghua.edu.cn/ubuntu noble/universe amd64 libxcb-cursor0 amd64 0.1.4-1build1 [10.7 kB]
已下載 10.7 kB,耗時(shí) 0秒 (22.2 kB/s)
正在選中未選擇的軟件包 libxcb-cursor0:amd64。
(正在讀取數(shù)據(jù)庫(kù) ... 系統(tǒng)當(dāng)前共安裝有 260931 個(gè)文件和目錄。)
準(zhǔn)備解壓 .../libxcb-cursor0_0.1.4-1build1_amd64.deb ...
正在解壓 libxcb-cursor0:amd64 (0.1.4-1build1) ...
正在設(shè)置 libxcb-cursor0:amd64 (0.1.4-1build1) ...
正在處理用于 libc-bin (2.39-0ubuntu8.3) 的觸發(fā)器 ...
Scanning processes...
Scanning processor microcode...
Scanning linux images...
Running kernel seems to be up-to-date.
The processor microcode seems to be up-to-date.
再次安裝
$ sudo -v && wget -nv -O- https://download.calibre-ebook.com/linux-installer.sh | sudo sh /dev/stdin
Using python executable: /usr/bin/python3
2024-12-05 08:50:05 URL:https://download.calibre-ebook.com/linux-installer.sh [35050/35050] -> "-" [1]
Installing to /opt/calibre
Downloading tarball signature securely...
Will download and install calibre-7.22.0-x86_64.txz
Downloading calibre-7.22.0-x86_64.txz
41% [============================------------------------------------------]
等待進(jìn)度條。
等待期間,研究下二進(jìn)制安裝命令。
繼續(xù)丟給AI。
sudo -v && wget -nv -O- https://download.calibre-ebook.com/linux-installer.sh | sudo sh /dev/stdin
解釋一下這段指令
sudo -v:
這個(gè)命令會(huì)提示用戶輸入當(dāng)前用戶的 sudo 密碼,以驗(yàn)證用戶是否有權(quán)限執(zhí)行需要超級(jí)用戶權(quán)限的操作。-v 選項(xiàng)會(huì)更新用戶的 timestamp(即延長(zhǎng)了用戶使用 sudo 的無(wú)密碼期),而不實(shí)際運(yùn)行任何命令。
&&:
這是一個(gè)邏輯運(yùn)算符,表示“與”。它將兩個(gè)命令連接起來(lái),并確保只有當(dāng)左邊的命令成功執(zhí)行后(返回狀態(tài)為0),右邊的命令才會(huì)被執(zhí)行。
wget -nv -O- https://download.calibre-ebook.com/linux-installer.sh:
wget 是一個(gè)從網(wǎng)絡(luò)下載文件的工具。
-nv 表示“不顯示進(jìn)度條”,也就是靜默模式,只打印重要的信息。
-O- 指定輸出文件名為 -,這通常意味著標(biāo)準(zhǔn)輸出(stdout)。所以這里的意思是將下載的內(nèi)容直接輸出到終端而不是保存到文件中。
https://download.calibre-ebook.com/linux-installer.sh 是要下載的 Calibre 安裝腳本的 URL。
| (管道):
管道符號(hào)將前一個(gè)命令的標(biāo)準(zhǔn)輸出作為下一個(gè)命令的標(biāo)準(zhǔn)輸入。在這個(gè)例子中,它將 wget 下載的內(nèi)容(即安裝腳本)傳遞給下一條命令。
sudo sh /dev/stdin:
sudo 再次被用來(lái)提升權(quán)限,以便可以執(zhí)行可能需要管理員權(quán)限的操作。
sh 是啟動(dòng) shell 解釋器的命令,它用于運(yùn)行 shell 腳本。
/dev/stdin 是一個(gè)特殊的文件,代表標(biāo)準(zhǔn)輸入。在這里,它告訴 sh 讀取來(lái)自管道的數(shù)據(jù)并將其當(dāng)作腳本來(lái)執(zhí)行。
綜上所述,這條指令的作用是以超級(jí)用戶權(quán)限驗(yàn)證后,通過 wget 靜默地下載 Calibre 的安裝腳本,并立即將該腳本的內(nèi)容通過管道傳遞給 sh 來(lái)執(zhí)行,從而完成 Calibre 的安裝過程。這種方式常用于自動(dòng)化安裝或部署過程中。
wget的參數(shù)-nv不是不顯示進(jìn)度條么?那怎么會(huì)有進(jìn)度條呢?
再細(xì)看一下,是下載linux-installer.sh這個(gè)安裝腳本的時(shí)候不顯示進(jìn)度條。而上面看到的進(jìn)度條,應(yīng)該是這個(gè).sh腳本里面的下載時(shí)候的進(jìn)度顯示。
再單獨(dú)下載linux-installer.sh打開看了下,感覺超過能力范圍了......
回頭看安裝進(jìn)度。
Downloading calibre-7.22.0-x86_64.txz
100% [======================================================================]
Downloaded 183175740 bytes
Checking downloaded file integrity...
Extracting files to /opt/calibre ...
Extracting application files...
Creating symlinks...
Symlinking /opt/calibre/ebook-device to /usr/bin/ebook-device
Symlinking /opt/calibre/ebook-meta to /usr/bin/ebook-meta
Symlinking /opt/calibre/ebook-convert to /usr/bin/ebook-convert
Symlinking /opt/calibre/ebook-polish to /usr/bin/ebook-polish
Symlinking /opt/calibre/markdown-calibre to /usr/bin/markdown-calibre
Symlinking /opt/calibre/web2disk to /usr/bin/web2disk
Symlinking /opt/calibre/calibre-server to /usr/bin/calibre-server
Symlinking /opt/calibre/lrf2lrs to /usr/bin/lrf2lrs
Symlinking /opt/calibre/lrs2lrf to /usr/bin/lrs2lrf
Symlinking /opt/calibre/calibre-debug to /usr/bin/calibre-debug
Symlinking /opt/calibre/calibredb to /usr/bin/calibredb
Symlinking /opt/calibre/calibre-parallel to /usr/bin/calibre-parallel
Symlinking /opt/calibre/calibre-customize to /usr/bin/calibre-customize
Symlinking /opt/calibre/fetch-ebook-metadata to /usr/bin/fetch-ebook-metadata
Symlinking /opt/calibre/calibre-smtp to /usr/bin/calibre-smtp
Symlinking /opt/calibre/calibre to /usr/bin/calibre
Symlinking /opt/calibre/lrfviewer to /usr/bin/lrfviewer
Symlinking /opt/calibre/ebook-viewer to /usr/bin/ebook-viewer
Symlinking /opt/calibre/ebook-edit to /usr/bin/ebook-edit
Setting up command-line completion...
Installing zsh completion to: /usr/share/zsh/vendor-completions/_calibre
Installing bash completion to: /usr/share/bash-completion/completions/
Setting up desktop integration...
Creating un-installer: /usr/bin/calibre-uninstall
Run "calibre" to start calibre
發(fā)現(xiàn)已經(jīng)安裝完成。
今次CV工作完成。

浙公網(wǎng)安備 33010602011771號(hào)