- cd/etc/yum.repos.d/
- CP Centos-base.repo Centos-base.repo.bak
Copy Code1.2 Replace the source with VI open Centos-base.repo, and empty the contents, then copy the contents below and save.
- Yum-y Update
Copy Code2. Install apache,mysql,php with Yum. 2.1 Installing Apache
- Yum Install httpd Httpd-devel
Copy CodeAfter the installation is complete, use/ETC/INIT.D/HTTPD start to start Apache to boot:
- Chkconfig httpd on
Copy Code2.2 Installing MySQL 2.2.1
- Yum install MySQL mysql-server mysql-devel
Copy CodeAgain, when done, start MySQL with/etc/init.d/mysqld start 2.2.2 Setting the MySQL password
- mysql>; Use MySQL;
- mysql>; UPDATE user SET Password=password (' newpassword ') WHERE user= ' root ';
- mysql>; FLUSH privileges;
Copy Code2.2.3 Allow remote logins
- Mysql-u root-p
- Enter Password:
- Mysql>grant all privileges on * * to ' user name ' @ '% ' identified by ' password ' with GRANT OPTION;
Copy CodeWhen you're done, you can manage MySQL remotely with Mysql-front. 2.2.4 Set to boot
- Chkconfig mysqld on
Copy Code3. Install PHP
- Yum install php php-mysql php-common php-gd php-mbstring php-mcrypt php-devel php-xml
- /ETC/INIT.D/HTTPD start
Copy Code4. Test installation Results 4.1 Create a new test.php file in/var/www/html/, write the following, and then save.
- Phpinfo ();
- ?>
Copy Code4.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
Copy CodeB. Turn off firewall {not recommended}.
- Service Iptables Stop
Copy CodeC. Reset load Firewall service iptables restart 4.3 Open http://serverip/test.php In the client browser, if successful display, the installation is successful. |