(MVC) MVC (2020)

Deploy ASP.NET Core application from scratch (install and tune SSH/VNC/FTP/NGINX/Daemon)

I have a dozens various instructions about tuning linux, and now I want to list all needed steps to deploy ASP.NET Core application in OpenSuse.

1. Install linux

For this guide I done clear installation, configuring IP address in Linux machine and set router to access to this machine from inet.



To check IP address your machine use special SUSE command instead common linux Ifconfig command.



2. Start and configure sshd and vncmanager.service

SSHD no need to configure in actual version of SUSE - need only start it and set start it in boot time.



VNC server need to prepare more carefully.



Then need to set at least two command vncpasswd and I recomend you install minimum resolution for start vncserver -geometry 640x480 manually by command or in config. Need provide start VNC server in boot time too.

.

Also need to prepare client.



If VNC server working in minimal resolution, you can change resolution to bigger by xrandr.



Main command to working with VNC server is check service status systemctl status vncmanager.service, similar command is exist to check sshd service rcsshd start.



In practice not need to install to Windows computer Putty, I always use mRemoteNG from win machine or command string in Linux machine. From Windows machine is exist two great VNC client - RealVnc amd TigerVnc.



I would recommend you turn off Linux Firewall for beginners, you will tune it in any time later. You can do manipulation with Firewall service in command line systemctl status/stop/stop/status firewalld or in Yast dialog.





3. FTP server

Without FTP will be impossible to upload and update you program to server. FTP service need to add zypper -n install vsftpd, than need to create config files, for development I use this ftp config, also I set extended permission to folder and files by command chmod -R 755 /srv/ftp - this is developer mode server, for production server need set permission more carefully.



To control FTP server use command systemctl start/stop/status vsftpd.

4. Install .net core

There are some choice to install .net core, this is full developer machine, therefore I install to it full net core, in production more runtime version is enough. Need firstly adding a repository with dot net, than install dotnet core. Below you can see a list on command to add repository

sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
wget https://packages.microsoft.com/config/opensuse/15/prod.repo
sudo mv prod.repo /etc/zypp/repos.d/microsoft-prod.repo
sudo chown root:root /etc/zypp/repos.d/microsoft-prod.repo

Than need to install .net core zypper install dotnet-sdk-3.1. And than reboot shutdown -r now .



5. Deploy application

There are some choice to deploy application for server, for me is so stupid to copy source code to server and compile source code in server. I doing this work in VS2019 in Windows machine. Therefore I simple copy framework independent DLL (result of compilation from debug folder) to server. Another options is self-contained DLL (with all library), but its also stupid case for public site, because goal of kestrel is automatically uploading all application dependency. Maybe another choice has sense to embedded device isolated from inet or for developer used VS Code, but these choice is not applicable for me.



6. First start your program

This is a good time to check success of all previous step. Connect after reboot to your server by VNC, upload you program, check working directory to /srv/ftp and do first start you program /usr/bin/dotnet /srv/ftp/CoreLinux.dll. Changing folder before start cd srv/ftp/ is important, without this changing root directory would to /home.



Check site locally by Firefox in VNC is often impossible, then I recommend you to install elinks - it working fine in any case.



If you have success in this step this is a good time to moving forward.

7. Install and tune Nginx

There are some choice to forwarding kestrel to internet, Apache or Nginx web servers, in this case I select Nginx sudo apt-get install nginx.



In the screen below you can see Nginx config after installation, need to change this config to force Nginx as reversyProxy. In my developer SUSE-server config looks as this - nginx.conf, then service nginx restart.



And finally, if forwarding to inet is working fine, you can check your site outside.



If this step will be success you immediately see attack to you site. This is normal, simple ignore it, because any crack in our world is expected PHP installation in server.



8. Change source code to apply Nginx reversyProxy mode

Working with Nginx to cache Kestrel need to add two header to your web site.



9. Demonize kestrel application as a background service

In this step I have full workable application, I use this public template VB.NET.ASP.NET.Core.3.1.AuditAttribute and I see all headers of request.



Next step is creation service from kestrel apps. The goal of this step is automatically restart application in linux boot process and show this journal in filesystem instead console. For demonize my apps I use file kestrel-1.service and place it to /etc/systemd/system/, then start service systemctl enable kestrel-1.service, systemctl start kestrel-1.service. For check status I use a GUI.



In linux there are so many various log, I recommended you install and use KSystemLog and show kestrel log and your application log by this program.





Comments ( )
<00>  <01>  <02>  <03>  <04>  <05>  <06>  <07>  <08>  <09>  <10>  <11>  <12>  <13>  <14>  <15>  <16>  <17>  <18>  <19>  <20
Link to this page: http://www.vb-net.com/DeployCoreToLinux/Index.htm
<SITEMAP>  <MVC>  <ASP>  <NET>  <DATA>  <KIOSK>  <FLEX>  <SQL>  <NOTES>  <LINUX>  <MONO>  <FREEWARE>  <DOCS>  <ENG>  <MAIL ME>  <ABOUT ME>  < THANKS ME>