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 to build LAMP Environment quickly by CentOS

2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

This article focuses on "how to quickly build a LAMP environment with CentOS". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "how to build a LAMP environment quickly by CentOS".

First step, install and configure apache

1. Install using yum

Yum install httpd

2. Modify the firewall configuration to open port 80, and you can also open port 3306 of mysql.

Vi / etc/sysconfig/iptables

Add two records

-an input-m state-- state new-m tcp-p tcp-- dport 80-j accept-an input-m state-- state new-m tcp-p tcp-- dport 3306-j accept

Pay attention to the location, as shown in the following figure

3. Close selinux

Vi / etc/selinux/config

Modify selinux=disabled

4. Apache configuration file

Vi / etc/httpd/conf/httpd.conf

Find servername and set it to your own domain name. If there is no domain name, you can set it to localhost:80.

5. Boot and start apache automatically.

Chkconfig httpd on

6. Restart apache

Service httpd restart

7. Open the browser and enter the address to test

Step 2, install and configure mysql

1. Install using yum

Yum install mysql mysql-server

2. Boot and start mysql automatically.

Chkconfig mysqld on

3. Mysql sets the root password

Mysql_secure_installation

After entering, enter y to set the password. After setting the password, enter all the way until: thanks for using mysql!

4. Restart mysql

Service mysqld restart

Step 3: install and configure php

1. Install using yum

Yum install php

2. Install php components

Yum install php-mysql php-gd libjpeg* php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-bcmath php-mhash libmcrypt

3. Restart apache and mysql

4. You can upload php files for testing in the default code directory. The default directory is / var/www/html. You can modify the path in the httpd.conf file.

* then, you can configure apache mysql php according to your specific needs. The default profile path is as follows:

Apache profile path: / etc/httpd/conf/httpd.conf

Mysql profile path: / etc/my.cnf

Php profile path: / etc/php.ini

At this point, I believe you have a deeper understanding of "how to quickly build a LAMP environment in CentOS". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

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

Internet Technology

Wechat

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

12
Report