Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install lamp environment with yum on Centos7.2 system

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces the relevant knowledge of "how to install the lamp environment with yum on the Centos7.2 system". The editor shows you the operation process through an actual case. The method of operation is simple and fast, and it is practical. I hope that this article "how to install the lamp environment with yum on the Centos7.2 system" can help you solve the problem.

I. preparatory work

1. Download and install centos7.2, configure the network environment, ensure that centos can access the Internet, and access to yum sources.

Network configuration of centos7.2:

Vim / etc/sysconfig/network-scripts/ifcfg-eno16777736

Refer to the following network configuration:

Type=ethernetbootproto=staticdefroute=yespeerdns=yespeerroutes=yesipv4_failure_fatal=noipv6init=yesipv6_autoconf=yesipv6_defroute=yesipv6_peerdns=yesipv6_peerroutes=yesipv6_failure_fatal=noname=eno16777736uuid=a90b6241-89da-450a-9742-d5b186a17084device=eno16777736onboot=yesipaddr0=192.168.0.228prefixo0=24gateway0=192.168.0.1dns1=192.168.0.1

Once configured, restart the network using systemctl restart network.service, and then ping www.baidu.com tests to see if the network connection is smooth.

two。 Configure the firewall to open ports 80 and 3306. Centos 7.0 uses firewall as the firewall by default, which is changed to iptables firewall here.

# stop firewall service systemctl stop firewalld.service# disable firewall boot start systemctl disable firewalld.service# install yum install iptables-services# edit firewall configuration file vi / etc/sysconfig/iptables

Add two lines of code in red, please note that the position must correspond.

# firewall configuration written by system-config-firewall# manual customization of this file is not recommended.*filter:input accept [0:0]: forward accept [0:0]: output accept [0:0]-an input-m state-- state established Related-j accept-an input-p icmp- j accept-an input-I lo-j accept-an input-m state-- state new-m tcp-p tcp-- dport 22-j accept-an input-m state-- state new-m tcp-p tcp-- dport 80-j accept-an input-m state-state new-m tcp-p tcp-dport 3306-j accept-an input-j reject--reject-with icmp-host-prohibited-a forward-j reject--reject-with icmp- Host-prohibitedcommit:wq! # Save and exit # finally restart the firewall to make the configuration effective systemctl restart iptables.service# settings firewall boot start systemctl enable iptables.service

3. Close seinux

# modify the configuration file vi / etc/selinux/config#selinux=enforcing # comment out # selinuxtype=targeted # comment out selinux=disabled # add: wq! # Save exit # make the configuration effective immediately setenforce 0

Second, install lamp environment.

1. Install apahce

Yum install httpd

It may be used:

Systemctl start httpd.service # start apachesystemctl stop httpd.service # stop apachesystemctl restart httpd.service # restart apachesystemctl enable httpd.service # set apache to boot

Restart the service, systemctl restart httpd.service

Enter localhost

After it appears, it means it has been installed.

two。 Install mysql.

Because there is no mysql-server on the yum source. So we must go to the official website to download, here we use the wget command to get it directly.

# wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm# rpm-ivh mysql-community-release-el7-5.noarch.rpm# yum install mysql-community-server

Restart mysql, systemctl restarat mysqld.service after installation is complete

The first time to install the root user does not have a password:

[root@yl-web yl] # mysql-u root # set the msyql password to 123456mysql > set password for 'root'@'localhost' = password (' 123456'); # remote connection settings, set the password for all remote users connected with the root account as 123456mysql > grant all privileges on *. * to root@'%'identified by '123456password # Update permissions mysql > flush privileges

3. Install php

Yum install php# installs php components to make php support mysqlyum install php-mysql php-gd libjpeg* php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-bcmath php-mhash# restart of the corresponding service systemctl restart mysqld.servicesystemctl restart httpd.service

The above installation of apahce, mysql, php has been completed.

Check the version of the installation environment: cd / var/www/html, create a new index.php file, and enter:

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report