CentOS Stream 9
Sponsored Link

.NET 7.0 : インストール2023/10/13

 
.NET 7.0 をインストールします。
[1] .NET 7.0 のインストールと動作確認です。
[root@dlp ~]#
dnf -y install dotnet-runtime-7.0 dotnet-sdk-7.0 dotnet-targeting-pack-7.0 dotnet-templates-7.0 dotnet-hostfxr-7.0

Dependencies resolved.
================================================================================
 Package                          Arch      Version          Repository    Size
================================================================================
Installing:
 dotnet-hostfxr-7.0               x86_64    7.0.10-2.el9     appstream    167 k
 dotnet-runtime-7.0               x86_64    7.0.10-2.el9     appstream     24 M
 dotnet-sdk-7.0                   x86_64    7.0.110-2.el9    appstream     85 M
 dotnet-targeting-pack-7.0        x86_64    7.0.10-2.el9     appstream    2.6 M
 dotnet-templates-7.0             x86_64    7.0.110-2.el9    appstream    2.7 M
Installing dependencies:
 aspnetcore-runtime-7.0           x86_64    7.0.10-2.el9     appstream    7.3 M
 aspnetcore-targeting-pack-7.0    x86_64    7.0.10-2.el9     appstream    1.5 M
 dotnet-apphost-pack-7.0          x86_64    7.0.10-2.el9     appstream    3.9 M

Transaction Summary
================================================================================
Install  8 Packages
.....
.....

[root@dlp ~]#
dotnet --version

7.0.110

# Hello World で動作確認

[root@dlp ~]#
dotnet new console -o helloworld


Welcome to .NET 7.0!
---------------------
SDK Version: 7.0.110

----------------
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
--------------------------------------------------------------------------------------
The template "Console App" was created successfully.

Processing post-creation actions...
Restoring /root/helloworld/helloworld.csproj:
  Determining projects to restore...
  Restored /root/helloworld/helloworld.csproj (in 73 ms).
Restore succeeded.

[root@dlp ~]#
cd helloworld

[root@dlp helloworld]#
dotnet run

Hello, World!
[2] 任意の一般ユーザーで ASP.NET Web App サンプルアプリケーションを動作確認します。
[cent@dlp ~]$
dotnet new razor -o asp.net


Welcome to .NET 7.0!
---------------------
SDK Version: 7.0.110

----------------
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
--------------------------------------------------------------------------------------
The template "ASP.NET Core Web App" was created successfully.
This template contains technologies from parties other than Microsoft, see https://aka.ms/aspnetcore/7.0-third-party-notices for details.

Processing post-creation actions...
Restoring /home/cent/asp.net/asp.net.csproj:
  Determining projects to restore...
  Restored /home/cent/asp.net/asp.net.csproj (in 73 ms).
Restore succeeded.

[cent@dlp ~]$
cd asp.net

[cent@dlp asp.net]$
dotnet run --urls=http://10.0.0.30:5000/

Building...
warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35]
      No XML encryptor configured. Key {91fc5eba-3103-44db-8f45-9420a7277a26} may be persisted to storage in unencrypted form.
info: Microsoft.Hosting.Lifetime[14]
      Now listening on: http://10.0.0.30: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: /home/cent/asp.net
  任意のクライアントコンピューターで Web アクセスして、以下のようなページが表示されれば OK です。
関連コンテンツ