This article mainly introduces the yum installation of httpd php mysql operating environment under Linux. It has a certain reference value. Now I share it with you. Friends in need can refer to
System centos7
1, Install apache, mysql, php
yum -y install httpd yum -y install mysql-serveryum -y install php yum -y install php-gd php-mysql php-pdo php-soap php-mbstring php-xmlrpc php-dom
3. Add virtual host
Configuration file/etc/httpd/conf/httpd.conf, virtual The host configuration is generally at the bottom
Or create a new virtual host configuration file in /etc/httpd/conf.d/, usually named virtualhosts.conf
The web root directory is generally set in /var/www/, or you can Modify by yourself
4. Start apache
systemctl start httpd.service
5. Start mysql
systemctl start mysqld.servie
6. Modify the root of mysql Password
After using yum to install mysql5.7, the default root is not allowed to log in locally and obtain the initial password of mysql.
MySQLThe process will automatically print the root user's initial password in the process log, filter it with grep
#grep "paasword" /var/log/mysqld.log
Modify rootUser password
#mysql -uroot-p (this The block password is the random password filtered above)
After entering, you will be asked to change the root password first,
alter user'root' @'localhost' identified by '123456';
7. Deployment code
Put the project code into the set web directory
8 Set the time zone tzselect
9 /etc/sysconfig/iptables
This is the firewall configuration file, check whether the apache port (80) in this file is open
-A INPUT -p tcp -m state -m tcp –dport 80 –state NEW -j ACCEPT
10 service iptables restart //Execute this statement after modifying the iptables file
If the yum installation fails to find a valid baseurl for repo..., execute
vi /etc/sysconfig/net-work-scripts/, and then find the file starting with ifcfg, and put Change ONBOOT=no to ONBOOT=yes.
Restart the network: service network restart.
Related recommendations:
How to add php and mysql commands to environment variables under Linux system
linux centOS5 build lamp environment
The above is the detailed content of Install httpd php mysql running environment with yum under linux. For more information, please follow other related articles on the PHP Chinese website!