Ubuntu的软件包可以有三种方式:.deb
文件,.run
文件,以及压缩的zip
或tar
的原始源代码,
大部分是.deb
文件-它们是预编译的软件包,可供使用,命令行程序如apt
和apt-get
将为你自动安装依赖项,事实上,软件中心也在使用apt-get
作为后端,所以它会自动安装依赖。
.run
文件通常是专有和编码的二进制文件,
对于原始源代码,你必须自己完成所有事情-构建软件和安装依赖项。
也存在一类称为容器的软件,
再说一次,取决于你在做什么。如果是从官方Ubuntu存储库安装软件,那么你可以简单地 sudo apt-get install my-software
如果要安装.deb
软件包,可以使用dpkg
命令或apt-get
,以下是使用apt get安装google chrome deb包的示例,
$ sudo apt-get install ./google-chrome-stable_current_amd64.deb
[sudo] password for xieerqi:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'google-chrome-stable' instead of './google-chrome-stable_current_amd64.deb'
The following NEW packages will be installed:
google-chrome-stable
0 upgraded, 1 newly installed, 0 to remove and 54 not upgraded.
Need to get 0 B/50.0 MB of archives.
After this operation, 190 MB of additional disk space will be used.
Get:1 /home/xieerqi/下载/google-chrome-stable_current_amd64.deb google-chrome-stable amd64 53.0.2785.101-1 [50.0 MB]
Selecting previously unselected package google-chrome-stable.
(Reading database ... 476104 files and directories currently installed.)
Preparing to unpack .../google-chrome-stable_current_amd64.deb ...
Unpacking google-chrome-stable (53.0.2785.101-1) ...
Processing triggers for menu (2.1.47ubuntu1) ...
Processing triggers for bamfdaemon (0.5.3~bzr0+16.04.20160701-0ubuntu1) ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for gnome-menus (3.13.3-6ubuntu3.1) ...
Processing triggers for desktop-file-utils (0.22-1ubuntu5) ...
Processing triggers for mime-support (3.59ubuntu1) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up google-chrome-stable (53.0.2785.101-1) ...
update-alternatives: using /usr/bin/google-chrome-stable to provide /usr/bin/x-www-browser (x-www-browser) in auto mode
update-alternatives: using /usr/bin/google-chrome-stable to provide /usr/bin/gnome-www-browser (gnome-www-browser) in auto mode
update-alternatives: using /usr/bin/google-chrome-stable to provide /usr/bin/google-chrome (google-chrome) in auto mode
Processing triggers for menu (2.1.47ubuntu1) .
apt-get
有什么好处?它有--purge
选项,允许你删除与程序相关的内容, sudo apt-get remove google-chrome-stable
--purge
选项也会删除配置文件,这很方便,如果你的软件坏了,你想完全全新安装它,软件中心不能这样做,所以这是另一个区别。
如果正在处理.run
文件,你需要使该文件可执行,并运行它,
$ sudo chmod +x ./software.run
$ sudo ./software.run