Oracle Cloud
Ubuntu 20.04(Arm64) .NET Core 6 설치
IdeaFusion
2023. 2. 3. 14:57
반응형
Ubuntu 20.04 에 .NET Core 6을 설치하는 데 사용할 수 있는 자동화 스크립트가 있습니다.
스크립트는 아래와 같이 다운로드됩니다.
$ wget https://dot.net/v1/dotnet-install.sh
실행 권한처리
$ chmod +x dotnet-install.sh
이제 스크립트를 사용하여 아래와 같이 .NET 6 런타임과 SDK를 모두 설치합니다.
$ ./dotnet-install.sh -c 6.0
dotnet-install: Note that the intended use of this script is for Continuous Integration (CI) scenarios, where:
dotnet-install: - The SDK needs to be installed without user interaction and without admin rights.
dotnet-install: - The SDK installation doesn't need to persist across multiple CI runs.
dotnet-install: To set up a development environment or to run apps, use installers rather than this script. Visit https://dotnet.microsoft.com/download to get the installer.
dotnet-install: Attempting to download using aka.ms link https://dotnetcli.azureedge.net/dotnet/Sdk/6.0.405/dotnet-sdk-6.0.405-linux-arm64.tar.gz
dotnet-install: Extracting zip from https://dotnetcli.azureedge.net/dotnet/Sdk/6.0.405/dotnet-sdk-6.0.405-linux-arm64.tar.gz
dotnet-install: Installed version is 6.0.405
dotnet-install: Adding to current process PATH: `/home/ubuntu/.dotnet`. Note: This change will be visible only when sourcing script.
dotnet-install: Note that the script does not resolve dependencies during installation.
dotnet-install: To check the list of dependencies, go to https://learn.microsoft.com/dotnet/core/install, select your operating system and check the "Dependencies" section.
dotnet-install: Installation finished successfully.
설치 후 PATH 설정.
$ vim ~/.bashrc
export PATH=$PATH:$HOME/.dotnet
export DOTNET_ROOT=$HOME/.dotnet
변경된 bashrc를 적용합니다.
$ source ~/.bashrc
.NET CLI에 대한 TAB 자동완성 활성화
TAB 완성 dotnet은 TAB 키를 입력한 다음 입력하여 .NET CLI를 트리거합니다. 이 가이드에서는 Bash를 사용하여 .NET CLI에 대한 TAB 완성을 설정하는 방법을 설명합니다.
$ vim ~/.bashrc
_dotnet_bash_complete()
{
local word=${COMP_WORDS[COMP_CWORD]}
local completions
completions="$(dotnet complete --position "${COMP_POINT}" "${COMP_LINE}" 2>/dev/null)"
if [ $? -ne 0 ]; then
completions=""
fi
COMPREPLY=( $(compgen -W "$completions" -- "$word") )
}
complete -f -F _dotnet_bash_complete dotnet
변경된 bashrc를 적용합니다.
$ source ~/.bashrc
.NET 시작하기
이제 Ubuntu 20.04에서 .NET Core 6 설치를 테스트하도록 설정되었습니다.
$ dotnet new console --output testapp1
샘플 출력:
Welcome to .NET 6.0!
---------------------
SDK Version: 6.0.405
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
--------------------------------------------------------------------------------------
The template "Console App" was created successfully.
Processing post-creation actions...
Running 'dotnet restore' on /home/ubuntu/testapp1/testapp1.csproj...
Determining projects to restore...
Restored /home/ubuntu/testapp1/testapp1.csproj (in 119 ms).
Restore succeeded.
이제 프로그램을 실행해주세요
$ dotnet run --project testapp1
샘플 출력 결과
반응형