In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
Periodic task planning, package management, sed and shell programming basics
1. Back up and compress the / etc/ directory to the / backup directory every 12 hours. Save the file name in the format "etc- year-month-day-hour-minute .tar.gz".
[root@localhost /] # crontab-e0 * / 12 * / usr/bin/tar-zcf / data/backup/etc-$ (date'+% Ymuri% mmi% Dmurk% Hmi% M'). Tar.gz / ect/*
Summary of 2.rpm package management functions and demonstration of application examples
Rpm is a very powerful software package management system, which makes it easy to install, upgrade and delete software packages under Linux, and has the functions of installation, upgrade, uninstallation, query and verification, database maintenance and so on.
Rpm command: rpm [OPTIONS] [PACKAGE_FILE]
(1) install:
Rpm {- I |-- install} [install-options] PACKAGE_FILE... rpm-ivh PACKAGE_FILE... GENERAL OPTIONS:-v:verbose, details-vv: more detailed output [install-options]:-h:hash marks output progress bar; each # represents 2% progress;-- test: test installation, check and report dependencies and conflict messages, etc.;-- nodeps: ignore dependencies; not recommended -- replacepkgs: reinstall Note: rpm can have its own script Four categories:-- noscriptspreinstall: scripts run before the installation process starts,% pre,-- noprepostinstall: scripts run after the installation process is completed,% post,-- nopostpreuninstall: scripts run before the uninstall process actually starts,% preun,-- nopreunpostuninstall: scripts run after the uninstall process is completed,% postun,-- nopostun--nosignature: do not check the package signature information, do not check the source validity -- nodigest: do not check package integrity information
(2) upgrade:
Rpm {- U |-- upgrade} [install-options] PACKAGE_FILE. Rpm {- F |-- freshen} [install-options] PACKAGE_FILE.-U: upgrade or install;-F: upgrade rpm-Uvh PACKAGE_FILE... rpm-Fvh PACKAGE_FILE...-- oldpackage: downgrade;-- force: mandatory upgrade; Note: (1) do not upgrade the kernel. Linux supports the coexistence of multiple kernel versions, so install the new version of the kernel directly; (2) if the configuration file of the original package has been modified after installation, the same configuration file provided by the new version of the program will not overwrite the original version of the configuration file during the upgrade, but will be provided after renaming (FILENAME.rpmnew) the new version of the configuration file.
(3) uninstall:
Rpm {- e |-- erase} [--allmatches] [--nodeps] [--noscripts] [--test] PACKAGE_NAME...-allmatches: uninstall all versions of packages that match the specified name;-- nodeps: ignore dependencies-- test: test uninstall, dry run mode
(4) Enquiry:
Rpm {- Q |-- query} [select-options] [query-options] [select-options] PACKAGE_NAME: query whether the specified package is installed and its version;-a,-- all: query all installed packages;-f FILE: query which package the specified file is installed and generated;-p,-- package PACKAGE_FILE: it is used to query uninstalled packages. -- whatprovides CAPABILITY: query which package provides the specified CAPABILITY;-- whatrequires CAPABILITY: query which package the specified CAPABILITY is dependent on; [query-options]-- changelog: query the changlog;-l of the rpm package,-- list: a list of all files generated by the program installation;-I,-- info: package-related information, version number, size, package group, etc. -c,-- configfiles: query the configuration file provided by the specified package;-d,-- docfiles: query the documentation provided by the specified package;-- provides: list all the CAPABILITY;-R provided by the specified package,-- requires: query the dependencies of the specified package;-- scripts: view the script snippets that come with the package. Usage:-qi PACKAGE,-qf FILE,-qc PACKAGE,-ql PACKAGE,-qd PACKAGE-qpi PACKAGE_FILE,-qpl PACKAGE_FILE,-qpc PACKAGE_FILE,...
(5) check:
Rpm {- V |-- verify} [select-options] [verify-options] S file Size differsM Mode differs (includes permissions and file type) 5 digest (formerly MD5 sum) differsD Device major/minor number mismatchL readLink (2) path mismatchU User ownership differsG Group ownership differsT mTime differsP caPabilities differ package source legality verification and integrity verification: source legitimacy verification: integrity verification: obtain and import the keys of trusted package makers: for CentOS distributions: rpm-- Import / etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 verification: (1) when installing programs signed by this organization Correction will be performed automatically (2) Manual correction: rpm-K PACKAGE_FILE
(6) Database reconstruction:
Rpm Manager database path: / var/lib/rpm/
Query operation: through the database here
Get help: CentOS 6:man rpmCentOS 7:man rpmdbrpm {--initdb |-- rebuilddb} [--dbpath DIRECTORY] [--root DIRECTORY]-- initdb: initialize the database, currently no database can be instantiated to create a new one; sometimes nothing is done currently;-- rebuilddb: rebuild, recreate by reading all installed packages on the current system Summary of the configuration and usage of yum and the creation of yum private repository.
(1) yum is the front-end tool of rpm, which can solve the problem of software package dependency. The configuration file for yum is divided into two parts: one is the / etc/yum.conf configuration file that provides common configuration for all repositories, and the other is the / etc/yum.repos.d/*.repo repository configuration file. The log file for yum is saved in the / etc/log/yum.log file.
Usage of the yum command:
Yum [options] [command] [package...] Display warehouse list: repolist [all | enabled | disabled] display package: yum list [all | glob_exp1] [glob_exp2] [.] yum list {available | installed | updates} [glob_exp1] [..] Installation package: install package1 [package2] [...] reinstall package1 [package2] [...] Upgrade package: update [package1] [package2] [...] downgrade package1 [package2] [...] (downgrade) check for available upgrades: check-update uninstall package: remove | erase package1 [package2] [...] View the package information:info [...] See which package the specified feature (which can be a file) is provided by: provides | whatprovides feature1 [feature2] [...] Clean up the local cache: clean [packages | metadata | expire-cache | rpmdb | plugins | all] build cache: makecache search: search string1 [string2] [...] Search for the package name and summary information with the specified keywords; view the capabilities:deplist package1 [package2] [...] on which the specified package depends View yum transaction history: history [info | list | packages-list | packages-info | summary | addon-info | redo | undo | rollback | new | sync | stats] install and upgrade local packages: localinstall rpmfile1 [rpmfile2] [...] (maintained for legacy reasons only-use install) localupdate rpmfile1 [rpmfile2] [...] (maintained for legacy reasons only-use update) commands managed by the package group: groupinstall group1 [group2] [...] groupupdate group1 [group2] [...] grouplist [hidden] [groupwildcard] [...] groupremove Group1 [group2] [...] groupinfo group1 [...]
(2) creation of yum private warehouse
[root@localhost yum.repos.d] # vim epel.repo [epel] name=Fedora EPEL baseurl= https://mirrors.aliyun.com/epel/7/x86_64/ gpgcheck=0 writes a script implementation that lists the following menus to the user:
(1) disk:show disk info information
(2) mem: show memory info information
(3) cpu: show cpu info information
(*) quit/bin/bashcat / dev/null
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.