- Cd/etc/yum. repos. d/
- Cp CentOS-Base.repo CentOS-Base.repo.bak
1.2 replace the source open the CentOS-Base.repo with vi, clear the content, copy the following content into and save.
- Yum-y update
2. install Apache, Mysql, and PHP with yum. 2.1 install Apache
- Yum install httpd-devel
-
After the installation is complete, start apache with/etc/init. d/httpd start and set it to boot:
- Chkconfig httpd on
2.2 install mysql 2.2.1
- Yum install mysql-server mysql-devel
-
Similarly, start mysql with/etc/init. d/mysqld start 2.2.2 set the mysql password
- Mysql>; USE mysql;
- Mysql>; UPDATE user SET Password = PASSWORD ('newpassword') WHERE user = 'root ';
- Mysql>; flush privileges;
2.2.3 allow remote logon
- Mysql-u root-p
- Enter Password:
- Mysql> grant all privileges on *. * TO 'username '@' % 'identified by 'password' with grant option;
-
After that, you can use mysql-front to remotely manage mysql. 2.2.4 set to boot
- Chkconfig mysqld on
3. install php
- Yum install php-mysql php-common php-gd php-mbstring php-mcrypt php-devel php-xml
- /Etc/init. d/httpd start
4. test the installation result 4.1. create a test. php file in/var/www/html/, write the following content, and save the file.
- Phpinfo ();
- ?>
4.2 iptables firewall configuration a. add. allow access to port {21: ftp, 80: http }.
- Iptables-I RH-Firewall-1-INPUT-m state-state NEW-m tcp-p tcp-dport 21-j ACCEPT
- Iptables-I RH-Firewall-1-INPUT-m state-state NEW-m tcp-p tcp-dport 80-j ACCEPT
B. disable the firewall {not recommended }.
- Service iptables stop
-
C. reset and load the firewall service iptables restart 4.3 Open http: // serverip/test. php in the client browser. if it is displayed successfully, the installation is successful. |