Odpowiedzi:
Tak, po prostu wypisz wszystkie paczki w linii oddzielonej spacją. na przykład
sudo apt-get install package_name1 package_name2 package_name3 package_name4
-y
opcję. Jest dość długi, ale możesz przeczytać man apt-get
więcej informacji.
Jeśli masz plik (powiedzmy pkglist
), który zawiera listę pakietów do zainstalowania, takich jak:
pkg1
pkg2
pkg3
lub
pkg1 pkg2 pkg3
Następnie możesz zainstalować te pakiety za apt
pomocą następującego polecenia:
sudo apt-get install $(cat pkglist)
xargs sudo apt-get install < pkglist
Aby uzyskać więcej informacji, apt-get install
odwiedź man apt-get
sekcję instalacji.
xargs sudo apt-get -y install < pkglist
xargs -a pkglist sudo apt install
.
Umieść wszystkie nazwy pakietów w pliku (jedna nazwa pakietu dla każdej linii). Następnie uruchom poniższe polecenie, aby automatycznie zainstalować podane pakiety.
while read -r line; do sudo apt-get -y install "$line"; done < /path/to/the/packages/file
Przykład:
$ cat file
vlc
firefox
$ while read -r line; do sudo apt-get install "$line"; done < file
[sudo] password for avinash:
Reading package lists... Done
Building dependency tree
Reading state information... Done
vlc is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 499 not upgraded.
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
ttf-lyx
The following packages will be upgraded:
firefox
1 upgraded, 0 newly installed, 0 to remove and 498 not upgraded.
Need to get 35.8 MB of archives.
After this operation, 24.3 MB of additional disk space will be used.
Get:1 http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty-updates/main firefox amd64 33.0+build2-0ubuntu0.14.04.1 [35.8 MB]
0% [1 firefox 67.0 kB/35.8 MB 0%] 10.4 kB/s 57min 16s^