There are "Source Code Package" & "Binary Package" in Linux
In Centos Linux, the binary package is RPM package ended with ".rpm", and yum is a not a package,
yum is a online installation method for binary package software like "xxx.rpm".
RPM Install (rpm -ivh Full-Name-of-a-Rpm-Package)
// Sorry, the experiment failed
RPM Update (rpm -Uvh fullname)
// Sorry, the experiment failed
RPM Uninstall (rpm -e JUST-PACKAGE-NAME-NOT-FULL-NAME)
// Sorry, the experiment failed
RPM Query ( IMPORTANT, THIS COMMAND CAN‘T BE REPLACED BY YUM)
yum query what is on the server, rpm can query what is on your own computer
// rpm -q
┌─[root@nedrain]─[/etc/yum.repos.d]
└──? $rpm -q httpd
package httpd is not installed
rpm -qa
┌─[root@nedrain]─[/etc/yum.repos.d]
└──? $rpm -qa
microcode_ctl-2.1-22.el7.x86_64
grub2-common-2.02-0.64.el7.centos.noarch
rsyslog-8.24.0-12.el7.x86_64
setup-2.8.71-7.el7.noarch
dracut-config-rescue-033-502.el7.x86_64
basesystem-10.0-7.el7.centos.noarch
iprutils-2.4.14.1-1.el7.x86_64
firewalld-filesystem-0.4.4.4-6.el7.noarch
glibc-common-2.17-196.el7.x86_64
passwd-0.79-4.el7.x86_64
glibc-2.17-196.el7.x86_64
btrfs-progs-4.9.1-1.el7.x86_64
e2fsprogs-1.42.9-10.el7.x86_64
libsepol-2.5-6.el7.x86_64
iwl135-firmware-18.168.6.1-56.el7.noarch
libselinux-2.5-11.el7.x86_64
iwl7260-firmware-22.0.7.0-56.el7.noarch
info-5.1-4.el7.x86_64
iwl6050-firmware-41.28.5.1-56.el7.noarch
nspr-4.13.1-1.0.el7_3.x86_64
iwl6000g2a-firmware-17.168.5.3-56.el7.noarch
nss-util-3.28.4-3.el7.x86_64
iwl5000-firmware-8.83.5.1_1-56.el7.noarch
libcom_err-1.42.9-10.el7.x86_64
ivtv-firmware-20080701-26.el7.noarch
chkconfig-1.7.4-1.el7.x86_64
iwl100-firmware-39.31.5.1-56.el7.noarch
bzip2-libs-1.0.6-13.el7.x86_64
iwl5150-firmware-8.24.2.2-56.el7.noarch
readline-6.2-10.el7.x86_64
iwl105-firmware-18.168.6.1-56.el7.noarch
elfutils-libelf-0.168-8.el7.x86_64 // and so on
rpm -qi [package name]
┌─[root@nedrain]─[/etc/yum.repos.d]
└──? $rpm -qi chrony
Name : chrony
Version : 3.1
Release : 2.el7.centos
Architecture: x86_64
Install Date: Sun 15 Oct 2017 11:19:42 PM CST
Group : System Environment/Daemons
Size : 475316
License : GPLv2
Signature : RSA/SHA256, Thu 10 Aug 2017 11:17:57 PM CST, Key ID 24c6a8a7f4a80eb5
Source RPM : chrony-3.1-2.el7.centos.src.rpm
Build Date : Fri 04 Aug 2017 05:28:19 AM CST
Build Host : c1bm.rdu2.centos.org
Relocations : (not relocatable)
Packager : CentOS BuildSystem <http://bugs.centos.org>
Vendor : CentOS
URL : https://chrony.tuxfamily.org
Summary : An NTP client/server
Description :
A client/server for the Network Time Protocol, this program keeps your
computer‘s clock accurate. It was specially designed to support
systems with intermittent internet connections, but it also works well
in permanently connected environments. It can use also hardware reference
clocks, system real-time clock or manual input as time references.
rpm -ql [package name]: the directories
┌─[root@nedrain]─[/etc/yum.repos.d]
└──? $rpm -ql chrony
/etc/NetworkManager/dispatcher.d/20-chrony
/etc/chrony.conf
/etc/chrony.keys
/etc/dhcp/dhclient.d/chrony.sh
/etc/logrotate.d/chrony
/etc/sysconfig/chronyd
/usr/bin/chronyc
/usr/lib/systemd/ntp-units.d/50-chronyd.list
/usr/lib/systemd/system/chrony-dnssrv@.service
/usr/lib/systemd/system/chrony-dnssrv@.timer
/usr/lib/systemd/system/chrony-wait.service
/usr/lib/systemd/system/chronyd.service
/usr/libexec/chrony-helper
/usr/sbin/chronyd
/usr/share/doc/chrony-3.1
/usr/share/doc/chrony-3.1/COPYING
/usr/share/doc/chrony-3.1/FAQ
/usr/share/doc/chrony-3.1/NEWS
/usr/share/doc/chrony-3.1/README
/usr/share/man/man1/chronyc.1.gz
/usr/share/man/man5/chrony.conf.5.gz
/usr/share/man/man8/chronyd.8.gz
/var/lib/chrony
/var/lib/chrony/drift
/var/lib/chrony/rtc
/var/log/chrony
and you can find the package through any file of it: rpm -qf [filename]
// rpm -qf [filename]
┌─[root@nedrain]─[/etc/yum.repos.d]
└──? $rpm -qf /var/log/chrony
chrony-3.1-2.el7.centos.x86_64
Yum
the repository of yum is in the file /etc/yum.repos.d/
┌─[root@nedrain]─[/etc/pki/rpm-gpg]
└──? $ls /etc/yum.repos.d/
CentOS-Base.repo CentOS-Base.repo.bak epel.repo epel.repo.bak
update the yum repository
//first you need to backup the former repository
cp CentOS-Base.repo CentOS-Base.repo.bak
cp epel.repo epel.repo.bak
// then remember to clean the cache and remake the cache
yum clean all
yum makecache
yum list : show all the rpm package installable in the yum repository
// ...
zabbix40-proxy-pgsql.x86_64 4.0.17-1.el7 epel
zabbix40-proxy-sqlite3.x86_64 4.0.17-1.el7 epel
zabbix40-server.noarch 4.0.17-1.el7 epel
zabbix40-server-mysql.x86_64 4.0.17-1.el7 epel
zabbix40-server-pgsql.x86_64 4.0.17-1.el7 epel
zabbix40-web.noarch 4.0.17-1.el7 epel
zabbix40-web-mysql.noarch 4.0.17-1.el7 epel
zabbix40-web-pgsql.noarch 4.0.17-1.el7 epel
zanata-python-client.noarch 1.5.1-1.el7 epel
zarafa.x86_64 7.1.14-3.el7 epel
zarafa-archiver.x86_64 7.1.14-3.el7 epel
zarafa-client.x86_64 7.1.14-3.el7 epel
zarafa-common.noarch 7.1.14-3.el7 epel
zarafa-contacts.x86_64 7.1.14-3.el7 epel
zarafa-dagent.x86_64 7.1.14-3.el7 epel
zarafa-devel.x86_64 7.1.14-3.el7 epel
zarafa-gateway.x86_64 7.1.14-3.el7 epel
zarafa-ical.x86_64 7.1.14-3.el7 epel
zarafa-monitor.x86_64 7.1.14-3.el7 epel
zarafa-search.x86_64 7.1.14-3.el7 epel
zarafa-server.x86_64 7.1.14-3.el7 epel
zarafa-spooler.x86_64 7.1.14-3.el7 epel
zarafa-utils.x86_64 7.1.14-3.el7 epel
zarafa-webaccess.noarch 7.1.14-3.el7 epel
zathura.x86_64 0.2.7-2.el7 epel
zathura-devel.x86_64 0.2.7-2.el7 epel
zathura-djvu.x86_64 // too many
yum search [keyword]
┌─[root@nedrain]─[/etc/yum.repos.d]
└──? $yum search httpd
Loaded plugins: fastestmirror
Bad id for repo: #base, byte = # 0
Loading mirror speeds from cached hostfile
======================================== N/S matched: httpd =========================================
dmlite-apache-httpd.x86_64 : Apache HTTPD frontend for dmlite
iipsrv-httpd-fcgi.noarch : Apache HTTPD files for iipsrv
lighttpd-fastcgi.x86_64 : FastCGI module and spawning helper for lighttpd and PHP configuration
lighttpd-mod_authn_gssapi.x86_64 : Authentication module for lighttpd that uses GSSAPI
lighttpd-mod_authn_mysql.x86_64 : Authentication module for lighttpd that uses a MySQL database
lighttpd-mod_authn_pam.x86_64 : Authentication module for lighttpd that uses PAM
lighttpd-mod_geoip.x86_64 : GeoIP module for lighttpd to use for location lookups
lighttpd-mod_mysql_vhost.x86_64 : Virtual host module for lighttpd that uses a MySQL database
nextcloud-httpd.noarch : Httpd integration for NextCloud
owncloud-httpd.noarch : Httpd integration for ownCloud
pagure-web-apache-httpd.noarch : Apache HTTPD configuration for Pagure
radicale-httpd.noarch : httpd config for Radicale
sympa-lighttpd.x86_64 : Sympa with lighttpd
darkhttpd.x86_64 : A secure, lightweight, fast, single-threaded HTTP/1.1 server
httpd-itk.x86_64 : MPM Itk for Apache HTTP Server
lighttpd.x86_64 : Lightning fast webserver with light system requirements
mirmon-httpd.noarch : Apache configuration for mirmon
opensips-httpd.x86_64 : HTTP transport layer implementation
perl-Test-Fake-HTTPD.noarch : Fake HTTP server module for testing
python2-sphinxcontrib-httpdomain.noarch : Sphinx domain for documenting HTTP APIs
sympa-httpd.x86_64 : Sympa with Apache HTTP Server
sysusage-httpd.noarch : Apache configuration for sysusage
thttpd.x86_64 : A tiny, turbo, throttleable lightweight HTTP server
viewvc-httpd-fcgi.noarch : ViewVC configuration for Apache/mod_fcgid
viewvc-httpd-wsgi.noarch : ViewVC configuration for Apache/mod_wsgi
web-assets-httpd.noarch : Web Assets aliases for the Apache HTTP daemon
yum -y install [package name (No more full name in yum)]
┌─[root@nedrain]─[~]
└──? $yum -y install wget
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package wget.x86_64 0:1.14-15.el7 will be updated
---> Package wget.x86_64 0:1.14-18.el7_6.1 will be an update
--> Finished Dependency Resolution
Dependencies Resolved
=====================================================================================================
Package Arch Version Repository Size
=====================================================================================================
Updating:
wget x86_64 1.14-18.el7_6.1 base 547 k
Transaction Summary
=====================================================================================================
Upgrade 1 Package
Total download size: 547 k
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
wget-1.14-18.el7_6.1.x86_64.rpm | 547 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Updating : wget-1.14-18.el7_6.1.x86_64 1/2
Cleanup : wget-1.14-15.el7.x86_64 2/2
Verifying : wget-1.14-18.el7_6.1.x86_64 1/2
Verifying : wget-1.14-15.el7.x86_64 2/2
Updated:
wget.x86_64 0:1.14-18.el7_6.1
yum -y update [package name] // if you don‘t append the package name, it will update all include the kernel!!!
//Sorry
yum remove [package name]
//You should be really cautious, it will also remove the reliance
Source Code Package (This is just an Example)
1. download the source code and uncompress
wget http://archive.apache.org/dist/httpd/httpd-2.2.9.tar.gz
tar -zxvf httpd/httpd-2.2.9.tar.gz
// and here is the installation directory
┌─[root@nedrain]─[~/httpd-2.2.9]
└──? $ls
ABOUT_APACHE BuildBin.dsp docs InstallBin.dsp modules ROADMAP
acinclude.m4 buildconf emacs-style LAYOUT NOTICE server
Apache.dsw CHANGES httpd.dsp libhttpd.dsp NWGNUmakefile srclib
apachenw.mcp.zip config.layout httpd.spec LICENSE os support
build configure include Makefile.in README test
BuildAll.dsp configure.in INSTALL Makefile.win README.platforms VERSIONING
2. execute the "configure" file (which will produce the file "Makefile")
// you can first ./configure --help to query something
┌─[root@nedrain]─[~/httpd-2.2.9]
└──? $./configure --help
`configure‘ configures this package to adapt to many kinds of systems.
Usage: ./configure [OPTION]... [VAR=VALUE]...
To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE. See below for descriptions of some of the useful variables.
Defaults for the options are specified in brackets.
Configuration:
-h, --help display this help and exit
--help=short display options specific to this package
--help=recursive display the short help of all the included packages
-V, --version display version information and exit
-q, --quiet, --silent do not print `checking...‘ messages
--cache-file=FILE cache test results in FILE [disabled]
-C, --config-cache alias for `--cache-file=config.cache‘
-n, --no-create do not create output files
--srcdir=DIR find the sources in DIR [configure dir or `..‘]
Installation directories:
--prefix=PREFIX install architecture-independent files in PREFIX
[/usr/local/apache2]
--exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
[PREFIX]
By default, `make install‘ will install all the files in
`/usr/local/apache2/bin‘, `/usr/local/apache2/lib‘ etc. You can specify
an installation prefix other than `/usr/local/apache2‘ using `--prefix‘,
for instance `--prefix=$HOME‘.
For better control, use the options below.
Fine tuning of the installation directories:
--bindir=DIR user executables [EPREFIX/bin]
--sbindir=DIR system admin executables [EPREFIX/sbin]
--libexecdir=DIR program executables [EPREFIX/libexec]
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] // and so on
// --prefix : assign the installation directory
./configure --prefix=/usr/local/apache2/
// the output is:
...
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking for library containing strerror... none required
checking for minix/config.h... (cached) no
checking whether it is safe to define __EXTENSIONS__... (cached) yes
checking for ANSI C header files... (cached) yes
checking for string.h... (cached) yes
checking limits.h usability... yes
checking limits.h presence... yes
checking for limits.h... yes
checking for unistd.h... (cached) yes
checking sys/socket.h usability... yes
checking sys/socket.h presence... yes
checking for sys/socket.h... yes
checking pwd.h usability... yes
checking pwd.h presence... yes
checking for pwd.h... yes
checking grp.h usability... yes
checking grp.h presence... yes
... // too many
At the end, you can find a file named "Makefile"
┌─[root@nedrain]─[~/httpd-2.2.9]
└──? $ls
ABOUT_APACHE buildconf configure.in InstallBin.dsp modules ROADMAP
acinclude.m4 CHANGES docs LAYOUT modules.c server
Apache.dsw config.layout emacs-style libhttpd.dsp NOTICE srclib
apachenw.mcp.zip config.log httpd.dsp LICENSE NWGNUmakefile support
build config.nice httpd.spec Makefile os test
BuildAll.dsp config.status include Makefile.in README VERSIONING
BuildBin.dsp configure INSTALL Makefile.win README.platforms
3. make (which is compiling, the output is )
┌─[root@nedrain]─[~/httpd-2.2.9]
└──? $make
// just wait
┌─[root@nedrain]─[~/httpd-2.2.9]
└──? $ls
ABOUT_APACHE buildmark.o docs LAYOUT modules.lo server
acinclude.m4 CHANGES emacs-style libhttpd.dsp modules.o srclib
Apache.dsw config.layout httpd LICENSE NOTICE support
apachenw.mcp.zip config.log httpd.dsp Makefile NWGNUmakefile test
build config.nice httpd.spec Makefile.in os VERSIONING
BuildAll.dsp config.status include Makefile.win README
BuildBin.dsp configure INSTALL modules README.platforms
buildconf configure.in InstallBin.dsp modules.c ROADMAP
4. make clean (which means cleaning the compiling, only needed if something is wrong with the step 2
5 . make install (which is finally installation, but this
make install
//after this
┌─[root@nedrain]─[/usr/local/apache2]
└──? $ls
bin build cgi-bin conf error htdocs icons include lib logs man manual modules
If the "make install" command failed, then you‘d have to delete the whole directory and reinstall.