Install lamp environment with yum

Source: Internet
Author: User

Install Apache, MySQL, and PHP in yum
1. install Apache
Yum install httpd-devel
After the installation is complete, start Apache with/etc/init. d/httpd start
Set to boot: chkconfig httpd on
2. Install MySQL
2.1 Yum install MySQL mysql-server mysql-devel
Similarly, start MySQL with/etc/init. d/mysqld start
2.2 set the MySQL password
Mysql>; use MySQL; (remember to end with a semicolon)
Mysql>; update user SET Password = PASSWORD ('newpassword') where user = 'root ';
Mysql>; flush privileges;
2.3 Allow Remote Login
Mysql-u root-P // This is returned to the front of the Linux System
Enter Password: <your new password>
Mysql> grant all privileges on *. * To 'username '@' % '[where is the write-in connection?] identified by 'Password' with grant option;
After that, you can use MySQL-front to remotely manage MySQL.
2.4 set to boot
Chkconfig mysqld on

2.5 install phpMyAdmin

Download phpMyAdmin, change the permission to 755, and deploy it to the/var/www/html/directory. (Generally, the root user has no password)

3. install PHP
Yum install PHP-mysql PHP-common PHP-Gd PHP-mbstring PHP-mcrypt PHP-devel PHP-XML
/Etc/init. d/httpd restart (Key restart Apache)
4. Test
4.1 create a test. php file in/var/www/html/, write the following content, and save the file.
<?
Phpinfo ();
?>
Change the access permission of the test. php file to 755. Remember to restart the apache service. Otherwise, it cannot run.

Edit the new PHP version as follows:

<? PHP
Phpinfo ();
?>

Otherwise, a blank page is displayed!
5. 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
Then open http: // serverip/test. php In the client browser. If it is displayed successfully, the installation is successful.
So far, the installation is complete.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.