Segue um breve passo-a-passo de como instalar o .NET 8 no Ubuntu 22.04.
declare repo_version=$(if command -v lsb_release &> /dev/null; then lsb_release -r -s; else grep -oP '(?<=^VERSION_ID=).+' /etc/os-release | tr -d '"'; fi) wget https://packages.microsoft.com/config/ubuntu/$repo_version/packages-microsoft-prod.deb -O packages-microsoft-prod.deb dpkg -i packages-microsoft-prod.deb rm packages-microsoft-prod.deb sudo apt update apt install dotnet-sdk-8.0
mkdir /apps cd /apps dotnet new mvc -o teste dotnet dev-certs https --trust
dotnet run Após realizar qualquer mudança utilize do build para compilar novamente dotnet build
dotnet publish -c Release -o ./bin/Publish
dotnet bin/Publish/teste.dll
cd /etc/systemd/system --> Criar o arquivo vim app.service --> Editar o arquivo com os seguintes dados. [Unit] Description=App Teste [Service] WorkingDirectory=/app/teste/bin/Publish ExecStart=/usr/bin/dotnet /app/teste/bin/Publish/teste.dll Restart=always RestartSec=10 KillSignal=SIGINT SyslogIdentifier=App-Teste User=ubuntu [Install] WantedBy=multi-user.targetEm um prompt de comando use o seguinte comando para acompanhar o log para possíveis erros.
tail -f /var/log/syslogInstale e inicie o seviço
systemctl enable app.service systemctl start app.service se necessário systemctl daemon-reload