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

Practical record of installing LAMP (Apache/MySQL/PHP) WEB tutorial in CentOS6

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

Share

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

Although we can currently use many convenient tools to configure the WEB system in the server, such as pagoda panel, LNMP one-button package. But sometimes we still want to install it by compiling it. In this article, we need to manually install LAMP, based on the CENTOS6 system.

Step 1, install and configure the Apache server

Yum update

Yum install httpd

Install the current version of the Apache configuration environment, and then configure the httpd.conf (location in / etc/httpd/conf/httpd.conf) file, generally similar to the Linode 1GB scheme can be set like this, or you can default.

KeepAlive Off

.

< IfModule prefork.c>

StartServers 2

MinSpareServers 6

MaxSpareServers 12

MaxClients 80

MaxRequestsPerChild 3000

< /IfModule>

When configuring, it is not necessary to delete all the settings, but to modify the corresponding parameters.

The second step is to set up and bind site directory files

Manual installation of LAMP is different from adding domain names to build sites with one click package and directly using commands, all of which need to be done manually. For example, we need to add domain names to set up sites here.

/ etc/httpd/conf.d/vhost.conf

Create the vhost.conf file in the directory above, and then configure the site

NameVirtualHost *: 80

ServerAdmin admin@bandwagonhoster.com

ServerName bandwagonhoster.com

ServerAlias www.bandwagonhoster.com

DocumentRoot / srv/www/bandwagonhoster.com/public_html/

ErrorLog / srv/www/bandwagonhoster.com/logs/error.log

CustomLog / srv/www/bandwagonhoster.com/logs/access.log combined

< /VirtualHost>

ServerAdmin admin@vultrla.com

ServerName vultrla.com

ServerAlias www.vultrla.com

DocumentRoot / srv/www/vultrla.com/public_html/

ErrorLog / srv/www/vultrla.com/logs/error.log

CustomLog / srv/www/vultrla.com/logs/access.log combined

< /VirtualHost>

We can see in the above file is to add 2 sites, if it is to add multiple sites similar replication modification corresponding to the directory. Similarly, we need the corresponding directory to create a directory path that does not exist.

Mkdir-p / srv/www/bandwagonhoster.com/public_html

Mkdir / srv/www/bandwagonhoster.com/logs

Mkdir-p / srv/www/vultrla.com/public_html

Mkdir / srv/www/vultrla.com/logs

I created the corresponding directory path such as srv. If we need other paths, we will create them according to our own needs.

/ etc/init.d/httpd start

/ sbin/chkconfig-- levels 235 httpd on

/ etc/init.d/httpd reload

Start httpd and set boot up.

Step 3: install the MYSQL database

A-install and start

Yum install mysql-server # install the MYSQL service

/ sbin/chkconfig-- levels 235 mysqld on # set boot

/ etc/init.d/mysqld start # launch MYSQL

B-set up database user

Mysql_secure_installation # install to set ROOT permissions and follow the prompts to set the ROOT password

You can remove other default users and other default data.

Mysql-u root-p # Log in to ROOT database user

Create database vultrla

Grant all on vultrla.* to 'vultrlauser' identified by' vultrla.com'

Create the laozuo database user, as well as the laozuouser database user name, and the laozuo.org database password, which we need to use when building the website after we create it. Enter quit to exit after creation.

Step 4: install the PHP environment

Yum install php php-pear

Install the PHP environment and configure the / etc/php.ini file.

Error_reporting = E_COMPILE_ERROR | E_RECOVERABLE_ERROR | E_ERROR | E_CORE_ERROR

Display_errors = Off

Log_errors = On

Error_log = / var/log/php/error.log

Max_execution_time = 30

Memory_limit = 128m

Register_globals = Off

Max_input_time = 30

Use vi to find the above parameters, and then modify the parameters accordingly, save and exit.

Mkdir / var/log/php

Chown apache / var/log/php

To create a log file, if we need to support MYSQL in PHP, we need to enter the following command to install the php5-mysql package.

Yum install php-mysql

/ etc/init.d/httpd restart

Install and set up startup.

In this way, we manually install the LAMP WEB system in CENTOS. If we want to be used directly in the production environment, it is recommended to use mature tools instead of manual installation.

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