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 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.
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.
Create the vhost.conf file in the above directory, and then configure the site
DocumentRoot /srv/www/laozuo.org/public_ html/
CustomLog /srv/www/laozuo.org/logs/access.log combined
DocumentRoot /srv/www/idcxen.com/public_ html/
CustomLog /srv/www/idcxen.com/logs/access.log combined
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 -p /srv/www/idcxen.com/public_ html
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.
/sbin/chkconfig --levels 235 httpd on
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.
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
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