Home > Backend Development > PHP Tutorial > CentOS 55 uses yum to install the LAMPphp operating environment

CentOS 55 uses yum to install the LAMPphp operating environment

WBOY
Release: 2016-07-30 13:31:22
Original
1083 people have browsed it

Today I used the yum method to build a LAMP environment. I encountered many problems in the process. With the help of google and seniors, I finally set up the environment. Now I will record the complete steps.

1. Change the source, sohu is quite good 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 CentOS-Base.repo with vi and copy the contents Clear it, then copy the following content and save it.
# 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 are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, 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 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
Update to 1.3.
yum -y update
2. Use yum to install Apache, Mysql, PHP.
2.1 Install Apache
yum install httpd httpd-devel
After the installation is complete, use /etc/init.d/httpd start to start apache
Set to start at boot ; USE mysql;
mysql>; UPDATE user SET Password=PASSWORD('newpassword') WHERE user='root';
mysql>; FLUSH PRIVILEGES;
2.2.3 Allow remote login
mysql -u root -p
Enter Password:
mysql>GRANT ALL PRIVILEGES ON *.* TO 'Username'@'%' IDENTIFIED BY 'Password' WITH GRANT OPTION;
After completion, you can use mysql-front to remotely manage mysql.
2.2.4 Set to start at 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 restart
4. Test it
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 ports {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 the firewall {no Recommended}.
service iptables stop
c. Reset the loading firewall
service iptables restart
4.3 Then open http://serverip/test.php in the client browser. If it can be displayed successfully, it means the installation is successful.
Now, the installation is complete. Sigh, yum is so useful.

The above introduces how to use yum to install the LAMPphp running environment in CentOS 55, including the relevant aspects. I hope it will be helpful to friends who are interested in PHP tutorials.


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template