Linux rpm, yum, tar package management



January 2, Wuxu Year Name: Wang Guang

I understand:

A. Software classification under Linux system:
rpm software package (with the extension of .rpm Red Hat package format;
source code package (various compressed packages contain the source code of the program);
accompanying installer package (installation provided in the package) program);
an installation-free software package (the compiled executable program file is provided in the package and can be used after decompression)
B. Application directory structure:
/usr/bin ordinary executable file;
/usr/sbin management program file;
/ var/log log file;
/usr/share/doc documentation file;
/usr/share/man manual file;

Two, three methods of Linux system installation

1. rpm package management

-Introduction:
-Proposed by Red Hat to establish a unified database file, which simplifies system installation, uninstallation, update and upgrade, and can automatically analyze package dependencies -Design
goals:
-Upgradability (when upgrading to a new When a version is released, the configuration files of the original packages are preserved, so the user does not lose customized settings)
- Powerful query (easy to search for packages in the database, knowing which file belongs to which package comes from)
- System check ( When a file is lost)
- pure code (allows to package software code into source packages and program packages, and directly check the patch to determine what needs to be done after a new version is released)

- use the command:
rpm -qieUvh [rpm package name]
- query :
rpm -q [package name] (to check whether a package has been installed)
rpm -qa (to query all installed packages)
rpm -qi [package name] (to check the detailed information of this package)
rpm -ql [package name ] ] (query the software list of this package)
rpm -qR [package name] (query the dependencies of this package)
rpm -qf [file name] (query which software package this file belongs to) -Install
:
rpm -ivh [package name]
[i: install; v: display detailed information during installation; h: display progress bar]
still install if it is already installed: rpm -ivh –replacepkgs [package name] -uninstall
:
rpm -e [package name]
has dependencies when uninstalling Uninstall when the relationship is wrong (packages that depend on it may not work): rpm -e --nodeps [package name]
-Upgrade :
rpm -Uvh [package name] (Upgrade is a combination of install and remove)
Force upgrade: rpm -Uvh –oldpackage [package name] -Refresh
: [Upgrade when the option to refresh is newer than the installed version To a newer version]
rpm -Fvh [package name]
[Note: the difference between upgrade and refresh: if it is not installed, the refresh option will not install the upgrade, regardless of whether the earlier version has been installed, the upgrade option will be installed]
–rpm package location: /media/CentOS~/Packages/
——————————————————————————————————————————-

2.yum management package

– Advantages: Automatically resolve rpm software packages; all software packages are provided by the YUM software repository; maintain consistency with the rpm database –
yum configuration:
1. Directly configure /etc/yum.conf;
2. In /etc/yum Add the repo file to the .repos.d directory [repo file: the configuration file of the yum source in the Linux system]
– command use: yum [-yq] [list install update remove clean all] [-y: all the way yes! -q: no Display installation details]
– Default installation location: /usr/lib/yum;
– Detailed example:
Mount the CD image: mount /dev/sr0 /media –

After inserting the U disk, there is no mount directory, the solution: umount /dev /sr0
Backup the original yum source configuration file and create a local yum source configuration file –
cd /etc/yum.repos.d/
mkdir back
mv *.repo file name
Edit file name –
vi [file name]
[local] #software Source name, used for yum identification #
name=local #Software repository name, easy to read configuration files #
baseuer=file:///media #Source mirror server address #
enabled=1 #Indicates that the source in the repo is enabled #
gpcheck =0 #Indicates whether to open the rpm check, which is closed here! #Clear
the yum cache, create a new cache -
yum clean all
yum makecache
yum install package name -y (installation) -
service ~d start (open service) -
netstat -anlput (view port) -
local browser browse virtual machine IP -
cd /var/www/html/
vi ~ (Build a web page)
————————————————————————————————————–

3.tar package management: (packaging/compression)

– Advantages: Get the latest version to fix bugs in time;
Freely compile and install, modify code, customize software functions;
– Introduction:
- Package: Turn many files and directories into a total file, which is very convenient for backup files or network transmission
- Compression: Turn a large file into a small file through a compression algorithm
- Commonly used compression suffixes: .tar .gz .bz2 .tbz (files compressed with tar and bzip) .tgz (files compressed with tar and gzip) .zip
– Command use:
tar [main option + auxiliary option] [new file name] [file name to be tar]
[
– main option:
-t: list the contents of archive files (view those files that are backed up);
-c: create a new (if you want to backup a directory or some files);
-r: append the archive to the end (append the forgotten directory/file to the backup file);
-u: update the file (replace the original backup with the new file )
-x: release the file from the archive (unpack); -
auxiliary options:
-f: use the archive or device (usually required);
-k: save the existing file (if you encounter the same
-v: display tar processing details;
-w: confirm each step;
-z: use gzip to compress/decompress files; -j
: use bzip2 to compress and decompress files;
-m: Set the time to now when restoring files;
]
-Details:
- Backup all files in the /root directory and subdirectories, the backup name is backupFile.tar: tar cvf backFile.tar /root -Append
the forgotten /root/~ to backFile.tar: tar rvf backFile.tar /root~
-Then Unpack the packaged file backupFile.tar: tar xvf backFile.tar
- backup and gzip all files in the /root directory, named backupFile.tar.gz: tar zcvf backupFile.tar.gz /root

-Download the source code installation file >>
tar package unzip [unzip to the specified directory /usr/src] >>
./configure [customize the installation environment, create a makefile] >>
make compile [call resources according to the makefile, compile] >>
make install install [copy binary to system] >>
configure and use application software
complete! ————————
Example:
tar -zxvf [package name] -C /usr/src/ (decompression)
cd /usr/src/
./configure –prefix=/usr/local/httpd (install to httpd)
make
make install
cd /usr/local/httpd/bin
./apachect1 start (start service)
lsof -i:80 (display port)
cd /usr/ local/httpd/htdocs/ (configuration directory)
vi index.html (edit web page)



Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325939205&siteId=291194637