|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
欢迎大家来到仓酷云论坛!本次实验用了两个web,一个php和mysqlweb1,2(172.16.31.30,31.31)nfs172.16.31.34
php172.16.31.32mysql172.16.31.32
构建如图所示
1,搭建web
起首#mount-tnfs172.16.31.34:/mydata/mydata挂载nfs
此次编译和上篇LAMP中web所用的版本是一个版本,编译步调不异
1)下载apr-1.5.0.tar.bz2apr-util-1.5.3.tar.bz2httpd-2.4.9.tar.bz2这三个包,顺次解压,
#tarxfapr-1.5.0.tar.bz2
#cdapr-1.5.0
#./configure--prefix=/usr/local/apr
#make&&makeinstall
2)编译装置apr-util
#tarxfapr-util-1.5.3.tar.bz2
#cdapr-util-1.5.3
#./configure--prefix=/usr/local/apr-util--with-apr=/usr/local/apr
#make&&makeinstall
3)编译装置httpd-2.4.9
#tarxfhttpd-2.4.9.tar.bz2
#cdhttpd-2.4.9
#./configure--prefix=/usr/local/apache--sysconfdir=/etc/httpd24--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--with-mpm=event
#make&&makeinstall
两台都是做云云操纵,然后修正PATH情况变量
echo"exportPATH=/usr/local/apach/bin:$PATH">>/etc/profile.d/httpd.sh
让PATH在以后shell失效而且启动办事
source/etc/profile.d/httpd.sh
apachectlstart
#vim/etc/httpd/httpd.con
LoadModuleproxy_fcgi_modulemodules/mod_proxy_fcgi.so需启用的两个模块
LoadModuleproxy_modulemodules/mod_proxy.so
ServerNamewww.caoshujia.com:80
ProxyRequestsoff封闭正向代办署理
ProxyPassMatch^/(.*.php)$fcgi://172.16.2.11:9000/mydata/$1只需是php文件都利用fcgi协定代办署理到php办事器。
DocumentRoot"/mydata/"修正站点根目次为nfs
<Directory"/mydata/">修正对站点根目次的把持标签
DirectoryIndexindex.htmlindex.php增加默许哀求文件
AddTypeapplication/x-httpd-php.php在<IfModulemime_module>标签中到场,以撑持php格局的文件。
AddTypeapplication/x-httpd-php-source.phps
#httpd-t
#apacherestart
2php编译装置
1)事前必要装置几个包组,假如装置,无需装置
#yum-ygroupinstall"DesktopPlatformDevelopment"
#yum-yinstallbzip2-devel
#yum-yinstalllibmcrypt-devel
2)编译装置
#tarxfphp-5.4.26.tar.bz2
#cdphp-5.4.26
#./configure--prefix=/usr/local/php--with-mysql--with-mysqli--with-openssl--enable-mbstring--with-freetype-dir--with-jpeg-dir--with-png-dir--with-zlib--with-libxml-dir--enable-xml--enable-sockets--enable-fpm--with-bz2--with-config-file-path=/etc--with-config-file-scan-dir=/etc/php.d--with-mcrypt
#make&&makeinstall
3)为php供应设置文件:
#cpphp.ini-production/etc/php.ini
4)设置php-fpm
为php-fpm供应SysVinit剧本,并将其增加至办事列表:
#cpsapi/fpm/init.d.php-fpm/etc/rc.d/init.d/php-fpm
#chmod+x/etc/rc.d/init.d/php-fpm
#chkconfig--addphp-fpm
#chkconfigphp-fpmon
为php-fpm供应设置文件:
#cp/usr/local/php/etc/php-fpm.conf.default/usr/local/php/etc/php-fpm.conf
编纂php-fpm的设置文件:
#vim/usr/local/php/etc/php-fpm.conf
设置fpm的相干选项为你所必要的值,并启用pid文件(以下最初一行):
pm.max_children=50
pm.start_servers=5
pm.min_spare_servers=2
pm.max_spare_servers=8
pid=/usr/local/php/var/run/php-fpm.pid
指定php的PID文件地点地位。这条必定要写在[global]上面第一行,否则不会失效。
接上去就能够启动php-fpm了:
#servicephp-fpmstart
检测监听端口
#netstat-tnlp|grepphp-fpm
tcp00127.0.0.1:90000.0.0.0:*LISTEN689/php-fpm
[root@localhostphp-5.4.26]#servicephpstart
[root@localhostphp-5.4.26]#mkdir/mydata
[root@localhostphp-5.4.26]#mount-tnfs172.16.31.34:/mydata/mydata挂载nfs,用来存储php页面。
[root@localhostphp-5.4.26]#chown-Rnobody/mydata修正webdata目次的一切者为nobody,由于nobody是php历程运转的用户。
3,mysql设置
1起首下载mysql-5.5.33包组(mariadb-5.5.36-linux-x86_64.tar.gz),然后解压mariadb-5.5.36-linux-x86_64.tar.gz到/usr/local
[root@localhost~]#tarxfmariadb-5.5.36-linux-x86_64.tar.gz-C/usr/local
2筹办数据寄存的文件体系
a新建一个sda3
[root@localhost~]#fdisk/dev/sda
Command(mforhelp):n
Commandaction
eextended
pprimarypartition(1-4)
p
Partitionnumber(1-4):3
Firstcylinder(7859-13054,default7859):
Usingdefaultvalue7859
Lastcylinder,+cylindersor+size{K,M,G}(7859-13054,default13054):+20G
Command(mforhelp):t
Partitionnumber(1-4):3
Hexcode(typeLtolistcodes):8e(文件体系为LVM)
Changedsystemtypeofpartition3to8e(LinuxLVM)
Command(mforhelp):w
b读进磁盘中
[root@localhost~]#kpartx-af/dev/sda
device-mapper:reloadioctlonsda1failed:Invalidargument
create/reloadfailedonsda1
device-mapper:reloadioctlonsda2failed:Invalidargument
create/reloadfailedonsda2
device-mapper:reloadioctlonsda3failed:Invalidargument
create/reloadfailedonsda3
[root@localhost~]#partx-a/dev/sda
BLKPG:Deviceorresourcebusy
erroraddingpartition1
BLKPG:Deviceorresourcebusy
erroraddingpartition2
BLKPG:Deviceorresourcebusy
erroraddingpartition3(暗示已读进到磁盘中)
c新建逻辑卷,并将其挂载至特定目次,此处目次设置为/mydata
[root@localhost~]#pvcreate/dev/sda3
Physicalvolume"/dev/sda3"successfullycreated
[root@localhost~]#vgcreatemyvg/dev/sda3
Volumegroup"myvg"successfullycreated
[root@localhost~]#lvcreate-L10G-nmydatamyvg
Logicalvolume"mydata"created
[root@localhost~]#mke2fs-text4-LMYDATA-b4096-m3/dev/myvg/mydata
而且能开机挂载,编纂fastab文件
/dev/mapper/vg0-root/ext4defaults11
UUID=90ebd4cf-95c1-4338-b0dd-19b2b1cb943d/bootext4defaults12
/dev/mapper/vg0-usr/usrext4defaults12
/dev/mapper/vg0-var/varext4defaults12
/dev/mapper/vg0-swapswapswapdefaults00
tmpfs/dev/shmtmpfsdefaults00
devpts/dev/ptsdevptsgid=5,mode=62000
sysfs/syssysfsdefaults00
proc/procprocdefaults00
LABEL=MYDATA/mydataext4defaults00
(开机挂载)
d新建用户以宁静体例运转历程,并创立链接
[root@localhost~]#groupadd-rmysql
[root@localhost~]#useradd-gmysql-rmysql
[root@localhost~]#idmysql
uid=496(mysql)gid=493(mysql)groups=493(mysql)
[root@localhost~]#chown-Rmysql.mysql/mydata/data/
[root@localhost~]#ll-a/mydata/data/
total8
drwxr-xr-x2mysqlmysql4096Aug1120:15.
先辈进/usr/local目次下
<pstyle="padding:0px;margin:0px;clear:both;height:auto;overflow:hidden;color:rgb(80,80,80);font-family:宋体,ArialNarrow,arial,serif;font-size:14px;line-height:28px;text-indent:28px;">[root@localhostlocal]#ln-svmariadb-5.5.36-linux-x86_64mysql |
|