阿里雲的freebsd官方鏡像版本爲11.1,但很遺憾,該版本官方已經中止了支持。因此在進行ports
安裝軟件時,會遇到版本過時的問題。html
支持的日期到:2017年7月。
既然11.1不被支持,那咱們將其升級到被支持的版本就行了。當前官方最新的release版本爲11.2以及12.0,發佈時間均爲2018年,且在新的版本未發佈前,會一直獲得官方的支持。shell
12.0過時日期:12.1-release發佈日期 + 3個月。
11.2過時日期:11.3-release發佈日期 + 3個月。
本文的目的,便是將操做系統由11.1升級到12.0。解決問題的整個方法,仍然是以官方文檔爲主。在進行服務器升級時,須要逐步升級:bash
咱們當前想由11.1升級,那麼要先看11.2的文檔,升級完成後,再看12.0的文檔。
服務器
注意:咱們不能由11.1直接升級到12.0,這點在官方文檔的升級手冊上也寫明瞭。在升級12.0時,要求當前系統爲11.2-release.
若是你的系統當前是10.0,則須要依次看下面的文檔:
即升級過程爲:10.1 -> 10.2 -> 10.3 -> ... -> 11.1 -> 11.2
點擊各個版本的Installation Instructions
並找到:網絡
即,咱們須要的升級教程。app
先fetch到最新版本,再安裝ssh
# freebsd-update fetch
此過程會有些長,最後顯示的信息過多,會提示如下信息:ide
Applying patches... done. --More--(END)
此時,按q
退出日誌顯示,回到終端。獲得如下信息,它告訴咱們說11.1-release已過時了。fetch
WARNING: FreeBSD 11.1-RELEASE HAS PASSED ITS END-OF-LIFE DATE. Any security issues discovered after Mon Oct 1 08:00:00 CST 2018 will not have been corrected.
下一步:執行官方文檔中的freebsd-update install
ui
# freebsd-update install src component not installed, skipped No updates are available to install. Run '/usr/sbin/freebsd-update fetch' first.
上述操做保證了,咱們在11.1版本下是最新的。
參考官方文檔: https://www.freebsd.org/releases/11.2R/installation.html#upgrade-binary
先獲取11.2-release的安裝包,再升級。
# freebsd-update upgrade -r 11.2-RELEASE
期間會有個提示:
The following components of FreeBSD do not seem to be installed: kernel/generic-dbg world/base-dbg world/doc world/lib32 world/lib32-dbg Does this look reasonable (y/n)?
按y
繼續。下面的過程有些緩慢,主要是因爲要下載的包太多了,有10000多個,須要耐心等待。升級過程當中,有個衝突的提示:
The following file could not be merged automatically: /etc/ntp.conf Press Enter to edit this file in vi and resolve the conflicts
此時,按回車
編輯文件/etc/ntp.conf
,解決衝突 。個人作法是:刪除current version
中的全部數據,保留11.2-release
的。編輯之後,回到shell
按兩次y
確認本身的更改,而後按q
完成安裝過程。
安裝升級包
# freebsd-update install src component not installed, skipped Installing updates... Kernel updates have been installed. Please reboot and run "/usr/sbin/freebsd-update install" again to finish installing updates.
重啓
# shutdown -r now
待系統重啓後繼續安裝
# freebsd-update install
若是咱們是一個純淨的系統,因爲未使用ports
安裝軟件,因此此過程會簡單不少。【猜測】若是咱們不是純淨的系統,那麼此時之前使用port
安裝的軟件應該會隨之升級,並可能須要一些人工干預(更新ports -> 進行ports -> 從新安裝),干預完畢後,最後再執行一次安裝升級包,隨後從新啓動。
# freebsd-update install src component not installed, skipped No updates are available to install. Run '/usr/sbin/freebsd-update fetch' first. # shutdown -r now
查看freebsd
版本以肯定升級是否成功
# freebsd-version 11.2-RELEASE-p9
官方文檔: https://www.freebsd.org/releases/12.0R/installation.html#upgrade
如下的步驟,基本和11.1 -> 11.2
相同
# freebsd-update fetch # freebsd-update install # freebsd-update upgrade -r 12.0-RELEASE 出現提示後按y # freebsd-update install # shutdown -r now # freebsd-update install # freebsd-update install # shutdown -r now
注意:在修改/etc/ntp
時,我保留了阿里雲的ntp
設置,即保留了這段:
# local clock server 127.127.1.0 fudge 127.127.1.0 stratum 10 restrict ntp1.aliyun.com nomodify notrap nopeer noquery restrict ntp1.cloud.aliyuncs.com nomodify notrap nopeer noquery restrict ntp10.cloud.aliyuncs.com nomodify notrap nopeer noquery restrict ntp11.cloud.aliyuncs.com nomodify notrap nopeer noquery restrict ntp12.cloud.aliyuncs.com nomodify notrap nopeer noquery restrict ntp2.aliyun.com nomodify notrap nopeer noquery restrict ntp2.cloud.aliyuncs.com nomodify notrap nopeer noquery restrict ntp3.aliyun.com nomodify notrap nopeer noquery restrict ntp3.cloud.aliyuncs.com nomodify notrap nopeer noquery restrict ntp4.aliyun.com nomodify notrap nopeer noquery restrict ntp4.cloud.aliyuncs.com nomodify notrap nopeer noquery restrict ntp5.aliyun.com nomodify notrap nopeer noquery restrict ntp5.cloud.aliyuncs.com nomodify notrap nopeer noquery restrict ntp6.aliyun.com nomodify notrap nopeer noquery restrict ntp6.cloud.aliyuncs.com nomodify notrap nopeer noquery restrict ntp7.cloud.aliyuncs.com nomodify notrap nopeer noquery restrict ntp8.cloud.aliyuncs.com nomodify notrap nopeer noquery restrict ntp9.cloud.aliyuncs.com nomodify notrap nopeer noquery server ntp1.aliyun.com iburst minpoll 4 maxpoll 10 server ntp1.cloud.aliyuncs.com iburst minpoll 4 maxpoll 10 server ntp10.cloud.aliyuncs.com iburst minpoll 4 maxpoll 10 server ntp11.cloud.aliyuncs.com iburst minpoll 4 maxpoll 10 server ntp12.cloud.aliyuncs.com iburst minpoll 4 maxpoll 10 server ntp2.aliyun.com iburst minpoll 4 maxpoll 10 server ntp2.cloud.aliyuncs.com iburst minpoll 4 maxpoll 10 server ntp3.aliyun.com iburst minpoll 4 maxpoll 10 server ntp3.cloud.aliyuncs.com iburst minpoll 4 maxpoll 10 server ntp4.aliyun.com iburst minpoll 4 maxpoll 10 server ntp4.cloud.aliyuncs.com iburst minpoll 4 maxpoll 10 server ntp5.aliyun.com iburst minpoll 4 maxpoll 10 server ntp5.cloud.aliyuncs.com iburst minpoll 4 maxpoll 10 server ntp6.aliyun.com iburst minpoll 4 maxpoll 10 server ntp6.cloud.aliyuncs.com iburst minpoll 4 maxpoll 10 server ntp7.cloud.aliyuncs.com iburst minpoll 4 maxpoll 10 server ntp8.cloud.aliyuncs.com iburst minpoll 4 maxpoll 10 server ntp9.cloud.aliyuncs.com iburst minpoll 4 maxpoll 10
NTP: 網絡時間協議(Network Time Protocol),它是用來同步網絡中各個計算機的時間的協議。
最後,重啓系統後,查看日誌信息。看是否有錯誤日誌。筆者獲得了兩個錯誤,分別是nfpd
與sshd
啓動失敗.
由日誌信息,得知是因爲/etc/ssh/sshd_config
致使的sshd
未成功啓動,這也直接致使了ssh
遠程登陸不上了。此時,咱們由阿里雲控制檯登陸。並修改/etc/ssh/sshd_config
.
該配置文件說明,請參見: https://www.freebsd.org/cgi/man.cgi?sshd_config(5))
按官方文檔,將Ciphers修改成官方默認列表值:
Ciphers chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-cbc,aes192-cbc,aes256-cbc
sshd -t service sshd start
修改完ssh的配置文件後,須要先執行sshd -t
進行驗證。不然一旦配置有錯,當咱們使用ssh
鏈接時,就會失去當前鏈接。
第二個錯誤參考論壇https://forums.freebsd.org/threads/ntpd-not-starting-after-upgrade-to-12-0-release.68758/執行/usr/sbin/pwd_mkdb -p /etc/master.passwd
後解決。
# /usr/sbin/pwd_mkdb -p /etc/master.passwd # /etc/rc.d/ntpd start
升級後pkg提示少libssl.so.8
-> ld-elf.so.1: Shared object "libssl.so.8" not found,
# pkg-static del -f pkg # pkg upgrade ===> NOTICE: This port is deprecated; you may wish to reconsider installing it: Unsupported by upstream. Use GCC 7 or newer instead.. Message from dejavu-2.37: Make sure that the freetype module is loaded. If it is not, add the following line to the "Modules" section of your X Windows configuration file: Load "freetype" Add the following line to the "Files" section of X Windows configuration file: FontPath "/usr/local/share/fonts/dejavu/" Note: your X Windows configuration file is typically /etc/X11/XF86Config if you are using XFree86, and /etc/X11/xorg.conf if you are using X.Org. Message from gcc8-8.2.0_4: To ensure binaries built with this toolchain find appropriate versions of the necessary run-time libraries, you may want to link using -Wl,-rpath=/usr/local/lib/gcc8 For ports leveraging USE_GCC, USES=compiler, or USES=fortran this happens transparently. Message from ntp-4.2.8p12_3: Please add ntpd_program="/usr/local/sbin/ntpd" ntpdate_program="/usr/local/sbin/ntpdate" to your /etc/rc.conf or run sysrc ntpd_program="/usr/local/sbin/ntpd" sysrc ntpdate_program="/usr/local/sbin/ntpdate" to enable ntp from ports/packages instead of base ntp. Message from busybox-1.26.2: ===> NOTICE: The busybox port currently does not have a maintainer. As a result, it is more likely to have unresolved issues, not be up-to-date, or even be removed in the future. To volunteer to maintain this port, please create an issue at: https://bugs.freebsd.org/bugzilla More information about port maintainership is available at: https://www.freebsd.org/doc/en/articles/contributing/ports-contributing.html#maintain-port # sysrc ntpd_program="/usr/local/sbin/ntpd" ntpd_program: /usr/sbin/ntpd -> /usr/local/sbin/ntpd # sysrc ntpdate_program="/usr/local/sbin/ntpdate" ntpdate_program: /usr/sbin/ntpdate -> /usr/local/sbin/ntpdate
最後,將系統盤作個鏡像,之後再安裝的時候,直接使用此空白鏡像便可。
1.官方文檔很重要。 2.看提示很重要。3.積累很重要。
任何的努力,都將在特定的時間點上閃光。