installation program and account management in Linux

Source: Internet
Author: User
Tags bz2

Program Installation and Management

    1. Linux Application Basics
      The relationship between Linux commands and applications
      1): File location
      System commands: Typically in/bin and/sbin directories, or as shell internal directives
      Applications: Typically in the/usr/bin and/usr/sbin directories
      2): Main use
      System command: Complete the basic management of the system, such as the IP Configuration tool
      Applications: Complete relatively independent other ancillary tasks, such as Web browsers
      3): Applicable environment
      System commands: Generally only run in the character operator interface
      Application: Depending on the actual needs, some programs can be run in the graphical interface
      4): Run format
      System commands: typically include command words, command options, and command parameters
      Application: There is usually no fixed execution format
      Directory structure for typical applications
File Type Save Directory
Common Execution Program Files /usr/bin
Server execution Program files and management program files Usr/sbin
Application configuration file etc
Log file /var/log
Application Documentation Files /usr/share/doc
Application manual page File /usr/share/man
    1. Common package types for packages
Package Type Description
RPM Package Extension ". RPM"
Deb Package The extension is ". Deb"
Source Code Package Compressed package containing the program's original code, typically ". tar.gz", ". tar.bz2", etc.
Package with Installer Provide installation programs such as install.sh, Setup, or a single executable file in the format ". Bin" in a compressed package

Package package types include RPM packages. Deb package. The source code package. The package with the installer.
Source code: The programmer writes good initial code, cannot be read by the computer, need to be compiled into binary computer language, Linux C language compiler is GCC.

3.RPM Package Management Tools
RPM Package Manager
Proposed by Red Hat and used by many Linux distributions.
Establish a unified database file, detailed record of package installation, uninstall and other changes, can automatically analyze package dependencies
RPM contains three parts of rpm database, RPM package file and rpm command
RPM Package
Software Material Reference: http://rpmfind.net/www.rpw.org
Generic naming format: Software name-software version-number of releases. Operating system type. Hardware architecture type. rpm

Note: Perform the "man rpm" command to get detailed help on the RPM command

4. Query RPM Package Information
1): Query the installed RPM software information
Syntax: rpm-q[sub-option] [software name]
Usage: Complete different queries with different sub-options
-QA: View a list of all RPM packages installed on the system
-qi: View detailed information about the specified software (--info)
-QL: Query the directory, file list (--list) that the specified package installs
-QC: Displays only the configuration files for the specified package installation
-QD: Displays only documentation files for the specified package installation
-QF: Check that the specified file or directory is installed by that package (--file)

2): Check which rpm software the file or directory belongs to
Syntax: RPM-QF file or directory name
3): Query for non-installed RPM package files
Syntax: rpm-qp[sub-option] RPM package file
Usage: Complete different queries with different sub-options
-qpi: View details of the software through the. RPM Package file
-QPL: View the list of directories and files included in the. RPM Installation Package
-QPC: View the list of configuration files included in the. RPM Installation Package
-QPD: View the list of document files included in the. RPM Installation Package
Note: Using the R PM command can only query package information that is installed in RPM by installing the package to the system in a different way, the RPM command will not be able to obtain the relevant information

    1. Install, upgrade, and uninstall RPM packages
      Install or upgrade the RPM software
      Syntax: RPM [Options] rpm package file ...
      Usage: Different options apply to different situations
      -I: Install a new RPM package
      -U: Upgrade an RPM software, install it if it is not already installed
      -F: Update an RPM software, if not installed, then discard the installation
      -H: Displays the progress of the installation with the "#" sign
      -V: Displays detailed information during installation

      Uninstalling the specified RPM software
      Syntax: RPM-E software name
      --nodeps: Remove packages, even if dependencies are installed on the system
      --test: Do not perform any action, only print output

    2. Maintain RPM Database
      The database for the currently installed software is retained in Linux, which is located in the/var/lin/rpm/directory. Using the file/var/lib/rpm/* command to view the contents of the directory, you can see that the hash database file is in binary form.
      View Digital signatures

6. Resolving Package dependencies
When multiple software dependencies are installed: The dependent packages need to be installed first, and multiple. RPM package files can be specified at the same time for installation
When uninstalling multiple software dependencies: packages that depend on other programs need to be uninstalled first, and multiple software names can be specified for uninstallation
Ignore dependencies: Combined with "--nodeps" option, but may cause software exceptions

For a chestnut: demo Vim-common and vim-enhanced software package Uninstall, installation process, the reference steps are as follows:
1) First uninstall the Vim-common normally, should be prompted by the vim-enhanced to rely on the failure
2) so the normal unloading order: Uninstall vim-enhanced First, then uninstall Vim-common
3) and reinstall the two packages from the CD, first install the vim-enhanced, you should be prompted to install the Vim-common first
4) so the normal installation order: First install the Vim-common, and then install vim-enhanced, the demonstration can also be in a RPM command to specify the same two files
-- Note: If you need to install dozens of interdependent. RPM packages simultaneously, you can combine the shell wildcard "*" and specify these files as parameters
perform the rpm command to complete the query for the RPM package. Install. Upgrade. Administrative operations such as uninstall.
Extensions: RPM Considerations
Prerequisites for the RPM package you can use the command-line options-requires and-provides to see the prerequisites for
Installation vsftpd directly: command rpm-q-requires vsftpd
Show package Explicit content: Command rpm-q-provides vsftpd
Display vsftpd installation script: Command rpm-q--scripts vsftpd
to display the RPM packages installed on the system chronologically: command Rpm-qa–last
Troubleshoot some of the RPM (Access database)
Killall-9 rpm command to kill all currently pending RPM processes
Delete all files in the RPM database directory (/var/lib/rpm/) that begin with _db.
7. Source Code Compilation Overview
1): Advantages
Obtain the latest software version, fix the bug in time, and flexibly customize the software function according to the user's needs
2): application example
When installing a newer version of the application; the latest version of free software is mostly published in the form of source code
The currently installed program does not meet the needs, the compiled installation can be modified by the user, custom features
need to add new features to the application, users can reconfigure, freely modify the source code, add new features

8. Compile and install the source code package
Tarball packet:. tar.gz and. tar.bz2 format; Software Material reference: Http://sourceforge.net
Integrity check
md5sum calibration Tool; Calculates the MD5 checksum, and compares it with the value provided by the official to determine whether it is consistent
[Email protected] ~]# md5sum axel-1.0a.tar.gz
2d94c0b36b374834567f1fcec5f89119 (MD5 checksum) axel-1.0a.tar.gz
For downloaded package files, if the MD5 checksum is inconsistent with the official offer, the package may have been illegally altered during network transmission.
For the checksum inconsistency of the package, should try not to use, so as not to bring viruses, trojans and other unsafe factors
Basic procedures for compiling and installing
Environment: Need to install the compiler that supports C + + programming language, such as: Gcc-4.4.7-4.el6, gcc-c++-4.4.7-4.el6; make-3.81-20.el6.
Process:

Step 1. Unpacking: It is customary to release the package to the/usr/src/directory; Source code file location after unpacking:/usr/src/software Name-version number/
Step 2. Configuration: Use configure script in source directory; perform "./configure--help" to see Help; Typical configuration options:--prefix= Software Installation directory
When installing the software from the source code in a Linux system, you can also install all program files into the same folder, such as: (/configure-prefix=/usr/local/apache).
Step 3. Compile: Execute make command
Step 4. Install: Execute make install command
The compilation of source code in Linux requires the use of GCC. make compile environment; The basic process for installing an application from source code consists of unpacking. Configuration. Compile. Installation of these four steps.

Account and Rights Management

1. User account and Group account overview
User account:
Superuser, Root: Similar to a administrator user in a Windows system, does not recommend using the root user to log on to a system when not performing administrative tasks
Normal users: Accounts typically have full permissions only in the user's own host directory
Program User: Used to maintain the normal operation of the system or a program, generally do not allow logging into the system. Example: Bin, daemon, ftp, mail, etc.
Group account:
Basic Group (Private group): Each account belongs to at least one group.
Additional group (public group): Once an account belongs to a basic group, another group is added.
UID and GID
UID (user identity, ID number)
GID (group IDentify, set identification number)
Note: The root user uid has a fixed value of 0, the root group account's GID number is fixed value 0, 1~499 uid, gid default reserved for program users, ordinary users/groups use UID, GID number between 500~60000

2. User account file/etc/passwd
Save the user name, host directory, login shell and other basic information; each line corresponds to one user's account record; All users can access the contents of the passwd file, but only the root user will be able to change

Password file configuration Seven field meaning: account name; user password or password placeholder; UID Number of user account, GID number of basic group account, user description, host directory, login Shell.

3. User account file/etc/shadow
Save user's password, account validity and other information; each line corresponds to a user's password record; each line of the file contains nine configuration fields separated by a colon ":"
Shadow file configuration Nine field meaning: account name; MD5 value. If you are "*/!! "Indicates that this user can not log in, if the password is not required for the last change password time, the minimum effective password days, the default is 0, the maximum effective number of days, the default is 99999, the number of days in advance to warn the user password is about to expire, the default is 7, the password expires in days after the disabled account; Represents a permanent use or reserved field.
1): Useradd command: Add user account
In Rhel 6, the Useradd command is used primarily to complete adding the user's account record at the end of the/etc/passwd and/etc/shadow files, and if the user host directory is not specified, a host directory with the same name as the account is created in the/home directory, or if the group to which the user belongs is not specified. The basic group with the same name as the user account is automatically created and saved in/etc/group. The/etc/gshadow.
Syntax: useradd [Options] ... User name
Common Command Options
-u: Specify UID tag number
-D: Specify the host directory, default to/home/user name
-e: Specify the account expiration time
-G: Specify the user's base group name (or UID number)
-G: Specify the user's additional group name (or GID number)
-M: Do not establish and initialize the host directory for the user
-S: Specify the user's login shell
2): Initial configuration file of user account
File Source: When creating a new user account, copy from the/etc/skel directory
Primary User Initial configuration file
~/.bash_profile: Executed every time the user logs on
~/.BASHRC: Execute every time you enter a new bash environment
~/.bash_logout: The user executes each time they log out
3): passwd command: Set password for user account
Syntax: passwd [Options] ... User name
Common Command options:-D: Clears the user's password so that it can log on without a password;-L: Lock user account;-S: Check the status of user account (whether locked);-u: Unlock user account
Note: The user account locked by the password command will not be able to add "!!" before logging into the system (the corresponding password string in the shadow file). "character), which can only be unlocked by an administrator.
4): Usermod command: Modify user account properties
Syntax: usermod [Options] ... User name
Common Command Options
-L: Change the login name of the user account
-L: Lock user account
-U: Unlocking user accounts
The following options are the same as in the Useradd command (change the designation to modify it):-U,-D,-e,-G,-G,-S
5): Userdel command: Delete user account
Syntax: Userdel [-r] User name
When you add the-r option, it means that the user's host directory is deleted

    1. Group account Files
      /etc/group: Save basic information of group account;/etc/gshadow: Save password information for group account
      1): Groupadd command: Add group account
      Syntax: Groupadd [-G GID] group account name
      2): gpasswd command: Add. Settings. Delete a group member
      Syntax: gpasswd [Options] ... Group account Name
      Common Command options:-A: Adding a user to a group;-D: Deleting a user member from within a group;-M: Defines a list of group members, separated by commas
      3): Groupdel command: Delete group account
      Syntax: Groupdel group account name (after deleting a group account, the corresponding record will not be found from the/etc/group file)

5. Enquiry Account Information
ID Command: Purpose: Query user identity; syntax: ID [user name]
Groups command: Purpose: Query the group to which the user belongs; syntax: groups [user name]
Finger command: Purpose: Query user account details; syntax: finger [user Name]
Users, W, who commands: Purpose: Querying user information that has been logged on to the host

6. Permissions and attribution of files/directories
Access rights
Read r: Allows viewing of file contents, displaying directory listings
Write W: Allows to modify the contents of the file, allowing new, moved, deleted files or subdirectories in the directory
Executable x: Allows you to run programs, switch directories
Attribution (ownership)
Owner: The user account that owns the file or directory
Group: An account number that owns the file or directory

7. Set permissions for directories and files chmod
Syntax 1:chmod [Ugoa] [+-=] [rwx] file or directory ... (+ 、-、 = Add, remove, set permissions respectively) (U, G, O, A are the main, group, other user, all users (sum of Ugo)) (the R,w,x permission character can be represented as a 8-character 4,2,1, which means that a combination of permissions is required to accumulate numbers; such as rwx= 7,rw-r-r=644)
Syntax 22:chmod nnn file or directory ... (3-bit octal number)
Common Command options:-r: Recursively modifies permissions for all subkeys under the specified directory

8. Setting the attribution of directories and files Chown
Syntax: Chown Master file or directory
Chown: A group file or directory
Chown: A group of files or directories
Common Command options:-r: Recursively modifies the attribution of all files, subdirectories, and directories in the specified directory

installation program and account management in Linux

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.