This blog demonstrates .Net installation and how to build a .Net based application on Oracle Linux in Oracle Cloud Infrastructure (OCI). .NET is an open source software framework for building cross-platform applications on Oracle Linux. With .Net, you can build various applications in supported languages such as C#, F#, and Visual basic.

Use the following steps to install .NET SDK and runtime on Oracle Linux 8 and build a simple web application on Oracle Linux.

A graphic depicting the Oracle Linux and .Net logos in a green circle.

Step 1

Create an Oracle Linux 8 instance in OCI and install the following packages. Ensure that these libraries are installed in Oracle Linux.

  • krb5-libs

  • libicu

  • openssl-libs

  • zlib

A screenshot of the code showing the packages and libraries for this example.

Step 2

Verify the prerequisites and ensure that system meets the .NET dependencies and requirements highlighted in red.

A screenshot of the code to verify the package with the requirements in red.

Step 3

Open a terminal and run the following commands to extract the downloaded .NET SDK:

# cd /opt/dotnet
# mkdir 5.0
# mkdir dotnetapp
# tar xvzf dotnet-sdk-5.0.407-linux-x64.tar.gz -C /var/opt/5.0/

Step 4

Run the dotnet command in the terminal, which verifies that .NET is correctly installed. Check the .Net version, SDK, and runtimes.

$ dotnet --list-sdks
5.0.407 [/opt/dotnet/5.0/sdk]
$ dotnet --list-runtimes
Microsoft.AspNetCore.App 5.0.16 [/opt/dotnet/5.0/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 5.0.16 [/opt/dotnet/5.0/shared/Microsoft.NETCore.App]

A screenshot of the resulting code for extracting the tar.

Step 5

Let’s build the first C# application in Oracle Linux 8. The “dotnet new console” command creates a Console application and “-o” create a directory.

A screenshot of the code for creating a net app.

The main file in the mydotnet5.0App folder is called Program.cs, I modified Program.cs. By default, it contains the necessary code to write “Hello, World!” to the Console.

Let’s test and run the C# application. Go to mydotnet5.0App directory and run the command, $ dotnet run.

A screenshot of the Hello World! result from testing the C# app.

Step 6

Now let’s create the ASP.NET web application.

A screenshot of the resulting code from creating the ASP.NET application.

Run the ASP.NET web application.

A screenshot of the code running the ASP.NET application.

Run ASP.NET web application on your web browser.

A screenshot of the web browser running the ASP.NET application.

Conclusion

I hope that this blog helps you understand .NET installation and web application creation concepts on Oracle Linux. Find out if OCI is right for your use cases by trying it. Sign up for our Oracle Cloud Free Tier, which includes over 20 cloud services free forever and US$300 in credit of more services for a 30-day trial.

If you have any questions regarding .NET deployment in Oracle Cloud Infrastructure, post them in the comments.

For more information, see the following resources: