How to install Nuget on Amazon Linux

2.5k views Asked by At

I'm trying to get Nuget installed on an Amazon Linux image. My goal is to do some research with the AWS .NET SDK that has some support for .netcore.

I have tried three (On a fresh instance each attempt) primary installation methods.

1 - Install .netcore then compile Nuget from source.

I installed .netcore successfully following the directions here although I modified (my changes are in bold) how the updates to the path are persisted by using these steps:

# sudo yum install libunwind libicu -y
# curl -sSL -o dotnet.tar.gz https://go.microsoft.com/fwlink/?LinkID=835019
# sudo mkdir -p /opt/dotnet && sudo tar zxf dotnet.tar.gz -C /opt/dotnet
**# echo 'pathmunge /opt/dotnet' > /etc/profile.d/dotnetcore.sh**
**# chmod +x /etc/profile.d/dotnetcore.sh**
**# . /etc/profile**

I then cloned the Nuget code from here https://github.com/NuGet/NuGet.Client and ran build.sh which completed successfully but did not create an artifacts subdirectory with a Nuget executable. This method was only meant to install the NuGet CLI - not the package manager - but installed neither. Only the CLI is supported on Linux according to this site: https://docs.nuget.org/ndocs/guides/install-nuget ("The NuGet CLI is the command-line utility that works on Windows, Mac OS X, and Linux and supports all NuGet capabilities.")

2 - Install Mono and run "yum install nuget"

I successfully installed Mono by executing these steps:

# sudo yum -y install cmake bison gettext glib2 freetype fontconfig libpng
         libpng-devel libX11 libX11-devel glib2-devel libexif glibc-devel 
         urw-fonts java       
         unzip gcc gcc-c++ automake autoconf libtool make bzip2 wget
# cd /usr/local/src
# sudo wget http://download.mono-project.com/sources/mono/mono-4.8.0.382.tar.bz2
# sudo tar jxf mono-4.8.0.382.tar.bz2
# cd mono-4.8.0
# sudo ./configure --prefix=/opt/mono
# sudo make 
# sudo make install

After mono was installed and tested I added some repos with the following commands:

# rpm --import "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF"
# yum-config-manager --add-repo http://download.mono-project.com/repo/centos/
# yum-config-manager --add-repo http://download.mono-project.com/repo/centos-nightly/

I received a dependency error when I ran the yum install nuget command, the results:

Loaded plugins: priorities, update-motd, upgrade-helper
amzn-main/latest                                                                                                                      
amzn-updates/latest                                                                                                                   
Resolving Dependencies
--> Running transaction check
---> Package nuget.noarch 0:2.12+mono-0.xamarin.1 will be installed
--> Processing Dependency: mono(Microsoft.Build.Engine) = 4.0.0.0 for package: nuget-2.12+mono-0.xamarin.1.noarch
--> Processing Dependency: mono(System.ServiceModel) = 4.0.0.0 for package: nuget-2.12+mono-0.xamarin.1.noarch
--> Processing Dependency: mono(Microsoft.Build.Framework) = 4.0.0.0 for package: nuget-2.12+mono-0.xamarin.1.noarch
--> Processing Dependency: mono(System.Xml.Linq) = 4.0.0.0 for package: nuget-2.12+mono-0.xamarin.1.noarch
--> Processing Dependency: mono(System.Runtime.Serialization) = 4.0.0.0 for package: nuget-2.12+mono-0.xamarin.1.noarch
--> Processing Dependency: mono(WindowsBase) = 4.0.0.0 for package: nuget-2.12+mono-0.xamarin.1.noarch
--> Processing Dependency: mono(Microsoft.CSharp) = 4.0.0.0 for package: nuget-2.12+mono-0.xamarin.1.noarch
--> Processing Dependency: mono(System.ComponentModel.DataAnnotations) = 4.0.0.0 for package: nuget-2.12+mono-0.xamarin.1.noarch
--> Processing Dependency: mono(Microsoft.Build) = 4.0.0.0 for package: nuget-2.12+mono-0.xamarin.1.noarch
--> Processing Dependency: mono(System.Security) = 4.0.0.0 for package: nuget-2.12+mono-0.xamarin.1.noarch
--> Processing Dependency: mono(System.ComponentModel.Composition) = 4.0.0.0 for package: nuget-2.12+mono-0.xamarin.1.noarch
--> Processing Dependency: mono(mscorlib) = 4.0.0.0 for package: nuget-2.12+mono-0.xamarin.1.noarch
--> Processing Dependency: mono(System) = 4.0.0.0 for package: nuget-2.12+mono-0.xamarin.1.noarch
--> Processing Dependency: mono(System.Core) = 4.0.0.0 for package: nuget-2.12+mono-0.xamarin.1.noarch
--> Processing Dependency: mono(System.Xml) = 4.0.0.0 for package: nuget-2.12+mono-0.xamarin.1.noarch
--> Processing Dependency: mono(System.Data.Services.Client) = 4.0.0.0 for package: nuget-2.12+mono-0.xamarin.1.noarch
--> Running transaction check
---> Package mono-core.x86_64 0:4.9.0.1028-0.nightly.1 will be installed
--> Processing Dependency: mono(System.ServiceProcess) = 4.0.0.0 for package: mono-core-4.9.0.1028-0.nightly.1.x86_64
--> Processing Dependency: libgdiplus0 for package: mono-core-4.9.0.1028-0.nightly.1.x86_64
---> Package mono-data.x86_64 0:4.9.0.1028-0.nightly.1 will be installed
---> Package mono-devel.x86_64 0:4.9.0.1028-0.nightly.1 will be installed
--> Processing Dependency: mono-data-oracle = 4.9.0.1028 for package: mono-devel-4.9.0.1028-0.nightly.1.x86_64
--> Processing Dependency: mono-winforms = 4.9.0.1028 for package: mono-devel-4.9.0.1028-0.nightly.1.x86_64
--> Processing Dependency: libgdiplus-devel for package: mono-devel-4.9.0.1028-0.nightly.1.x86_64
--> Processing Dependency: libmonosgen-2.0.so.1()(64bit) for package: mono-devel-4.9.0.1028-0.nightly.1.x86_64
---> Package mono-wcf.x86_64 0:4.9.0.1028-0.nightly.1 will be installed
--> Processing Dependency: mono(System.Web.Extensions) = 4.0.0.0 for package: mono-wcf-4.9.0.1028-0.nightly.1.x86_64
---> Package mono-web.x86_64 0:4.9.0.1028-0.nightly.1 will be installed
--> Processing Dependency: mono(Mono.Data.Sqlite) = 4.0.0.0 for package: mono-web-4.9.0.1028-0.nightly.1.x86_64
---> Package mono-winfxcore.x86_64 0:4.9.0.1028-0.nightly.1 will be installed
--> Running transaction check
---> Package libgdiplus-devel.x86_64 0:3.12-1 will be installed
---> Package libgdiplus0.x86_64 0:3.12-1 will be installed
--> Processing Dependency: libpng15.so.15(PNG15_0)(64bit) for package: libgdiplus0-3.12-1.x86_64
--> Processing Dependency: libtiff.so.5(LIBTIFF_4.0)(64bit) for package: libgdiplus0-3.12-1.x86_64
--> Processing Dependency: libtiff.so.5()(64bit) for package: libgdiplus0-3.12-1.x86_64
--> Processing Dependency: libcairo.so.2()(64bit) for package: libgdiplus0-3.12-1.x86_64
--> Processing Dependency: libpng15.so.15()(64bit) for package: libgdiplus0-3.12-1.x86_64
---> Package libmonosgen-2_0-1.x86_64 0:4.9.0.1028-0.nightly.1 will be installed
---> Package mono-data-oracle.x86_64 0:4.9.0.1028-0.nightly.1 will be installed
---> Package mono-data-sqlite.x86_64 0:4.9.0.1028-0.nightly.1 will be installed
---> Package mono-extras.x86_64 0:4.9.0.1028-0.nightly.1 will be installed
---> Package mono-mvc.x86_64 0:4.9.0.1028-0.nightly.1 will be installed
---> Package mono-winforms.x86_64 0:4.9.0.1028-0.nightly.1 will be installed
--> Running transaction check
---> Package cairo.x86_64 0:1.12.14-6.8.amzn1 will be installed
--> Processing Dependency: libpixman-1.so.0()(64bit) for package: cairo-1.12.14-6.8.amzn1.x86_64
---> Package libgdiplus0.x86_64 0:3.12-1 will be installed
--> Processing Dependency: libpng15.so.15(PNG15_0)(64bit) for package: libgdiplus0-3.12-1.x86_64
--> Processing Dependency: libpng15.so.15()(64bit) for package: libgdiplus0-3.12-1.x86_64
---> Package libtiff.x86_64 0:4.0.3-25.27.amzn1 will be installed
--> Processing Dependency: libjbig.so.2.0()(64bit) for package: libtiff-4.0.3-25.27.amzn1.x86_64
--> Running transaction check
---> Package jbigkit-libs.x86_64 0:2.0-11.4.amzn1 will be installed
---> Package libgdiplus0.x86_64 0:3.12-1 will be installed
--> Processing Dependency: libpng15.so.15(PNG15_0)(64bit) for package: libgdiplus0-3.12-1.x86_64
--> Processing Dependency: libpng15.so.15()(64bit) for package: libgdiplus0-3.12-1.x86_64
---> Package pixman.x86_64 0:0.32.4-4.11.amzn1 will be installed
--> Finished Dependency Resolution
**Error: Package: libgdiplus0-3.12-1.x86_64 (download.mono-project.com_repo_centos_)**
       **Requires: libpng15.so.15()(64bit)**
**Error: Package: libgdiplus0-3.12-1.x86_64 (download.mono-project.com_repo_centos_)**
       **Requires: libpng15.so.15(PNG15_0)(64bit)**
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest

I tried re-installing with the --skip-broken command but nuget did not install.

At this point I tried to manually update the Libpng packages by building the latest Libpng code from here http://www.libpng.org/pub/png/libpng.html

At this point I am begining to reach the limit of my linux abilities. I was able to successfull build the libpng with

./configure
make
make install

But I am not certain the libraries where updated OR if I just now have TWO versions of libpng. I am not certain how to see which version is being used by Yum.

3 - Install .net core then run "yum install nuget"

I get the exact same error that I received in attempt #2.

1

There are 1 answers

0
NickEm On

Just ran on the same issue, was able to resolve it by installing manually libpng. If you are on the same environment now, at first delete current libpng.

yum remove libpng

After that you can do this in the way:

mkdir -p /tmp/dependencies
cd /tmp/dependencies
wget https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/Packages/l/libpng15-1.5.28-2.fc26.x86_64.rpm
yum install -y libpng15-1.5.28-2.fc26.x86_64.rpm
yum install -y yum-utils
rpm --import "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF"
yum-config-manager --add-repo http://download.mono-project.com/repo/centos/
yum clean all
yum makecache
yum install -y mono-complete nuget
cd
rm -rf /tmp/dependencies

NOTE: Make sure also you have enabled EPEL on machine.

Also could be that you didn't succeed because you didn't clear yum cache dependency.