20 Mart 2020 Cuma

apt komutu - deb Dosyalarını Kurar

Giriş
apt komutu kilit (lock) kullandığı için aynı anda birden fazla paketin kurulumuna müsaade etmez. apt komutu ile yum komutu kardeştir.

apt vs dpkg
apt altta dpkg komutunu kullanır. apt dosya indirebilme yeteneğine sahip, dpkg ise sadece yerel .deb dosyalarını kurabilir

apt vs snap
Açıklaması şöyle. snap paketleri için snap komutu kullanılır
Apt only works on deb packages. Nothing else.

It doesn't work on Snaps. Nor Flatpaks. Nor Pips. Nor Wheels. Nor Brews. Nor git clones. Nor source code that you compiled or downloaded or write. Nor anything else.
Hepsini çalıştırmak için şöyle yaparız
sudo sh -c "apt update && apt dist-upgrade -y && snap refresh && flatpak upgrade -y"
Kardeş Komutlar
apt-add-repository komutu
apt-cache komutu
apt-file komutu
apt-get komutu
apt-key komutu

apt Uygulama Çalışırken Nasıl Güncelleme Yapar?
Açıklaması şöyle.
In POSIX (and Linux is a POSIX system), at least when using POSIX file systems, files are allowed to remain open after they're deleted (that is, after they're unlinked, by removing the link from a particular file name to the underlying inode object which is what actually identifies a particular string of bytes as the contents of a file). Files in this state continue to be accessible to code that has an open handle to them (a file descriptor in the user land, other structures in the kernel land), although they no longer have a name and anything that tries to open the old name will no longer be able to get them.
apt komutu Diğer Komutları Birleştirir
apt komutu apt-getapt-cache gibi komutları tek bir çatı altında birleştirir.

apt Patterns
apt 2'den itibaren düzenli ifade (regular expression) kullanımı değişti.
Örnek
Şöyle yaparız. Düzenli ifadeden önce ~n karakteri gelir.
apt install '~nlibkf5.*'
Uzun halini kullanmak istersek şöyle yaparız. ?name(...) şeklidedir.
apt install '?name(libkf5.*)'
Düzenli ifade eskiden şöyleydi
apt install libkf5.*
autoremove seçeneği
Şöyle yaparız.
sudo apt autoremove
full-upgrade seçeneği
Şöyle yapaız
#!/bin/bash

sudo apt update
sudo apt full-upgrade -y
sudo apt install jq
sudo apt autoclean -y
sudo apt autoremove
install seçeneği
Eğer bir dosya belirtmezse verdiğimiz ismi repository'de arar

Örnek
deb dosyasını kurmak için şöyle yaparsak hata alırız.
sudo apt install vs.deb

Reading package lists... Done   
Building dependency tree          
Reading state information... Done   
E: Unable to locate package vs.deb   
E: Couldn't find any package by glob 'vs.deb'
Şöyle yapmak gerekir
sudo apt install ./vs.deb
Örnek
Kurmadan sadece indirmek için şöyle yaparız
sudo apt install package_name --download-only
list seçeneği
Kurulu paketlerin bilgilerini verir. 
Örnek
Kurulu tüm paketleri görmek için şöyle yaparız.
$ apt list --installed
Örnek - Bir Paketi Görmek
gedit paketini görmek için şöyle yaparız.
$ apt list --installed gedit
gedit/stable 3.22.0-1
Örnek - Bir Paketi Görmek
Şöyle yaparız
apt list '?narrow(?installed,?name(wine))'
Örnek
Wildcard kullanmak istersek şöyle yaparız
apt list --installed '*wine*'
"(using the ~i and ~n shorthands for ?installed and ?name)" şeklinde düşünürsek şöyle yaparız
apt list '?narrow(~i,~nwine)'
purge seçeneği
-s simulation anlamına gelir. Belirtilen paketi kaldırırsak ne olacağını görmek için şöyle yaparız
apt purge -s python2.7
-s seçeneği
simulate anlamına gelir. Açıklaması şöyle
Passing the -s option to apt causes it to simulate installation but not actually install or modify anything. That shows what you can expect to see from apt when you install the package, including which packages if any are pulled in to satisfy its (direct and indirect) dependencies.
...
That shows you what steps would be taken by sudo apt install apache2.

The -s option can also be spelled as any of --simulate, --just-print, --dry-run, --recon, --no-act. So if you see (or write) any of those, they're doing the same thing.

The -s option is documented in man apt-get and not in man apt (the latter of which doesn't document most features and options), but both apt-get -s install ... and apt -s install ... are supported.

You can likewise simulate other actions with -s, such as the remove action.

Unlike with apt commands that actually make changes to your system, running apt -s as root is optional, so you can omit sudo.
Örnek
Şöyle yaparız
apt -s install apache2
search seçeneği
Örnek
Şöyle yaparız
apt search mongodb
show seçeneği
Açıklaması şöyle
Show information about the given package(s) including its dependencies, installation and download size, sources the package is available from, the description of the packages content and much more. It can e.g. be helpful to look at this information before allowing apt(8) to remove a package or while searching for new packages to install.
Örnek
Şöyle yaparız
$ apt show kate | grep 'APT-Sources'
APT-Sources: http://ar.archive.ubuntu.com/ubuntu focal/universe amd64 Packages
Örnek - version
Paketin sürümünü gösterir. Şöyle yaparız
$ apt show usb-creator-gtk | grep -i version

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

Version: 0.3.5ubuntu18.04.2
unattended-upgrades seçeneği
Açıklaması şöyle
No, apt on its own won’t reboot.

You can check for /var/run/reboot-required after running apt to see if a reboot is required. If you use unattended-upgrades, you can configure that to reboot for you.
update seçeneği - Sadece listeyi günceller
Açıklaması şöyle
The apt update updates your software repository lists, and apt upgrade upgrades packages from those lists (but may leave some behind until you perform the apt full-upgrade
Örnek
Şöyle yaparız
#!/bin/bash

apt update -y
apt upgrade ufw sshguard unattended-upgrades wget curl git zip unzip tree -y

Hiç yorum yok:

Yorum Gönder