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

The method of quickly Building LAMP Environment on CentOS platform

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This example describes how CentOS platform can quickly build LAMP environment. Share it for your reference, as follows:

LAMP -- Linux Apache MySQL PHP

In CentOS installation order, I generally go Apache -> MySQL -> PHP

Step 1: Install and configure Apache

1. Use yum to install

yum install httpd

2, modify the firewall configuration, open port 80, you can also open MySQL port 3306

vi /etc/sysconfig/iptables

Add two records

-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT

Note the location of the addition, as shown below

3. Close SELINUX

vi /etc/selinux/config

Modify SELINUX=disabled

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. Start Apache automatically

chkconfig httpd on

Restart Apache

service httpd restart

7, open the browser, enter the address test

Step 2: Install and configure MySQL

1. Use yum to install

yum install mysql mysql-server

2, Start MySQL automatically

chkconfig mysqld on

3. MySQL sets root password

mysql_secure_installation

After entering, enter y to set the password. After setting the password, enter all the way until it appears: Thanks for using MySQL!

Restart MySQL

service mysqld restart

Step 3: Install and configure PHP

1. Use yum to install

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

Restart Apache and MySQL

4. You can upload PHP files for testing under the default code directory, which is/var/www/html. You can change the path in the httpd.conf file.

Apache MySQL PHP can then be configured to suit your specific needs. The default configuration file path is as follows:

Apache configuration file path: /etc/httpd/conf/httpd.conf

MySQL configuration file path: /etc/my.cnf

PHP configuration file path: /etc/php. ini

I hope this article is helpful for CentOS server maintenance.

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