CentOS 5.5 uses Yum to install lamp (PHP run Environment) "Reprint"

Source: Internet
Author: User

Today with the Yum method built a lamp environment, encountered a lot of problems, after Google and the help of predecessors, finally set up the environment, now the complete steps to record down, 1. Change the source, the Sohu is quite useful.
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 and clear the contents, then copy and save the contents below.
# 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 that is updated to and
# Geographically close to the client. You should the use of this for CentOS updates
# Unless you is manually picking other mirrors.
#
# If The mirrorlist= does not work for you, as a fall back to 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 build and 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 could 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.
Yum-y Update
2. Install apache,mysql,php with yum.
2.1 Installing Apache
Yum Install httpd Httpd-devel
When the installation 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 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;
2.2.3 Allow remote logins
Mysql-u root-p
Enter Password: <your new password>
Mysql>grant all privileges on * * to ' user name ' @ '% ' identified by ' password ' with GRANT OPTION;
When you're done, you can manage MySQL remotely 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, and then save.
<?
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. Turn off firewall {not recommended}.
Service Iptables Stop
C. Resetting the load firewall
Service Iptables Restart
4.3 Then open the http://serverip/test.php in the client browser, if the successful display, it means that the installation is successful.
This completes the installation. Feeling that Yum is really good.

CentOS 5.5 uses Yum to install lamp (PHP run Environment) "Reprint"

Related Article

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.