Original http://www.myxzy.com/post-348.html address
Http://sudhir-web.blogspot.com/2012/07/how-to-install-nginx-with-php-and-mysql.html compilation Error
The Virtual Machine virtualbox version is 4.1.20 (the memory is set to 512 MB, and centos is installed in text mode). The 32-bit centos6.3 system is installed in the minimal package as the Local Web environment, last time I talked about installing apache2.4.3 + php5.4.8 + mysql5.5.8 in windows. This time I will talk about the compilation and Installation Process in Linux (centos) (completed in full command mode ).
There are several parts as follows:
Part 1: preparations.
1. The basic settings of centos6.3 (hereinafter referred to as centos) are omitted (such as user and network settings ).
2. You can connect to the Internet. I will not write them together.
Install wget.
[Root @ localhost ~] # Yum-y install wget
Install the GCC Software Package
[Root @ localhost ~] # Yum-y install gcc
[Root @ localhost ~] # Yum-y install gcc-C ++
Install make
[Root @ localhost ~] # Yum-y install make
Install Vim
[Root @ localhost ~] # Yum-y install Vim
3. Download various installation packages: these are mostly the sources provided on the official website.
[Root @ localhost ~] # Wget http://apache.etoak.com/httpd/httpd-2.4.3.tar.gz
[Root @ localhost ~] # Wget http://apache.etoak.com/apr/apr-1.4.6.tar.gz
[Root @ localhost ~] # Wget http://apache.etoak.com/apr/apr-util-1.5.1.tar.gz
[Root @ localhost ~] # Wget http://hk1.php.net/distributions/php-5.4.8.tar.gz
[Root @ localhost ~] # Wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.31.tar.gz
[Root @ localhost ~] # Wget http://nchc.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz
(Case sensitive. Otherwise, Error 404 will be reported .)
[Root @ localhost ~] # Ls
Check whether all the images are downloaded.
4. All the above source code packages are decompressed using tar zxvf xxx.tar.gz
[Root @ localhost ~] # Tar zxvf httpd-2.4.3.tar.gz
[Root @ localhost ~] # Tar zxvf apr-1.4.6.tar.gz
[Root @ localhost ~] # Tar zxvf apr-util-1.5.1.tar.gz
[Root @ localhost ~] # Tar zxvf php-5.4.8.tar.gz
[Root @ localhost ~] # Tar zxvf pcre-8.31.tar.gz
[Root @ localhost ~] # Tar zxvf libmcrypt-2.5.8.tar.gz
[Root @ localhost ~] # Ls
In the blue section, decompress the folder.
Part 2: install Apache.
1. Install the Apache dependency package PCRE
[Root @ localhost ~] # Cd./pcre-8.31
[Root @ localhost ~] #./Configure -- prefix =/usr/local/PCRE
[Root @ localhost ~] # Make & make install
2. Install OpenSSL
[Root @ localhost ~] # Yum-y install OpenSSL-devel
3. Move the APR and APR-util to the srclib under the httpd-2.4.3 folder and rename
[Root @ localhost ~] # Music apr-1.4.6/httpd-2.4.3/srclib/APR
[Root @ localhost ~] # Music apr-util-1.5.1/httpd-2.4.3/srclib/APR-util
4. install Apache 2.4.3 main program
[Root @ localhost ~] # Cd./httpd-2.4.3
[Root @ localhost ~] #. /Configure -- prefix =/usr/local/Apache -- enable-so -- enable-Deflate = shared -- enable-SSL = shared -- enable-expires = shared -- enable-headers = shared -- enable-Rewrite = shared -- enable-static-support -- With-modified ded-Apr -- With-MPM = prefork -- enable-Cache -- enable-file-Cache -- With-PCRE =/usr /local/PCRE
[Root @ localhost ~] # Make & make install
5. Make Apache self-start with the basic configuration.
Modify httpd. conf, save and exit WQ
[Root @ localhost ~] # Vim/usr/local/Apache/CONF/httpd. conf
Find "# servername www.example.com: 80" and add this line below
Servername localhost: 80
NOTE: If no modification is made, the system prompts "ah00558: httpd: cocould not reliably determine the server's fully qualified domain name, using centos. huoba. set the 'servername' directive globally to suppress this message"
Add a configuration file to enable automatic startup
[Root @ localhost ~] # Cp/usr/local/Apache/bin/apachectl/etc/init. d/httpd
[Root @ localhost ~] # Vim/etc/init. d/httpd
In #! Add the two rows under/bin/sh, and WQ will save and exit.
# Chkconfig: 345 90 90
# Description: Apache
[Root @ localhost ~] # Chkconfig -- add/etc/init. d/httpd
[Root @ localhost ~] # Service httpd start
Temporarily disable the firewall test.
[Root @ localhost ~] #/Etc/init. d/iptables status # view the Firewall Status
[Root @ localhost ~] #/Etc/init. d/iptable stop # disable the firewall this time
[Root @ localhost ~] #/Etc/init. d/iptable restart # restart the Firewall
[Root @ localhost ~] # Chkconfig -- level 35 iptables off # permanently disable the Firewall
Because I use a virtual machine, disable the firewall and access the test. Browse and enter the IP address. If "It Works" is displayed, Apache is installed properly.
Firewall settings:
If it is a virtual machine, it is easy to permanently close the firewall as a local environment.
You can also set the firewall.
Add port 80,443 and SSH port 22. You can also add FTP port 21 and so on.
[Root @ localhost ~] #/Sbin/iptables-I input-P TCP -- dport 80-J accept
[Root @ localhost ~] #/Sbin/iptables-I input-P TCP -- dport 22-J accept
[Root @ localhost ~] #/Sbin/iptables-I input-P TCP -- dport 443-J accept
[Root @ localhost ~] #/Etc/init. d/iptables save # Save the Configuration
[Root @ localhost ~] #/Etc/init. d/iptable restart # restart the Firewall
So far. Apache configuration is basically complete.
Part 3: Install MySQL
1. I forgot to download MySQL.
[Root @ localhost ~] # Wget http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.28.tar.gz
Decompress mysql-5.5.28.tar.gz
[Root @ localhost ~] # Tar zxvf mysql-5.5.28.tar.gz
2. Install cmake
[Root @ localhost ~] # Yum-y install cmake make
Install some other
[Root @ localhost ~] # Yum-y install Autoconf bison automake zlib * fiex * libxml * ncurses-devel libmcrypt * libtool-ltdl-devel *
3. Install MySQL 5.5.28 main program
[Root @ localhost ~] # Cd mysql-5.5.28
[Root @ localhost ~] # Cmake-dcmake_install_prefix =/usr/local/MySQL-dmysql_datadir =/usr/local/MySQL/data-dsysconfigdir =/usr/local/MySQL/etc-dwith_innobase_storage_engine = 1-runtime = 1
-Dwith_blackhole_storage_engine = 1-dwith_partition_storage_engine = 1-dmysql_unix_addr =/tmp/mysqld. sock-dmysql_tcp_port = 3306-denabled_local_infile = 1-dextra_charsets = All-ddefault_charset = utf8-ddefault_collation = utf8_general_ci-dmysql_user = MySQL
[Root @ localhost ~] # Make & make install
Official notes:
The MyISAM, merge, memory, and CSV engines are mandatory (always compiled into the server) and need not be installed explicitly. (Note: by default, MySQL supports the following database engines: MyISAM, merge, memory, and CSV. You do not need to declare them during compilation)
Therefore, the preceding compilation condition saves the following two rows:
-Dwith_myisam_storage_engine = 1
-Dwith_memory_storage_engine = 1
However, InnoDB must be installed in declarative mode.
-Dwith_innobase_storage_engine = 1
4. Configure MySQL 5.5.28
[Root @ localhost ~] # Cp/usr/loacl/MySQL/support-files/my-huge.cnf ETC/My. CNF
[Root @ localhost ~] # Vi/etc/My. CNF
Modify the configuration of my. CNF and remove the # In front of InnoDB related options, which is roughly between 115-130.
Run the following command to configure MySQL startup and Automatic startup:
[Root @ localhost ~] # Cp/usr/loacl/MySQL/support-files/MySQL. Server/etc/init. d/mysqld
[Root @ localhost ~] #/Usr/local/MySQL/scripts/mysql_install_db -- user = MySQL -- basedir =/usr/local/MySQL -- datadir =/usr/local/MySQL/Data &
Chkconfig -- add mysqld
Chkconfig -- level 345 mysqld on
[Root @ localhost ~] # Service mysqld start
Generally, no error is reported if I set my. CNF. Leave a comment if there are any mistakes, and I will try to help you solve them.
The rest is the MySQL settings.
[Root @ localhost ~] #/Usr/local/Server/MySQL/bin/MySQL-u root-p-S/tmp/MySQL. Sock
Enter the password and press Enter.
Set password:
Mysql> set password for 'root' @ 'localhost' = PASSWORD ('123 ');
Mysql> quit
Delete records with empty root passwords
Mysql> use MySQL;
Mysql> Delete from user where Password = '';
Mysql> flush privileges;
Configure MySQL to allow remote root login
Mysql> grant all privileges on *. * to root @ '%' identified by "123456 ";
Mysql> flush privileges;
Mysql> quit
The host can remotely access the MySQL database of centos through software.
The installation and Setup of MySQL are basically complete.
Part 4: install PHP 5.4.8
1. View apache version
[Root @ localhost ~] #/Usr/local/Apache/bin/httpd-V
View the compiled and installed modules of Apache
[Root @ localhost ~] #/Usr/local/Apache/bin/httpd-m
2. Install related resources and dependency packages
[Root @ localhost ~] # Yum-y install Bzip2 bzip2-devel curl-devel libjpeg-devel libpng-devel FreeType-devel
3. Install the PHP 5.4.8 Program
[Root @ localhost ~] # Vim/usr/local/Apache/bin/apxs
Edit apxs and set #! /Replace/with/path/to/perl/interpreter-W (usually the first line) "#! /Usr/bin/perl-W ".
NOTE: If no modification is made, the error message "sorry, I cannot run apxs" appears during compilation. Because the location of the correct Perl execution program is not specified.
[Root @ localhost ~] # Cd php-5.4.8
[Root @ localhost ~] #. /Configure -- prefix =/usr/local/PHP -- with-apxs2 =/usr/local/Apache/bin/apxs -- With-libxml-Dir =/usr/include/libxml2 --- config-file-Path =/usr/local/Apache/conf -- With-mysql =/usr/local/MySQL -- With-mysqli =/usr/local/MySQL/bin/mysql_config -- With-Gd -- enable-Gd-native-TTF -- With-zlib -- With-mcrypt -- With-PDO-mysql =/usr/local/MySQL -- enable-shmop -- enable- soap -- enable-sockets -- enable-wddx -- enable-zip -- With-XMLRPC -- enable-FPM -- enable-mbstring -- With-zlib-dir -- with-bz2 -- With-curl -- enable- EXIF -- enable-FTP -- With-JPEG-Dir =/usr/lib -- With-PNG-Dir =/usr/lib -- With-FreeType-Dir =/usr/lib/
[Root @ localhost ~] # Make & make install
PHP configuration. during compilation and installation, the Directory of my PHP. ini file directs to/usr/local/Apache/CONF.
[Root @ localhost ~] # Cd php-5.4.8
[Root @ localhost ~] # Cp PHP. ini-production/usr/local/Apache/CONF/PHP. ini
4. Modify the Apache configuration file httpd. conf to support PHP
[Root @ localhost ~] # Vim/usr/local/Apache/CONF/httpd. conf
1. Add PHP support.
Addtype application/X-httpd-PHP. php. phtml
Addtype application/X-httpd-PHP-source. PHPs
2. Click "index. php" next to "index. php" on the Index page"
Directoryindex index.html index. php
3. If the directory structure is not displayed, find "Options indexes followsymlinks" and change it
Options followsymlinks
4. Enable Apache to support pseudo-static state. Find "AllowOverride none" and change it
AllowOverride all
Save the httpd. conf configuration, and then execute the following two lines
[Root @ localhost ~] # Chown-r nobody./usr/local/Apache/htdocs/
[Root @ localhost ~] # Chmod-r 777/usr/local/Apache/htdocs/
[Root @ localhost ~] # Service httpd restart
Note: An error may be reported in libphp5.so upon restart. This is not described here in many cases. You can post the error prompt to find a solution.
I created an index. php In htdocs,
<? PHP phpinfo ();?>
The following section shows the running status:
Now, the basic PHP installation is complete.
In short, it takes the longest time to compile and install. Multiple n errors are reported during the installation of the three software, most of which are due to the absence of relevant resources or dependency packages.
The errors mentioned here are not described in detail. Originally, I wanted to use all the offline Resource Packages for local compilation and installation. I found that there are too many things to install, so some related resources and dependency packages were updated and installed using online sources.
Finally, we have to say that you don't need to update and install the source, or you don't need to install the one-click installation package.
At last, I will attach the presentation diagram after installing emlog5.0, and try installing a program for so long: