In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Demand:
CenOS 6 platform builds LAMP, in which php works as an independent service
(1) the three are separated from two hosts
(2) one virtual host is used to provide phpMyAdmin; and the other virtual host provides wordpress.
(3) install cache to provide acceleration for php
(4) mpm is prefork model.
Note:
(1) because httpd is cpu-intensive, php is io-intensive, and mariadb is both cpu-intensive and io-intensive. So we put httpd and php on a host, and mariadb on a separate host.
(2) since the CentOS 6 platform only provides mysql's rpm package, here we use the mariadb binary installation package to install.
(3) since php runs as a separate service process, the php-fpm feature should be enabled when compiling php
(4) since the versions of rpm installers for all applications provided by CentOS 6 are relatively old, they all need to be installed by compiling the source code.
(5) httpd and php need to be connected through FastCGI protocol. Httpd actually works as a reverse proxy, and proxy and proxy_cgi features need to be enabled when compiling httpd.
(6) if MPM is required to ask event model, and when php works as a module of httpd, because event is a thread model, php must enable thread safety function-- enable-maintainer-zts
Environment:
Close iptables and SELinux
Host1: as a front-end web server IP:10.0.0.61
Host2: as a backend DB server IP:10.0.0.62
Linux modification / etc/hosts/
Windows modifies C:\ Windows\ System32\ drivers\ etc
10.0.0.61 www.wordpress.com
10.0.0.61 www.phpadmin.com
Configuration:
Host2:
Install binary mariadb
# add a system user mysql [root@localhost ~] # useradd-r mysql# extract binary installation package under `/ usr/local/` directory [root@localhost ~] # tar-xf mariadb-5.5.46-linux-x86_64.tar.gz-C / usr/local/ [root@localhost ~] # cd / usr/local/# link to the `mys ql` directory [root@localhost local] # ln-sv mariadb-5.5.46-linux- X86ql64 / mysql`mysql'- > `mariadb-5.5.46-linux-x86_64/'# modify its owner and group [root@localhost local] # chown-R root:mysql mysql/# create database storage directory `/ data/ mysql` [root@localhost local] # mkdir-pv / data/mysqlmkdir: created directory` / data'mkdir: created directory `/ data/mysql'# modify its owner and group. [root@localhost local] # chown-R mysql:mysql / data/mysql/# install [root@localhost local] # cd mysql/ [root@localhost mysql] # scripts/mysql_install_db-- user=mysql-- datadir=/data/mysql/# replication service startup script to `/ etc/rc.d/ init.d` directory [root@localhost mysql] # cp support-files/mysql.server / etc/rc.d/init.d/mysqld
Copy the configuration file and configure
# cp support-files/my-large.cnf / etc/my.cnf# vim / etc/ my.cnf[client] default-character-set=utf8 [mysql] default-character-set=utf8 [mysqld] datadir=/data/mysqlcharacter-set-server=utf8collation-server=utf8_general_cidefault-storage-engine=InnoDBinnodb-file-per-table=TRUEskip-name-resolve=TRUE
Database initialization:
# start the database [root@localhost mysql] # / etc/init.d/mysqld startStarting MySQL.. SUCCESS! [root@cb9326a6 mysql] # ss-tunl | grep 3306tcp LISTEN 0 50 *: 3306 *: * # Export the `/ usr/local/mysql/bin/` directory to the `PATH` system environment variable [root@localhost mysql] # export PATH=/usr/local/mysql/bin/:$PATH# database initialization settings [root@localhost mysql] # mysql_secure_installation
Authorization:
[root@localhost ~] # mysql-u root-p # authorizes root to log in and operate all databases from hosts in the 10.0.0.0 Universe 8 network segment. MariaDB [(none)] > grant all privileges on *. * to 'root'@'10.0.0.%' identified by' 123456 creating data wpdb for wordpress. MariaDB [(none)] > create database wordpress;# creates a user wordpress for wordpress. MariaDB [(none)] > create user 'wordpress'@'172.18.71.%' identified by' wordpress';# authorizes wordpress to log in and operate the wordpress database from a host in the 10.0.0.0 Universe 8 network segment. MariaDB [(none)] > grant all privileges on wpdb.* to 'wordpress'@'10.0.0.%' identified by' wordpress';# overload permission table MariaDB [(none)] > flush privileges
Host1
Test whether you can link to the database server
# because CentOS-6 does not provide mariadb, install the client of mysql. [root@localhost ~] # yum install-y mysql# test connection to HostB database [root@localhost ~] # mysql-u root-h 10.0.0.62-p
Add a new system user
# useradd-r apache
Prepare the development environment
# yum groupinstall-y "Development tools"Server Platform Development" # yum install-y pcre-devel libxml2-devel libmcrypt-devel bzip2-devel libcurl-devel
Prepare the source package:
Apr-1.5.0.tar.bz2 apr-util-1.5.3.tar.bz2 httpd-2.4.10.tar.bz2 php-5.4.40.tar.bz2 xcache-3.2.0.tar.bz2
Compile and install apr:
# tar xf apr-1.5.0.tar.bz2# cd apr-1.5.0#. / configure-- prefix=/usr/lcoal/apr# make & & make install
Compile and install apr-util
# tar xf apr-util-1.5.3.tar.bz2# cd apr-util-1.5.3#. / configure-- prefix=/usr/local/apr-util-- with-apr=/usr/local/apr# make & & make install
Compile and install httpd-2.4.9
# tar-xf httpd-2.4.10.tar.bz2# cd httpd-2.4.10#. / configure-- prefix=/usr/local/apache2\-- sysconfdir=/etc/httpd\-- enable-so\-- enable-ssl\-- enable-cgi\-- enable-rewrite\-with-zlib\-- with-pcre\-- with-apr=/usr/local/apr\-- with-apr-util=/usr/local/apr-util\-- enable-modules=most\-- enable -mpms-shared=all\-enable-proxy\-enable-proxy-fcgi\-with-mpm=prefork [root@localhost httpd-2.4.10] # make & & make install
Compile and install php, enable fpm function-- enable-fpm
# tar-xf php-5.4.40.tar.bz2# cd php-5.4.40#. / configure-- prefix=/usr/local/php\-- with-config-file-path=/etc\-- with-config-file-scan-dir=/etc/php.d\-- with-libxml-dir=/usr\-- with-mysql\-- with-mysqli\-- with-openssl\-- with-mcrypt\-- with-png-dir\-- with-jpeg-dir\- -with-freetype-dir\-- with-zlib\-- with-bz2\-- with-curl\-- enable-zip\-- enable-fpm\-- with-fpm-user=apache\-- with-fpm-group=apache\-enable-mbstring\-- enable-xml\-- enable-sockets\ # make & & make test & & make install
To be continued.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.