Ubuntu下安装卸载软件方法详解

文章目录

  • 安装方法
    • apt-get方法
    • dpkg安装deb包
    • make install源码安装
  • 卸载方法
    • APT方式
    • Dpkg方式
    • 源码安装方式
  • apt-get与dpkg关系
  • 安装位置
    • sudo apt-get install 安装之后的软件位置
    • 怎么看安装在哪里

安装方法

apt-get方法

sudo apt-get install 软件名
比如:sudo apt-get install build-essential

  • 普通安装:apt-get install softname1 softname2 …;
  • 修复安装:apt-get -f install softname1 softname2… ; (-f Atemp to correct broken dependencies)
  • 重新安装:apt-get –reinstall install softname1 softname2…;
    其他命令
    apt-get install xxx 安装xxx 。如果带有参数,那么-d 表示仅下载 ,-f 表示强制安装
    apt-get remove xxx 卸载xxx
    apt-get update 更新软件信息数据库
    apt-get upgrade 进行系统升级
    apt-cache search 搜索软件包

dpkg安装deb包

sudo dpkg -i package.deb
其他命令
dpkg -i package.deb 安装包
dpkg -r package 删除包
dpkg -P package 删除包(包括配置文件)
dpkg -L package 列出与该包关联的文件
dpkg -l package 显示该包的版本
dpkg –unpack package.deb 解开 deb 包的内容
dpkg -S keyword 搜索所属的包内容
dpkg -l 列出当前已安装的包
dpkg -c package.deb 列出 deb 包的内容
dpkg –configure package 配置包

make install源码安装

如果要使用make安装的话,那么必须得安装build-essential这个依赖包
源码安装大致可以分为三步骤:(./configure)–> 编译(sudo make) –> 安装(sudo make install)。

  • 配置:这是编译源代码的第一步,通过 ./configure 命令完成。执行此步以便为编译源代码作准备。常用的选项有 –prefix=PREFIX,用以指定程序的安装位置。更多的选项可通过 –help 查询。也有某些程序无需执行此步。
  • 编译:一旦配置通过,可即刻使用 make 指令来执行源代码的编译过程。视软件的具体情况而定,编译所需的时间也各有差异,我们所要做的就是耐心等候和静观其变。此步虽然仅下简单的指令,但有时候 所遇到的问题却十分复杂。较常碰到的情形是程序编译到中途却无法圆满结束。此时,需要根据出错提示分析以便找到应对之策。
  • 安装:如果编译没有问题,那么执行 sudo make install 就可以将程序安装到系统中了。

下面以安装nagios为例进行说明。

//1.解压缩
tar -zxf nagios-4.0.2.tar.gz
//2.进入目录
cd nagios-4.0.2

//3.配置
./configure –prefix=/usr/local/nagios
//4.编译
make all
//5.安装
make install && make install-init && make install-commandmode && make install-config

卸载方法

APT方式

  • 移除式卸载:apt-get remove softname1 softname2 …;(移除软件包,当包尾部有+时,意为安装)
  • 清除式卸载 :apt-get –purge remove softname1 softname2…;(同时清除配置)
    • 清除式卸载:apt-get purge sofname1 softname2…;(同上,也清除配置文件)

Dpkg方式

  • 移除式卸载:dpkg -r pkg1 pkg2 …;
  • 清除式卸载:dpkg -P pkg1 pkg2…;

源码安装方式

在安装目录下执行make uninstall

apt-get与dpkg关系

1.dpkg是用来安装.deb文件,但不会解决模块的依赖关系,且不会关心Ubuntu的软件仓库内的软件,可以用于安装本地的deb文件。
2.apt是建立在dpkg之上的软件管理工具
3.dpkg绕过apt包管理数据库对软件包进行操作,所以你用dpkg安装过的软件包用apt可以再安装一遍,系统不知道之前安装过了,将会覆盖之前dpkg的安装。
4.apt会解决和安装模块的依赖问题,并会咨询软件仓库, 但不会安装本地的deb文件, 。

安装位置

sudo apt-get install 安装之后的软件位置

  • 下载的软件的存放位置:/var/cache/apt/archives
  • 安装后软件的默认位置:/usr/share
  • 可执行文件位置:/usr/bin
  • 配置文件位置:/etc
  • lib文件位置:/usr/lib

怎么看安装在哪里

  • dpkg -L softwarename
    for example:
dpkg -L mricron
/.
/usr
/usr/share
/usr/share/applications
/usr/share/applications/dcm2niigui.desktop
/usr/share/applications/mricron.desktop
/usr/share/applications/mricron-npm.desktop
/usr/share/man
/usr/share/man/man1
/usr/share/man/man1/dcm2nii.1.gz
/usr/share/man/man1/mricron.1.gz
/usr/share/pixmaps
/usr/share/pixmaps/mricron.xpm
/usr/share/menu
/usr/share/menu/mricron
/usr/share/lintian
/usr/share/lintian/overrides
/usr/share/lintian/overrides/mricron
/usr/share/doc
/usr/share/doc/mricron
/usr/share/doc/mricron/copyright
/usr/share/doc/mricron/changelog.Debian.gz
/usr/bin
/usr/bin/mricron-npm
/usr/bin/dcm2niigui
/usr/bin/mricron
/usr/bin/dcm2nii
/usr/lib
/usr/lib/mricron
/usr/lib/mricron/mricron
/usr/share/man/man1/dcm2niigui.1.gz
/usr/share/man/man1/mricron-npm.1.gz
  • apt-file list softwarename
    首先安装 apt-file,命令:sudo apt-get install apt-file,然后使用命令:apt-file list softwarename,
    for example:
apt-file list mricron

mricron: /usr/bin/dcm2nii

mricron: /usr/bin/dcm2niigui

mricron: /usr/bin/mricron

mricron: /usr/bin/mricron-npm

mricron: /usr/lib/mricron/mricron

mricron: /usr/share/applications/dcm2niigui.desktop

mricron: /usr/share/applications/mricron-npm.desktop

mricron: /usr/share/applications/mricron.desktop

mricron: /usr/share/doc/mricron/changelog.Debian.gz

mricron: /usr/share/doc/mricron/copyright

mricron: /usr/share/lintian/overrides/mricron

mricron: /usr/share/man/man1/dcm2nii.1.gz

mricron: /usr/share/man/man1/dcm2niigui.1.gz

mricron: /usr/share/man/man1/mricron-npm.1.gz

mricron: /usr/share/man/man1/mricron.1.gz

mricron: /usr/share/menu/mricron

mricron: /usr/share/pixmaps/mricron.xpm

mricron-data: /usr/share/doc/mricron-data/changelog.Debian.gz

mricron-data: /usr/share/doc/mricron-data/copyright

mricron-data: /usr/share/mricron/lut/16.lut

mricron-data: /usr/share/mricron/lut/1hot.lut

mricron-data: /usr/share/mricron/lut/2winter.lut

mricron-data: /usr/share/mricron/lut/3warm.lut

mricron-data: /usr/share/mricron/lut/4cool.lut

mricron-data: /usr/share/mricron/lut/5redyell.lut

mricron-data: /usr/share/mricron/lut/6bluegrn.lut

mricron-data: /usr/share/mricron/lut/GE_color.lut

mricron-data: /usr/share/mricron/lut/HOTIRON.lut

mricron-data: /usr/share/mricron/lut/NIH.lut

mricron-data: /usr/share/mricron/lut/NIH_fire.lut

mricron-data: /usr/share/mricron/lut/NIH_ice.lut

mricron-data: /usr/share/mricron/lut/Rainramp.lut

mricron-data: /usr/share/mricron/lut/actc.lut

mricron-data: /usr/share/mricron/lut/blackbdy.lut

mricron-data: /usr/share/mricron/lut/blue_otto.lut

mricron-data: /usr/share/mricron/lut/bluegray.lut

mricron-data: /usr/share/mricron/lut/bone.lut

mricron-data: /usr/share/mricron/lut/cardiac.lut

mricron-data: /usr/share/mricron/lut/cortex.lut

mricron-data: /usr/share/mricron/lut/flow.lut

mricron-data: /usr/share/mricron/lut/french.lut

mricron-data: /usr/share/mricron/lut/gold.lut

mricron-data: /usr/share/mricron/lut/gooch.lut

mricron-data: /usr/share/mricron/lut/greengray.lut

mricron-data: /usr/share/mricron/lut/overlay_classic.lut

mricron-data: /usr/share/mricron/lut/pink.lut

mricron-data: /usr/share/mricron/lut/pink_old.lut

mricron-data: /usr/share/mricron/lut/red_otto.lut

mricron-data: /usr/share/mricron/lut/spectrum.lut

mricron-data: /usr/share/mricron/lut/surface.lut

mricron-data: /usr/share/mricron/lut/x_hot.lut

mricron-data: /usr/share/mricron/lut/x_rain.lut

mricron-data: /usr/share/mricron/templates/aal.nii.gz

mricron-data: /usr/share/mricron/templates/aal.nii.lut

mricron-data: /usr/share/mricron/templates/aal.nii.txt

mricron-data: /usr/share/mricron/templates/brodmann.nii.gz

mricron-data: /usr/share/mricron/templates/brodmann.nii.lut

mricron-data: /usr/share/mricron/templates/ch2bet.nii.gz

mricron-doc: /usr/share/doc/mricron-doc/changelog.Debian.gz

mricron-doc: /usr/share/doc/mricron-doc/copyright

mricron-doc: /usr/share/doc/mricron-doc/examples/attention.nii.gz

mricron-doc: /usr/share/doc/mricron-doc/examples/clipnearr.ini

mricron-doc: /usr/share/doc/mricron-doc/examples/cut2.ini

mricron-doc: /usr/share/doc/mricron-doc/examples/cutr.ini

mricron-doc: /usr/share/doc/mricron-doc/examples/dataset/1.voi

mricron-doc: /usr/share/doc/mricron-doc/examples/dataset/10.voi

mricron-doc: /usr/share/doc/mricron-doc/examples/dataset/11.voi

mricron-doc: /usr/share/doc/mricron-doc/examples/dataset/12.voi

mricron-doc: /usr/share/doc/mricron-doc/examples/dataset/13.voi

mricron-doc: /usr/share/doc/mricron-doc/examples/dataset/14.voi

mricron-doc: /usr/share/doc/mricron-doc/examples/dataset/15.voi

mricron-doc: /usr/share/doc/mricron-doc/examples/dataset/16.voi

mricron-doc: /usr/share/doc/mricron-doc/examples/dataset/17.voi

mricron-doc: /usr/share/doc/mricron-doc/examples/dataset/18.voi

mricron-doc: /usr/share/doc/mricron-doc/examples/dataset/19.voi

mricron-doc: /usr/share/doc/mricron-doc/examples/dataset/2.voi

mricron-doc: /usr/share/doc/mricron-doc/examples/dataset/20.voi

mricron-doc: /usr/share/doc/mricron-doc/examples/dataset/21.voi

mricron-doc: /usr/share/doc/mricron-doc/examples/dataset/22.voi

mricron-doc: /usr/share/doc/mricron-doc/examples/dataset/23.voi

mricron-doc: /usr/share/doc/mricron-doc/examples/dataset/24.voi

mricron-doc: /usr/share/doc/mricron-doc/examples/dataset/3.voi

mricron-doc: /usr/share/doc/mricron-doc/examples/dataset/4.voi

mricron-doc: /usr/share/doc/mricron-doc/examples/dataset/5.voi

mricron-doc: /usr/share/doc/mricron-doc/examples/dataset/6.voi

mricron-doc: /usr/share/doc/mricron-doc/examples/dataset/7.voi

mricron-doc: /usr/share/doc/mricron-doc/examples/dataset/8.voi

mricron-doc: /usr/share/doc/mricron-doc/examples/dataset/9.voi

mricron-doc: /usr/share/doc/mricron-doc/examples/dataset/binomial.val

mricron-doc: /usr/share/doc/mricron-doc/examples/dataset/continuous.val

mricron-doc: /usr/share/doc/mricron-doc/examples/fmri2r.ini

mricron-doc: /usr/share/doc/mricron-doc/examples/fmri3r.ini

mricron-doc: /usr/share/doc/mricron-doc/examples/fmrir.ini

mricron-doc: /usr/share/doc/mricron-doc/examples/lesionm.ini

mricron-doc: /usr/share/doc/mricron-doc/examples/saccades.nii.gz

mricron-doc: /usr/share/doc/mricron-doc/html/bat.html

mricron-doc: /usr/share/doc/mricron-doc/html/dcm2nii.html

mricron-doc: /usr/share/doc/mricron-doc/html/images/48x36.gif

mricron-doc: /usr/share/doc/mricron-doc/html/images/autocrop.jpg

mricron-doc: /usr/share/doc/mricron-doc/html/images/dcm2niigui.gif

mricron-doc: /usr/share/doc/mricron-doc/html/images/design.gif

mricron-doc: /usr/share/doc/mricron-doc/html/images/draw/3dfill.png

mricron-doc: /usr/share/doc/mricron-doc/html/images/draw/circle.png

mricron-doc: /usr/share/doc/mricron-doc/html/images/draw/closedpen.png

mricron-doc: /usr/share/doc/mricron-doc/html/images/draw/fill.png

mricron-doc: /usr/share/doc/mricron-doc/html/images/draw/pen.png

mricron-doc: /usr/share/doc/mricron-doc/html/images/examplefmri.jpg

mricron-doc: /usr/share/doc/mricron-doc/html/images/examplefmri_multi.jpg

mricron-doc: /usr/share/doc/mricron-doc/html/images/icon.png

mricron-doc: /usr/share/doc/mricron-doc/html/images/layers.gif

mricron-doc: /usr/share/doc/mricron-doc/html/images/lazarus.gif

mricron-doc: /usr/share/doc/mricron-doc/html/images/lesionsum.jpg

mricron-doc: /usr/share/doc/mricron-doc/html/images/lieber.gif

mricron-doc: /usr/share/doc/mricron-doc/html/images/main.jpg

mricron-doc: /usr/share/doc/mricron-doc/html/images/meld.jpg

mricron-doc: /usr/share/doc/mricron-doc/html/images/nifti.jpg

mricron-doc: /usr/share/doc/mricron-doc/html/images/npm.gif

mricron-doc: /usr/share/doc/mricron-doc/html/images/patient9.jpg

mricron-doc: /usr/share/doc/mricron-doc/html/images/prefs.gif

mricron-doc: /usr/share/doc/mricron-doc/html/images/renderAAL.gif

mricron-doc: /usr/share/doc/mricron-doc/html/images/results.jpg

mricron-doc: /usr/share/doc/mricron-doc/html/images/space.gif

mricron-doc: /usr/share/doc/mricron-doc/html/images/splash.jpg

mricron-doc: /usr/share/doc/mricron-doc/html/images/threshold.gif

mricron-doc: /usr/share/doc/mricron-doc/html/images/transparency.gif

mricron-doc: /usr/share/doc/mricron-doc/html/images/val.gif

mricron-doc: /usr/share/doc/mricron-doc/html/images/zhistogram.gif

mricron-doc: /usr/share/doc/mricron-doc/html/index.html

mricron-doc: /usr/share/doc/mricron-doc/html/install.html

mricron-doc: /usr/share/doc/mricron-doc/html/main.html

mricron-doc: /usr/share/doc/mricron-doc/html/peri/images/eventtime.png

mricron-doc: /usr/share/doc/mricron-doc/html/peri/images/icon.png

mricron-doc: /usr/share/doc/mricron-doc/html/peri/images/meld.jpg

mricron-doc: /usr/share/doc/mricron-doc/html/peri/images/periset.png

mricron-doc: /usr/share/doc/mricron-doc/html/peri/images/peristimulusplot.png

mricron-doc: /usr/share/doc/mricron-doc/html/peri/images/perivol.png

mricron-doc: /usr/share/doc/mricron-doc/html/peri/images/timeline.png

mricron-doc: /usr/share/doc/mricron-doc/html/peri/index.html

mricron-doc: /usr/share/doc/mricron-doc/html/source.html

mricron-doc: /usr/share/doc/mricron-doc/html/stats.html

mricron-doc: /usr/share/doc/mricron-doc/html/tutorial/images/design.gif

mricron-doc: /usr/share/doc/mricron-doc/html/tutorial/images/icon.png

mricron-doc: /usr/share/doc/mricron-doc/html/tutorial/images/lesionsum.jpg

mricron-doc: /usr/share/doc/mricron-doc/html/tutorial/images/lieber.gif

mricron-doc: /usr/share/doc/mricron-doc/html/tutorial/images/meld.jpg

mricron-doc: /usr/share/doc/mricron-doc/html/tutorial/images/npm.gif

mricron-doc: /usr/share/doc/mricron-doc/html/tutorial/images/patient9.jpg

mricron-doc: /usr/share/doc/mricron-doc/html/tutorial/images/results.jpg

mricron-doc: /usr/share/doc/mricron-doc/html/tutorial/images/threshold.gif

mricron-doc: /usr/share/doc/mricron-doc/html/tutorial/images/val.gif

mricron-doc: /usr/share/doc/mricron-doc/html/tutorial/images/zhistogram.gif

你可能感兴趣的:(ubuntu使用)