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

What is the configuration of CentOS LAMP

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

Today, I would like to talk to you about the configuration of CentOS LAMP, many people may not know much about it. In order to make you understand better, the editor summarized the following content for you. I hope you can get something according to this article.

Today, we built a CentOS LAMP environment with yum method, and encountered a lot of problems. With the help of google and your predecessors, we finally set up the environment, and now record the complete steps:

First, change the source, sohu is quite easy to use.

Backup CentOS-Base.repo

View sourceprint?cp / etc/yum.repos.d/CentOS-Base.repo / etc/yum.repos.d/CentOS-Base.repo.bak

Replace sourc

Open CentOS-Base.repo with vi and empty the content, then copy the following content in and save it.

View sourceprint?# 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.

[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 the system

View sourceprint?#yum-y update

Third, install Apache

View sourceprint?#yum install httpd

After installation is complete, use the

View sourceprint?/etc/init.d/httpd start

Start apache

Set to boot

View sourceprint?#chkconfig httpd on

Fourth, install MYSQL

View sourceprint?#yum install mysql mysql-server

Similarly, when you are finished, use the

View sourceprint?/etc/init.d/mysqld start

Start mysql

Set MYSQL password

View sourceprint?#/usr/bin/mysqladmin-u root-h localhost password 'new password'

# mysql-u root-p # enter MYSQL

# Enter Password:# [enter password]

Update MYSQL password

View sourceprint?mysql > USE mysql

Mysql > UPDATE user SET Password=PASSWORD ('newpassword') WHERE user='root'

Mysql > FLUSH PRIVILEGES

Allow remote login

View sourceprint?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.

Make MYSQL database more secure

View sourceprint?mysql-u root-p [at this point, you will be asked to enter the password you just set. Enter and enter.

Mysql > DROP DATABASE test; [delete test database]

Mysql > DELETE FROM mysql.user WHERE user =''; [delete anonymous account]

Mysql > FLUSH PRIVILEGES; [overload permissions]

Mysql > exit; [quit MYSQL]

Set to boot

View sourceprint?#chkconfig mysqld on

5. Install PHP

View sourceprint?#yum install php php-mysql php-common php-gd php-mbstring php-mcrypt php-devel php-xml libmcrypt

View sourceprint?#/etc/init.d/httpd start [run HTTPD]

6. Test it

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

View sourceprint?

Phpinfo ()

? >

Then open http://IP/test.php in the client browser. If it can be displayed successfully, it means that the installation is successful.

At this point, the installation is complete.

After reading the above, do you have any further understanding of CentOS LAMP configuration? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

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

Servers

Wechat

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

12
Report