CentOS 7 Yum Mode configuration lamp environment

Source: Internet
Author: User

Environment: CentOS 7 minimized installation with Putty connection

Method: Using Yum Installation method

Objective: To build apache+mysql+php environment

1, install Apache

Yum Install httpd//By default, Y is selected for installationafter successful installation, the default is to prohibit external IP access, you need to set VI /etc/httpd/conf/httpd.conf  //Enter configuration fileFind<directory/>allowoverride nonerequire all denied</directory >modified to:<directory/>allowoverride nonerequire all granted</directory >systemctl start Httpd.service//StartSystemctl Restart Httpd.service//StopSystemctl Status Httpd.service//View StatusSystemctl Restart Httpd.service//Restart 
systemctl Enable Httpd.service //boot up

Access server IP, if the test interface is displayed, the installation succeeds:

2. Install PHP

Yum Install PHP  // default Select y install  /var/www/Htmlvi test.php You can type in the relevant PHP code to enter hello World, for example,< PHP     " Hello World " ;? > Visit website 192. 168.199. 235/test.php, if normal parsing, then the PHP environment is completed.

3. Install MySQL

In CentOS7, mariadb instead of MySQL, in fact mariadb just a m has a branch of SQL, due to MySQL Kibaki staff dissatisfaction Oracle acquisition of MySQL caused the update slow, and re-developed and MySQL similar open source database. To deal with Oracle's MySQL.

Yum Install mariadb Maridb-server//default Installationafter successful installation, the root user's default password is empty and the native login is limited mysqladmin-U root--password'Password' //To modify the root user passwordGRANT all privileges on*. * To'Root'@'%'Identified by'Password'With GRANT OPTION;//Configure any IP remote accessflush Privileges;//Refresh PermissionsSystemctl Restart Mariadb.service//Restart Service

This allows any IP to access the server database through the mysql-h 192.168.199.235-u root-p. For security purposes, of course, you specify a specific host to access the database server.

By default, PHP does not support MARIADB and requires the installation of PHP extensions.

Yum Install php-MySQL creates a new test database file under the Site directory, for example<?PHP $con= Mysql_conncet ('localhost','Root','Root'); if(!$con) {Die ("connet MySQL failed". Mysql.error ()); } Echo"connet MySQL Successful"; ?>by default, PHP does not turn on error debugging and needs to be/etc/php.ini to open the wrong debug, ie; dispaly_errors;error_reporting; remove. 

At this point, the simple lamp environment to build success!

The total feeling, before the use of the integration environment, always heard that the configuration environment is quite complex, today seems to be quite relaxed. For simple use, the current environment is sufficient, the need to install what extensions, subsequent installation can be.

CentOS 7 Yum Mode configuration lamp environment

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.