星期三, 8月 31, 2016

VMware ESXi patch安裝小記 - profile update 指令方式

VMware ESXi patch安裝小記


今天收到通知 VMware ESXi 5.5 需要進行更新
來進行 patch update, 卻遇到以下錯誤訊息


# esxcli   software   vib   update   -d  /vmfs/volumes/Local_30.4/patch/ESXi550-201608001.zip  
[DependencyError]
VIB VMware_bootbank_ehci-ehci-hcd_1.0-3vmw.550.3.89.4179633 requires xhci-xhci >= 1.0-3vmw.550.3.89, but the requirement cannot be satisfied within the ImageProfile.
Please refer to the log file for more details.

這邊顯示需要 xhci-xhci , 使用 # esxcli  software  vib  list 查詢, 的確沒有相關套件.
Google 了一下找到相關作法

使用 esxcli software sources profile list 指令列出 profile
# esxcli   software   sources   profile  list --depot=/vmfs/volumes/Local_30.3/patch/ESXi550-201608001.zip
Name                              Vendor        Acceptance Level
--------------------------------  ------------  ----------------
ESXi-5.5.0-20160804001-no-tools   VMware, Inc.  PartnerSupported
ESXi-5.5.0-20160801001s-no-tools  VMware, Inc.  PartnerSupported
ESXi-5.5.0-20160804001-standard   VMware, Inc.  PartnerSupported
ESXi-5.5.0-20160801001s-standard  VMware, Inc.  PartnerSupported

這邊之後選取 standard 版本即可

使用 esxcli  software  profile update 指令升級
# esxcli   software   profile   update   --depot=/vmfs/volumes/Local_30.4/patch/ESXi550-201608001.zip   -p  ESXi-5.5.0-20160804001-standard
  • 這邊藉由 -p 指定要升級的 profile

升級完成之後還是要重開機
# reboot


相知道與之前指令的差異, 所以下 vib update 試試看, 結果果然有升級
# esxcli   software   vib  update  -d  /vmfs/volumes/ISCSI_30.6/patch/ESXi550-201608001.zip
Installation Result
  Message: Host is not changed.
  Reboot Required: false
  VIBs Installed:

Notes
  • 一開始是放在 share storage 上面那台遇到, 其他的機器後來沒有遇到, 所以先紀錄下來
  • 後來看到 esxcli  software profile update 也是 ESXi 在線升級的作法
  • 經過今天一天, 也把 ESXi 5.5 升級 6.0U2 的技能學習到了


先記下來

~ enjoy it


參考

星期二, 8月 30, 2016

.NET Core with CentOS 安裝測試小記

.NET Core with CentOS 安裝小記

因為工作的關係, 之前有同事問 .NET Core 可否在 linux container 內執行?

上星期六有去參加 Microsoft 辦的 Community open camp 活動( https://community-open-camp.azurewebsites.net/ ), 有看到上官 demo Virtual Studio Core with .NET core, 所以本周就來嘗試



OS: CentOS 7.2


安裝 .NET Core SDK


# yum  install  libunwind  libicu
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: centos.cs.nctu.edu.tw
* extras: centos.cs.nctu.edu.tw
* updates: centos.cs.nctu.edu.tw
Package 2:libunwind-1.1-5.el7_2.2.x86_64 already installed and latest version
Package libicu-50.1.2-15.el7.x86_64 already installed and latest version
Nothing to do


# ls
anaconda-ks.cfg  initial-setup-ks.cfg


下載 dotnet.tar.gz
# curl   -sSL   -o   dotnet.tar.gz   https://go.microsoft.com/fwlink/?LinkID=809131


# ls
anaconda-ks.cfg  dotnet.tar.gz  initial-setup-ks.cfg


建立資料夾
# mkdir   /opt/dotnet


解壓縮 dotnet.tar.gz 到 /opt/dotnet


# tar   zxvf   dotnet.tar.gz   -C   /opt/dotnet/

建立 link ( 官方是用 # ln  -s  /opt/dotnet/dotnet   /usr/local/bin , 雖然 link 到目錄會自動建立 dotnet 在 /usr/local/bin 下, 但是我還是習慣完整打出來 )
# ln  -s  /opt/dotnet/dotnet   /usr/local/bin/dotnet


進行測試
$ pwd
/home/max


$ mkdir  hwapp


$ cd    hwapp/


$ dotnet  new


Welcome to .NET Core!
---------------------
Learn more about .NET Core @ https://aka.ms/dotnet-docs. Use dotnet --help to see available commands or go to https://aka.ms/dotnet-cli-docs.
Telemetry
--------------
The .NET Core tools collect usage data in order to improve your experience. The data is anonymous and does not include commandline arguments. The data is collected by Microsoft and shared with the community.
You can opt out of telemetry by setting a DOTNET_CLI_TELEMETRY_OPTOUT environment variable to 1 using your favorite shell.
You can read more about .NET Core tools telemetry @ https://aka.ms/dotnet-cli-telemetry.
Configuring...
-------------------
A command is running to initially populate your local package cache, to improve restore speed and enable offline access. This command will take up to a minute to complete and will only happen once.
Decompressing 100% 3872 ms
Expanding 100% 5549 ms
Created new C# project in /home/max/hwapp.


觀察目錄
$ ls
Program.cs  project.json


觀察相關檔案內容
$ cat   Program.cs
using System;


namespace ConsoleApplication
{
   public class Program
   {
       public static void Main(string[] args)
       {
           Console.WriteLine("Hello World!");
       }
   }
}

$ cat   project.json
{
 "version": "1.0.0-*",
 "buildOptions": {
   "debugType": "portable",
   "emitEntryPoint": true
 },
 "dependencies": {},
 "frameworks": {
   "netcoreapp1.0": {
     "dependencies": {
       "Microsoft.NETCore.App": {
         "type": "platform",
         "version": "1.0.0"
       }
     },
     "imports": "dnxcore50"
   }
 }
}

執行程式
$ dotnet   restore
log  : Restoring packages for /home/max/hwapp/project.json...
log  : Writing lock file to disk. Path: /home/max/hwapp/project.lock.json
log  : /home/max/hwapp/project.json
log  : Restore completed in 1372ms.


觀察目錄
$ ls  -a
.  ..  Program.cs  project.json  project.lock.json


$ dotnet    run
Project hwapp (.NETCoreApp,Version=v1.0) will be compiled because expected outputs are missing
Compiling hwapp for .NETCoreApp,Version=v1.0


Compilation succeeded.
   0 Warning(s)
   0 Error(s)


Time elapsed 00:00:02.6575843


Hello World!


觀察目錄
$ ls  -a
.  ..  bin  obj  Program.cs  project.json  project.lock.json


到目前為止是在 console 輸出 Hello World!


但是之後可能是在網頁上面輸出


建立一個新的或是修改舊的來測試也可以, 這邊我是建立一個新的
回到家目錄
$ cd


建立資料夾
$ mkdir  webapp


進入到工作目錄
$ cd   webapp/


透過 dotnet  new 建立新專案
$ dotnet  new
Created new C# project in /home/max/webapp.


$ ls
Program.cs  project.json


修改 project.json


$ vi   project.json
加入 Microsoft.AspNetCore.Server.Kestrel  相關設定
{
 "version": "1.0.0-*",
 "buildOptions": {
   "debugType": "portable",
   "emitEntryPoint": true
 },
 "dependencies": {},
 "frameworks": {
   "netcoreapp1.0": {
     "dependencies": {
       "Microsoft.NETCore.App": {
         "type": "platform",
         "version": "1.0.0"
       },
       "Microsoft.AspNetCore.Server.Kestrel": "1.0.0"
     },
     "imports": "dnxcore50"
   }
 }
}


這個部份個人推測是告訴等下的 dotnet  restore 指令要匯入哪些 lib


執行  dotnet  restore
$ dotnet   restore
log  : Restoring packages for /home/max/webapp/project.json...
log  : Writing lock file to disk. Path: /home/max/webapp/project.lock.json
log  : /home/max/webapp/project.json
log  : Restore completed in 1852ms.

建立 Startup.cs
$ vi   Startup.cs
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
namespace ConsoleApplication {
   public class Startup{
       public void Configure(IApplicationBuilder app){
           app.Run(context => {
               return context.Response.WriteAsync("Hello world");
           });
       }
   }
}

修改 Program.cs
$ vi  Program.cs
using System;
using Microsoft.AspNetCore.Hosting;
namespace ConsoleApplication
{
   public class Program
   {
       public static void Main(string[] args)
       {
           Console.WriteLine("Hello World!");
           var host = new WebHostBuilder()
           .UseKestrel()
           .UseStartup<Startup>()
           .Build();
           host.Run();
       }
   }
}


執行 dotnet  run
$ dotnet  run
Project webapp (.NETCoreApp,Version=v1.0) will be compiled because expected outputs are missing
Compiling webapp for .NETCoreApp,Version=v1.0


Compilation succeeded.
   0 Warning(s)
   0 Error(s)


Time elapsed 00:00:02.9192331


Hello World!
Hosting environment: Production
Content root path: /home/max/webapp/bin/Debug/netcoreapp1.0
Now listening on: http://localhost:5000
Application started. Press Ctrl+C to shut down.

這個時候可以看到 程式在 localhost port 5000 listen


開個 firefox 來測試一下
2016-08-30 15-51-00 的螢幕擷圖.png

算是對 .NET Core 有個初步嘗試
但是後續的 code 撰寫還是要透過 Virtual Studio Core 來連接會比較好


先記下來


~ enjoy it

參考文件