Linux software installation,

Source: Internet
Author: User

Linux software installation,
Previous

Windows software cannot be installed in linux. The advantage is that the vast majority of Trojans and viruses in windows do not affect Linux. The disadvantage is that the software needs to be re-developed for linux. This document describes how to install Linux software.

 

Category

[1] source code package

Advantages of the source code package:

1. Open-source. If you have sufficient capabilities, you can modify the source code;

2. You can select the required functions as needed.

3. The software is compiled and installed, so it is more suitable for your system and more stable and efficient;

4. Easy to uninstall;

Disadvantages of the source code package:

1. There are many installation steps, especially when a large set of software is installed (such as a LAMP environment), which may cause spelling errors.

2. The compilation process is long and the installation process is longer than that of binary.

3. It is difficult for new users to solve the problem once an error is reported during installation because it is compiled and installed.

[2] Binary Package (RPM package and system default package)

A binary package is a compiled package, that is, an RPM package.

Advantages of Binary Package:

1. The package management system is simple. Only a few commands can be used to install, upgrade, query, and uninstall packages.

2. The installation speed is much faster than the source package

Disadvantages of Binary Package:

1. The Source Code cannot be viewed after compilation

2. The function selection is not as flexible as the source code package

3. Dependency

[3] script installation package

The so-called script installation package is to write the complex installation process of the software package into a program script. Beginners can execute the program script for one-click installation. But the actual installation is the source code package or binary package.

Advantages: simple and quick installation

Disadvantage: Completely lost Customization

 

RPM

All RPM Packages are in the Packages directory of the system disk.

mkdir /mnt/cdrom/mount /dev/sr0  /mnt/cdrom/
cd /mnt/cdrom/Packages/

Naming rules]

httpd-2.2.15-15.el6.centsos.1.i686.rpm

Httpd package name

2.2.15 Software Version

15 times of release

El6.centos suitable for Linux platforms

I686 hardware platform

Rpm package Extension

[Dependency]

1. Tree dependency: a-> B-> c solution: Install

2. Circular dependency: a-> B-> c-> a solution: install it in a command.

3. Module dependency: library file dependency, also called module, is a function in linux. It has a typical feature 【. so. number. It depends on a file instead of a software package. This file is hidden in a software package. Install the software package where the file is located. Solution: log on to www.rpmfind.net, enter the library file name to query the corresponding rpm package, and then install it.

RPM Installation

[Package name]

Full package name: When operating a package that is not installed, use the full package name, and note the path

Package name: When operating installed software packages, the package name is used to search for databases in/var/lib/rpm /.

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

[Installation command]

Rpm-ivh package full name option:-I (install) install-v (verbose) display details-h (hash) display 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 does not have to be in the installation directory.

Rpm-e package name option:-e (erase) uninstall -- nodeps does not check Dependencies

 

Query and Test

[Query for installation]

Rpm-q package name # Check whether the package is installed-q query (query) rpm-qa # query all installed rpm packages-a all (all)
rpm -qa | grep httpd

[Query Software Package details]

Rpm-qi package name-I query software information-p query uninstalled package)

[Query the file installation location in the package]

Rpm-ql package name-l list (list)-p query package information)

The default installation path of the RPM package is as follows:

[Which RPM package does the Query System File belong]

Rpm-qf system file name-f system file to which the file belongs)

[Query the dependency of a software package]

Rpm-qR package name-R query package dependency (requires)-p query package information)

[Verification]

Rpm-V: verify the file (verify) in the specified RPM package)

After executing rpm-V httpd, no prompt is displayed, indicating that the file has not been modified. Therefore, determine whether the local apache is consistent with the official apache version to determine whether the apache version has been modified.

Modify the/etc/httpd/conf/httpd. conf file and add any content in the comment line. After executing rpm-V httpd again, the following prompt is displayed:

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

The content of the eight items in the verification content is as follows:

S: whether the file size is changed. M: whether the file type or File Permission (rwx) is changed. 5. Whether the MD5 checksum of the file is changed (whether the file content is changed). D: whether the Master/Slave code of the device has changed L: whether the file path has changed U: whether the file owner (owner) has changed G: whether the file group has changed T: whether the file modification time has changed

[File extraction in RPM package]

Rpm2cpio indicates the command to convert the rpm package to the cpio format

Cpio is a tag tool used to create software files and Extract files from files.

Full name of rpm2cpio package | cpio-idv. Absolute file path
Cpio option <[file | device] Option-I: copy-in mode. Restore-d: The Directory is automatically created during restoration-v: the restoration process is displayed.

 

YUM

The advantage of yum installation is that all software packages are installed on the official server. When yum is installed online, the dependency problem can be automatically solved.

[Note] redhat yum online installation requires payment, and centOS does not.

[Yum source file]

In/etc/yum. repos. d/directory, by default there are 4 yum source files, where the CentOS-Base.repo is the basic yum source file, if you can access the Internet, it is effective by default, and other are not effective by default

[Base]: Container name, which must be placed in []. The name can be set to "name: Container description" or "Image site". You can comment out the baseurl: the address of the yum source server. The default address is the official yum source server of CentOS. If you think it is slow, you can change it to another yum source address enabled: if you do not write or write it as enable = 1, it will take effect. If you write it as enable = 0, it will not take effect. By default, the last container does not take effect, and other containers take effect. gpgcheck: If it is 1, the RPM digital certificate takes effect, and 0 does not. Generally, it must be enabled. After it is enabled, the system will verify whether the rpm package is official during installation to ensure system security. gpgkey: the location where the public key file of the digital certificate is saved without modification.

After the default system is installed, a digital certificate will exist in the/etc/pki/rpm-gpg directory. The previous file: // indicates the file protocol, followed by/etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 is the location of the digital certificate

[Optical disc yum source construction]

1. Attach a cd

Mkdir/mnt/cdrom # create a mount point mount/dev/sr0/mnt/cdrom # attach a cd

2. Make the network yum source invalid

It is determined that the yum source is implemented based on the suffix repo. Modifying the suffix can invalidate the yum source.

Cd/etc/yum. repos. d/# enter the yum source directory mv CentOS-Base.repo CentOS-Base.repo.bak # modify the Yum source file suffix to make it invalid

3. Enable the yum source function of the CD

vim CentOS-Media.repo

Baseurl = file: // mnt/cdrom

[Note] When commenting, you must write quotation marks at the beginning of the line. Otherwise, the quotation marks do not take effect.

Enabled = 1: Change enabled = 0 to enabled = 1 to make the yum source configuration take effect.

4. Commands

Yum list: This command verifies the available rpm packages of the currently used yum source.

[Yum command]

[Query]

Yun list # query the list of all available software packages yum search keywords # search for all keyword-related packages on the server

[Installation]

Only the package name is required for yum installation.

Yum-y install package name option:-install-y (Automatic Answer yes)

[Gcc installation]

Gcc is a C language compiler, gdk is a java compiler, and bash is a linux Command line compiler.

yum -y install gcc

[Upgrade]

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

Yum-y update package name-update: upgrade-y: Automatic Answer yes

[Uninstall]

Minimal installation of servers, software installation, and installation as far as possible

Yum-y remove package name-remove: uninstall-y: automatically answers yes

[Group Management command]

Yum grouplist # list all available software list yum groupinstall software group name # Install the specified software group. The group name can be queried by grouplist to find the yum gourpremove software group name # uninstall the specified Software Group

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

[Language settings]

LANG = en_US: switch to English (temporarily effective) LANG = zh_CN.utf8: Switch to Chinese (temporarily effective)

 

Source code package installation

The main difference between the source code package and the RPM package is the installation location.

The source code package cannot start the service using the service command, because the installation location of the source code package is specified by the user, which is not uniform, generally, it is stored in the "/usr/local/software name" directory. After the rpm package is installed, the startup files are usually stored in/etc/rc. d/init. d directory, and the directory will be automatically searched when the service command is executed, so the rpm package installed services can use the service command

service httpd start

Because the services installed in the source code package cannot be managed by server management commands, you can only use absolute paths for service management.

/usr/local/apache2/bin/apachectl start

Of course, if you copy the startup program installed in the source code package to the/etc/rc. d/init. d directory, you can also run the service command

[Installation preparation]

1. Install gcc

Since the source code packages are written in C language, you must first install the C language compiler: gcc

2. Download the source code package

Download the source code package from the official website. If the package is downloaded to windows, you can use winSCP and other software to upload it to linux.

[Note] If the binary package has been installed, you can continue to install the source package because the installation directories are different. However, this is not recommended because the port will conflict.

For software that requires efficiency, install the source code package version, because it is compiled locally, it is more compatible and efficient, and the rpm package is a public version provided by software developers, can be used for apps that do not focus on efficiency

[Note]

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

Software storage location:/usr/local/

How to determine the installation process error: the installation process is stopped, and an error, warning, or no prompt appears

[Installation]

The installation process and installation sequence of the source package is fixed, the following takes the installation of apache2 as an example, the decompressed directory for the httpd-2.2.31

1. installation must go to the decompressed directory httpd-2.2.31

2. The configure command is used for software configuration and check (basically, this command is available in each source code package, even if some do not have this command, it will provide alternative commands)

It has the following functions:

A. Define required function options;

B. Check whether the system environment meets the installation requirements.

C. Write the function options defined in a and the information of the system environment checked in B to the Makefile file, used for subsequent editing (subsequent 'make' and 'make install' commands depend on this file)

Run the command. /configure -- prefix =/usr/local/apache2. This command is used to specify the installation location:/usr/local/apache2 (the 'apache2' directory does not need to be created in advance, the 'Make install' command is automatically created when it is executed ). After the command is executed, the Makefile file is generated in the current directory.

3. Execute the 'make' command to compile the source code (this step is usually time-consuming)

If an error is reported during compilation, run the make clean command to clear the cache and temporary files, and restore the installation environment to the uninstalled status.

4. Run the make install command to install the program. The/usr/local/apache2 directory is created.

If an error is reported during installation, delete the/usr/local/apache2 directory and run the make clean command.

  

Script Installation

The so-called one-click installation package is actually the installation source code package and RPM package, but the installation process is written as a script to facilitate installation for beginners. It is simple, fast, and convenient. The disadvantage is that the version of the installed software cannot be defined, and the required software features cannot be defined. The advantage of the source code package is lost.

The following uses the installation of LNMP (http://lnmp.org/download.html) as an Example

[Preparations]

1. Stop the previously installed apache and mysql services (it is best to delete the apache directory '/usr/local/apache2' installed in the source package

service apache stopservice httpd stop

2. Run the "yum list" command to test the yum source. If the disk is a yum source, remember to attach the disk.

3. Disable SELinux and Firewall

A. permanently disable SELinux: edit the file "/etc/selinux/config", change "SELINUX = enforcing" to "SELINUX = disabled", and restart the system.

B. Permanent firewall shutdown: "chkconfig iptables off", enabled: "chkconfig iptables on ";

To temporarily disable the firewall, set "service iptables stop" to "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. decompress the installation package

tar -zxvf lnmp1.4-full.tar.gz

3. Enter the installation directory

cd lnmp1.4

4. Execute the install. sh script.

./install.sh

[Installation process]

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

Currently, many MySQL and MariaDB versions are provided, and database installation is not required.Note that MySQL 5.6, 5.7, and MariaDB 10 must be configured with a higher memory of 1 GB or higher.! Enter the serial number before MySQL or MariaDB, and press enter to go to the next step.

You need to set the MySQL root Password (the root password will be set if you press enter without entering it). If an error occurs, you need to delete the password, you can press Ctrl and then press the Backspace key to delete it (in some cases, only the Backspace key is required ). Enter and press enter to go to the next step, as shown in:

Ask if you want to enable MySQL InnoDB. the InnoDB engine is enabled by default. It is generally recommended to enable it. Press ENTER or enter y. If you do not need this engine, enter n. The input is complete, press enter to go to the next step. Note: When you select a PHP 7 or higher version, you must check whether it is compatible with your program.

Enter the PHP version number to be selected, press enter to go to the next step, and select whether to install memory optimization:

You can choose not to install, Jemalloc, or TCmalloc. Enter the corresponding serial number and press Enter. The default value is not to install Jemalloc.

Press any key to install... or Press Ctrl + c to cancel, and then Press enter to confirm installation. The LNMP script automatically installs and compiles software Nginx, MySQL, PHP, phpMyAdmin, and Zend Optimizer. The installation time may be several minutes to several hours, mainly because the machine's network speed configuration may affect

The installation is completed as follows:

[Error handling]

If the installation is stuck in "php-fpm", it usually indicates that the installation is successful, but "php-fpm" is stuck (physical machines are rare, but virtual machines are common ), the solution is to use the command "pkill-9 php-fpm" to kill the "php-fpm" process and restart the process "/etc/rc. d/init. d/php-fpm start"

 

 

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.