EdgeMAX - 在 EdgeRouter 中升級 EdgeOS 固件
簡介
這篇文章中,讀者將會了解到如何通過 CLI(命令行)更新 EdgeRouter 固件。目前可以在 EdgeRouter 中存儲兩個固件映像。如果升級後無法正常工作,可以很容易的切換到老版本。
工具
EdgeRouter
操作步驟
1.查看當前版本的方法:
ubnt@RTR:~$ show version
Version: v0.9.5
Build ID: 13450177
Build on: 08/15/12 01:02
Copyright: 2012 Ubiquiti, Inc
HW model: EdgeRouter Lite 3-Port
HW S/N: 1226TDC9FDB170D87
Uptime: 18:03:12 up 4 min, 1 user, load average: 0.32, 0.25, 0.11
(1)例如可以直接使用一個下載鏈接(當然要使用真實的網址):
add system image http://dl.ubnt.com/...
(2)從本地文件添加一個新的映像:
ubnt@RTR:~$ add system image egdeos-120821.tar
Preparing to upgrade... Done
Copying upgrade image... Done
Removing old image... Done
Checking upgrade image... Done
Finishing upgrade... Done
Upgrade completed
ubnt@RTR:~$
注意: 在添加一個新的映像時,整個/config 目錄都會被複制到新的映像,所以新的映像將會擁有跟舊的映像相同的配置。保存在/config/auth 目錄下的 OpenVPN 密鑰也會被複制。
2.可以從本地或者一個網址添加一個新的映像。
ubnt@RTR:~$ add system image ?
Possible completions:
File name or URL of system image file to be installed
3.查看兩個映像以及映像運行狀態和下次重啟時會運行的映像的方法:
ubnt@RTR:~$ show system image
The system currently has the following image(s) installed:
v0.9.5.13455361.120821.0102 (default boot)
v0.9.5.13450177.120815.0102 (running image)
A reboot is needed to boot default image
(1)重啟後,新的映像正在運行並且是默認啟動:
ubnt@RTR:~$ show system image
The system currently has the following image(s) installed:
v0.9.5.13455361.120821.0102 (running image) (default boot)
v0.9.5.13450177.120815.0102
(2)查看每個映像佔用的存儲空間的方法:
ubnt@RTR:~$ show system image storage
Image name Read-Only Read-Write Total
------------------------------ ------------ ------------ ------------
v0.9.5.13455361.120821.0102 69060 460 69520
v0.9.5.13450177.120815.0102 69056 77428 146484
(3)要切換到另一個映像,例如要恢復升級按照下述操作:
ubnt@RTR:~$ set system image default-boot
The system currently has the following image(s) installed:
v0.9.5.13455361.120821.0102 (running image) (default boot)
v0.9.5.13450177.120815.0102
Are you sure you want to switch images? (Yes/No) [Yes]:
Moving images...
Done
Switched from
Version: v0.9.5.13455361.120821.0102
to
Version: v0.9.5.13450177.120815.0102
4.如果你要刪除另一個映像,你需要使用 delete 指令來作業
ubnt@RTR:~$ delete system image
The system currently has the following image(s) installed:
v0.9.5.13455361.120821.0102 (running image) (default boot)
v0.9.5.13450177.120815.0102
You are about to delete image [v0.9.5.13450177.120815.0102]
Are you sure you want to delete ? (Yes/No) [Yes]:
Removing old image... Done