rpm and yum software management

File transfer between linux and window -lrzsz

Step One: Download lrzsz
[root @ ken ~] # yum -y install lrzsz
Step Two: file upload window to linux on them
[root @ ken ~] # rz
[root @ ken ~] # LS
Anaconda-KS. ken1 Redis-test2 3.2.12-2.el7.x86_64.rpm CFG
the a.out lib64jemalloc1-3.6.0-2.mga5.x86_64.rpm test1 test.txt
[Ken the root @ ~] #

The third step: transfer files on linux to window among the
[root @ ken ~] # sz test.txt
future career development better
operation and maintenance development, DBA, architect

Introduction rpm

This is a database management tool, you can read the database to determine whether the software has been installed, if you have installed can read out the location of all the files, etc., and can be achieved delete these files.
rpm: RPM is Redhat Package Manager (recursive acronym)
rpm can complete the operation
to install the software
uninstall software
query software information
upgrades, downgrades
test
Packager
rpm is only able to manage packages in line with rpm format, not the program management of source format
program format
1 ) source format program: are presented in compression (suffix are .tar.gz | bz2)
program 2) rpm format: this is a program (.rpm suffix are later compiled)

Software installation summary

There are several ways to install the software
mode 1: compile and install
the program source code to compile on demand, after the installation
Disadvantages:
the installation process is complicated and very slow
advantages:
the installation process control, according to the real needs of the installation (the installation location, installation the module can be selected)
mode 2: rpm installation (with rpm to install rpm suffix installation package)
advantages:
the installation and uninstallation process is very easy
drawbacks:
the installation process is not controllable (mounting position, mounting those functional modules)
dependencies rpm package very complex
way 3: yum install
yum install, in fact, automatic dependency analysis rpm package, then follow the desired order and then click install
mode 4: green installation

rpm operation

First, the installation package rpm

Format: rpm -ivh package names
option
-i: Install the software
-v: display the installation process
-h: with # indicate the installation progress (# 2%)
-vv: display more detailed installation information
-vvv: show more and more detail the installation process information

Second, uninstall the rpm package

Format: rpm -e name of the software
options:
-e: uninstall the software
example: Uninstall packages ken
RPM -e ken

Third, the inquiry has been installed rpm package

Format: rpm -q name of the software
options:
-q: View an installed software
-a: View all software installed All
the -l: display after the software installation is complete generated file list (all files) List
-i: View Packages information related info
-d: display a list of documents docfiles the nature of the software generated
-c: View software generated a list of profiles configfiles
-scripts: View related software script
to add:
pre-install script (preinstall)
after installation script (postinstall)
pre-uninstall script (preuninstall)
after the uninstall script (postuninstall)

rpm install redis

[Ken the root @ ~] # RPM -ivh Redis-3.2.12-2.el7.x86_64.rpm
\ warning: Redis-3.2.12-2.el7.x86_64.rpm: Header V3 the RSA / the SHA256 the Signature, Key ID 352c64e5 : NOKEY
error: the Failed Dependencies:
libjemalloc.so.1 () (64bit) needed by IS-3.2.12-2.el7.x86_64 # Redis prompted to install dependent
[root @ ken ~] # rpm -ivh lib64jemalloc1-3.6. 0-2.mga5.x86_64.rpm # install the required dependencies
warning: lib64jemalloc1-3.6.0-2.mga5.x86_64.rpm: Header V3 RSA / SHA1 Signature, Key ID 80420f66: NOKEY
the Preparing ... #### ############################# [100%]
Updating / Installing ...
. 1: ## lib64jemalloc1-3.6.0-2.mga5 ############################### [100%]
[Ken the root @ ~] # RPM -ivh Redis-3.2.12 End -2.el7.x86_64.rpm # resolve dependencies installed again
warning: redis-3.2.12-2.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 352c64e5: NOKEY
Preparing… ################################# [100%]
Updating / installing…
1:redis-3.2.12-2.el7 ################################# [100%]
[root@ken ~]# systemctl restart redis
[root@ken ~]# redis-cli
127.0.0.1:6379> set name ken
OK
127.0.0.1:6379> get name
“ken”
二、rpm卸载redis
[root@ken ~]# rpm -e redis

Third, the query packet
-q: a viewing software already installed
-a: View all software installed All
the -l: displays the generated file list (all files) after the software installation is complete list
Example 1: Query redis is installed
[root @ ken ~] # Redis -q RPM
Package not installed iS Redis not installed #
[@ Ken the root ~] -q RPM # Redis
Redis-installed 3.2.12-2.el7.x86_64 #

Example 2: View redis generated file
[Ken the root @ ~] # RPM the -ql redis
/etc/logrotate.d/redis
/etc/redis-sentinel.conf
/etc/redis.conf
/ etc / systemd / System / redis- sentinel.service.d
/etc/systemd/system/redis-sentinel.service.d/limit.conf
/etc/systemd/system/redis.service.d
/etc/systemd/system/redis.service.d/limit. the conf
/ usr / bin / Redis-Benchmark
/ usr / bin / Redis-Check-AOF
/ usr / bin / Redis-Check-RDB
/ usr / bin / Redis-CLI
/ usr / bin / Redis-Sentinel
/ usr / bin / Server-Redis
/usr/lib/systemd/system/redis-sentinel.service
/usr/lib/systemd/system/redis.service
/ usr / libexec / Redis the shutdown-
/usr/share/doc/redis-3.2.12
/usr/share/doc/redis-3.2.12/00-RELEASENOTES
/usr/share/doc/redis-3.2.12/BUGS
/usr/share/doc/redis-3.2.12/CONTRIBUTING
/ usr / share / doc /redis-3.2.12/MANIFESTO
/usr/share/doc/redis-3.2.12/README.md
/usr/share/licenses/redis-3.2.12
/usr/share/licenses/redis-3.2.12/COPYING
/usr/share/man/man1/redis-benchmark.1.gz
/usr/share/man/man1/redis-check-aof.1.gz
/usr/share/man/man1/redis-check-rdb.1 .gz
/usr/share/man/man1/redis-cli.1.gz
/usr/share/man/man1/redis-sentinel.1.gz
/usr/share/man/man1/redis-server.1.gz
/usr/share/man/man5/redis-sentinel.conf.5.gz
/usr/share/man/man5/redis.conf.5.gz
/ var / lib / redis
/ var / log / redis
/ Var / run / redis

Example 3: Check all packets linux system
[root @ ken ~] # rpm -qa

Example 4: The current statistical system total number of installed software
rpm -qa [root @ ken ~] # | wc -l

4.rpm query file which program is generated
[the root Ken @ ~] Which LS #
Alias = LS 'LS -color = Auto'
/ usr / bin / LS
[Ken the root @ ~] # -qf RPM / usr / bin / LS
coreutils-8.22-21.el7.x86_64

Example 1: httpd unload command generation program
[Ken the root @ ~] # Which httpd
/ usr / sbin / httpd
[Ken the root @ ~] # RPM -qf which httpd
httpd-2.4.6-80.el7.centos.x86_64
5. The View All have been installed and not yet installed rpm package
yum list all or yum list list all packages

  1. yum list available: you can only display but not yet installed rpm package installed
  2. yum list installed: show only installed rpm package
    @: that is already installed rpm
  3. View yum repository of information
    yum repolist

    Yum software management

    Also a rpm package management tool, can be achieved automatically resolve dependencies rpm package (installed automatically rely order to install the rpm package)
    why would rpm package dependencies?
    People make rpm, and in the production of the rpm package, this information will be dependent on the rpm of the software stored in the internal rpm package

    yum works

    1. You need to create a yum repository (rpm package warehouses, depots)
    1) warehouse is actually a directory
    2) is stored in a warehouse rpm package
    3) warehouse also save a file, the file recorded in the warehouse all metadata package information rpm
    4) the metadata information includes
    the software name
    software version
    that the software has been installed
    dependencies software
    2. the procedure to find the software installation from the warehouse with yum (for example, to install the software a, a, B and C depend , B-dependent CD)
    1) yum first scans the saved file metadata information, check whether a is installed, if installed, it prompts have been installed
    2) If a is not already installed, then the dependency information scanned a, you will find a dependent B, and C
    3) yum scans again metadata files, detect BC is installed, if you have already installed, it will start to begin the installation a
    4) If BC is not already installed, it will detect dependencies BC, you will find B depends CD
    5) yum again scans the metadata file, detects whether the installation CD, if already installed, it will start to begin the installation B, and then install the C ,, and then install A

yum warehouse

Local: The local directory made a yum repository, only the current system
network: the network via a directory on the server as a yum repository, all hosts in the network can be a
way to use yum repository, yum configuration file is modified
yum profile
main: /etc/yum.conf
sub:. /etc/yum.repos.d / * the repo
/etc/yum.conf document
cachedir = / var / cache / yum / $ basearch / $ releasever
specified cache file save location, default: / var / cache / yum / x86_64 / 7 /
keepcache = 0
specify whether to keep the cache files
with yum install process will download the software from the yum cache repository and multiple resources
1) yum repository metadata will cache configuration file to the file path specified by
the software and software-dependent 2) will be installed to collectively designated by the profile cache directory

Yum configuration files constitution

[localRpm] <<< designated yum repository id, can easily write, but without spaces
name = name specifies the yum repository xxx <<<, you can easily write
enabled = 0 | 1 <<< specify whether to use the yum repository 0 means no use; 1 indicates use
gpgcheck = 0 | 1 <<< specify whether the rpm package to do to verify the legitimacy and integrity of the source, 0 means no verification; 1 represents must be done to verify
gpgkey = <<< designated public file (if gpgcheck = 1, then this can not be omitted)
baseurl = <<< designated yum repository url
[repoid]
name = reponame
Enabled = 1
gpgcheck = 0 | 1 # 0 means no parity, 1 check
baseurl = File: // | HTTP: //
gpgkey = File: //

yum repository url of representation

Note: The designated yum warehouse, when in fact not point to the directory rpm package, but performs repodata directory where local yum repository file: //
example: For example my yum repository / myrpm, this time yum representation is the file repository: /// myrpm
network yum repository
http: //

Create a local yum repository

Use the CD-ROM rpm package yum repository as a
first step: mount the CD
mount / dev / cdrom / media
Step two: Backup comes with yum configuration file
cd /etc/yum.repos.d
mkdir BAK
mv * .repo BAK
step 3: create yum configuration file, use the CD as a yum repository

Example 1: preparation of local files yum - not open check
[Ken]
name = ken1
Enabled = 1
gpgcheck = 0
BaseURL = File: /// mnt

Example 2: preparation of local yum file - open check
[Ken]
name = ken1
Enabled. 1 =
gpgcheck. 1 =
BaseURL = File: /// mnt
gpgkey = File: /// mnt / the RPM-the GPG-KEY. 7-the CentOS-

Step Four: Execute the command yum detection results of
all the data yum yum clean all <<< empty the cache
yum repolist <<< check yum repository how many rpm package available

Use yum

1. Install the software
yum -y install software Software 1 2 3 ... software.
2. The software uninstall
yum -y remove Software Software 1 2 3 ... software.
3. management packet group
grouplist: All packet group system
groupinfo packet group name: Displays the information packet group (packet group action, software included)
groupinstall package group name: install the specified package group
groupremove package group name: uninstall the package specified set of
CentOS7: command-line interface to upgrade to a graphical interface
at this time we can enter the command startx graphical interface, first entered will be relatively slow, please be patient. (May require reboot command reboot)
4. Management yum cache data
Clean [Packages Standard Package | the Metadata | All]
All: erases all data
packages: just remove rpm package
metadata: just clear the cache metadata
[root @ ken ~] # yum All Clean
Loaded plugins: fastestmirror
Cleaning Repos: ken
Cleaning up Everything
Maybe you want: rm -rf /var/cache/yum, to also free up space taken by orphaned data from disabled or removed repos
Cleaning up list of fastest mirrors
查看yum源
[root@ken ~]# yum repolist
Loaded plugins: fastestmirror
Determining fastest mirrors
ken | 3.6 kB 00:00:00
(1/2): ken/group_gz | 166 kB 00:00:00
(2/2): ken/primary_db | 3.1 MB 00:00:00
repo id repo name status
ken ken1 3,971

Make a network source yum

Ideas: Preparing the network a host in which to install a web server software (such as apache), and then create a directory in preparation for this directory on all the resources yum repository, if the user has access to the host computer via a network directory , then this directory will become a network yum warehouse
implementation process
Step 1: configure yum source host
1) install apache configuration
omitted
2) configured yum repository resources
1. create a directory as a storage resource yum directory
mkdir / usr / local / the Apache / htdocs / MySource
2. mount the CD
Mount / dev / cdrom / mnt
3. copy the CD-ROM resource to the directory you created earlier under
cp / mnt / * / usr / local / the Apache / htdocs / MySource -rvf
4 accessing about yum repository browser, check whether you can see related files

http://ip/mysource

Step Two: Configure the client host
to modify yum configuration file
1) backup the original configuration file
mkdir BAK
mv * .repo BAK
vim a.repo
[]
name
Enabled =
gpgcheck =
baseurl = HTTP: // ip / MySource
2) test a bit

yum repolist

Examples of demonstration network yum source - source configuration epel

Step 1: Create a local yum file
[root @ ken yum.repos.d] # vim net.repo
[NET]
name = aliyun
Enabled = 1
gpgcheck = 0
baseurl = HTTPS: //mirrors.aliyun.com/epel/7 / x86_64 /

Step two: Empty the cache
[root @ ken yum.repos.d] # yum clean all

第三步:查看包
[root@ken yum.repos.d]# yum repolist
Loaded plugins: fastestmirror
Determining fastest mirrors
ken | 3.6 kB 00:00:00
net | 4.7 kB 00:00:00
(1/5): ken/group_gz | 166 kB 00:00:00
(2/5): ken/primary_db | 3.1 MB 00:00:00
(3/5): net/group_gz | 88 kB 00:00:01
(4/5): net/updateinfo | 1.0 MB 00:00:03
(5/5): net/primary_db | 6.7 MB 00:00:27
repo id repo name status
ken ken1 3,971
net aliyun 13,190
repolist: 17,161

Step Four: Download Redis
[root @ ken yum.repos.d] # yum -y install Redis

Step Five: Verify whether the download was successful redis
[root @ ken yum.repos.d] # systemctl restart redis
[root @ ken yum.repos.d] # redis-cli
127.0.0.1:6379>
127.0.0.1:6379>
127.0 .0.1: 6379> the SET name ken
the OK
127.0.0.1:6379> GET name
"ken"

Guess you like

Origin www.cnblogs.com/LibetJohn/p/11126511.html