LoginSignup
2
1

More than 5 years have passed since last update.

GoogleComputeEngine上で.NET Core!

Posted at

設定

  • Google Cloud Platformを使ってサービスしよう
  • サーバー費抑えたい = Linux
  • C# 使いたい = .NET Core

Google Compute Engine(GCE)

Linuxのインスタンスをつくる
今回は Ubuntu 16.04 LTS を選択

nginx

Webサーバーとしてnginxを導入

$ sudo apt-get update
$ sudo apt-get install nginx
$ sudo /etc/init.d/nginx start

GCEのVMインスタンスにある外部IPにアクセスして、"Welcome to nginx!"と表示されればOK
2017-05-30_10h17_23.png

.NET Core

Get Started with .NET Core のコマンドをそのまま OSやバージョンで分かれているので、要注意

Add the dotnet apt-get feed
$ sudo sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ xenial main" > /etc/apt/sources.list.d/dotnetdev.list'
$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 417A0893
$ sudo apt-get update
Install .NET Core SDK
$ sudo apt-get install dotnet-dev-1.0.4
Initialize some code
$ sudo dotnet new console -o hwapp
$ cd hwapp
Run the app
$ sudo dotnet restore
$ sudo dotnet run

コンソール Hellow World のできあがり

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1