Linux beginner-Software Installation and management Chapter

Source: Internet
Author: User

Linux beginner-Software Installation and management Chapter

You need to install a lot of software in the study and work of Linux. Under Redhat's Linux operating system, software is generally in RPM format. The following describes some of the software installation and management content.

1. Software name

When installing the software, the most basic is the identification of the software name, "Firefox" Software as an example, the software is:

Firefox |  -  |  38.3.0-2 |  .  |  El7_1 |.   | x86_64

"Firefox" is the software name, "38.3.0-2" is the software version, "El7_1" is the software applicable system, "x86_64" is represented as 64-bit software.

2. Software Installation

2.1, RPM

"RPM" is a common software installation and query commands, the parameters in the software management has a great application.

The parameter "-IVH" is the installation software parameters, installation software, "-V" display process, "-H" specifies the encryption method is "hash". For example, install the software "firefox-24.5.0-1.el7.x86_64.rpm".

The parameter "-IVH" after the software name and "--force" can be forced to install the software. For example, if you accidentally delete "/usr/bin/firefox", the situation will occur, and the normal installation will prompt that it has been installed, you need to use a mandatory installation.

Parameter "-Q | -qa "Can see if the software is installed, for example, to query the" Firefox "software you just installed, some three ways.

The parameter "-QL" allows you to view the files generated after the software installation, such as "Firefox" files generated after installation.

The parameter "-QLP" can query the software installation before the software installation will generate what files, such as the query "Firefox" before installing the query will be generated files, but this parameter should be appended with the software full name, that is, ". RPM".

The parameter "-E" can uninstall the installed software. Uninstall the "Firefox" software.

The parameter "-KV" can detect if the package has been tampered with, for example, by comparing the two graphs below, the software changes to "bad".

The parameter "-QP" can be queried for the name of the software installation package after installation, but the software name must be full. , the name of the "Firefox" software is displayed.

If you add "--scripts" after the name of the software after the parameter "-QP", you can detect the actions that the software performs during the installation or uninstallation process. It is necessary to use this parameter to detect the software before the software is installed, for example, the existing "fluffymcawesome-a-6.4.0-11.r19335.x86_64.rpm" and " fluffymcawesome-b-6.4.0-11.r19335.x86_64.rpm "Two software, now with the parameter"-KV "detection of the two software, such as found that both software has not been tampered with.

However, if you use "--scripts", you will find that the "fluffymcawesome-a-6.4.0-11.r19335.x86_64.rpm" software will remove all directories under the root during the uninstallation process causing the system to crash, so use "-kv" and " --scripts "is necessary.

The parameter "-qi" allows you to view information about the software. For example, enter the "Rpm-qi Firefox" query software "Firefox" information.

You can use the parameter "-QF" query if you know a file, but you do not know which software installation package was built at the time of installation.

2.2. Yum

"Yum" is another common command in software installation and management. There are also many features that need to be implemented by adding parameters.

"Install" is a parameter for installing the software, such as installing the Software "GCC". If you add "-Y" you can have the software install automatically without asking if you are sure of the installation.

"Repolist" can list the set of Yum source information, listed, you can see that the Yum source has a total of 4,305 software.

"Remove" is a parameter for software uninstallation.

List to see if the software is in the source of the software, for example, to see if "GCC" is installed.

"List All" is a parameter that lists all software names, and you can see all the software under that Yum source.

"List Installd" can list all installed software.

List available can list software names that are not yet installed, but can be installed.

"Clean All" is the parameter that empties the Yum cache.

When you need to install software, sometimes you do not know what software to install, only know the purpose of the software and other information, you can use the parameter "search" to view, for example, you can see the check message can use which software. This parameter can also be used to find the full software name based on the software names information.

Similar to "RPM-QF", the parameter "Whatprovides" can also look up software from the Yum source based on the file name.

The parameter "Update" can be used to update the software, "reinstall" can be used to reinstall the software, the role of "RPM-IVH--force" the use of similar.

The parameter "history" can be changed by the software system.

The parameter "info" can display the software information.

Software is not only in the form of a single software, but in the presence of many software groups, software groups can be managed using the following parameters.

The Groups list can view the software included in the software group.

"Groups info" to view software group information.

"Groups install" can install the software group, "groups remove" can uninstall the software group, and the installation of a single software consistent.

3. Yum Source

Although there are "rpm" and "Yum" in the software installation process, but there are many software dependencies, that is, the installation of the software needs to be installed as a prerequisite for other software, this problem "RPM" does not solve, but "yum" can, so the installation of software multi-use "yum", "RPM" is based on query.

The "Yum" can be put into use only if there is a Yum source and a pointer to the source file. The general Yum Source has the client source, namely the local side and the server source end as the network side. The two different source-side configuration methods are described below.

The image files in this article are stored in the/iso directory for convenience, regardless of whether the client source or server source is configured to download ISO image files that match the native system version from the Web.

3.1, client source side

The client source is a Yum source that mounts the image file in a native directory, and the Yum source can only be used natively. The configuration steps for the client source side are as follows.

A. " mkdir/rhel7.2 "Create a" rhel7.2 "directory under the root directory where you can select the directory name.

B. " mount/iso/rhel-server-7.2-x86_64-dvd.iso/rhel7.2 "mount the downloaded image file under the/rhel7.2 directory. See if the file appears through "ls/rhel7.2".

C. " rm-fr/etc/yum.repos.d/* "Delete all files under directory/etc/yum.repos.d/.

D. " Vim/etc/yum.repos.d/rhel7.2.repo "Create a file under directory/etc/yum.repos.d/, name can be self-starting but must end with. Repo and write in file

[rhel7.2]

name=rhel7.2

baseurl=file:///rhel7.2

Gpgcheck=0

E. " Yum clean all "clears the Yum cache to identify the new configuration. The overall step diagram is as follows.

The above is the source of the Yum source client configuration process, after the successful configuration, you can use the "yum" command to install the software, and will automatically resolve the software dependency problem.

3.2. Server Source Side

The server source is a Yum source that creates a shared directory and hangs on the mirrored file to a shared directory, which can be used either natively or by other hosts. You need to install the HTTPD service before configuring the Yum source, and enter "Systemctl stop Firewalld" To turn off the firewall, which can cause problems with data transfer. Server source side and client source side configuration is basically the same, some of the differences are as follows.

A. " mkdir/var/www/html/rhel7.2 "To create a directory under this directory, HTTPD can share this directory.

B. " mount/iso/rhel-server-7.2-x86_64-dvd.iso/var/www/html/rhel7.2 "Mount the image under the/var/www/html/rhel7.2 directory.

The following content is consistent with the C.D.E steps of the client source, but when configuring the/etc/yum.repos.d/rhel7.2.repo file, you need to change the "baseurl=file:///rhel7.2" to "baseurl=http:/ /natively ip/rhel7.2 ". As shown in.

After the server source-side configuration is complete, you can see the contents of the image in the browser by entering "http://Native ip/rhel7.2". The overall step diagram is as follows.

3.3. Automatic Mounting

In the above method, the ISO image file is mounted directly in the directory, but the directory that is mounted after restarting the host is automatically lifted and requires a re-mount before the Yum source can be used. This in the study work undoubtedly increased workload, so generally can take the boot automatically mount ISO image file method to avoid such situations, the specific steps are as follows:

Enter "Vim/etc/rc.d/rc.local", as shown in the client source-side mount as an example, enter "mount/iso/rhel-server-7.2-x86_64-dvd.iso/rhel7.2" below.

Save and exit and enter "Chmod +x/etc/rc.d/rc.local" to give this file permission to execute. This setting will automatically mount the ISO image file to the "/rhel7.2" directory when booting. The same can also be used when the server source-side is configured.

3.4. Build a third-party software warehouse

After the Yum source configuration is successful, the software in the image file can be used, but the software in the image is not all, if you need to install third-party software with Yum and solve the software dependencies, then you need to build a third-party software repository, the essence of which is to put third-party software into the Yum source. The construction steps are as follows:

A. " Mkdir/software ", create a directory and put all third-party RPM packages into a directory, this directory can only be placed in the RPM file, directory name or path can be set by itself.

B. " Createrepo-v/software ", use this command to generate a" repodata "file in the directory, which will be read when Yum is used.

C. " Vim/etc/yum.repos.d/rhel7.2.repo ", after the previously configured" Rhel7.2.repo "file is added, as shown in.

[Software]

Name=software

Baseurl=file:///software

Gpgcheck=0

When you are finished, enter the "Yum clean all" load configuration to use the Yum command for third-party software. The third-party software warehouse is built and completed.

4. Other uses of RPM and Yum

4.1, RPM installation package disassembly

Previously said that if you accidentally deleted a file in the software, you need to forcibly re-install the software in the recovery, which sometimes seems to be more troublesome. If you can disassemble the software installation package and copy the deleted files back to the original directory, it will be a lot more convenient and the disassembly command for the Software installation package is "Rpm2cpio xxxxx.rpm | Cpio-id ", where" xxxxx.rpm "needs to be added to the package location.

For example, accidentally deleted the "/usr/bin/wps" file, so that the "WPS" command is not available, you can disassemble the "WPS" command of the package, and the "/usr/bin/wps" file to copy back to the original directory, can solve the problem.

4.2. Yum Software Masking

When viewing and using packages under the Yum source, it is sometimes necessary to block some or a class of software that automatically ignores such software when executing the "yum" command, which requires software masking.

For example, when using "Yum list available" To view the list of software, want to automatically ignore 64-bit software, only show 32 of the software, you need to enter "vim/etc/yum.conf", and enter "exclude=*.x86_64", as shown in.

Once you have saved the exit, using the Yum list available to view the software listing will block out the 64-bit software that is not installed.

The above is the Redhat Linux system software Installation and management of some content.

Linux beginner-Software Installation and management Chapter

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.