简体   繁体   中英

Cannot install .NET on Ubuntu 18.04

I followed the official installation page for installing .NET 6.0 on Ubuntu 18.04 but I am not able to succeed.

The page told me to do:

wget https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb

sudo dpkg -i packages-microsoft-prod.deb

rm packages-microsoft-prod.deb

And then:

sudo apt-get update; \
  sudo apt-get install -y apt-transport-https && \
  sudo apt-get update && \
  sudo apt-get install -y dotnet-sdk-6.0

I get the following result:

Reading state information... Done
E: Unable to locate package dotnet-sdk-6.0
E: Couldn't find any package by glob 'dotnet-sdk-6.0'
E: Couldn't find any package by regex 'dotnet-sdk-6.0'

When I do "apt search do.net 6" the package do.net-sdk-6.0/bionic is shown. But I am not able to install this, I get the same error as before.

I also tried installing with snap. But that is not working either. After giving it the alias do.net (like was told on the installation page) I get the following: /snap/do.net-sdk/79/snap/command-chain/snapcraft-runner: 3: exec: /snap/do.net-sdk/79/do.net: not found

Can somebody please help me with this? Or tell me the reason why it is not working.

if you upgraded to Ubuntu 22.04, first install SSL 1.0

http://security.ubuntu.com/ubuntu/pool/main/o/openssl1.0/libssl1.0.0_1.0.2n-1ubuntu5.8_amd64.deb

and then follow standard instructions:

https://learn.microsoft.com/en-US/do.net/core/install/linux-ubuntu#2110

------ EDIT

I now prefer a "portable" way of using several SDKs on the same Linux machine:

  • download .NET 3.1 and .NET 6.0 as x64 binaries from https://do.net.microsoft.com/en-us/download/do.net

  • Unpack the TAR.GZ files: do.net-sdk-3.1.423-linux-x64.tar.gz and do.net-sdk-6.0.401-linux-x64.tar.gz currently

  • Copy everything into a folder, eg /opt/do.net; first .NET 3.1 then .NET 6.0; overwrite files if necessary

  • Update your Bash/Zsh profile to point to their location

    export DO.NET_ROOT=/opt/do.net

    export PATH=$PATH:$DO.NET_ROOT:$DO.NET_ROOT/tools

  • Reboot and enjoy:

在此处输入图像描述

On what architecture are you running your ubuntu 18.04?

If you want to use dotnet 6, you also could download the binary file and install it.

Installation inside your home directory.

mkdir ~/.dotnet 
cd ~/.dotnet
wget https://download.visualstudio.microsoft.com/download/pr/17b6759f-1af0-41bc-ab12-209ba0377779/e8d02195dbf1434b940e0f05ae086453/dotnet-sdk-6.0.100-linux-x64.tar.gz
tar -xf dotnet-sdk-6.0.100-linux-x64.tar.gz
export PATH="$PATH:$HOME/.dotnet"
rm -rf dotnet-sdk-6.0.100-linux-x64.tar.gz

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM