Lao Zuo's blog also shared it very early“ LAMP one button installation package ", but sometimes the machine is not suitable for one click package. The best way is to install the environment step by step. If you need to install LAMP (Linux/Apache/MySQL/PHP) environment, it is recommended to adopt the following step-by-step method, so that you can not make errors, but also be familiar with the entire installation process. This original LAMP installation method is based on the CENTOS6 32-bit environment. It has been tested to be fully effective and can build a PHP+MYSQL site after installing the Apache/MySQL/PHP environment.

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 file (located in/etc/httpd/conf/httpd. conf). Generally, similar to the Linode 1GB scheme, this can be set or defaulted.
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.
Step 2: Set and bind the site directory file
Installing LAMP manually is different from using one click package to add a domain name and establish a site directly with a command. All of these must be done manually. For example, we need to add a domain name to establish a site here.
/etc/httpd/conf.d/vhost.conf
Create the vhost.conf file in the above directory, and then configure the site
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin admin@laozuo.org
ServerNamelaozuo.org
ServerAlias www.laozuo.org
DocumentRoot /srv/www/laozuo.org/public_ html/
ErrorLog /srv/www/laozuo.org/logs/error.log
CustomLog /srv/www/laozuo.org/logs/access.log combined
</VirtualHost>
<VirtualHost *:80>
ServerAdmin admin@idcxen.com
ServerNameidcxen.com
ServerAlias www.idcxen.com
DocumentRoot /srv/www/idcxen.com/public_ html/
ErrorLog /srv/www/idcxen.com/logs/error.log
CustomLog /srv/www/idcxen.com/logs/access.log combined
</VirtualHost>
We can see in the above file that it is to add two sites. If it is to add multiple sites, it is necessary to modify the corresponding directory for similar replication. Similarly, we need to create a directory path that does not exist in the corresponding directory.
mkdir -p /srv/www/laozuo.org/public_ html
mkdir /srv/www/laozuo.org/logs
mkdir -p /srv/www/idcxen.com/public_ html
mkdir /srv/www/idcxen.com/logs
The corresponding directory path, such as srv, is created by me. If we need other paths, we can 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 startup.
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 startup
/Etc/init.d/mysqld start # Start MYSQL
B - Set database user
mysql_ secure_ Installation # Install and set the ROOT permission, and set the ROOT password according to the prompt
You can remove the default other users and other default data.
MySQL - u root - p # Log in to ROOT database user
create database laozuo;
grant all on laozuo.* to 'laozuouser' identified by 'laozuo.org';
Create laozuo database user, laozuuser database user name, and laozuo.org database password, which we need to use later when building the website. After creation, enter quit to exit.
Step 4: Install the PHP environment
yum install php php-pear
Install the PHP environment, and then 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, then modify the parameters accordingly, save and exit.
mkdir /var/log/php
chown apache /var/log/php
Create log files. 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, our domain name site binding and MYSQL database have been added. For example, we need to install WORDPRESS program or other programs under the laozuo.org domain name. We only need to install WORDPRESS program in/srv/www/laozuo.org/public_ Upload the program under the html/directory, and then install it by using the set database user.
Scan the code to follow the official account
Get more news about webmaster circle!
Entrepreneurship, operation and new knowledge