Vodič kroz Ubuntu Desktop 12.04 - Instaliranje programa iz komandne ljuske

Izvor: HrOpenWiki
Inačica od 15:39, 9. prosinca 2014. koju je unio/unijela Rpremuz (razgovor | doprinosi)

(razl) ←Starija inačica | vidi trenutačnu inačicu (razl) | Novija inačica→ (razl)
Skoči na: orijentacija, traži

Instaliranje softvera iz softverskih repozitorija moguće je i iz komandne ljuske za što se najčešće koristi program apt-get koji upravlja softverom na razini softverskih paketa.

Prije instaliranja dobro je pozvati naredbu koja dohvaća najnovije informacije o softverskim paketima raspoloživim na repozitorijima:

$ sudo apt-get update

Slijedi primjer instaliranja programa gdebi. Može se vidjeti kako zahtjev za instaliranjem jednog softverskog paketa povlači za sobom instaliranje dodatnih paketa koji su potrebni da bi zadani program mogao raditi:

$ sudo apt-get install gdebi
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
 gdebi-core
The following NEW packages will be installed:
 gdebi gdebi-core
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 185 kB of archives.
After this operation, 1,398 kB of additional disk space will be used.
Do you want to continue [Y/n]?
Get:1 http://hr.archive.ubuntu.com/ubuntu/ precise/universe gdebi-core all 0.8.5build1 [159 kB]
Get:2 http://hr.archive.ubuntu.com/ubuntu/ precise/universe gdebi all 0.8.5build1 [26.1 kB]
Fetched 185 kB in 0s (1,087 kB/s)
Selecting previously unselected package gdebi-core.
(Reading database ... 384134 files and directories currently installed.)
Unpacking gdebi-core (from .../gdebi-core_0.8.5build1_all.deb) ...
Selecting previously unselected package gdebi.
Unpacking gdebi (from .../gdebi_0.8.5build1_all.deb) ...
Processing triggers for man-db ...
Processing triggers for bamfdaemon ...
Rebuilding /usr/share/applications/bamf.index...
Processing triggers for desktop-file-utils ...
Processing triggers for gnome-menus ...
Setting up gdebi-core (0.8.5build1) ...
Setting up gdebi (0.8.5build1) ...

Poslije pozivanja naredbe program najavi što će biti napravljeno te postavi pitanje može li nastaviti s izvršenjem, na što treba odgovoriti s y (podrazumijevani odgovor ako se samo pritisne tipka Enter) ili n (yes = da, no = ne).

Za uklanjanje programa poziva se slična naredba s istim parametrom (imenom glavnog paketa). Nakon toga može se pozvati još i naredba koja će ukloniti dodatne pakete instalirane za potrebe glavnog paketa a koji više nisu potrebni niti za jedan drugi instalirani program:

$ sudo apt-get remove gdebi
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
 gdebi-core
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
 gdebi
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 200 kB disk space will be freed.
Do you want to continue [Y/n]?
(Reading database ... 384219 files and directories currently installed.)
Removing gdebi ...
Processing triggers for man-db ...
Processing triggers for bamfdaemon ...
Rebuilding /usr/share/applications/bamf.index...
Processing triggers for desktop-file-utils ...
Processing triggers for gnome-menus ...

$ sudo apt-get autoremove
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
 gdebi-core
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 1,198 kB disk space will be freed.
Do you want to continue [Y/n]?
(Reading database ... 384205 files and directories currently installed.)
Removing gdebi-core ...
Processing triggers for man-db ...

Naredbom apt-cache mogu se pregledavati i pretraživati dohvaćene informacije o softverskim paketima što omogućava nalaženje paketa koji obavlja određenu funkciju koja nas zanima. Npr. sljedeća naredba daje popis paketa koji u svom imenu ili opisu sadrže riječi shred i files:

$ apt-cache search shred files
bleachbit - delete unnecessary files from the system

Sljedeća naredba daje detaljniji opis zadanog paketa (ovdje: bleachbit):

$ apt-cache show bleachbit
Package: bleachbit
Priority: optional
Section: universe/admin
Installed-Size: 1710
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Luca Falavigna <dktrkranz@debian.org>
Architecture: all
Version: 0.9.1-1
Depends: python (>= 2.7.1-0ubuntu2), python-gtk2 (>= 2.14), menu
Recommends: python-notify
Filename: pool/universe/b/bleachbit/bleachbit_0.9.1-1_all.deb
Size: 326786
MD5sum: f824d7748cc9c0da6203a735ea811b1a
SHA1: 6e197e4942c70785138d394967b5630bef6f115c
SHA256: 6a689de150268924567da406aed5163090aba65e7eb924ff28673ab26e13d023
Description-en: delete unnecessary files from the system
 BleachBit deletes unnecessary files to free valuable disk space, maintain
 privacy, and remove junk. It removes cache, Internet history, temporary files,
 cookies, and broken shortcuts.
 .
 It handles cleaning of Adobe Reader, Bash, Beagle, Epiphany, Firefox, Flash,
 GIMP, Google Earth, Java, KDE, OpenOffice.org, Opera, RealPlayer, rpmbuild,
 Second Life Viewer, VIM, XChat, and more.
 .
 Beyond simply erasing junk files, BleachBit wipes free disk space (to hide
 previously deleted files for privacy and to improve compression of images),
 vacuums Firefox databases (to improve performance without deleting data), and
 securely shreds arbitrary files.
Homepage: http://bleachbit.sourceforge.net
Description-md5: a958efd51e414316ebd3cb47958129ea
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Origin: Ubuntu

Ako nas zanima koji paket sadrži neki program instaliran na sustavu, to možemo učiniti na sljedeći način (primjer za ifconfig):

$ which ifconfig
/sbin/ifconfig
$ dpkg -S /sbin/ifconfig
net-tools: /sbin/ifconfig

S druge strane, sljedeća naredba daje popis direktorija i datoteka koje je instalirao zadani paket (ovdje: vim):

$ dpkg -L vim
/.
/usr
/usr/bin
/usr/bin/vim.basic
/usr/share
/usr/share/doc
/usr/share/bug
/usr/share/bug/vim
/usr/share/bug/vim/script
/usr/share/bug/vim/presubj
/usr/share/lintian
/usr/share/lintian/overrides
/usr/share/lintian/overrides/vim
/usr/share/doc/vim

Pretraživanje instaliranih paketa može se napraviti npr. putem sljedeće naredbe koja ispisuje pakete u čijem imenu ili opisu je nađen zadani uzorak (ovdje: ssh). Ispis sadrži više stupaca: stanje instalacije, ime paketa, inačica i opis.

$ dpkg -l | grep -i ssh
ii  libssh-4                 0.5.2-1                  tiny C SSH library
ii  openssh-client           1:5.9p1-5ubuntu1         secure shell (SSH) client, for secure access to remote machines
ii  ssh-askpass-gnome        1:5.9p1-5ubuntu1         interactive X program to prompt users for a passphrase for ssh-add

Ponekad želimo koristiti neku naredbu (program) koja trenutačno ne postoji na sustavu a ne znamo koji paket ju sadrži. To se može saznati putem naredbe apt-file:

  • Instaliramo paket apt-file:
$ sudo apt-get install apt-file
  • Dohvatimo najnovije podatke o svim paketima koji su na raspolaganju u repozitorijima koje koristimo:
$ sudo apt-file update
(tu naredbu bi trebalo povremeno pokretati da se ažuriraju informacije o paketima).
  • Primjer traženja paketa koji sadrži naredbu dlocate:
$ apt-file search '/dlocate' | grep 'dlocate$'
dlocate: /etc/cron.daily/dlocate
dlocate: /etc/default/dlocate
dlocate: /usr/bin/dlocate
Vidi se da se program /usr/bin/dlocate nalazi u paketu dlocate.

Idi na: Sadržaj | < Prethodno poglavlje | Sljedeće poglavlje >