Linux Software Installation

Source: Internet
Author: User
Tags fpm gpg file permissions

Previous words

Windows software cannot be installed in Linux, the advantage is that most of the Trojan horse, virus has no effect on Linux, the disadvantage is that the software needs to be developed for Linux. This article describes the Linux Software installation in detail

Classification

"1" source package

The advantages of the source package:

1, open source, if there is sufficient capacity, you can modify the source code;

2, you can freely select the required functions

3, the software is compiled and installed, so more suitable for their own system, more stable, more efficient;

4, easy to unload;

The disadvantages of the source package:

1, installation process more, especially when installing a large set of software (such as lamp environment), prone to spelling mistakes

2, the compilation process time is long, installation than the binary installation time

3, because it is compiled installation, the installation process when the novice is difficult to solve

"2" Binary package (RPM package, system default package)

Binary package refers to the source package after the compilation of the package, which is often said RPM package

Advantages of the binary package:

1, package management system is simple, only through a few commands can be implemented package installation, upgrade, query and Uninstall

2, installation speed is much faster than the source package

Disadvantages of the binary package:

1, after compiling, no longer see the source code

2, the function choice is not as flexible as the source package

3. Dependence

"3" Script installation package

The so-called script installation package, that is, the complex package installation process as a program script, beginners can execute the program script implementation of one-click installation. But the actual installation is either a source or a binary package

Advantages: Easy and quick installation

Cons: Total loss of customization

Rpm

All RPM packages are in the packages directory of the system CD

mkdir/mnt/cdrom//dev/sr0  /mnt/cdrom/
cd/mnt/cdrom/packages/

"Naming rules"

httpd-2.2. El6.centsos. 1 . i686.rpm

HTTPD Package Name

2.2.15 software version

15 times of release

El6.centos the right Linux platform

i686 adaptation of the hardware platform

RPM Package Extension

Dependence

1, tree-based dependency: A->b->c solution: Install from the rear

2. Ring-dependent: A->b->c->a solution: Install in one command

3, the module depends on: library file dependencies, library also called module, is the function of Linux, it has a typical feature, is the ". So." End, it relies on is actually a file, not a package. This file is hidden in one package. The file is installed as long as the package on which it resides is installed. Workaround: Log into the Www.rpmfind.net website, enter the library file name query to the corresponding RPM package, and then install it

RPM Installation

"Package Name"

Package full Name: When the package is not installed, use the package full name, and note the path

Package Name: When you operate a package that is already installed, use the package name to search for the database in/var/lib/rpm/

For example, httpd-2.2.15-15.el6.centsos.1.i686.rpm is the full name of the package, and httpd is the package name

"Install command"

RPM-IVH package full name Option    :-I (install)    installation -v    (verbose) Show Details -H (hash) Show Progress    --nodeps does not detect dependencies

"Upgrade Command"

RPM-UVH package full name Option    :-U (upgrade) upgrade

"Uninstall Command"

[Note] The uninstall command uses the package name and is not necessarily in the installation directory

RPM-E package name option:    -E (erase) unload     --nodeps does not check for dependencies

Inquiry and inspection

"Whether the query is installed"

RPM-Q Package Name # Check if package is installed -q  -qa# query all installed RPM packages-a   
Rpm-qa | grep httpd

"Query Package Details"

RPM-QI package name     -i query software information (information)     -P query not installed package

"File installation location in the query package"

RPM-QL Package name     -    list-P   Query no package information installed

RPM Package The default installation path is as follows

"Which RPM package does the query system file belong to?"

RPM-QF System file name -F query System file belongs to which package (file)

"Querying the dependencies of a package"

RPM-QR package name     -R Query Package dependency (requires)    -P Query No package information installed

Parity

RPM-v installed package name     -V: Verifies the files in the specified RPM package (verify)

After executing rpm-v httpd, there is no hint that the file has not been modified. Therefore, judging whether the local Apache and the official given is consistent, so as to determine whether the modification

After you modify the file/etc/httpd/conf/httpd.conf and add any content to the comment line, after you execute rpm-v httpd again, you have the following prompt

S.5..... T. c/etc/httpd/conf/httpd.conf

The details of the 8 information in the verification content are as follows

S: File size changed m: file type or file permissions (RWX) changed 5

"File extraction in RPM package"

Rpm2cpio represents a command to convert the RPM package to the CPIO format

Cpio is a tagging tool that is used to create software archive files and extract files from files

Rpm2cpio Package Full Name | Cpio-idv. File absolute Path
Cpio Options < [file |  Device] option     -i:copy-in mode, restore     -D: Automatically new directory    on restore -V: Show restore process

YUM

The advantage of the Yum installation is that all packages are on the official server and can automatically resolve dependencies when the Yum is installed online

[Note that]redhat Yum needs to pay for thread, CentOS does not need

"Yum source file"

In the/etc/yum.repos.d/directory, the default is 4 yum source files, where Centos-base.repo is the basic Yum source file, if you can access the Internet, it is the default, and the other is not in effect by default

[base]: container name, must be placed in [], the name can be casual name: container description, the name is also casual mirrorlist: Mirror site, this can be commented out Baseurl:yum source server address, The default is the official CentOS Yum source server. If you feel slow, you can modify it to another Yum source address enabled: If not written or written as enable=1 is in effect, written enable=0 does not take effect. The default last container does not take effect and the other containers are in effect Gpgcheck: If 1, the digital certificate of RPM is in effect and 0 does not take effect. Generally to open, after the installation will verify RPM package is official, to ensure system security Gpgkey: Digital certificate of the public key file save location, without modification

After the default system is installed, a digital certificate will exist under directory/ETC/PKI/RPM-GPG. The previous file://represents the file protocol, and the subsequent/etc/pki/rpm-gpg/rpm-gpg-key-centos-7 is the location of the digital certificate

"Disc Yum Source Build"

1. Mount the disc

mkdir/mnt//dev/sr0/mnt/cdrom# mount Disc

2. Failure of the network Yum source

To determine that the Yum source is based on the suffix name repo, modifying the suffix name can invalidate the Yum source.

cd/etc/yum.repos.d/#进入yum源目录mv CentOS-base.repo centos-base.repo.bak# Modify the Yum source file suffix to invalidate it

3. Make the CD Yum source effective

Vim Centos-media.repo

Baseurl=file:///mnt/cdrom: Address is a disc mount address, if there are redundant CD mount points, you need to comment out the non-existent or do not need to use the CD-ROM mount address

[note] When commenting, be sure to write the quotation marks at the beginning of the line, otherwise it will not take effect

Enabled=1: Change enabled=0 to Enabled=1 to make the Yum source configuration effective

4. Command

Yum list: This command verifies which RPM packages are available for the currently used Yum source

"Yum Command"

Query

Yun list# query all available packages list yum Search keyword # search all and keyword-related packages on the server

Installation

Yum Install write-only package name

Yum-y installed package name option: -Install installation -y  (answer yes automatically)

"GCC Installation"

GCC is the C compiler, GDK is the Java compiler, bash is the Linux command line compiler

Yum-y Install GCC

Upgrade

If you do not write the package name, write-only yum-y update will cause the system to crash directly

Yum-y update package name     -update: Upgrade     -y: Auto Answer Yes

Uninstall

Server use minimal installation, what software to install what, try not to uninstall

Yum-y Remove package name     -Remove: Unload     -y: Auto Answer Yes

"Group Management Commands"

Yum grouplist# lists all available software lists Yum Groupinstall software group name # Install specified software group, group name can be queried by grouplist Yum Gourpremove software Group name # Uninstall the specified software group

[Note that the software group name in]groupinstall only supports English

"Language Settings"

lang=en_us: Switch to English (temporarily in effect) LANG=zh_cn.utf8: Switch to Chinese (temporary effect)

SOURCE Package Installation

Source package and RPM package after installation, the main difference is the installation location of the different

The source package is not able to use service command to start the services, because the source package installation location is specified by the user, where is not uniform, generally put it in the "/usr/local/software name" directory, and RPM package installation, boot files are usually placed in/etc/rc.d/ The INIT.D directory, and when the service command executes, the directory is automatically searched, so RPM package-installed services can use the servicing command

Service httpd Start

Because the source package installation service cannot be managed by Server Management commands, the service can only be managed with an absolute path

/usr/local/apache2/bin/apachectl start

Of course, you can also use the service command if you copy the source package Installer's startup program to the/ETC/RC.D/INIT.D directory.

"Preparation for Installation"

1. Installing GCC

Since the source package is written in C, the C language compiler should be installed first: GCC

2. Source Package Download

Download the source package from the official website, if downloaded to Windows, you can use WINSCP and other software to upload to Linux

[note] If the binary package is installed, the source package can also continue to install, because the installation directory is different. However, this is not recommended because the port will conflict

For software that requires efficiency, install the source package version because it is natively compiled, more compatible and efficient, and the RPM package is a popular version provided by software developers and can be used for applications that do not focus on efficiency

"Precautions"

Source code save location:/usr/local/src/

Software Save location:/usr/local/

How to determine the installation process error: The installation process is stopped, and error, warning, or no prompts

Installation

Source package installation process and installation sequence is fixed, the following to install Apache2 as an example, the extracted directory is httpd-2.2.31

1, the installation must enter into the extracted directory httpd-2.2.31

2, configure command for software configuration and inspection (basically each source package will have the command, even if the individual does not have the command, will also provide relevant alternative commands)

It has the following features:

A, define the required functional options;

b, the detection system environment is consistent with the installation requirements

c, the definition of a in the functional options and B in the detection system environment information are written to the makefile file for subsequent edits (the subsequent ' make ' and ' make install ' command will depend on the file)

Executes the command./configure--prefix=/usr/local/apache2, which specifies the installation location:/usr/local/apache2 (where the ' apache2 ' directory does not need to be created in advance, ' make install ' is created automatically when the command executes). After the command executes, the makefile file is generated in the current directory

3, execute ' make ' command, compile the source code (this step is usually time-consuming)

If an error occurs during compilation, execute the Make clean command to clear the cache, temporary files, and so on, so that the installation environment is restored to an installed state

4. Execute the Make install command, install the program, the/usr/local/apache2 directory will be created at this time

If an error occurs during installation, you need to delete the/usr/local/apache2 directory and execute the make clean command

  

Script Installation

The so-called one-click installation package, in fact, the installation of the source package and RPM package, just write the installation process as a script, easy for beginners to install. The advantages are simple, fast and convenient. The disadvantage is that you cannot define the version of the software installed, you cannot define the required software features, the advantages of the source package are lost

The following is an example of installing LNMP (http://lnmp.org/download.html)

"Ready to Work"

1, first stop the pre-installed Apache and MySQL services (preferably the source package installed Apache directory '/usr/local/apache2 ' also deleted

Service Apache StopService httpd stop

2, to ensure that the Yum source is normal: You can use the "Yum List" command test. If the disc is a Yum source, remember to mount the disc

3. Turn off SELinux and firewalls

A, permanently close the SELinux method: Edit the file "/etc/selinux/config", change "selinux=enforcing" to "selinux=disabled", and then restart the system

B, the method of permanently shutting down the firewall: "Chkconfig iptables off", open as: "Chkconfig iptables on";

How to temporarily turn off the firewall: "Service iptables Stop", open as: "Service iptables start"

"Start Installation"

1. Upload the one-click installation package of the Lnmp.org website to the root directory of the server

2. Unzip the installation package

TAR-ZXVF lnmp1.4-full.tar.gz

3. Enter the installation directory

CD LNMP1. 4

4. Execute install.sh Script

./install.sh

"Installation Process"

After running the LNMP installation command above, you will receive the following prompt:

Currently provides more MySQL, mariadb version and do not install the database options, It is important to note that MySQL 5.6,5.7 and mariadb 10 must be more than 1G memory in the higher configuration to choose ! Enter the serial number that corresponds to the previous MySQL or MARIADB version and enter the next step.

Need to set the root password of MySQL (do not enter the direct return will be set to root) if the input has an error to delete, you can hold down CTRL and then press the BACKSPACE key to delete (in some cases, only the BACKSPACE key is required). Enter back and enter the next step as shown in:

Ask if it is necessary to enable the MySQL Innodb,innodb engine is on by default, generally recommended to turn on, direct enter or enter Y, if sure does not need the engine can enter n, input completed, enter the next step. Note: You need to confirm that you are compatible with your own programs when you choose a PHP7 version.

Enter the number of the PHP version you want to select, enter the next step, and choose whether to install memory optimization:

You can choose not to install, jemalloc or Tcmalloc, enter the corresponding serial number return, the direct return to the default is not installed

Next, you will be prompted to confirm that the installation begins by pressing the ENTER key to Install...or press CTRL + C to cancel. The Lnmp script will automatically install software that compiles nginx, MySQL, PHP, PhpMyAdmin, Zend Optimizer. Installation time may vary from a few 10 minutes to several hours, mainly due to the machine's configuration speed, etc.

The interface is as follows, indicating that installation is complete

"Error Handling"

If the installation card is "PHP-FPM" there, usually indicates that the installation is successful, but "PHP-FPM" is stuck (the physical machine is rare, but the virtual machine is more common), the solution is: Use the command "Pkill-9 php-fpm" Kill "PHP-FPM" process, Then restart the process "/etc/rc.d/init.d/php-fpm start" to

Linux Software Installation

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.