LoginSignup
8
8

More than 5 years have passed since last update.

.Net Core を手順に従ってAzure Ubuntu Server 14.04 LTSに入れてみた

Last updated at Posted at 2015-04-04

以下の手順に従いました。
https://github.com/dotnet/coreclr/wiki/Linux-instructions

手順通りなので、価値はないかもしれません。

最初に

~用意したもの~
・SSHクライアント(teraTermを利用)
・Azure上のUbuntu Server 14.04 LTS
・Windowsマシン
・git(Windowsマシン用)

~注意点~
・Linuxサイドのコンパイルは、本当のコア部分のみ。
・Windows側で一部アセンブリをビルドする必要があるため、Linuxだけで環境は作れない。

~git clone url~
https://github.com/dotnet/coreclr.git
https://github.com/dotnet/corefx.git

Ubuntu

コマンド 依存関係のモジュールをapt-getでインストール

echo "deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty-3.6 main" | sudo tee /etc/apt/sources.list.d/llvm.list
wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add -
sudo apt-get update
sudo apt-get install cmake llvm-3.5 clang-3.5 lldb-3.6 lldb-3.6-dev libunwind8 libunwind8-dev gettext

sudo apt-get install git

コマンド git clone

cd
mkdir git
git clone https://github.com/dotnet/coreclr.git

コマンド coreclr ビルド

cd coreclr
./build.sh

ここからwindows

http://msysgit.github.io/
からGitをインストール

windowsコマンド gitのclone coreclr

gitを実行可能なコンソールにて
cd /
mkdir git
cd git

git clone https://github.com/dotnet/coreclr.git

windowsコマンド linux用のcoreclrをビルド

cd \git\coreclr
.\build.cmd linuxmscorlib

windowsコマンド gitのclone corefx

cd \git
git clone https://github.com/dotnet/corefx.git

windowsコマンド linux用のcorefxをビルド

cd \git\corefx
.\build.cmd /p:OS=Linux /p:SkipTests=true

コピー

できたファイル
\git\coreclr\bin\obj\Linux.x64.Debug\mscorlib.dll
\git\corefx\bin\Linux.AnyCPU.Debug\System.Console\System.Console.dll
\git\corefx\bin\Linux.AnyCPU.Debug\System.Diagnostics.Debug\System.Diagnostics.Debug.dll
をデモ用のフォルダー
~/coreclr-demo/runtime
にコピーする

teratermのアップロード方法

ここからUbuntu

コマンド Ubuntu

cd ~/coreclr
cp bin/Product/Linux.x64.Debug/corerun ~/coreclr-demo/runtime
cp bin/Product/Linux.x64.Debug/libcoreclr.so ~/coreclr-demo/runtime

ls ~/coreclr-demo/runtime/
[以下のファイルが表示されればOK]
corerun libcoreclr.so mscorlib.dll System.Console.dll System.Diagnostics.Debug.dll

コマンド monoインストール

cd
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb http://download.mono-project.com/repo/debian wheezy main" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list
sudo apt-get update
sudo apt-get install mono-devel

コマンド nugetインストール

mkdir ~/coreclr-demo/packages
cd ~/coreclr-demo/packages
curl -L -O https://nuget.org/nuget.exe

packages.config
<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="System.Console" version="4.0.0-beta-22703" />
  <package id="System.Diagnostics.Contracts" version="4.0.0-beta-22703" />
  <package id="System.Diagnostics.Debug" version="4.0.10-beta-22703" />
  <package id="System.Diagnostics.Tools" version="4.0.0-beta-22703" />
  <package id="System.Globalization" version="4.0.10-beta-22703" />
  <package id="System.IO" version="4.0.10-beta-22703" />
  <package id="System.IO.FileSystem.Primitives" version="4.0.0-beta-22703" />
  <package id="System.Reflection" version="4.0.10-beta-22703" />
  <package id="System.Resources.ResourceManager" version="4.0.0-beta-22703" />
  <package id="System.Runtime" version="4.0.20-beta-22703" />
  <package id="System.Runtime.Extensions" version="4.0.10-beta-22703" />
  <package id="System.Runtime.Handles" version="4.0.0-beta-22703" />
  <package id="System.Runtime.InteropServices" version="4.0.20-beta-22703" />
  <package id="System.Text.Encoding" version="4.0.10-beta-22703" />
  <package id="System.Text.Encoding.Extensions" version="4.0.10-beta-22703" />
  <package id="System.Threading" version="4.0.10-beta-22703" />
  <package id="System.Threading.Tasks" version="4.0.10-beta-22703" />
</packages>

コマンド nuget

mono nuget.exe restore -Source https://www.myget.org/F/dotnet-corefx/ -PackagesDirectory .

コマンド runtimeディレクトリにコピー

find . -wholename '/aspnetcore50/.dll' -exec cp -n {} ~/coreclr-demo/runtime \;

コマンド サンプルソースのダウンロード

cd ~/coreclr-demo/runtime
curl -O https://raw.githubusercontent.com/dotnet/corefxlab/master/demos/CoreClrConsoleApplications/HelloWorld/HelloWorld.cs

コマンド サンプルソースのコンパイル

cd ~/coreclr-demo/runtime
mcs /nostdlib /noconfig /r:../packages/System.Console.4.0.0-beta-22703/lib/contract/System.Console.dll /r:../packages/System.Runtime.4.0.20-beta-22703/lib/contract/System.Runtime.dll HelloWorld.cs

コマンド サンプルソースの実行

cd ~/coreclr-demo/runtime
./corerun HelloWorld.exe linux

023.png

[参考]
http://blog.shibayan.jp/entry/20150311/1426055738

8
8
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
8
8