生產環境vSphere CoreOS
最后更新于:2022-04-01 23:04:34
# 生產環境vSphere部署CoreOS
如果你要將CoreOS部署到vSphere上,由於vSphere需要對其上的每一個VM都進行嚴格的控管,因此所有在vSphere下的VM都必須安裝VMware Tools。如此一來,你就必須下載已經預先安裝好VMware Tools的CoreOS的VMware Image。
下載網址為
[coreos_production_vmware_image.vmdk.bz2](http://alpha.release.core-os.net/amd64-usr/current/coreos_production_vmware_image.vmdk.bz2)(要先解壓)
[coreos_production_vmware.vmx](http://alpha.release.core-os.net/amd64-usr/current/coreos_production_vmware.vmx)
下載回來有兩個檔案,一個是`vmx`,另一個則是壓縮後的`vmdk`。使用前必須先將這個VM轉換成OVF格式,Windows/Mac下使用VMware Workstation/Fusion內建程式,Linux下則可以至VMware的官網下載OVF Tool來轉換,下載網址為
[https://developercenter.vmware.com/web/dp/tool/ovf/3.5.2](https://developercenter.vmware.com/web/dp/tool/ovf/3.5.2)
此版本的CoreOS雖預先安裝了vSphere 的VMware Tools,但預設沒有使用者帳號密碼,如果要使用,必須透過雲端工具或設定開機參數,下面就是完整的部署步驟。
_預先安裝了VMware Tools才能在開機後回報IP_

### 在vSphere下部署雲端版的CoreOS
1. 將下載回來的`bz2`檔案解壓,內容是一個`vmdk`檔案。

1. 使用VMware Workstation打開這個`vmx`。
1. 選擇`File/Export to OVF`,並且儲存在確定位置。

1. 進入vSphere Client視窗,選擇`Deploy OVF Template`。

1. 此時會出現匯入視窗,一直按「下一步」即可,最後會在vSphere的列表中出現該VM,直接啟動即可。



1. 可以看到這個VM已經預設安裝好VMware Tools了。

1. 啟動這個VM,並且快速進入主控介面。

1. 在還沒完全啟動前,請快速按下`e`鍵,直到啟動選項出現為止。
1. 在圖中的位置輸入`coreos.autologin`,之後按下F10重新啟動,這次就會直接進入桌面,不需要帳號密碼。


1. 在這個VMware中輸入`sudo passwd core`來建立帳號密碼,下次才可正常登入,你也可以輸入`sudo passwd root`來建立root的帳號密碼方便操作docker。

1. 可以從`docker version`或`docker info`查看。

1. 一樣輸入`docker run -d --name web -p 8080:80 joshhu/webdemo`來查看安裝是否成功。


';