Home  >  Article  >  Backend Development  >  CentOS 5.5 uses yum to install LAMP (php environment) steps to share

CentOS 5.5 uses yum to install LAMP (php environment) steps to share

WBOY
WBOYOriginal
2016-07-25 08:52:06972browse
  1. cd /etc/yum.repos.d/
  2. cp CentOS-Base.repo CentOS-Base.repo.bak
Copy code

1.2 replacement source Open CentOS-Base.repo with vi, clear the content, then copy the following content into it and save it.

  1. yum -y update
Copy code

2. Use yum to install Apache, Mysql, PHP.

2.1 Install Apache

  1. yum install httpd httpd-devel
Copy the code

After the installation is complete, use /etc/init.d/httpd start to start apache Set to start at boot:

  1. chkconfig httpd on
Copy code

2.2 Install mysql 2.2.1

  1. yum install mysql mysql-server mysql-devel
Copy code

Similarly, after completion, start mysql with /etc/init.d/mysqld start

2.2.2 Set mysql password

  1. mysql>; USE mysql;
  2. mysql>; UPDATE user SET Password=PASSWORD('newpassword') WHERE user='root';
  3. mysql>; FLUSH PRIVILEGES;
Copy code

2.2 .3 Allow remote login

  1. mysql -u root -p
  2. Enter Password:
  3. mysql>GRANT ALL PRIVILEGES ON *.* TO 'username'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
Copy the code

After completion, you can use mysql-front to remotely manage mysql.

2.2.4 Set to start at boot

  1. chkconfig mysqld on
Copy code

3. Install php

  1. yum install php php-mysql php-common php-gd php-mbstring php-mcrypt php-devel php-xml
  2. /etc/init.d/httpd start
Copy code

4. Test installation results 4.1 Create a new test.php file in /var/www/html/, write the following content, and then save it.

  1. phpinfo();
  2. ?>
Copy code

4.2 iptables firewall configuration a. Add. Allow access to ports {21: ftp, 80: http}.

  1. iptables -I RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dport 21 -j ACCEPT
  2. iptables -I RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEPT
Copy code

b. Turn off the firewall {not recommended}.

  1. service iptables stop
Copy code

c.Reset loading firewall service iptables restart

4.3 Open http://serverip/test.php in the client browser. If it can be displayed successfully, it means the installation is successful.



Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn