In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
The following describes disk quotas, quota and related commands, rpm package manager, rpm command line tool functions, and so on.
I. disk quota
1. Disk quota function: disk quota can be used to build file servers.
File server function: used to share storage space, so that users can store data at any time.
Common file servers are FTP, SMB, network disk, network disk (extremely fast upload)
Disk quota is mainly put forward for this kind of file server to limit the use of disk space.
2. The setting object of disk quota
(1) Block devices that can perform read and write operations
(2) to have a correct file system.
3. Disk quota mainly restricts whose access behavior
(1), user
Disk quota limits disk usage for specified users: disk space (blocks), inode usage.
(2) Group
Disk quota limits the sum of the disk usage of all members of the specified group.
4. Type of disk quota
(1), soft limit: soft quota
When the user's disk usage reaches the soft quota limit, the grace period countdown will be started; before the countdown is returned to 0, the user can normally use the remaining quota, but once the countdown is returned to 0, the user will not be able to continue to use disk space unless the data is cleaned up below the soft limit, and then can continue to use disk space.
(2), hard limit: hard limit
The true upper limit of disk space that the user can use.
In general, the soft limit is smaller than the hard limit. In Linux, the default grace period is 7 days.
II. Quota and related orders
1. A data file is needed for users to record disk usage and quotas for users and groups.
Aquota.user
Aquota.group
2 、 usrquota,grpquota
If you want the partition or volume to support disk quota setting, you need a separate mount option.
(1), # mount-o usrquota,grpquota DEVICE MOUNT_POINT
(2), / etc/fstab
Example: DEVICE MOUNT_POINT FSTYPE defaults,usrquota,grpquota 0 0
3. Quotacheck command
(quotacheck-scan a filesystem for disk usage, create, check and repair quota files)
Option:-v,-- verbose: displays the details of the entire operation
-u,-- user: create, detect, and repair user quota files
-g,-- group: create, detect, and repair group quota files
-c,-- create-files: if there is no user quota file and or group quota file, install the option given by the user to create the file
-a,-- all: whether there are quota files for all devices that contain quota-related mount options in the / etc/fstab file
4. Commands for writing quota content
Edquota command:
(edquota-edit user quotas)
-u,-- user:Edit the user quota. This is the default. Write user quotas, the default function.
-g,-- group:Edit the group quota. Write group quotas, which are not recommended.
-t,-- edit-period: set the grace period beyond the soft limit. The default is 7 days. You can choose seconds, minutes, hours, days, months, years and other time units.
5. Make the quota function effective
Quotaon, quotaoff commands:
(quotaon, quotaoff-turn filesystem quotas on and off)
Example: # quotaon | quotaoff / dev/sdb1
6. Check the usage of quotas
(1), quota command:
Quota-display disk usage and limits
(2), repquota command (only root users can use it)
Repquota-summarize quotas for a filesystem
Note: root is not subject to disk quotas.
7. Linux package management
(1) the composition of the program
Program: instruction + data
Program: algorithm + data structure
(2) the existence form of the application:
Source code: a text file that contains all the code in the programming language of the entire application.
Binary: a file that can be executed directly after a series of conversion operations of the source code.
(3) installation process
The procedure for installing an application using the source code is as follows:
Preprocessing (preprocessor)-- > compile (compiler)-- > assembler (assembler)-- > link (linker)-- > binary program files that can be executed directly.
(4) POSIX standard
POSIX standard: POX,Portable Operating System, portable operating system
API:Application Program Interface, application programming interface
ABI:Application Binary Interface, apply binary interface
ABI in Unix-like system is: ELF
The system of ABI in Windows is: exe, msi
(5), library-level compatibility, library-level virtualization
Cywin software: simulates the sharing of Linux in windows system.
WinE software: a library that simulates windows in Linux systems.
(6) Application-level programming language
Java/Python/Perl/ruby/PHP/GO
System applications written by Java: dadoop2, hbase, ELK, (all need to have a Java runtime environment-Java virtual machine .JVM)
System applications written by Python: Openstack, saltstack (PVM)
(7) system-level programming language
Linux, Unix written by CumberCraft +
(8) compiling and developing environment
Source code compilation: it needs to be supported by a compiled development environment.
Compiling and developing environment of CAccord +: preprocessor, compiler, header file, development library file
Java/Python compilation and development environment: preprocessor, compiler, development library files
(9) dependency relationship
In general: there are multiple source code files, and these files directly have a certain relationship, which we call a dependency relationship.
Autoconf
Automake
(10) Software project building tools
Make tool: CAccord Clippers
Java: maven tool
Python: buildout tool
(11), package Manager
Install, uninstall, upgrade, query and verify programs in the designated system
(12), different package managers
Different Linux distributions have different package managers:
Debian:dpt, Debian Package Toolkits, dpkg tools manage package files with .deb suffix names
Redhat:rpm, Redhat Package Manager, rpm tool management .rpm suffix name
Rpm becomes the industry standard for Linux's package manager
Rpm is written in Perl language and re-rpm in C language
Rpm is package manager
S.u.S.E:rpm, .rpm
Gentoo: uses FreeBSD's portage package management mechanism and emerge's tools
ArchLinux:pacman
Write a script
(1) automatically create a snapshot volume for the logical volume lv1 on the volume group vg1, and archive and save the internal files through the snapshot volume to the lv2 logical volume of the volume group vg2. The file name format is "vg1-lv1- date-time .tar.xz".
(2) after the backup is completed, delete the snapshot volume
A:
#! / bin/bash
#
Lvcreate-n snap_lv1-s-pr / dev/vg1/lv1
[!-d / mnt/snap_lv1] & & mkdir-p / mnt/snap_lv1
Mount / dev/vg1/snap_lv1 / mnt/snap_lv1
Tar-cJf / mnt/lv2/vg1-lv1-$ (date +% Tmuri% F). Tar.xz / mnt/snap_lv1/*
If [$?-eq 0]; then
Lvremove / dev/vg1/snap_vg1
Fi
3. Rpm package Manager
Taking Centos as an example, the relevant contents of the rpm package manager are as follows:
1. Naming rules for Centos packages
Centos's package manager: the naming rules for packages are as follows
(1), source code package format:
Software_name-VERSION.tar.gz
VERSION:major.minor.release
Major: the major version number, which usually represents the version branch of major feature improvements
Minor: minor version number, which usually represents a change in a function in a branch of a version
Release: release number, fixed some bug or optimized a piece of code
Apache-tomcat-7.0.63.tar.gz
(2) rpm package naming rules:
Source code package: source code
Software_name-VERSION.src.rpm
Binary package:
Software_name-VERSION- [release]. [os]. Arch.rpm
VERSION:major.minor.release
[release]: the release number of the rpm packet
[os]: supported operating system version, el6, el7, suse11, fedora22,...
Arch: hardware platform type, I 386, x64 (amd64), ppc, sparc, noarch,...
Puppet-3.8.7-1.el7.noarch.rpm
2. Subcontracting
When making rpm packages, its creators usually use subcontracting technology to build rpm packages. Multiple packages are built according to the different functions of the program.
Subcontracted programs are generally divided into two categories:
Main package format:
Software_name-VERSION- [release]. [os]. Arch.rpm
Ancillary feature pack format:
Software_name-function-VERSION- [release]. [os]. Arch.rpm
Generally speaking, the main package and the ancillary package have the same version number, release number, operating system and compatible platform identification.
The main package is often dependent on all ancillary feature packages, which cannot be installed without installing the main package.
Function:devel, utils, libs, tools, manual, client, common,...
Dependence: a-> B-- > CD-- > A dependent black hole
3. Front-end management tools for package management
RHEL | frontend management tool of CentOS system: [yum] Yellow dog Update Midifier
Yum will start transactions when implementing installation, upgrade, uninstallation, etc.
The so-called transaction is to regard the whole process as a whole, either all or none at all.
The front-end management tool of Debian system: apt-get,apt-cache
Apt-get: implement installation, uninstall and other functions
Apt-cache: implement keyword-based search function to manage local cache and cached metadata.
Suse front-end management tool: zypper
4. Rpm package Manager: rpm Command Line tool, yum tool
(1) the function of rpm command line tool
A. package each component file of the compiled application into one or more package files.
B. installation, uninstallation, upgrade, query, verification and database management functions of the software package
(2). Composition list of files in rpm package
A, the file of the program
B. List of documents
C. The script files that run when the software is installed or uninstalled are divided into four categories:
Preinstall: script run before the formal installation operation begins,% pre
Postinstall: script executed after installation,% post
Preuninstall: script run before the official uninstall operation starts,% preun
Postuninstall: script executed after the uninstall is complete,% postun
Examples of installed package names and versions are as follows: / var/lib/rpm
5. The way to get the package:
(1) CD-ROM of the distribution version of the system
(2) official file servers or mirror sites are commonly used as follows:
Http://mirrors.aliyun.com
Http://mirrors.sohu.com
Http://mirrors.163.com
Https://mirrors.tuna.tsinghua.edu.cn
Http://mirrors.hust.edu.cn
...
(3), the official site of a project
(4) rpm package sites produced by third-party organizations
Fedora EPEL: Hongmao's official community organization, which also includes EPEL images in the mirror site.
Search engine site:
Http://pkgs.org
Http://rpmfind.net
Http://rpm.pbone.net
(5) make by yourself
Suggestion: after obtaining the package, carry out the integrity check, mainly to check the following two aspects:
Source legitimacy: the data encrypted by the digital signature of the program provider is decrypted and verified by its public key.
Package integrity: sha-1 check code.
Fourth, the function of rpm command line tool
Seven functions are: installation, uninstall, upgrade (downgrade), query, file verification, verification, database maintenance.
Common options for the rpm command:
-v: displays information about the installation process, showing only the name of the installation software.
-vv: displays very detailed operation information.
(1), installation
Rpm {- I |-- install} [install-options] PACKAGE_FILE...
[install-options]
-v: displays the file name after installation
-h,-- hash: use 50 "#" to indicate the installation progress
-- test: it's not really about installing the package, it's just testing whether it can be done properly during installation, dry run mode
-- nodeps: ignore installation errors due to dependencies. It is not recommended.
-- replacefiles: when you install a software package, the files in the package will directly replace the files that were originally installed.
-- replacepkgs: reinstall without uninstalling the package
-- noscripts: do not run any scripts
-- nopre: do not run pre-installation scripts
-- noppost: do not run post-installation scripts
-- nosignature: regardless of whether the source of the package is legitimate
-- nodigit: regardless of whether the package is complete
Example: # rpm-ivh php-mysql-5.3.3-40.el6_6.x86_64.rpm php-pdo-5.3.3-40.el6_6.x86_64.rpm
(2), upgrade
Rpm {- U |-- upgrade} [install-options] PACKAGE_FILE...
If you choose to install the package that is not installed in advance, install it completely; if you have already installed the old version, you can upgrade the security
Rpm {- F |-- freshen} [install-options] PACKAGE_FILE...
Only low-version packages that have been installed can only be upgraded and installed
Common options: same as installation
-v: displays the file name after installation
-h,-- hash: use 50 "#" to indicate the installation progress
-- test: it's not really about installing the package, it's just testing whether it can be done properly during installation, dry run mode
-- oldpackages: downgrade the installation and replace the new version of the package with the old version.
-- force: force upgrade
Note: a, it is strongly recommended that you do not upgrade the kernel; Linux can support multiple kernels, you can install a new version of the kernel directly, and you can replace it manually in the startup interface
B. Upgrading the installation may bring changes to the files, so by default, the system will not directly change the configuration files of the previously installed software. The configuration files in the new package will be renamed, usually: FINENAME.rpmnew
(3), uninstall
Rpm {- e |-- erase} [--allmatches] [--nodeps] [--noscripts] [--notriggers] [--test] PACKAGE_NAME...
-- allmatches: uninstalls all versions of packages that match the specified name
-- nodeps: ignore dependencies when uninstalling. It is not recommended to use
-- test: test uninstall, dry run mode
(4), inquiry
Rpm {- Q |-- query} [select-options] [query-options]
[select-options]
PACKAGE_NAME: give the package name directly
-amam Murall: query all installed [package names]
# rpm-qa | grep mysql
-fmam Murray file FILE: find out which package provided the specified file
-pmam Murray package PACKAGE_FILE: perform query operations on [uninstalled] package files
-- whatprovides CAPABILITY: query which package the specified CAPABILITY is provided by
-- whatrequires CAPABILITY: queries which package the specified CAPABILITY is dependent on
[query-options]
-- changelog: query the changelog of the rpm package
-crecast: query which of the specified packages are [configuration files]
-dmine: query which [document files] are in the specified package.
-imam murmurinfo: query the information related to the package, including [version number, release number, size], etc.
-lmmam Musi list: list shows what files will be generated when the package is installed.
-- provides: lists all the CAPABILITY provided by the specified package
-Rmaine Methodist: query the [dependency] of the specified package
-- scripts: view the [script content] carried by the package
Specific usage:
-qf FILE
-qc |-ql |-qd |-qi PACKAGE_NAME
-qpl |-qpc |-qpd |-qpi PACKAGE_FILE
(5), check
Rpm {- V |-- verify} [select-options] [verify-options]
S file Size differs
M Mode differs (includes permissions and file type)
5 digest (formerly MD5 sum) differs
D Device major/minor number mismatch
L readLink (2) path mismatch
U User ownership differs
G Group ownership differs
T mTime differs
P caPabilities differ
(6) Certification
Rpm-import / PATH/TO/KEY_FILE
Rpm-K / PATH/TO/PACKAGE_FILE
(7) Database management
Initialization and reconstruction of the database: / var/lib/rpm
-- dbpath specified location
Rpm {--initdb |-- rebuilddb}
[--dbpath DIRECTORY]
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.