prepare two servers, one for installation Apache, one installation MySQL
installation Apache
1. Download and install
Yum Install Zlib-devel-ywgethttp://mirror.bit.edu.cn/apache/httpd/httpd-2.2.31.tar.gztar XF HTTPD-2.2.31.TAR.GZCD Httpd-2.2.31./configure--prefix=/application/apache2.2.31--enable-deflate--enable-expires--enable-headers-- Enable-modules=most--enable-so--with-mpm=worker--enable-rewritemakemake installln-s/application/apache2.2.31// Application/apachels-l/application/
2. Start the service
/application/apache/bin/apachectl Startnetstat-lntup|grep httpd
3. Configuring a domain-based virtual host
cd /application/apache/conf/vim httpd.conf Modify Line 98,132,378,396 98 servername 127.0.0.1:80132 <directory "/application/apache2.2.31/html" >378 include conf/extra/ httpd-mpm.conf396 include conf/extra/httpd-vhosts.conf cd /application/apache/conf/ extraextra/vim httpd-vhosts.conf <virtualhost *:80> serveradmin [ email protected] documentroot "/application/apache2.2.31/html/www" ServerName www.etiantian.org ServerAlias etiantian.org ErrorLog "/app/logs/www-error_log" CustomLog "/app/logs/www-access_log" common</virtualhost> <virtualhost *:80> serveradmin [email protected] documentroot "/application/apache2.2.31/html/bbs" ServerName bbs.etiantian.org errorlog "/app/logs/bbs-error_log" CustomLog "/app/logs/bbs-access_log" common </VirtualHost> <VirtualHost *:80> ServerAdmin [email protected] documentroot "/application/apache2.2.31/html/blog" servername blog.etiantian.org errorlog "/app/logs/blog-error_log" customlog "/app/logs/blog-access_log" common</virtualhost> cd /application/ apache/conf/extramkdir -p/application/apache2.2.31/html/{www,bbs,blog}echo www.etiantian.org>/ application/apache2.2.31/html/www/index.htmlecho bbs.etiantian.org>/application/apache2.2.31/html/bbs/ Index.htmlecho blog.etiantian.org>/application/apache2.2.31/html/blog/index.htmlmkdir /app/logs -p
Check syntax
/application/apache/bin/apachectl-tsyntax Ok/application/apache/bin/apachectl Graceful
Verify before /etc/hosts to have parsing
Verify:
Curl www.etiantian.org
www.etiantian.org
Curl bbs.etiantian.org
bbs.etiantian.org
Curl blog.etiantian.org
blog.etiantian.org
This machine does not install MySQL,mysql server exists independently
Install PHP
1) Install dependent packages
Wget-o/etc/yum.repos.d/epel.repohttp://mirrors.aliyun.com/repo/epel-6.repoyum Install Zlib-devel Libxml2-devellibjpeg-devel Libiconv-devel-yyum Install freetype-devel libpng-develgd-devel curl-devel libxslt-devel- Y rpm-qa freetype-devellibjpeg-turbo-devel libcurl-devel libpng-devel gd-devel libxslt-devel View Result: freetype-devel-2.3.11-15.el6_6.1.x86_64gd-devel-2.0.35-11.el6.x86_64libpng-devel-1.2.49-1.el6_2.x86_ 64libcurl-devel-7.19.7-46.el6.x86_64libxslt-devel-1.1.26-2.el6_3.1.x86_64libjpeg-turbo-devel-1.2.1-3.el6_5.x86 _64
The source package does not have the following package:
Libiconv-devel
Installing Libiconv-devel
Mkdir-p/home/oldboy/toolscd/home/oldboy/toolswget Http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gztar ZXF libiconv-1.14.tar.gzcd Libiconv-1.14./configure-prefix=/usr/local/libiconvmake make INSTALLCD. /
installing the Libmcrypt library
Yum Install Libmcrypt-devel-yrpm-qa libmcrypt-devel libmcrypt-devel-2.5.8-9.el6.x86_64
installing the Mhash library
Yum-y Install Mhash Mhash-develrpm-qa mhash mhash-develmhash-0.9.9.9-3.el6.x86_64mhash-devel-0.9.9.9-3.el6.x86_64
installing The mcrypt encryption extension Library
Yum-y Install MCrypt Mcrypt-develrpm-qa mcrypt mcrypt-2.6.8-10.el6.x86_64
formally install PHP
Rz-y Uploading Packages
Tar zxf php-5.3.27.tar.gzcd php-5.3.27./configure--prefix=/application/php5.3.27--with-apxs2=/application/apache/ Bin/apxs--with-mysql=mysqlnd--with-iconv-dir=/usr/local/libiconv--with-freetype-dir--with-jpeg-dir-- With-png-dir--with-zlib--with-libxml-dir=/usr--enable-xml--disable-rpath--enable-safe-mode--enable-bcmath-- Enable-shmop--enable-sysvsem--enable-inline-optimization--with-curl--with-curlwrappers--enable-mbregex-- Enable-mbstring--with-mcrypt--with-gd--enable-gd-native-ttf--with-openssl--with-mhash--enable-pcntl-- Enable-sockets--with-xmlrpc--enable-zip--enable-soap--enable-short-tags--enable-zend-multibyte--enable-static- -with-xsl--enable-ftp Makemake installln-s/application/php5.3.27//application/php
cd/application/apache/conf/
Configuration:
Vim httpd.conf311 Line added: AddType application/x-httpd-php. php. phtml AddType Application/x-httpd-php-source phps168 Line : DirectoryIndex index.php index.html67 line add user Wwwgroup www
To create a user:
Useradd-s/sbin/nologin www
ID www
/application/apache/bin/apachectl-tsyntax Ok/application/apache/bin/apachectl Graceful
Site Directory
Cd/application/apache/html/blog
Build two test files
Vim test1.php
<?phpphpinfo ();? >
The second test file waits for MySQL to be installed before the results can be obtained.
Vim test2.php
<?php $link _id=mysql_connect (' db01.etiantian.org ', ' WordPress ', ' 123456 ') ormysql_error (); if ($link _id) {echo "MySQL successful by zhou!"; } else{Echo mysql_error (); }?>
Vim/etc/hosts
172.16.1.51 db01.etiantian.org
Detection:
Ping db01.etiantian.org
Check syntax
/application/apache/bin/apachectl-t
Start the service
/application/apache/bin/apachectl start
Reload
/application/apache/bin/apachectl Graceful
Second, installation MySQL Database
Installing with mysql-5.5.32 binary Package
1. Add Users
Useradd mysql-s/sbin/nologin-m
2, unpacking processing
Tar XF mysql-5.5.32-linux2.6-x86_64.tar.gzmv mysql-5.5.32-linux2.6-x86_64/application/mysql-5.5.32
Create a soft link
Ln-s/application/mysql-5.5.32//application/mysql
3. Initialize the database
/application/mysql/scripts/mysql_install_db--basedir=/application/mysql/--datadir=/application/mysql/data/-- User=mysql
The result of the initialization is the build file
Ll/application/mysql/data/total 12drwx------2 mysql root 4096 Nov 02:59 mysqldrwx------2 mysql mysql 4096 Nov 11 02 : 59performance_schemadrwxr-xr-x 2 mysql root 4096 Nov 02:53 test
To authorize after initialization:
Chown-r mysql.mysql/application/mysql/
4. Start the database
\cp/application/mysql/support-files/my-small.cnf/etc/my.cnfsed-i ' s#/usr/local/mysql#/application/mysql#g '/ Application/mysql/bin/mysqld_safe\cp/application/mysql/support-files/mysql.server/etc/init.d/mysqldsed-i ' s#/ Usr/local/mysql#/application/mysql#g '/etc/init.d/mysqld
Start the MySQL service
/etc/init.d/mysqld startstarting MySQL success!
Plus Path to MySQL
Path paths
Echo ' path= '/application/mysql/bin: $PATH "' >>/etc/profilesource/etc/profile
Enter Mysql
Mysql
5. managing Databases
Set a new password
Mysqladmin-uroot passwordnew Password: Enter the password here confirm New password: Repeat the above password
Log in to Database
Mysql -uroot -penter password: Creating a Database mysql> create database wordpress; query ok, 1 row affected (0.07&NBSP;SEC) Authorized mysql> grant all on wordpress.* to [email protected] ' localhost ' identified by ' 123456 '; query ok, 0 rows affected (0.07 sec) Refresh mysql> flush privileges; query ok, 0 rows affected (0.05 sec) mysql> show grants for [email protected] ' localhost '; +------------------------------ ------------------------------------------------------------------------------------+| grants for [email protected] |+------------------------------------------------------------------------ ------------------------------------------+| grant usage on *.* to ' WordPress ' @ ' localhost ' identified by password ' *6bb4837eb74329105ee4568dda7dc67ed2ca2ad9 ' | | GRANT ALL PRIVILEGES ON ' wordpress ' .* to ' wordpress ' @ ' localhost ' |+------------------------------------------ ------------------------------------------------------------------------+2 rows in set (0.06 sec) mysql> select user,host from mysql.user whereuser= ' WordPress '; +-----------+-----------+| user |host |+-----------+--------- --+| wordpress | localhost |+-----------+-----------+1 row in set ( 0.00&NBSP;SEC) mysql> select user,host from mysql.user;+-----------+-------- ---+| user | host |+-----------+---- -------+| root |127.0.0.1 | | root |localhost | | wordpress | localhost | | root |web01 |+-----------+-----------+4 rows in set (0.00&NBSP;SEC)
Switch to the Site directory:
Cd/application/apache/html/blog/rz-ytar XF WORDPRESS-4.2.2-ZH_CN.TAR.GZMV blog/*. cd. /chown-r www.www blog/
after the native hosts do the parsing, The browser accesses the following address, as requested in the next step.
blog.etiantian.org/wp-admin/setup-config.php
This article is from the "Zhou-linux Cultivation Road" blog, please be sure to keep this source http://zhouzefang.blog.51cto.com/9475331/1717653
Lamp's Build Blog