个人工具

“UbuntuHelp:InstallingSoftware/zh”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
Source or Binary?
源码还是二进制?
第31行: 第31行:
 
Normally, when someone makes a package for a program, they put all of the ''source code'' for the program into that package.  Source code is written by programmers and is essentially a list of instructions to a computer which humans are able to read and write.  Computers can only understand this code if it is ''interpreted'' for them into a form that they can use directly.  One such way of interpreting source code for a computer is by translating or ''compiling'' it into ''binary'', which computers can understand.
 
Normally, when someone makes a package for a program, they put all of the ''source code'' for the program into that package.  Source code is written by programmers and is essentially a list of instructions to a computer which humans are able to read and write.  Computers can only understand this code if it is ''interpreted'' for them into a form that they can use directly.  One such way of interpreting source code for a computer is by translating or ''compiling'' it into ''binary'', which computers can understand.
 
----
 
----
通常,人们将程序打包时,他们把所有程序需要的的源代码放到软件包里。
+
通常,人们将程序打包时,他们把所有程序需要的的源代码放到软件包里。源代码实际上是程序员写的可阅读的计算机指令列表。计算机仅能理解这些代码
 
----
 
----
 
So why don't the people who make the package (called ''packagers'') just convert it into binary from the start?  Well, different computers use different types of binary, so if you make a binary package for one type (like an Intel PC), it won't work on another (like an Apple Macintosh).
 
So why don't the people who make the package (called ''packagers'') just convert it into binary from the start?  Well, different computers use different types of binary, so if you make a binary package for one type (like an Intel PC), it won't work on another (like an Apple Macintosh).

2007年11月13日 (二) 14:26的版本


引言

Ubuntu下安装软件是很容易的,本向导将向您演示如何操作。

默认情况下,当您把Ubuntu安装到您的计算机时很多有用的程序就已经安装完毕了。 然而,您可能需要某一项默认应用程序中不提供的软件服务。也许您只是想尝试一下某一已安装软件的另类功能。换句话说,您需要新软件。

如果您想获取安装软件时的一些后台信息(有时可能有很高技术性),请参阅 软件包和软件包的管理。如果您只是想安装新程序,您可以直接跳转到 安装软件包

软件包和软件包的管理

This section covers the basic concepts of packages and package management. You will learn about what a package is, the differences between different types of package and also how package management works on Ubuntu.


本节概述包的基本概念,以及包管理.通过阅读本节你将会了解包是什么,不同类型包之间的区别,同样你也会了解如何在Ubuntu中进行软件包管理工作.

什么是软件包?

Software is a very broad term, and is generally taken to mean a program which you can run on your computer. However, such programs often need other resources to work. When you install software, thousands of files may be required just to let the program start! When you think that they all have to be put in exactly the right location, and some of those files may need to be changed depending on what type of computer you have, it can all get very complicated. Luckily, Ubuntu can look after this complexity.


"软件"是一个非常宽泛的概念,通常认为软件是指可以运行在计算机上的长须。然而,有些程序必须依赖其它的资源才能正常工作。当你安装一个软件时,很可能你需要安装成千上万的文件才能使程序运行起来!当你想到这些成千上万的文件中,有些文件必须放置在正确的路径,而有些文件的位置又因为计算机平台的不同而不同时,这将是个很麻烦的事情,Ubuntu可以很好地解决这种麻烦.


Ubuntu uses packages to store everything that a particular program needs to run. A 'package', then, is essentially a collection of files bundled into a single file, which can be handled much more easily. As well as the files required for the program to run, there will be special files called installation scripts, which copy the files to where they are needed (amongst other things).


Ubuntu使用软件包存储指定程序运行所需的一切文件.一个“包裹”实际上是所需的文件集捆绑在一个单独文件里,这样使得操作更加方便。就如文件需要程序来运行一样,这个包也需要一个特定的文件,名为"installation scripts(安装脚本)"来指定各个文件该拷贝到什么地方(当然脚本做的可能还不止这些)。

源码还是二进制?

Normally, when someone makes a package for a program, they put all of the source code for the program into that package. Source code is written by programmers and is essentially a list of instructions to a computer which humans are able to read and write. Computers can only understand this code if it is interpreted for them into a form that they can use directly. One such way of interpreting source code for a computer is by translating or compiling it into binary, which computers can understand.


通常,人们将程序打包时,他们把所有程序需要的的源代码放到软件包里。源代码实际上是程序员写的可阅读的计算机指令列表。计算机仅能理解这些代码


So why don't the people who make the package (called packagers) just convert it into binary from the start? Well, different computers use different types of binary, so if you make a binary package for one type (like an Intel PC), it won't work on another (like an Apple Macintosh).

Source packages are simply packages which just include source code, and can generally be used on any type of machine if the code is compiled in the right way.
Binary packages are ones which have been made specifically for one type of computer, or architecture. Ubuntu supports the x86 (i386 or i686), AMD64 and PPC architectures. The correct binary packages will be used automatically, so you don't have to worry about picking the right ones. To find out which one you are using, open ApplicationsAccessoriesTerminal, type arch then hit the enter key.

软件包的依赖

Programs often use some of the same files as each other. Rather than putting these files into each package, a separate package can be installed to provide them for all of the programs that need them. So, to install a program which needs one of these files, the package containing those files must also be installed. When a package depends on another in this way, it is known as a package dependency. By specifying dependencies, packages can be made smaller and simpler, and duplicates of files and programs are mostly removed.

When you install a program, its dependencies must be installed at the same time. Usually, most of the required dependencies will already be installed, but a few extras may be needed, too. So, when you install a package, don't be surprised if several other packages are installed too - these are just dependencies which are needed for your chosen package to function properly.

InstallingSoftware?action=AttachFile&do=get&target=scrn-synaptic-dependencies.jpg
An example of dependencies


软件包管理器

A package manager is an application which handles the downloading and installation of packages. Ubuntu includes a few package managers by default, and which one you use depends on how advanced the package management tasks are that you want to achieve. Most people will only need to use the most basic package manager, the Add/Remove tool, which is very easy to use.


软件 频道/源

Where can you get packages from?

Ubuntu stores all of its packages in locations called software channels or repositories. A software channel is simply a location which holds packages of similar types, which can be downloaded and installed using a package manager. A package manager will store an index of all of the packages available from a software channel. Sometimes it will 're-build' this index to make sure that it is up to date and knows which packages have been upgraded or added into the channel since it last checked.

There are four Ubuntu software channels for each architecture - Main, Restricted, Universe and Multiverse. Each has a different purpose. By default, only packages from Main and Restricted can be installed. If you would like to install packages from Universe or Multiverse, see the UbuntuHelp:Repositories page for instructions on how to do this.

In addition to the official Ubuntu repositories, it is possible to use third party repositories. Be careful, though - some are not compatible with Ubuntu and using them may cause programs to stop working or may even cause serious damage to your installation. The page http://www.ubuntulinux.nl/source-o-matic can help you to find extra repositories, and the UbuntuHelp:Repositories page gives instructions on how to enable them.

安装软件包

这部分将向您解释如何使用Ubuntu和Kubuntu下可用的各种工具安装软件包。


Ubuntu

  • Ubuntu 6.06 LTS (Dapper Drake)
  • Ubuntu 6.10 (Edgy Eft)
  • Ubuntu 7.04 (Feisty Fawn)


添加/删除—— 最基本方法

The easiest way of installing a package is to click ApplicationsAdd/Remove.... Find the package or packages you want to install. You can search for a keyword, such as 'email', or look through the categories shown on the left hand side of the window. Once you've found a package you want to install, tick the box next to its icon.

Once you've finished choosing, click the Apply button at the bottom of the window. Another window will pop up, showing all of the packages you've selected and asking if you'd like to apply the changes. To install the packages, click Apply. You'll then be asked to type in your super-user/administrator password. Once you've entered it, another window will appear informing you of the installation progress. Once this has finished, click Close. Your new programs are installed, ready to use!


Synaptic(新立得软件包管理器) ——更高级的方法

The Synaptic Package Manager offers a more advanced way of installing packages. If you have problems finding a suitable package with the Add/Remove tool, try using the search in Synaptic. This searches all of the packages in the available repositories, even the ones which don't contain programs.

For details on using Synaptic, read the UbuntuHelp:SynapticHowto.


Kubuntu

  • Kubuntu 6.06 LTS (Dapper Drake)
  • Kubuntu 6.10 (Edgy Eft)


添加/删除 应用程序——- 最基本方法

A new and easy method of installing packages is to use the 'Add/Remove Programs' tool. Click K-MenuAdd/Remove Programs to start it.

InstallingSoftware?action=AttachFile&do=get&target=AddRemoveProgs.png

Add/Remove Programs is a simple graphical way of installing and removing applications in Kubuntu. To launch Add/Remove Programs, choose K MenuAdd/Remove Programs from the desktop menu system.

Running Add/Remove Programs requires administrative privileges; see RootSudo for more information.

To install new applications select the category on the left, then check the box of the application you want to install. When finished click Apply, then your chosen programs will be downloaded and installed automatically, as well as installing any additional applications that are required. The default selection is restricted to KDE suite, but GNOME applications can be installed by selecting from dropdown menu at the top. Alternatively, if you know the name of the program you want, use the Search tool at the top.

Software from additional repositories may be installed by enabling the Show: Unsupported and Show: proprietary software checkboxes if they are enabled in your repository list. For more information, see the UbuntuHelp:Repositories page.

Once this has finished, click Close.Your new programs are installed, ready to use!


Adept——更高级的方法

InstallingSoftware?action=AttachFile&do=get&target=adept.png

The Adept Package Manager offers a more advanced way of installing packages. If you have problems finding a suitable package with the Add/Remove tool, try using the search in Adept.

For details on using Adept, read the Adept Howto.


基于文本的方法

Text based methods can be used across Ubuntu, Kubuntu and Xubuntu, but require familiarity with the terminal.


Aptitude ——基于文本方法

InstallingSoftware?action=AttachFile&do=get&target=Aptitude.png

Aptitude is a text-based package manager, which must be run from a Terminal. Read the AptitudeSurvivalGuide for more information on how to use Aptitude.


apt-get ——终端下方法

The apt-get program is a command-line package manager, which should be used if the Add/Remove tool and Synaptic ever run into problems. It provides an advanced interface to APT, the underlying package management system which Ubuntu uses, but is reasonably easy to operate. Power users may find that apt-get is quicker to use and more powerful than the graphical options above.

For details on how to use apt-get, read [[UbuntuHelp:AptGetHowto] and [|CommandLinePackageManagement]].


安装已下载软件包

You may wish to install a package you have downloaded from a website, rather than from a software repository. These packages are called .deb files. Because they may have been created for a different Linux distribution, you might find that there's dependency issues with Ubuntu, meaning that they may be uninstallable.


使用 GDebi 安装软件包

GDebi is a graphical application used to install .deb packages. It automatically checks packages for their dependencies and will try to download them from the Ubuntu software repositories if possible. You may first need to install GDebi - simply install the gdebi package using one of the package managers listed above, or open a Terminal and type sudo apt-get install gdebi.

Once you have installed GDebi, use the File Browser to find the package you wish to install. Package files will look similar to this:

InstallingSoftware?action=AttachFile&do=get&target=deb_package.png

Double-click the package to open it with GDebi. If all dependencies have been met for the selected package, simply click the 'Install package' button to install it. GDebi will warn you if there are unmet dependencies, which means that there's dependencies that aren't in the repositories that you're using.


Using the Kubuntu Package Management Utility

To install a .deb file in Kubuntu, right-click on the .deb file, and choose Kubuntu Package Menu->Install Package.


使用 dpkg 安装软件包

dpkg is a command-line tool used to install packages. To install a package with dpkg, open a Terminal and type the following:

cd directory
sudo dpkg -i package_name.deb

Note: replace directory with the directory in which the package is stored and package_name with the filename of the package.

It is recommended that you read the dpkg manual page before using dpkg, as improper use may break the package management database. To view the manual page for dpkg, open a Terminal and type man dpkg.

自动更新

Ubuntu will automatically notify you when security updates and software upgrades are available. Simply click the update icon (which will appear in the notification area), type in your super-user/administrator password and follow the instructions on-screen to download and install the updates.

Keeping up to date is important, as security fixes which protect your computer from harm are delivered in this way.

InstallingSoftware?action=AttachFile&do=get&target=update-notification.png


词汇

apt: The 'Advanced Package Tool', the program on which Ubuntu's Package Managers are based. apt handles the more complicated parts of package management, such as maintaining a database of packages.

Architecture: The type of processor the computer uses is referred to as its architecture.

Binary Package: A package which contains a program suitable for one particular architecture.

deb: A .deb file is a Ubuntu (or Debian) package, which contains all of the files which the package will install.

Dependency: A dependency is a package which must be installed for another package to work properly.

Package Manager: A program which handles packages, allowing you to search, install and remove them. E.g. Add/Remove...

Repository/Software Channel: A location from which packages of a similar type are available to download and install.

Source Package: A package which contains the original code for a program, which must be compiled to be usable on a particular architecture.