The .NET Core SDK is a set of libraries and tools that enable developers to create .NET Core applications and libraries.
Installation of .Net on Centos Web Panel (CWP) :
rpm -Uvh https://packages.microsoft.com/config/rhel/7/packages-microsoft-prod.rpm
To install dotnet SDK 2.2
yum install dotnet-sdk-2.2 -y
To install dotnet SDK 3.1 LTS :
yum install dotnet-sdk-3.1 -y
you can examine the main .net version by running this command :
dotnet --version
How to Create project - example:
to create a project or download any existing prebuild project you want to follow these steps:
Login into ssh with the username of your account user (ensure you enabled the full shell access for that user)
or from root you can run this command to alter the user
or from root you can run this command to alter the user.
su - username -s /bin/bash
now go to user dir public_html:
cd /home/username/public_html
Download pre-build ASP core project, we're practising "movie-app-list" as an example :
git clone https://github.com/do-community/movie-app-list.git movie-app-list
Then enter the project dir :
cd movie-app-list
before we do the configuration this project requires MySQL DB and MySQL User for its data storage, you can easily create MySQL user and DB from user panel as well as admin panel.
after you create db and its user add those details in "appsettings.json"
{
"Logging": {
"LogLevel": {
"Default": "Warning"
}
},
"AllowedHosts": "*",
"ConnectionStrings": {
"MovieContext": "Server=localhost;User Id=user_netdb;Password=dqrESQo3;Database=user_netdb" } }
Now build the application :
you require to run this as root :
dotnet ef database update
dotnet build
dotnet publish
**upper commands will install csharp and all other dependencies.
Then fix the user permission :
cd /home/username/public_html
chown -R username:username *
Now repeat login to ssh as a user and run the below command to begin the application by default application is set to run on localhost:5000
Now start the application via this command :
$ su - username -s /bin/bash
$ /usr/bin/dotnet /home/username/public_html/movie-app-list/bin/Debug/netcoreapp2.2/publish/MvcMovie.dll
After that Ensure you've installed Nginx from CWP for port 5000 proxy go to :
ADMIN >> Webserver Settings >> Webserserver domain conf >> Choose user >> Create config under domain you need to proxy .net application >> Choose "nginx -> proxy -> (custom-port)" and choose force https template tick rebuild vhost and save changes and done
don't forget to fix your app port!
go to the domain name and see your application is active there.
Troubleshoot guide :
If you get too many files open you simply want to expand the open file limit for the user from edit user account