Ubuntu 14.04 將在 2019 四月後中止維護,還有機器還沒更新的記得更新。
ps. 在 terminal 中執行「do-release-upgrade」即可。
軟體開發、伺服器和生活瑣事
以往在 ufw 加入防火牆規則時,都是一條一條新增上去:
ufw allow 80
ufw allow 443
ufw allow 8080
.....
這種方式雖然簡單,但是之後要維護會有點困難:到底哪個 port 是為了哪一個應用程式開的?
ufw 其實還有其他特別功能,叫做 app list:
zero@zero-x230:~$ sudo ufw app list
Available applications:
Apache
Apache Full
Apache Secure
CUPS
Samba
會自動增測,並有預設的設定檔來幫你新增 rule set。來看一下「Apache Full」設定檔到底寫了什麼,打開「/etc/ufw/applications.d/」:
[Apache]
title=Web Server
description=Apache v2 is the next generation of the omnipresent Apache web server.
ports=80/tcp
[Apache Secure]
title=Web Server (HTTPS)
description=Apache v2 is the next generation of the omnipresent Apache web server.
ports=443/tcp
[Apache Full]
title=Web Server (HTTP,HTTPS)
description=Apache v2 is the next generation of the omnipresent Apache web server.
ports=80,443/tcp
預設有三個 rule sets,一個是 port 80,另一個是 HTTPS 的 port 443,亦或二者都開啟。
我們可以依樣畫葫蘆,建立自己的 app rule sets,像是我幫 Resilio Sync 湊出來的 rule set。
你也可以參考 Ubuntu forum 上面的教學,建立自己需要的 rule set。
查了很多資料,大多都說是去修改 /boot/grub/grub.cnf 的設定,但新版的 grub.cnf 事實上是電腦自動產生的,不管怎麼改參數,數值都會被覆蓋掉。
正確解法應該是直接修改 /etc/default/grub:
GRUB_TIMEOUT=10 # wait for 10 secs
修改完畢後記得更新設定:
sudo update-grub2
詳細的解說,可以參考 Grub2 – Ubuntu community wiki 上的說明。
這邊標題應該下的不是很好,其實問題和 gnome-teminal 應該是沒什麼關係的。
在 windows 透過 pietty (快換 putty 吧) 連上 server 時,都是直接用 Ctrl + 左/右 來切換 windows, .screenrc 設定方式如下:
bindkey 33[C next
bindkey 33[D prev
不過當 client 是 Ubuntu 時,在 gnome-terminal 操作時,Ctrl + arraow 卻完全沒有效果。後來友人提示在 screen 底下可以先 ctrl + V,再按下 key binding,screen 會把收到的 key code 顯示出來,方便 debug。嘗試了不少種組合都沒有成功。
當 Google 第一頁搜尋結果無法找到方法時,只好往第二頁找屍體。慢慢看到有人提到需要修改 /etc/inputrc 的設定:
# allow the use of the Home/End keys
"e[1~": beginning-of-line
"e[4~": end-of-line
# allow the use of the Delete/Insert keys
"e[3~": delete-char
"e[2~": quoted-insert
....
# mappings for Ctrl-left-arrow and Ctrl-right-arrow for word moving
"e[1;5C": forward-word
"e[1;5D": backward-word
"e[5C": forward-word
"e[5D": backward-word
"ee[C": forward-word
"ee[D": backward-word
設定檔中間可以看到 Ctrl + arrow 已經被轉成 forward-word 等操作,把那幾行註解掉即可。
ps. 除了 ssh client 這邊的 inputrc 需要修改外,server side 若有 inputrc 也需要一起修改,不然 client 送過去的 key binding 還是會被 server 改掉。
執行的 aptitude update 以後,出現錯誤訊息:
W: GPG error: http://ppa.launchpad.net trusty InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 00A6F0A3C300EE8C
W: GPG error: http://ppa.launchpad.net trusty InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 4F4EA0AAE5267A6C
可以透過下列指令去 import keys:
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com {KEY}
例如上面的錯誤,可以這樣 import key:
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 00A6F0A3C300EE8C
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 4F4EA0AAE5267A6C
reference: How do I fix the GPG error “NO_PUBKEY”?