Hello,
Project developers with .net core can run their projects on linux. I am telling from scratch what they have to do for this.
First of all, you must have a physical or virtual server and have ssh authority. Cheap VDS because we will do all transactions with ssh.
First of all, let's install the [b] WinSCP [/ b] program where we can manage our file and use ssh commands.
https://winscp.net/eng/download.php After installation, let's fill in the fields I show in the picture below and connect.
Then open the ssh command and apply the following codes one by one. Let's first update our server to the latest (I'll install it on ubuntu.)
After logging in as root, let's apply the codes in order.
[b] apt-get update [/ b] ”,“ [b] apt-get upgrade [/ b] ”these commands will take a long time to update the system afterwards
https://dotnet.microsoft.com/download/linux-package-manager/rhel/sdk-current Let's go here and install the aspnet package according to our operating system, I will install it on ubuntu 16.04 and send commands accordingly. We are introducing the following command package. We are installing ilede in the second line.
Code:
wget -q https://packages.microsoft.com/config/ubuntu/16.04/packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
Then we do the following commands in order.
Code:
sudo apt-get install apt-transport-https
sudo apt-get update
sudo apt-get install dotnet-sdk-2.2
When it is completed, our linux is now able to run asp.net core. now
[b] Let's see how we will publish our Asp Net Core Project. [/ b]
[b] First of all, we activate our module with the command below.
[/ b]
Code:
a2enmod proxy proxy_http proxy_html
For each project we will need to create a config file separately for this use the following command
Code:
sudo nano /etc/apache2/conf-enabled/aspnetcoredemo.conf
This is, paste the contents of the configuration file the following codes and save with ctrl + x yes and enter. This content defines the port you will broadcast. It means that we will call this project at port 80
Code:
ProxyPreserveHost On
ProxyPass / http://127.0.0.1:5000/
ProxyPassReverse / http://127.0.0.1:5000/
ErrorLog /var/log/apache2/aspnetcoredemo-error.log
CustomLog /var/log/apache2/aspnetcodedemo-access.log common
Now let's restart apache using the command below.
Code:
sudo service apache2 restart
Apache is now configured to forward requests to http: // localhost: 80 to the ASP.NET Core application running on Kestrel at http://127.0.0.1:5000
Now, it's time to create and publish an Asp net project. For this, run the following commands in order. The commands are to create a new folder and then install a new asp project in that folder.
Code:
mkdir aspnetcoredemo
cd aspnetcoredemo /
dotnet new mvc
Let's use the following code again to publish our aspnet core project that we have already created and copy it to the relevant folder.
Code:
dotnet publish
sudo cp -a ~ / aspnetcoredemo / bin / Debug / netcoreapp2.0 / publish / / var / aspnetcoredemo /
Not over! it means run to this project. So we will run it, we create a configuration file for it.
Code:
sudo nano /etc/systemd/system/kestrel-aspnetcoredemo.service
Then we paste the following code into this configuration file. again ctrl X yes and save with enter.
Code:
[Unit]
Description = Example ASP .NET Web Application running on Ubuntu 16.04
[Service]
WorkingDirectory = / var / aspnetcoredemo
ExecStart = / usr / bin / dotnet /var/aspnetcoredemo/aspnetcoredemo.dll
Restart = always
RestartSec = 10
SyslogIdentifier = dotnet-demo
User = www-data
Environment = ASPNETCORE_ENVIRONMENT = Production
[Install]
WantedBy = multi-user.target
We saved this service file and now we need to run it. Let's send the following codes.
Code:
sudo systemctl enable kestrel-aspnetcoredemo.service
sudo systemctl start kestrel-aspnetcoredemo.service
[b] Now our project is ready. You can have a demo project published directly in the var var / aspnetcoredemo / folder.
[/ b]
If you want to have such a ready corenet server. By placing an order on our site, you can open a support request and say I want to establish a snet core site. CLICK for our vds packages.
Good work..