Net Core Geliştirme Ortamının Linux Ubuntu Dağıtımı Üzerine Kurulması
Microsft .Net Core SDK ortamı an itibari ile 5.0 versiyonu bulunmaktadır ve snap paket yöneticisi ile kurulabilmetedir. Kurulum Ubuntu18.04 üzerinde gerçekleştirilmiştir.
Kullanacağımız işletim sisteminde; uygulama geliştirmek için SDK paketinin, geliştirilen uygulamanın çalıştırılması için ise runtime paketinin kurulması gereklidir.
1 - Snap Paket Yöneticisinin Kurulması
$ sudo apt update $ sudo apt install snapd2 - .Net Core SDK Kurulumu
$ sudo snap install dotnet-sdk --classic --channel=5.0 $ sudo snap alias dotnet-sdk.dotnet dotnet3 - .Net Core RunTime Kurulumu
$ sudo snap install dotnet-runtime-50 --classic $ sudo snap alias dotnet-runtime-50.dotnet dotnet4 - Ortam Değişkeninin Tanımlanması
$ export DOTNET_ROOT=/snap/dotnet-sdk/current5 - TLS/SSL Sertifika Hatasında (Opsiyonel)
$ export SSL_CERT_FILE=[path-to-certificate-file:/etc/ssl/certs/ca-certificates.crt] $ export SSL_CERT_DIR=/dev/nullSnap kullanılarak 5.0 versiyonu yüklendikten sonra root kullanıcı olmadan çalıştıramama hatası (cannot snap-exec: cannot exec "/snap/dotnet-sdk/140/snap/command-chain/snapcraft-runner": permission denied) Bu hata ile ilgili dotNet core github da bir script yer almakta ilgili hata (https://github.com/dotnet/core/issues/4446) adresinden detaylı biçimde incelenebilir.
# Install the .NET 5 SDK as a snap package. # The snap package will automatically be mounted. snap install dotnet-sdk --channel=5.0/beta --classic # To find out where the snap package has been mounted, # list all block devices and look for /snap/dotnet-sdk/ # in the MOUNTPOINT column. Remember the name of the loop # device. lsblk # To get the actual path of the snap package file, run # the following command with the name of the loop device. # Replace XXX with the number of your loop device. # The path in the BACK-FILE column points to the snap package. losetup --list /dev/loopXXX # Create a folder where we're extracting the snap package into. mkdir dotnet-snap-fix cd dotnet-snap-fix # Extract the snap package into this directory. # Add the correct BACK-FILE path to your snap package here. sudo unsquashfs /var/lib/snapd/snaps/dotnet-sdk_67.snap # Change the permissions of the snap folder containing the runner # to be readable and executable. This will fix the permission problem. sudo chmod -R +rx ./squashfs-root/snap/ # Create a new snap package with the changed permissions. # Make sure to use the same file name as in the BACK-FILE path. sudo mksquashfs ./squashfs-root/ dotnet-sdk_67.snap -comp xz -all-root # Overwrite the old snap package with our new one. # Make sure the file name is correct (same as in BACK-FILE). sudo mv ./dotnet-sdk_67.snap /var/lib/snapd/snaps/ # Finally reboot your machine so the changes are detected. sudo reboot # Do not use snap disable / snap enable, they will replace the # fixed snap package with the broken one again. # After the reboot, the dotnet-sdk.dotnet command will work without sudo. dotnet-sdk.dotnet
Yorumlar
Yorum Gönder