Centos 5.5 uses Yum to install lamp (PhP runtime environment)
Source: Internet
Author: User
1. For the source, Sohu is quite easy to use. 1.1 backup CentOS-Base.repo
CD/etc/yum. Repos. d/
CP CentOS-Base.repo CentOS-Base.repo.bak
1.2 replace Source
Open the CentOS-Base.repo with VI, clear the content, copy the following content into it, and save it.
# CentOS-Base.repo
#
# This file uses a new release list system developed by Lance Davis for centos.
# The mirror system uses the connecting IP address of the client and
# Update Status of each mirror to pick mirrors that are updated to and
# Geographically close to the client. You shoshould use this for centos updates
# Unless you are manually picking other mirrors.
#
# If the specified list = does not work for you, as a fall back you can try
# Remarked out baseurl = line instead.
#
#
[Base]
Name = centos-$ releasever-Base
Baseurl = http://mirrors.sohu.com/centos/?releasever/ OS /?basearch/
Gpgcheck = 1
Gpgkey = http://mirrors.sohu.com/centos/RPM-GPG-KEY-CentOS-5
# Released updates
[Updates]
Name = centos-$ releasever-Updates
Baseurl = http://mirrors.sohu.com/centos/?releasever/updates/?basearch/
Gpgcheck = 1
Gpgkey = http://mirrors.sohu.com/centos/RPM-GPG-KEY-CentOS-5
# Packages used/produced in the build but not released
[Addons]
Name = centos-$ releasever-Addons
Baseurl = http://mirrors.sohu.com/centos/?releasever/addons/?basearch/
Gpgcheck = 1
Gpgkey = http://mirrors.sohu.com/centos/RPM-GPG-KEY-CentOS-5
# Additional packages that may be useful
[Extras]
Name = centos-$ releasever-extras
Baseurl = http://mirrors.sohu.com/centos/?releasever/extras/?basearch/
Gpgcheck = 1
Gpgkey = http://mirrors.sohu.com/centos/RPM-GPG-KEY-CentOS-5
# Additional packages that extend functionality of existing packages
[Centosplus]
Name = centos-$ releasever-plus
Baseurl = http://mirrors.sohu.com/centos/?releasever/centosplus/?basearch/
Gpgcheck = 1
Enabled = 0
Gpgkey = http://mirrors.sohu.com/centos/RPM-GPG-KEY-CentOS-5
1.3 update it.
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
Set to boot: chkconfig httpd on
2.2 install MySQL
2.2.1 Yum install MySQL 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: <your new 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 it. 4.1 create a test. php file in/var/www/html/, write the following content, and save the file.
<?
Phpinfo ();
?>
4.2 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 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. Yum is so easy to use.
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.