CentOS7+LAMP (Linux, Apache, MySQL/MariaDB, PHP)_installation record_and script LAMP one-click installation_Note: Apache is not included!!!

VMWare15.

For the installation and configuration process of Apache (httpd service), see the previous process record-VMWare.CentOS7+ApacheWeb service-installation test .
View apache service status:
#systemctl status httpd

LAMP ~ Linux、Apache、MySQL/MariaDB、PHP

Install PHP:

#yum install -y php
#yum info php

Restart the apache service for php to take effect.
#systemctl restart httpd.serviceWrite
a php test file #vi
/var/www/html/info.php The
content is: (output php information)

<?php phpinfo(); ?>

Test php function:
#lynx 127.0.0.1/info.php

Install MariaDB database server

# yum install -y mariadb-server mariadb

# yum info mariadb-server mariadb

Enable MariaDB service:
#systemctl start mariadb.service
Set to start MariaDB service at boot:
#systemctl enable mariadb.service

View MariaDB status:
#systemctl status mariadb

Set the database security settings:
# mysql_secure_installation
prompts for a password, the initial password is empty, so press Enter directly.
Next, choose to set a password, enter the password twice, and then keep choosing yes or pressing enter all the time.
A prompt appears:
All done!…
Thanks for using MariaDB! means
success.
Verify that the password is valid:
# mysql -u root -p
Enter exit to exit.

Other required operations:

Associate PHP with MySQL
Install the software package:
# yum install -y php-mysql
View software information
# yum info php-mysql

Install common php modules
Install php modules:
# yum install -y php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-snmp php-soap curl curl-devel
Restart the apache service.

Verification:
Use lynx to access or use a graphical interface browser to access (other hosts need to configure or close the firewall and SELinux)
# lynx 127.0.0.1

Install LAMP with one click (it takes a long time)

Note: Because most installation sources are GitHub, the installation may be slow or fail to install. One-click installation must be performed on a machine that has not been installed before.
# yum -y install wget screen unzip
# wget -O lamp.zip https://github.com/teddysun/lamp/archive/master.zip

# unzip lamp.zip
# cd lamp-master/
# chmod +x *.sh
# There
will be a series of options after ./lamp.sh , you can press Enter by default or choose your own.
Finally, press any key to start the installation. Once there is an error in one of the installations, subsequent installations will be cancelled, so there will be requirements for the network.
After running the code for a period of time, the installation will prompt information such as what has been installed and the installation time.
Finally, when you visit the website 127.0.0.1 and you can see this picture, the installation is successful:
Insert picture description here

Finish.

Guess you like

Origin blog.csdn.net/qq_43750882/article/details/109785027