Develop, run, and deploy .NET Core projects in a full Linux environment!

“

2016 The first official version of .NET Core came out in 2016, and it has now been released to .NET Core 3.1. In another two months, .NET 5 will come as scheduled. Cross-platform development has been almost 5 years, but many people are only on Windows Using Visual Studio + SQL Server to do .NET Core cross-platform development, lack of knowledge of Linux. This time the .NET community invites big coffee to share with you, to develop, run, and deploy .NET Core projects in a full Linux environment! Let us embrace Linux together!

Embrace Linux together

Linux advantages

Linux is completely open source, easy to view the source code and modify and customize. The completely free attribute is also favored by enterprises, and its stability, security, and flexibility are far superior to Windows servers. Nowadays, servers in a large number of data centers around the world have begun to be based on Linux Server platform migration.

Open source components

The well-known high-concurrency components, Redis, MongoDB, RabbitMQ, Nginx, Kafka, etc., are all developed and released based on Linux servers. Although they also provide installation versions for Windows Server, they are all castrated versions. Yes, the version update is seriously delayed, like the performance of Redis under Windows, it does not reach 50% of Linux.

Linux general trend

The current development direction of Internet technology is containerization, K8S, DevOps, and cloud native. 90% of the tool environments are based on Linux. Microsoft has released .NET Core to adapt to Linux, and has also launched VS Code development tools, even SQL Server has a Linux version.

DotNetdaily

Preparation before full Linux development

. NET Core has been released for more than 4 years. There are already complete solutions for development, operation and deployment under Linux. We need to do a series of preparations before starting actual combat. The tools and environments mentioned are also organized at the end of the article. .

Server preparation

Friends who are not used to dual systems can use VMware workstation to get a virtual machine. There are many Linux operating systems. Here I recommend the latest version CentOS8. You may not get used to it at first, just use it.

Development environment preparation

Of course, it is Visual Studio Code, Microsoft products must be excellent, and then the environment of .NET Core3.1. I recommend using [MySQL] (https://cloud.tencent.com/product/cdb?from=10680) as the standard configuration for the database. Don't try to use SQL Server for Linux.

Project framework selection

There is no difference between this and Windows development. This time, the front and back separation architecture is selected. The front-end Vue, the back-end is Core WebApi, the lightweight Dapper selected by O/RM, and it is convenient to connect to MySQL.

Deploy and run

A cluster of Nginx+WebApi instances deployed with Docker containers, then MySQL and Redis are directly installed on the Linux host, and a small project is built.

DotNetdaily

. NET Core full Linux development sharing meeting

After finishing the above preparations, you can start developing, running, and deploying .NET Core projects in a full Linux environment.

In this sharing, I will demonstrate the entire environment installation, complete project handwriting, including the subsequent deployment and online process, on-site stepping (upper and lowercase pits, path pits, deployment pits), etc., and I will sort out the .NET Framework Points for attention when migrating the project to .NET Core and Windows environment to Linux environment, I hope I can give you a little help!

Before you want to share with you, you need to prepare:

1 Prepare a Linux virtual machine based on VMware and configure the network (install the software and activation code below)

2 . NET Core installation and development basis under Linux

3 SSL Toolkit for Linux Management

(Installation package and .NET Core2.2 development explanation video self-selected)

Recommended Posts

Develop, run, and deploy .NET Core projects in a full Linux environment!
Use Jexus 5.8.2 to deploy and run Asp.net core under Centos