Install CENTOS7 under virtual machine and configure Apache+php+mysql+phpmyadmin+wordpress

Source: Internet
Author: User
Tags install php mysql host phpmyadmin

First, install Apache

Yum Install httpd

After successful installation, Apache Operation command:

Systemctl start httpd//      start Apachesystemctl stop httpd//       stop apachesystemctl restart httpd    // Restart Apachesystemctl enable httpd     //set Apache on boot

Accessing the server Apache may require the following actions:
(1) Open 80 ports in the firewall
The HTTP service needs to be joined to the firewall to allow external access,

Firewall-cmd--add-service=http--permanent

The –permanent parameter indicates that this is a permanent firewall rule, and there is no rule to restart the system if it is not added.

For custom ports (such as 81), you also need to add a firewall rule,

Firewall-cmd--zone=public--add-port=81/tcp--permanent

Restart Firewalld to make the rule effective,

Systemctl Restart Firewalld

Second, install MARIADB (an open source branch of MySQL)

Yum Install mariadb Mariadb-server

MARIADB after the installation is successful, you need to configure the root password for MySQL, and in addition, note the common commands to start closing mariadb

Systemctl start mariadb//     start Mariadbsystemctl stop mariadb//      stop mariadbsystemctl restart mariadb   // Restart Mariadbsystemctl enable MARIADB    //Set boot up

Set the root account password

Mysql_secure_installation

Enter current password to root (enter for none):
Set root Password? [y/n]

Click Enter and then prompt to set the root account password, type Y

New Password:
Re-enter new password:
Password Updated successfully!

Prompt to enter a new password and re-enter the new password, after repeated two times, the update password appears successfully prompted.

Then enter y as you go.

Remove anonymous users? [y/n] Y
... success!

Disallow Root login remotely? [y/n] Y
... success!

Remove test database and access to it? [y/n] Y
-Dropping test database ...
... success!
-Removing privileges on test database ...
... success! Reload privilege tables now? [y/n] Y
... success! Thanks for using mariadb!

After setting the root password, restart mariadb effective

Systemctl Restart Mariadb.service

Test Access database:

Mysql-uroot-p

Enter the following command to view the database server database

show databases;

Exit command:

Exit

Third, install PHP and PHP extension

Yum install php php-mysql php-gd libjpeg* php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-bcmath Php-mhash

After the installation is complete, restart the Apache server

Systemctl Restart Httpd.service

Test the PHP installation results

Enter the following:

<? php  phpinfo (); ?>

Input

Save exit


Enter the server address in the browser to see if the installation was successful

Iv. installation of phpMyAdmin

Install the Remi Source First,

Yum Install EPEL-RELEASERPM-IVH http://rpms.famillecollet.com/enterprise/remi-release-7.rpm

Then use Yum to install phpMyAdmin

Yum Install phpMyAdmin Php-mcrypt
The default installation directory for PhpMyAdmin is/usr/share/phpmyadmin, and the virtual host profile/etc/httpd/conf.d/phpmyadmin.conf (case sensitive) is automatically created in the Apache profile directory. By default, phpMyAdmin on CentOS 7 only allows access from the loopback address (127.0.0.1). In order to be able to connect remotely, you need to change its configuration.

Modify the configuration file as follows:

<Directory/usr/share/phpmyadmin/>Adddefaultcharset UTF-8<Ifmodulemod_authz_core.c># Apache 2.4<Requireany># Require IP 127.0.0.1 #注释掉 # Require IP:: 1 #注释掉 Require all granted #新添加</Requireany> </Ifmodule> <Ifmodule!mod_authz_core.c># Apache 2.2 Order Deny,allow Deny from all to 127.0.0.1 allow from:: 1</Ifmodule></Directory><Directory/usr/share/phpmyadmin/setup/>   <Ifmodulemod_authz_core.c># Apache 2.4<Requireany>#Require IP 127.0.0.1 #注释掉 #Require IP:: 1 #注释掉 Require all granted #新添加</Requireany>   </Ifmodule>   <Ifmodule!mod_authz_core.c># Apache 2.2 Order Deny,allow Deny from all to 127.0.0.1 allow from:: 1</Ifmodule></Directory>

Then restart the Apache server

Systemctl Restart httpd

You can then access the HTTP./server IP address via the browser/phpmyadmin

Iv. Installation of WordPress

Install wget:

Yum Install wget

Download WordPress

wget Http://cn.wordpress.org/wordpress-4.9.1-zh_CN.zip

Installation: Unzip

Yum Install unzip

Use Unzip to extract files:

Unzip Wordpress-4.9.1-zh_cn.zip

Create a new database in Mysql

Mysql-u root-p

Enter the database via the above command and enter the password: password

And then create a database called WordPress.

Create DATABASE WordPress;

CD into the WordPress directory

Modify the wordpress configuration file wp-config.php

P.s.1: Default this file does not, need to rename wp-config-sample.php

MV Wp-config-sample.php wp-config.php

Modify the following in accordance with the server information

/** MySQL database name: WordPress */define (' db_name ', ' WordPress '); /** MySQL Database user name: Root*/define (' Db_user ', ' root '); /** MySQL Database password:p assword*/define (' Db_password ', ' password ');/** MySQL host (without modification) */define (' db_host ', ' localhost ');

After the modification is complete,

Copy the files to the/var/www/html directory

CP-RF wordpress/*/var/www/html/

Then enter the server address to access WordPress for installation

P.s.2: After installing WordPress, the background management plug-in, you need to enter the FTP problem

Workaround:

Chown-r apache:apache/var/www/html

Install CENTOS7 under virtual machine and configure apache+php+mysql+phpmyadmin+wordpress

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.