-
-
Save gtabasa1012/9971f202b241eb3dc0ba614d39e83f4f to your computer and use it in GitHub Desktop.
Install .NET Core 2.0.0 SDK for Ubuntu 16.04
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| ## Install .NET Core 2.0.0 SDK on Ubuntu 16.04 64Bits | |
| ## Author: Nilton OS www.linuxpro.com.br | |
| ## https://www.microsoft.com/net/core#linuxubuntu | |
| ## https://docs.microsoft.com/en-us/aspnet/core/publishing/apache-proxy | |
| ## https://medium.com/@renato.groffe/net-core-e-sql-server-em-linux-primeiros-passos-89a7cb475ebd | |
| ## Version 0.1 | |
| curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg | |
| mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg | |
| echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-xenial-prod xenial main" > /etc/apt/sources.list.d/dotnetdev.list | |
| apt-get update && apt-get install -y dotnet-sdk-2.0.0 | |
| #----------------------------------------------------------------------------------------- | |
| ### Create Service in SystemD | |
| echo '[Unit] | |
| Description=Example .NET Web API Application running on Ubuntu | |
| [Service] | |
| WorkingDirectory=/home/appdotnet/WelcomeDotNet | |
| ExecStart=/usr/bin/dotnet bin/Debug/netcoreapp2.0/WelcomeDotNet.dll | |
| Restart=always | |
| RestartSec=10 # Restart service after 10 seconds if dotnet service crashes | |
| SyslogIdentifier=WelcomeDotNet | |
| User=appdotnet | |
| Environment=ASPNETCORE_ENVIRONMENT=Production | |
| [Install] | |
| WantedBy=multi-user.target' > /etc/systemd/system/WelcomeDotNet.service | |
| ### Create user and Project | |
| useradd appdotnet -d /home/appdotnet -m | |
| mkdir -p /home/appdotnet/WelcomeDotNet | |
| cd /home/appdotnet/WelcomeDotNet | |
| dotnet new mvc | |
| dotnet restore | |
| dotnet build | |
| ## dotnet /home/appdotnet/WelcomeDotNet/bin/Debug/netcoreapp2.0/WelcomeDotNet.dll | |
| chown -R appdotnet:appdotnet /home/appdotnet/* | |
| ### Enable and Start Service in SystemD | |
| systemctl enable WelcomeDotNet.service | |
| systemctl start WelcomeDotNet.service | |
| ### Enable Modules in Apacha2 | |
| # a2enmod proxy proxy_balancer proxy_http rewrite | |
| # service apache2 restart | |
| # ProxyPreserveHost On | |
| # ProxyPass / http://127.0.0.1:5000/ | |
| # ProxyPassReverse / http://127.0.0.1:5000/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment