How is the lamp environment built? Detailed process of lamp environment construction

Source: Internet
Author: User
Tags gpg
This article introduces you to the details of the lamp environment to build the detailed process, there is a certain reference value, the need for a friend can refer to, I hope to help you.

After starting to minimize the installation of CentOS 7, directly enter the Ifconfig command, prompting "ifconfig command not found", stating that the minimal installation does not install the relevant software, we can use IP addr instead of ifconfig to view the NIC details, or We can install the Ifconfig command via the Yum install Net-tools and enter two y during the installation process to complete the installation.

First, Apache

yum install httpdInstalling Apache

Total download size:3.0 minstalled size:10 MIs This ok [y/d/n]:  //Enter Y, confirm installation
retrieving key from File:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7Importing GPG Key 0xf4a80eb5:userid: "CentOS-7 key (CentOS 7 official Signing key) <security@centos.org>" fingerprint:6341       Ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5 package:centos-release-7-5.1804.el7.centos.x86_64 (@anaconda) from :/etc/pki/rpm-gpg/rpm-gpg-key-centos-7is This OK [y/n]://Verify that the GPG key is correct, enter Y 
Running transaction checkrunning Transaction testtransaction test succeededrunning transaction installing:apr-1.4.8-3.                                                           el7_4.1.x86_64 1/5 installing:apr-util-1.5.2-6.el7.x86_64                                              2/5 installing:httpd-tools-2.4.6-80.el7.centos.1.x86_64                                                           3/5 Installing:mailcap-2.1.41-2.el7.noarch                                                    4/5 installing:httpd-2.4.6-80.el7.centos.1.x86_64 5/5 Verifying:mailcap-2.1.41-2.el7.noarch 1/5 Verif Ying:httpd-tools-2.4.6-80.el7.centos.1.x86_64 2/5 verifying:apr-util-                          1.5.2-6.el7.x86_64 3/5 verifying:apr-1.4.8-3.el7_4.1.x86_64                                   4/5 verifying:httpd-2.4.6-80.el7.centos.1.x86_64                                                                   5/5 Installed:httpd.x86_64 0:2.4.6-80.el7.centos.1 Dependency Installed:apr.x86_64 0:1.4.8-3.el7_4.1 apr-util.x86_64 0:1.5.2-6.el7 httpd-tools.x86_64 0:2.4 .6-80.el7.centos.1 Mailcap.noarch 0:2.1.41-2.el7complete!

Turn on the Apache service and set the service to start automatically when the system starts:
systemctl start httpd.service
systemctl enable httpd.service

In order to be able to access the Web server externally, the HTTP (80) and HTTPS (443) ports must be opened in the firewall. The default firewall on CentOS is FIREWALLD and can be configured with the Firewalld-cmd command.
firewall-cmd --permanent --zone = public --add-service = http
firewall-cmd --permanent --zone = public --add-service = https
firewall-cmd --reloadRestart Firewalld

To detect if the Apache service is open:
systemctl status httpd.service

Httpd.service-the Apache HTTP Server loaded:loaded (/usr/lib/systemd/system/httpd.service; disabled; Vendor Preset: Disabled) active:active (running) since Mon 2018-08-06 20:14:21 CST; 9s ago DOCS:MAN:HTTPD (8) Man:apachectl (8) Main pid:1498 (httpd) Status: "Total requests:0; Current requests/sec:0;           Current traffic:0 b/sec "CGroup:/system.slice/httpd.service├─1498/usr/sbin/httpd-dforeground ├─1499/usr/sbin/httpd-dforeground├─1500/usr/sbin/httpd-dforeground├─1501/usr/sbin/httpd-dforeg  Round├─1502/usr/sbin/httpd-dforeground└─1503/usr/sbin/httpd-dforegroundaug 20:14:21 localhost SYSTEMD[1]: Starting the Apache HTTP Server ... 20:14:21 localhost httpd[1498]: AH00558:httpd:Could not reliably determine the server ' s F...sageaug 20:14:21 l Ocalhost Systemd[1]: Started the Apache HTTP Server.Hint:Some lines were ellipsized, use-l to show on full.

Then use your browser to enter the IP address of the server:


See the interface to indicate that the installation was successful.

Second, mysql/mariadb

MARIADB database management System is a branch of MySQL, mainly by the open source community in the maintenance, the use of GPL license.

One of the reasons for developing this branch is that after Oracle acquired MySQL, there is a potential risk of shutting MySQL out of the source, so the community uses a branching approach to avoid this risk.

MARIADB is designed to be fully compatible with MySQL, including APIs and command lines, and is currently the most watched MySQL database derivative, and is also considered a replacement for the open source database MySQL.

Here we use MARIADB instead of mysql,mysql installation and operation method is roughly similar.
When installing, replace the mariadb with MySQL;
Start, stop service, view status, change Mariadb.service to Mysql.service.

yum -y install mariadb-server mariadbInstalling MARIADB

Installed:mariadb.x86_64 1:5.5.56-2.el7 mariadb-server.x86_64 1:5.5.56-2.el7 Dependen Cy Installed:perl.x86_64 4:5.16.3-292.el7 Perl-carp.noarch 0:1.26-244.el7 per  l-compress-raw-bzip2.x86_64 0:2.061-3.el7 perl-compress-raw-zlib.x86_64 1:2.061-4.el7 perl-DBD-MySQL.x86_64               0:4.023-6.el7 perl-dbi.x86_64 0:1.627-4.el7 perl-data-dumper.x86_64 0:2.145-3.el7 perl-encode.x86_64 0:2.51-7.el7 perl-exporter.noarch 0:5.68-3.el7 perl- File-path.noarch 0:2.09-2.el7 perl-file-temp.noarch 0:0.23.01-3.el7 perl-filter.x86_64 0:1.                 49-3.el7 perl-getopt-long.noarch 0:2.40-3.el7 Perl-http-tiny.noarch 0:0.033-3.el7 Perl-io-compress.noarch 0:2.061-2.el7 perl-net-daemon.noarch 0:0.48-5.el7 Perl-pa Thtools.x86_64 0:3.40-5.El7 perl-plrpc.noarch 0:0.2020-14.el7 Perl-pod-escapes.noarch 1:1.04-292.el7 Perl-pod-perldoc.noarch 0:3.20-4.el7 perl-pod-simple.noarch 1:3.28-4.el7 perl-pod-usage.                    Noarch 0:1.63-3.el7 perl-scalar-list-utils.x86_64 0:1.27-248.el7 perl-socket.x86_64 0:2.010-4.el7            perl-storable.x86_64 0:2.45-3.el7 Perl-text-parsewords.noarch 0:3.29-4.el7 perl-time-hires.x86_64 4:1.9725-3.el7 perl-time-local.noarch 0:1.2300-2.el7 Perl-constant.noa                  RCH 0:1.27-2.el7 perl-libs.x86_64 4:5.16.3-292.el7 perl-macros.x86_64 4:5.16.3-292.el7 Perl-parent.noarch 1:0.225-244.el7 Perl-podlators.noarch 0:2.5.1-3.el7 p erl-threads.x86_64 0:1.87-4.el7 perl-threads-shared.x86_64 0:1.43-6.el7 complete!

Turn on the MARIADB service and set the service to start automatically when the system starts:
systemctl start mariadb.service
systemctl enable mariadb.service

To set the password for the MySQL root account:
mysql_secure_installation

Note:running all PARTS of this SCRIPT are RECOMMENDED for all MariaDB SERVERS in PRODUCTION use! Please READ each STEP carefully!  In order to log into MariaDB to secure it, we'll need the CurrentPassword for the root user. If you ' ve just installed MariaDB, Andyou Haven ' t set the root password yet, the password would be a blank,so you should just Press ENTER here. Enter current password to root (enter for none)://Enter the root user password, direct enter OK, successfully used password, moving on ... Setting The root password ensures that nobody can log into the Mariadbroot user without the proper authorisation. Set root Password? [y/n] New Password://Enter password re-enter new password://Confirm password Password updated successfully! Reloading privilege tables. ... success!  By default, a MariaDB installation had an anonymous user, allowing Anyoneto log into MariaDB without had to had a user  Account created Forthem.  This was intended only for testing, and the Installationgo a bit smoother. You should remove them bEfore moving into aproduction environment. Remove anonymous users? [y/n]//Delete anonymous user, enter ... success!  Normally, Root should only is allowed to connect from ' localhost '. Thisensures that someone cannot guess at the root of password from the network. Disallow Root login remotely? [y/n]//Do not allow root users to Telnet, enter ... success!  By default, the MariaDB comes with a database named ' Test ' anyone canaccess. This was also intended only for testing, and should was removedbefore moving into a production environment. Remove test database and access to it? [y/n]//delete test database and access it, enter-dropping test ... success! -Removing privileges on test database ... success! Reloading the privilege tables would ensure that all changes made so farwill take effect immediately. Reload privilege tables now? [y/n]//Reload Permissions table, enter ... success! Cleaning up ...  All done! If you've completed all of the above steps, your mariadbinstallation should now is secure. Thanks for using mariadb!

Third, PHP

yum install phpInstall PHP

Total download size:4.7 minstalled size:17 MIs This ok [y/d/n]://Allow installation, input ydownloading packages: (quarter): libzip-0.10.1-8.  el7.x86_64.rpm | KB 00:00:00 (2/4): php-5.4.16-45.el7.x86_64.rpm | 1.4 MB 00:00:01 (3/4): php-common-5.4.16-45.el7.x86_64.rpm | 565 KB 00:00:01 (4/4): php-cli-5.4.16-45.el7.x86_64.rpm | 2.7 MB 00:00:02------------------------------------------------------------------------------------------------- --------Total 2.1 mb/s | 4.7 MB 00:00:02 Running transaction checkrunning transaction testtransaction test succeededrunning transaction Insta Lling:libzip-0.10.1-8.el7.x86_64 Installing:php-commo                          N-5.4.16-45.el7.x86_64                             2/4 installing:php-cli-5.4.16-45.el7.x86_64   3/4 installing:php-5.4.16-45.el7.x86_64 4/4 Verifying:php-5.4.16-45.el7.x86_64 verifying:php -cli-5.4.16-45.el7.x86_64 2/4 verifying:libzip-0.10.1-8.el7.                                                       x86_64 3/4 verifying:php-common-5.4.16-45.el7.x86_64                                                                             4/4 Installed:php.x86_64 0:5.4.16-45.el7 Dependency Installed:libzip.x86_64 0:0.10.1-8.el7 php-cli.x86_64 0:5.4. 16-45.el7 php-common.x86_64 0:5.4.16-45.el7 complete!

In order for the database to be associated with PHP, we also need to install Php-mysql:
yum install php-mysqlThe installation process enters Y to complete the installation

systemctl restart httpd.serviceAfter you install PHP, restart the Apache service.

Test that PHP is not installed properly:
vi /var/www/html/index.phpCreate a new PHP file, fill in the following content

<?phpphpinfo ();? >

Add/info.php to the previous URL and see the following interface to indicate that the installation was successful.

Related articles recommended:

Procedure for Nginx configuration file nginx.conf

Steps to modify the MySQL port number in the Phpstudy integration environment under the Linux system

Explanation of the view in the thinkphp frame (attached code)

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.