1.Microsoft 패키지 리포지토리 추가:
1 2 3 |
sudo rpm -Uvh https://packages.microsoft.com/config/centos/7/packages-microsoft-prod.rpm |
1.1 8.0 일 경우
1 2 3 |
sudo rpm -Uvh https://packages.microsoft.com/config/centos/8/packages-microsoft-prod.rpm |
2. .NET SDK 설치:
1 2 3 |
sudo yum install dotnet-sdk-6.0 |
2.1 또는 .NET Runtime만 필요한 경우:
1 2 3 |
sudo yum install aspnetcore-runtime-6.0 |
3. 설치 확인
1 2 3 |
dotnet --version |
3.1 .NET SDK의 버전을 출력
1 2 3 4 5 6 |
dotnet --list-runtimes Microsoft.AspNetCore.App 6.0.28 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 6.0.28 [/usr/share/dotnet/shared/Microsoft.NETCore.App] |
4 .package 예시
1 2 3 4 |
dotnet add package Pomelo.EntityFrameworkCore.MySql --version 6.0.0 dotnet add package Microsoft.EntityFrameworkCore.Design --version 6.0.0 |
5. publish 예시
1 2 3 4 |
dotnet publish --configuration Release dotnet /var/www/helloworld/bin/Release/net6.0-windows/InMemoryCacheCore.dll |
6. Kestrel 예시
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
sudo cat appsettings.json { "Logging": { "LogLevel": { "Default": "Information", "Microsoft.AspNetCore": "Warning" } }, "Kestrel": { "Endpoints": { "Http": { "Url": "http://***.143.21.175:50002" }, "Https": { "Url": "https://***.143.21.175:60020" } } }, "AllowedHosts": "*" } |