Deploy .NET Core +SqlServer application to Ubuntu
Tools used:
SSH – Windows Native
DOS – Windows Native
SSMS – download https://docs.microsoft.com/en-us/sql/ssms/download-sql-server-management-studio-ssms?view=sql-server-ver15
FileZilla – download https://filezilla-project.org/download.php?platform=win64
How I did :
SSH : Install SqlServer: https://docs.microsoft.com/en-us/sql/linux/quickstart-install-connect-ubuntu?view=sql-server-ver15
SSMS: Copy database with SSMS export data
DOS : Windows Compile application for Linux: dotnet publish -r linux-x64
Filezilla: Transfer with FileZilla all files: manual
SSH -Change permission chmod +777 <application name> – to can execute
SSH –execute: sudo ./<application name>–urls http://<ip>:8090
Note: Pay attention to Environment Variables on Linux – it did not work . See https://docs.microsoft.com/en-us/dotnet/api/system.environment.getenvironmentvariables?view=netcore-2.0 . It did not work for me with Export.
Maybe it is better to configure as Linux Service, as in
https://irina.codes/net-api-as-a-linux-service/
https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/linux-apache?view=aspnetcore-5.0
Add
Environment=ASPNETCORE_URLS=http://asdasd:port/
Also, for editing in ssh , sudo nano name.of.the.service
Also, to start , sudo systemctl start name.of.the.service
Also, to start at startup, sudo systemctl enable name.of.the.service
Leave a Reply