CentOS 7 에 NetCore5.0 을 설치해 보자
remark :
CentOS 7 와 CentOS 8 설치 방법이 다르다.
1.Install MS package signing key
1 2 3 |
sudo rpm -Uvh https://packages.microsoft.com/config/centos/7/packages-microsoft-prod.rpm |
2. Install the SDK
1 2 3 |
sudo yum install dotnet-sdk-5.0 |
3. Version 확인
1 2 3 4 |
[root@localhost]# dotnet --version 5.0.301 |
4.Helloworld Test
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
[root@localhost www]# dotnet new console -o helloworld Welcome to .NET 5.0! --------------------- SDK Version: 5.0.301 Telemetry --------- The .NET tools collect usage data in order to help us improve your experience. It is collected by Microsoft and shared with the community. You can opt-out of telemetry by setting the DOTNET_CLI_TELEMETRY_OPTOUT environment variable to '1' or 'true' using your favorite shell. Read more about .NET CLI Tools telemetry: https://aka.ms/dotnet-cli-telemetry ---------------- Installed an ASP.NET Core HTTPS development certificate. To trust the certificate run 'dotnet dev-certs https --trust' (Windows and macOS only). Learn about HTTPS: https://aka.ms/dotnet-https ---------------- Write your first app: https://aka.ms/dotnet-hello-world Find out what's new: https://aka.ms/dotnet-whats-new Explore documentation: https://aka.ms/dotnet-docs Report issues and find source on GitHub: https://github.com/dotnet/core Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli -------------------------------------------------------------------------------------- Getting ready... The template "Console Application" was created successfully. Processing post-creation actions... Running 'dotnet restore' on helloworld/helloworld.csproj... Determining projects to restore... Restored /var/www/helloworld/helloworld.csproj (in 286 ms). Restore succeeded. [root@localhost www]# cd helloworld [root@localhost helloworld]# dotnet run Hello World! |
5. Microsoft Visual Studio Community 2019 로 만들어 올려 보기
6.소스 수정 .UseUrls(“http://*:5000”)추가
1 2 3 4 5 6 7 8 9 |
.UseUrls("httpublic static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) .ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup<Startup>() .UseUrls("http://*:5000"); }); |
7. 방화벽 오픈 : tcp 5000
8.웹에서 확인
1 2 3 4 5 6 7 8 9 10 11 12 |
[root@localhost helloworld]# dotnet run Building... info: Microsoft.Hosting.Lifetime[0] Now listening on: http://[::]:5000 info: Microsoft.Hosting.Lifetime[0] Application started. Press Ctrl+C to shut down. info: Microsoft.Hosting.Lifetime[0] Hosting environment: Development info: Microsoft.Hosting.Lifetime[0] Content root path: /var/www/helloworld |
http://111.222.222.222:5000