Basic Linux tutorial ---- install software in Linux

Source: Internet
Author: User

Basic Linux tutorial ---- install software in Linux
Introduction

This article introduces several methods for installing software in Ubuntu and the use of apt and dpkg tools.

1. Install software on Linux

There are usually three methods for installing software on Linux:

  • Online Installation
  • Install deb software package from disk
  • Install from Binary Package
  • Compile and install from source code

These installation methods have their own advantages and disadvantages, and most software packages release software in multiple ways. Therefore, we often need to master all these software installation methods to adapt to various environments. The following describes the first three installation methods. You will learn from the source code compilation and installation in Linux programming.

2. Online Installation

Imagine that when we use Windows and want to install a software, we need to download the corresponding software installation package on the Internet. When we install it, we will continue to click Next, these procedures may have gone through countless times, but in Linux, a command is followed by a carriage return. After a while, the software is installed. This is a convenient way to install software online. Before learning about this installation method, you must note that there are some differences in the online installation methods on different linux distributions, including the commands used and their package management tools, because our development environment is based on ubuntu, the online installation method involved here will only apply to the ubuntu release, or other ubuntu-based releases, such as ubuntukylin in China, and ubuntu is a debian-based release, which uses the debian package management tool dpkg, therefore, some operations are also applicable to debian. Other releases that use other package management tools, such as RedHat, CentOS, and Fedora, will not apply (redhat and centos use rpm ).

1. Try it first

For example, we want to install a software namedw3m(W3m is a simple Web browser with command line), enter the following command:

$ sudo apt-get install w3m

You have seen this operation many times in the previous chapter. It indicates that a software package namedw3mSoftware

Let's take a look at the effect of command execution:

$ w3m www.shiyanlou.com/faq

Note: if you cannot use the software immediately after installing itTabKey completion: This command can be executed first.source ~/.zshrcThen you can use the complete operation.

2. Introduction to apt package management tools

APT is the abbreviation of Advance Packaging Tool (Advanced Packaging Tool). It is the Software Package Manager of Debian and its derivative release. APT can automatically download, configure, and install software packages in binary or source code format, therefore, the process of managing software on Unix systems is simplified. APT was first designed as a front-end of dpkg to process software packages in deb format. Now, after APT-RPM Organization Modification, APT can be installed in a system that supports RPM to manage RPM packages. This Package Manager containsapt-Multiple tools, suchapt-get apt-cache apt-cdromIn the release of the Debian series.

Firstapt-getThe tool searches a local databasew3mYou may have a question: why is the software installed online? To explain this question, you must mention the following terms:

  • Software source backup storage
  • Software Source

We need to regularly download a list of software packages from the server, usingsudo apt-get updateCommand to keep the local software package list up-to-date (sometimes you need to manually perform this operation, such as replacing the software source), and there will be a software dependency information record in this table, for software dependencies, let's take an example: we installw3mThis software requireslibgc1c2This package can work normally.apt-getThe software will be installed for us to ensurew3mCan work normally.

3. apt-get

apt-getUsed for processingaptPublic Assembly of the package. We can use it to install, uninstall, and upgrade software packages online.apt-getInclude common tools:

Tools Description
install Add the software package name to install a software package.
update Download/update the software package list used to update the local software source from the software source backup storage.
upgrade Update all software packages that can be updated locally. If dependency problems exist, they are not upgraded. Generally, they are executed once before the update.update
dist-upgrade Resolve dependencies and upgrade (risky)
remove Remove installed software packages, including software packages that are dependent on the removed software package, but do not contain the configuration files of the software package.
autoremove Remove a software package that was previously depended on by another software package but is no longer in use
purge It is the same as remove, but the software package will be completely removed, including its configuration file
clean Remove the installed software package downloaded to the local device. It is saved in/var/cache/apt/archives/by default/
autoclean Remove Old software packages of installed software

Below are someapt-getCommon parameters:

Parameters Description
-y This parameter is useful in some automated installation scripts because it automatically responds to the options for installing software packages.
-s Simulated Installation
-q Silent Installation Method, specifying multipleqOr-q=#, # Indicates a number, used to set the silent level, which is useful when you do not want to output too much screen when installing the Software Package
-f Repair corrupted Dependencies
-d Download only without Installation
--reinstall Reinstall the software package that has been installed but may have problems
--install-suggests Install the recommended software package provided by APT.
4. install the software package

For installation, as shown in the previous demonstration, you only need to executeApt-get install <package name>In addition to this, you should also know how to reinstall the software package. In many cases, we need to reinstall a software package, for example, your system is damaged, or some wrong configuration causes the software to fail to work normally.

You can reinstall it as follows:

$ sudo apt-get --reinstall install w3m

The other thing you need to know is how to install the software package without knowing the full name of the software package. We usually useTabKey to complete the software package name. Later we will introduce a better method to search for the software package. Sometimes you need to install multiple software packages at the same time. You can also use regular expressions to match the software package name for batch installation.

5. Software Upgrade
# Update software source $ sudo apt-get update # upgrade a software package without dependency problems $ sudo apt-get upgrade # upgrade and resolve dependencies $ sudo apt-get dist-upgrade
6. uninstall software

If you thinkw3mThis software is not your own appetite, or you have found a better one. You need to uninstall it, which is so simple! It is also a command and press ENTERsudo apt-get remove w3m, The system will have a confirmation operation, and then the software will be "out of the box ".

Or, you can execute

# Remove without retaining the configuration file $ sudo apt-get purge w3m # or sudo apt-get -- purge remove # remove unnecessary dependent software packages $ sudo apt-get autoremove
7. Software search

When you want to download and use a software, you need to check whether the software warehouse exists. You need to use the search function. The command is as follows:

sudo apt-cache search softname1 softname2 softname3……

apt-cacheCommands are used to perform operations on local data,searchSearch for related information in the local database as the name suggestssoftname1 softname2...... Information about related software. Search for the software we installed before.w3m,

The result shows fourw3mRelated Software.

We have introduced so much about online installation.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.