Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does CentOS use yum to install LAMP

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces "how CentOS uses yum to install LAMP". In daily operation, I believe many people have doubts about how CentOS uses yum to install LAMP. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubts of "CentOS how to use yum to install LAMP". Next, please follow the editor to study!

1. Change 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 centos-base.repo with vi and empty the content, then copy the following content in 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

1.3 update.

Yum-y update

two。 Use yum to install apache,mysql,php.

2.1 install apache

Yum install httpd 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, when you are finished, 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 login

Mysql-u root-p

Enter password:

Mysql > grant all privileges on *. * to 'username' @'% 'identified by' password 'with grant option

When you are finished, you can use mysql-front to remotely manage mysql.

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 it

4.1 create a new test.php file in / var/www/html/, write the following, and then save it.

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 the firewall {not recommended}.

Service iptables stop

c. Reset load Firewall

Service iptables restart

4.3. then open http://serverip/test.php in the client browser, and if it is displayed successfully, the installation is successful.

At this point, the installation is complete. Sigh, yum is so easy to use.

At this point, the study on "how CentOS uses yum to install LAMP" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report