简体   繁体   中英

How can I offline install .NET Core and SDK on Linux (RHEL)?

I have to install .NET Core 2.0 and SDK on a Linux machine ( Red Hat Linux (RHEL) distribution) server, where there isn't any Internet connectivity. How can I do it?

I extracted the .NET Core 2.2 package into a directory, /dotnet , on Linux openSUSE 42.1.

Then in a terminal:

sudo ln -sf "/dotnet" "usr/bin/dotnet"

export PATH=/usr/bin/dotnet:$netcorepkgs`

Then in the terminal, the dotnet command works:

dotnet --version

Output:

2.2.104

You can download the binaries for the .NET Core version you are interested at the All Downloads page. Pick the version you are interested in. Then inside that version, there will be a Linux section, select the "x64 Binaries" link, which will download the .tar.gz file you can put on the machine and extract to any directory.

These steps worked for me in CentOS 7:

Download these packages on a CentOS 7 system that is connected to the Internet by these commands:

yumdownloader --destdir=/etc/LinuxRepos/DOTNETSDK2.2.402 dotnet-host-3.0.0-x64.rpm
yumdownloader --destdir=/etc/LinuxRepos/DOTNETSDK2.2.402 dotnet-runtime-deps-2.2.7-rhel.7-x64.rpm4.
yumdownloader --destdir=/etc/LinuxRepos/DOTNETSDK2.2.402 dotnet-runtime-2.2.7-x64.rpm
yumdownloader --destdir=/etc/LinuxRepos/DOTNETSDK2.2.402 aspnetcore-runtime-2.2.7-x64.rpm
yumdownloader --destdir=/etc/LinuxRepos/DOTNETSDK2.2.402 dotnet-sdk-2.2.402-x64.rpm

Now you have all of necessary rpm's in the path:

/etc/LinuxRepos/DOTNETSDK2.2.402

Transfer them to the target offline CentOS system and run these commands (in order) to install SDK 2.2.402:

sudo yum localinstall dotnet-host-3.0.0-x64.rpm
sudo yum localinstall dotnet-hostfxr-2.2.7-x64.rpm
sudo yum localinstall dotnet-runtime-deps-2.2.7-rhel.7-x64.rpm4.
sudo yum localinstall dotnet-runtime-2.2.7-x64.rpm
sudo yum localinstall aspnetcore-runtime-2.2.7-x64.rpm
sudo yum localinstall dotnet-sdk-2.2.402-x64.rpm

If any one of them failed due to a dependency then download by yumdownloader and install the related dependency.

Run dotnet --version and enjoy!

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