官术网_书友最值得收藏!

Installing .NET Core 2

We're using Ubuntu Server 16.04 LTS in this guide, but these instructions will work on other versions too. Using Advanced Package Tool (APT), we can install .NET Core very easily, but first we will need to add a custom feed as .NET Core is not in the default repository.

First we need to add the .NET Core package source to the list used by APT. The package source is on Azure, so we write this URL (plus some other info) to a file in the folder of sources used by apt-get. We do this by redirecting the standard output of echo to it, using the following command:

sudo sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ xenial main" > /etc/apt/sources.list.d/dotnetdev.list'

All packages are signed with public key cryptography to verify their integrity (read the later chapters for more on this). We import the public key for the .NET Core packages from the Ubuntu key server with the apt-key command:

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 417A0893

We need to update our sources so that the latest changes can be picked up with this simple command:

sudo apt-get update
The update command is different to the upgrade command, but they are often used together. While update simply refreshes the information that APT holds about packages, upgrade allows you to very easily update all of the software on the machine (that hasn't been manually installed) to the latest versions. This can be quite a time-saver.

Now we are in a position to install .NET Core with the following command:

sudo apt-get install dotnet-sdk-2.0.0

If the SDK package ever makes it to the default list of sources, then this will be all you need to do.

If you are trying out a preview, then the package will have the preview tag suffixed (for example, -preview2-006497).

After a wall of text scrolls, assuming you don't get any errors and you see the telemetry notice, you're ready to go. Type dotnet to see the usage information and dotnet --version to see the current version that you are running.

主站蜘蛛池模板: 呼图壁县| 舒城县| 广安市| 河津市| 三门县| 滨海县| 鸡西市| 宝清县| 安龙县| 文成县| 通河县| 堆龙德庆县| 左权县| 元谋县| 开鲁县| 察雅县| 钟山县| 沁源县| 天长市| 乐至县| 达日县| 长岭县| 武城县| 沙坪坝区| 花垣县| 旬邑县| 镶黄旗| 霍林郭勒市| 泸溪县| 滨州市| 安庆市| 万载县| 临沂市| 苍南县| 铁岭县| 阳曲县| 海兴县| 类乌齐县| 永昌县| 郑州市| 黔南|