4

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?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Kushhh Alll
  • 91
  • 1
  • 6

3 Answers3

6

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
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
unos baghaii
  • 2,539
  • 4
  • 25
  • 42
2

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.

Eric Erhardt
  • 2,286
  • 15
  • 19
  • thanks eric, I am able to successfully extract binaries to a folder in RHEL. However, running command 'dotnet' results in the error - 'dotnet: command not found'. should be execute any futher steps after extraction ? ~/coreprojects > dotnet -bash: dotnet: command not found – Kushhh Alll Jun 30 '18 at 07:48
  • after setting the path using 'export PATH=$PATH:$netcorepkgs', 'dotnet' command works only on the directory on which binaries are exported. I have 2 questions 1. How to set path permanently 2. how to make this installation global ? i.e dotnet command should work from any other directory – Kushhh Alll Jun 30 '18 at 14:41
  • What our installers do to make this permanently on the $PATH is to create a symbolic link between where `dotnet` is installed and `/usr/bin`. You can do this with: `sudo ln -sf "/path/where/installed/dotnet" "/usr/bin/dotnet"` – Eric Erhardt Jul 06 '18 at 17:24
0

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!

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131