12 Mayıs 2019 Pazar

apt-get komutu

Giriş
add-apt-repository, apt ile kardeştir. Kurulan paketler global (system wide) olarak kurulur. Kullanıcı silinince paket silinmez. System wide kurulum yapmayan başka paket yöneticileri de var ancak ben kullanmadım.

apt-get komutunun nasıl çalıştığı burada.

Yeni Kurulum Yapınca, Açık ve Çalışmakta Olan Sürüm Etkilenmez
Açıklaması şöyle.
With Windows, replacing a file that is in use by a running process can badly affect that process. The process will reference locations within that file and get incorrect information from it, usually with catastrophic results. That's why a Windows update generally requires a reboot to ensure that all processes are using correct versions of libraries etc.

With Unix, once a file has been opened by a process, that same file will always be available to the process even if the original file is removed from the filesystem.

After an update, the filesystem will contain a different version of the file, and all process that start after the update will use that new file. But, unlike Windows, all old Unix processes will continue using the original files that they started with. Even though no longer accessible via the filesystem, those files will persist as long as any process is using them. Eventually, when no processes are using the files, the old version of the files will finally be deleted.
Tek problem uygulamanın spawn veya fork()/exec() yapması. Chrome'un kullandığı çözüm şöyle.
Typically, updating a program while it's already open is no problem – as the other answerers have explained, a running process can continue to run even if its executable is deleted.

However, due to Firefox's multi-process model, you may get a prompt to restart it after an update anyway. This is because Firefox spawns new processes to isolate different websites, so if it spawns a new process after you've updated it but before you restart Firefox, the new process will be a newer version of Firefox than the rest of the browser. This can cause various issues, so Firefox might prompt you to restart it before allowing you to continue.

Incidentally, Chrome avoids this by using a "zygote" process that sits around doing nothing; when the browser needs to spawn a new process, instead of asking the OS to execute the browser executable again (which would execute the possibly-updated binary) it asks the zygote process to duplicate itself, and one of the copies then becomes a normal renderer process.
Tarihçe Dosyası
Şöyle
/var/log/apt/history.log
Paket İsmi
Örnek
Eğer paket isminden sonra eksi karakteri geliyorsa paket kaldırılır. Açıklaması şöyle.
If a hyphen is appended to the package name (with no intervening space), the identified package will be removed if it is installed. Similarly a plus sign can be used to designate a package to install.
Şöyle yaparız.
sudo apt-get install python3-
autoremove seçeneği
Örnek ver.

install seçeneği
Belirtilen paketi yükler. Şöyle yaparız.
apt-get install tree
Sorulara yes cevabı vermek için şöyle yaparız.
apt-get install -y openjdk-8-jre openjdk-8-jdk
print-uris seçeneği
İndirilen paketlerin adreslerini görmek için şöyle yaparız
apt-get --print-uris update
purge seçeneği
Örnek ver.

remove seçeneği 
Paketin ismini bilmiyorsak ancak içindeki bir dosyayı biliyorsak, paket ismini öğrenmek için için dpkg -S komutu kullanılabilir.
Paket silinse bile home dizininde kullanıcıya mahsus ayarlar dosyası kalabilir. Ayarlar dosyası ~/.config dizininde veya silinen paketin kendi ismi ile bir dizinde (örneğin ~/.foo) olabilir.

Örnek
Şöyle yaparız
sudo apt remove foo
Örnek
Şöyle yaparız.
sudo apt-get remove gdb
update seçeneği
Örnek
Şöyle yaparız
sudo apt-get update
Eğer devam etmekte olan bir kurulum varsa şuna benzer bir hata verir
Reading package lists... Done
E: Could not get lock /var/lib/apt/lists/lock. It is held by process 1131 (packagekitd)

N: Be aware that removing the lock file is not a solution and may break your system.

E: Unable to lock directory /var/lib/apt/lists/
Hata mesajındaki "process 1131 (packageitd)" kısmına dikkat etmek gerekiyor. Dosyayı hangi uygulamanın kilitlediği burada yazılır. Açıklaması şöyle
The lock file was created by process 1131 (packagekitd). It was created so that that process could make changes to the package system without worrying about other programs doing other changes at the same time.

If you remove the lock file, you make it possible for another process, such as apt-get, to make changes simultaneously with packagekitd. Since there was no lock file, apt-get will also assume it is the only process making changes.
upgrade seçeneği
Örnek ver

Hiç yorum yok:

Yorum Gönder