Linux package installation and uninstallation

Source: Internet
Author: User
Tags aliases

three ways to install packages

RPM Package Introduction

Mount mount/dev/cdrom/mnt/

Usage: Install RPM-IVH rpm

Upgrade Package RPM-UVH rpm

Uninstall RPM-E directly behind the parking name

Query the installed package RPM-QA

RPM-Q Package Name, query whether the specified package is installed

Rpm-qi querying the specified package information

RPM-QL package name, listing files for package installation

RPM-QF file absolute path to see which package the file was installed by

Yum Tool usage

Just parking name behind

Yum List List of available RPM packages

Configuration file for Ls/etc/yum.repos.d/yum

Yum Search package behind with vim or network

Yum List | grep filters a tool for strings, precise search

Yum install-y Install a package

Yum Grouplist all the available groups, and can also change Chinese to English, lang=en

Yum Groupinstall-y installs the package inside this kit, if there is a word, do not add ' single quotation marks, if there are two words with a space, plus

Yum remove-y Uninstall Package

Yum update-y Upgrade Pack

Yum provides "/*/vim" if your command is not available use this command to search to see which package it is installed on, such as Vim.

Yum builds local warehouses

① first to mount the image to the/MNT directory

② because some files may be deleted, make a backup first copy cp-r/etc/yum.repos.d/etc/yum.repos.d.bak

③ then delete rm-f/etc/yum.repos.d/*

④ then edit the configuration file Vim/etc/yum.repos.d/dvd.repo

⑤, write down the contents of the bottom.

[DVD] Name

Name=install DVD Customization

Where is the baseurl=file:///mnt RPM package?

Enable=1 is available

Gpcheck=0 whether to detect

⑥ before putting some cache cleanup Yum Cean all

⑦ look at the Yum list again.

Yum replaces the domestic source and replaces the Yum warehouse source.

The first thing to do is remove rm-f/yum.repos.d/dvd.repo

The copy of the test back to the CP. /yum./yum.repos.d.bak/*.

Then erase the mirror rm-f Centos-base.repo

In the download 163 image, with the second, wget Http://mirrors.163.com/.help/CentOS7-Base-163.repo

· Or

· Curl-o Http://mirrors.163.com/.heIp/CentOS7-Base-163.repo

· Yum list look at

Yum Download RPM Package

Installing the extension source Epel

Yum Install-y epel-release

Yum List Lgrep Epel

Yum Download RPM Package

Installation: Yum install-y package name--downloadonly only download not installed

· is/var/cache/yum/x86-64/7/

· Yum install-y Package name--downloadonly--downloaddir= path

Reinstall Download: Yum reinstall-y package name--downloadonly--downloaddir= path

--downloaddir Plus it means that only download does not install

SOURCE Package Installation

In the future, the source package is placed in this path

cd/usr/local/src/

Download an Apache wget http://mirrors.cnnic.cn/apache/httpd/httpd-

2.2.32.tar.gz

Then unzip it TAR-ZXVF httpd-2.2.32.tar.gz

After unpacking, go to this directory. CD httpd-2.2.32 ls look at

There's a readme. More readme Look at

There is also an install more to look at, this is the installation document, the method is as follows:

First step./configure--prefix=/usr/local/apache2

Step two make

Step three make Install

Uninstall is to delete the installed files

If you don't know your command, can you use echo $? command if it shows non-zero proof it's not right


Shell

Command history

History can save up to 1000 records

echo $HISTSIZ Environment variables

Vi/etc/profile can modify the data of the environment variable/search to Histsiz it can be modified and then source/etc/profile take effect

History-c can empty the cache in the current command history

History is just a command that shows the LD, how to record a command of what time it is running, can run this command: Histtim eformat= "%y/%m/%d%h:%m:%s" but only in the current terminal takes effect

Permanent entry requires Edit profile: Vim/etc/profile

/Search for histsiz command histtim eformat= "%y/%m/%d%h:%m:%s" put it there, as

Permanently save Chattr + a/.bash history

! N runs the specified command, n indicates the number

!echo in command history, looking for the first command to begin with Echo.


Command completion and aliases

TAB key,

Parameter completion: Yum install-y bash-completion

Reboot reboot

Alias aliases give the command a name again


Wildcard characters

· is *.txt file terminated with. txt

· Any one character of is?. txt

· is [0-9].txt within the range of

· is {1,2}.txt One of this range

Input and output redirection

> The meaning of redirection

· Cat 1 txt > 2.txt put the output of the front file directly into the back of the file, redirect the contents of 1.txt to 2.txt, and it will delete the contents of the file to rewrite

> > Add the meaning that it will not remove your original content

· Cat I.txt >> 2.txt

2> error Redirect, it will specify the error message generated by the command input into the file

· is Aaa.txt 2>err

2>> Error Append redirect

· is Aaa.txt 2 >>err

Input redirection, the contents of a file or file on the right to the left of a file or command inside

· Wc-l < 1. txt

· Command > L.txt 2 > &1

&= the right and wrong combination


Linux package installation and uninstallation

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.