Are you developing on .NET Core? Let’s go to Ubuntu, I’ve prepared everything
Photo by Kevin Horvat
For all 12 years of my career I have been working with .NET and have been strongly riveted to Windows and proprietary development tools.
But, thanks to Microsoft, .NET Core has changed everything and now it is possible to develop .NET applications on almost any platform. Not so long ago, I decided to move to Ubuntu. In this article I will share what I learned and try simplify this process for those who also want to try Linux development with .NET Core.
First of all, I really liked the result. All the necessary tools worked well. Development process became fluid almost immediately. Also Docker and Kubernetes made the moving process much easier. But, due to poor knowledge of the OS, bash and the confusion of the installation options for some tools (e.g. Docker), the initial setup took more than a day. That is, the process is quite long and sometimes confusing.
In order to save time in future for myself and for those who want to try Linux with .NET Core, I prepared a Github repository with a couple of bash scripts. You can run them on clean Ubuntu installation and they will set everything up while you are sitting and drinking coffee. Also, if required, these scripts can be easily modified to fit your needs.
In order to understand these scripts only a basic understanding of bash is required. All interesting points are provided with links explaining relevant topics. Also, a person who knows Linux well will most likely find non-optimal moments in these scripts (if you find them, let me know, please, I will be very grateful to you).
There are five files in the repository — three bash scripts and two config files for Kubernetes. Let’s look to each of these scripts.
Sorry, but the first script is the main candidate for customization, or even a pass.
First of all, this script installs a hypervisor for the further launch of Kubernetes. I chose Virtualbox, but it is also possible to run on KVM or without a hypervisor at all. Each option has its own nuances, so the final choice of hypervisor is yours.
The script also installs the Russian language pack. You can install the one you need by simply changing the language codes or you can comment these lines.
When the script completes, you need to reboot so that Virtualbox can configure itself before installing the rest of the tools.
The biggest and most useful script does the following:
- Installs Git, .NET Core 3.1 SDK, Nodejs.
- Installs Docker Community Edition and adds Docker repository to the registry to perform updates.
- Checks that Virtualbox or KVM is installed and installs Minikube.
- Installs Visual Studio Code and adds several extensions which are useful for frontend and backend development: Gitlens, TSLint, Prettier, Stylelint, C#, Docker tools, Kubernetes tools, Kubernetes Support.
This script configures previously installed tools. Namely:
- Requests git username and email to configure them globally.
- Suggests you to set VS Code as a default git editor.
- Suggests you to install libsecret and use it to store Git passwords in encrypted form.
- Adds the current user to the «docker» group, which is necessary for working with Docker commands without the constant use of sudo.
- Starts Minikube and configures Kubernetes dashboard to manage cluster via Web UI.
- Creates user with admin privileges at Minikube to access dashboard. minikube_admin_user.yaml and minikube_role_binding.yaml files are used for that.
- Displays instructions for obtaining a token and access the Kubernetes dashboard.
For Docker access settings to take effect, you need to log out and restart the Docker service. Or you can simply reboot.
I hope these scripts will be useful for those who want to quickly get comfortable with Ubuntu and development for .NET Core.
Happy .NET development!
Only registered users can participate in poll.Log in, please.
Have you already tried .NET development on Linux?
50% I have not tried and do not plan to try. Windows gives me all I need. 3
16.67% I have tried and didn’t like it 1
0% I have tried recently, everything is great. 0
33.33% I have been using Linux for a long time and I am not going to return to Windows. 2
6 users voted. 2 users abstained.