CentOS 5.5 uses Yum to install lamp (PHP operating environment) _linux

Source: Internet
Author: User
Tags gpg install php iptables
1. 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 Replacement Source
Open the Centos-base.repo with VI and empty the contents, then copy the contents below and save them.
# Centos-base.repo
#
# This file uses a new mirrorlist system developed by Lance Davis for CentOS.
# The Mirror system uses the connecting IP address of the client and the
# Update status of each mirror to pick mirrors, are updated to and
# Geographically close to the client. You are should use this for CentOS updates
# Unless you are manually picking the other mirrors.
#
# If The mirrorlist= does not work for your, as a fall back you can try the
# 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 builds 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 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.
Yum-y Update
2. Install apache,mysql,php with yum.
2.1 Installing Apache
Yum Install httpd Httpd-devel
When Setup is complete, start Apache with/etc/init.d/httpd start
Set to boot: Chkconfig httpd on
2.2 Installing MySQL
2.2.1 Yum install MySQL mysql-server mysql-devel
Again, when finished, start MySQL with/etc/init.d/mysqld start
2.2.2 Set MySQL Password
mysql>; Use MySQL;
mysql>; UPDATE user SET Password=password (' newpassword ') WHERE user= ' root ';
mysql>; FLUSH privileges;
2.2.3 Allow remote logins
Mysql-u root-p
Enter Password: <your new password>
Mysql>grant all privileges in *.* to ' username ' @ '% ' identified by ' password ' with GRANT OPTION;
When you are done, you can remotely manage MySQL with Mysql-front.
2.2.4 Set to boot
Chkconfig mysqld on
3. Install PHP
Yum install php php-mysql php-common php-gd php-mbstring php-mcrypt php-devel php-xml
/ETC/INIT.D/HTTPD start
4. Test
4.1 Create a new test.php file in/var/www/html/, write the following content, and then save it.
?
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. Shutdown firewall {not recommended}.
Service Iptables Stop
C. Reset the Load Firewall
Service Iptables Restart
4.3 Then open the http://serverip/test.php in the client browser and, if successful, indicates that the installation was successful.
At this point, the installation is complete. Feeling, yum really good use.

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.