🤷🏻‍♀️ 사전 작업

레포지토리 추가

출처 : https://learn.microsoft.com/ko-kr/dotnet/core/install/linux-ubuntu#register-the-microsoft-package-repository


# Get Ubuntu version
declare repo_version=$(if command -v lsb_release &> /dev/null; then lsb_release -r -s; else grep -oP '(?<=^VERSION_ID=).+' /etc/os-release | tr -d '"'; fi)

# Download Microsoft signing key and repository
wget https://packages.microsoft.com/config/ubuntu/$repo_version/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
# 다운로드 후 2023-05-30 12:18:55 (412 MB/s) - ‘packages-microsoft-prod.deb’ saved [3690/3690] 형태로 출력이 된다.

# Install Microsoft signing key and repository
sudo dpkg -i packages-microsoft-prod.deb
# (Reading database ... 109485 files and directories currently installed.)
# Preparing to unpack packages-microsoft-prod.deb ...
# Unpacking packages-microsoft-prod (1.0-ubuntu20.04.1) ...
# Setting up packages-microsoft-prod (1.0-ubuntu20.04.1) ...


# Clean up
rm packages-microsoft-prod.deb

# Update packages
sudo apt update

.NET 7 설치

sudo apt-get install -y dotnet-sdk-7.0
제품 Type 패키지
7.0 ASP.NET Core 런타임 aspnetcore-runtime-7.0
7.0 .NET 런타임 dotnet-runtime-7.0
7.0 .NET SDK dotnet-sdk-7.0
6.0 ASP.NET Core 런타임 aspnetcore-runtime-6.0
6.0 .NET 런타임 dotnet-runtime-6.0
6.0 .NET SDK dotnet-sdk-6.0

.NET 7 설치 확인

dotnet --version

### 출력
7.0.302

혹은

dotnet --info

### 출력
.NET SDK:
 Version:   7.0.302
 Commit:    990cf98a27

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  20.04
 OS Platform: Linux
 RID:         ubuntu.20.04-x64
 Base Path:   /usr/share/dotnet/sdk/7.0.302/

Host:
  Version:      7.0.5
  Architecture: x64
  Commit:       8042d61b17

.NET SDKs installed:
  7.0.302 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 7.0.5 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 7.0.5 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
  None

Environment variables:
  Not set

global.json file:
  Not found

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download


No SDKs were found

  dotnet --info

  ### 출력
  Host:
  Version:      7.0.9
  Architecture: x64
  Commit:       8e9a17b221

.NET SDKs installed:
  No SDKs were found.

.NET runtimes installed:
  Microsoft.AspNetCore.App 7.0.9 [/usr/lib/dotnet/shared/Microsoft.AspNetCore.Ap                 p]
  Microsoft.NETCore.App 7.0.9 [/usr/lib/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
  None

Environment variables:
  DOTNET_ROOT       [/usr/lib/dotnet]

global.json file:
  Not found

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download

이런식

Note: No SDKs were found. 이런 에러가 뜨면

  sudo apt remove dotent*
  sudo apt remove aspnetcore*

  sudo rm /etc/apt/sources.list.d/microsoft-prod.list

  sudo apt update

  sudo apt install dotnet-sdk-7.0

이런식으로 해결이 가능하다.


Note: 만들고나니 내것이 아니었다.

Leave a comment