Install Mono-Complete 4.8 on Ubuntu

2019-07-29 12:49发布

问题:

I'm trying to install Mono 4.8 in a Docker image but I am failing to download. Here is the dockerfile

`
  RUN apt-get update \
  && apt-get install -y curl \
  && rm -rf /var/lib/apt/lists/* \
  && apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys     3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF \
  && echo "deb http://download.mono-project.com/repo/debian wheezy main" >> /etc/apt/sources.list.d/mono-xamarin.list \
  && echo "deb http://download.mono-project.com/repo/debian wheezy-apache24-compat main" >> /etc/apt/sources.list.d/mono-xamarin.list \
  && echo "deb http://download.mono-project.com/repo/debian wheezy-libjpeg62-compat main" >> /etc/apt/sources.list.d/mono-xamarin.list \
  && apt-get update \
  && apt-get install -y clang \
  && apt-get install -y mono-complete=4.8.0.520-0xamarin3 
`

It fails to install mono-compete with this error message

`
E: Version '4.8.0.520-0xamarin3' for 'mono-complete' was not found `

I was wondering what should be the mono-complete 4.8 version?

回答1:

Pin the version to the snapshots directory:

echo "deb http://download.mono-project.com/repo/ubuntu wheezy/snapshots/4.8.0.520 main" | sudo tee /etc/apt/sources.list.d/mono-official.list
sudo apt-get update

After modifying/update the caches, you can use apt-cache policy {package} to determine if the version you wish to install is available.

>apt-cache policy mono-complete
mono-complete:
  Installed: (none)
  Candidate: 4.8.0.520-0xamarin3
  Version table:
     4.8.0.520-0xamarin3 500
        500 http://download.mono-project.com/repo/ubuntu wheezy/snapshots/4.8.0.520/main amd64 Packages
     4.6.2.7+dfsg-1ubuntu1 500
        500 http://us.archive.ubuntu.com/ubuntu artful/universe amd64 Packages

Now you can install 4.8.0.520-0xamarin3:

sudo apt-get install -y mono-complete=4.8.0.520-0xamarin3 


标签: ubuntu mono