DEV Community

Abdulmalik Musa
Abdulmalik Musa

Posted on

Deploy a .NET Core App on Ubuntu

To deploy a .NET Core application on Ubuntu, you can follow these general steps:

Prepare the Ubuntu Server: Set up a clean Ubuntu server with the necessary dependencies. Install .NET Core Runtime and any other required dependencies for your application. You can follow the official Microsoft documentation for detailed instructions on installing .NET Core on Ubuntu.

Build Your Application: On your development machine, build your .NET Core application using the appropriate build commands for your project. Typically, you would use the dotnet build or dotnet publish command to generate the necessary files for deployment.

Transfer Files to Ubuntu: Once your application is built, transfer the application files to your Ubuntu server. You can use various methods such as SCP, SFTP, or Git to transfer the files from your local machine to the Ubuntu server.

Configure and Start the Application: SSH into your Ubuntu server and navigate to the directory where you transferred the application files. Make sure the main application executable (e.g., yourapp.dll or yourapp) is present. You may need to mark the executable as executable using the chmod +x command.

Run the Application: To start your .NET Core application, use the dotnet command followed by the name of the main application executable. For example, dotnet yourapp.dll or dotnet yourapp. This will start the application and make it accessible on the specified port.

Setup Reverse Proxy (optional): If you want to expose your application on a specific domain or port, you can set up a reverse proxy using a web server like Nginx or Apache. This step is optional but can provide additional features such as SSL termination, load balancing, and improved security.

Remember to ensure that your Ubuntu server is properly secured with firewall settings, user permissions, and other necessary measures to protect your deployed application.

These steps provide a general guideline for deploying a .NET Core application on Ubuntu. The exact process may vary depending on your specific application requirements and infrastructure setup.

Top comments (0)