lamp环境搭建自己整理_第1页
lamp环境搭建自己整理_第2页
lamp环境搭建自己整理_第3页
lamp环境搭建自己整理_第4页
lamp环境搭建自己整理_第5页
已阅读5页,还剩5页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、a c h e 2/ hd e x html3.用小海豚(SQLyog ) 文件/新建连接一.准备工作在lamp环境中搭载网站1. 用w i nsp将网站目录co p y到1 i n ux的php系统文件目录下/ u s r / 1 ocal/a pt do c s给nin t ime文件夹可写权限c h mod 777 R nintime2. 修改ap a che配宜文件,修改网站首页/us r /I o cal/apach e 2/etc/h t tp.co n f 修改 D i rectoryin d ex index.phpi n重启 a pa c h e :/us r /loca 1

2、 /apache2/bin / ap a c h e ct 1 r esta r t连凄到MySQL主机 上、新建(H). j保存删除0)保存的连接(E):mdb_linux j MvSQL http sshrrn223310踊定(0)私钥WORKS 一 My连接© I I取消CO连接到MySQL主机连接到MySQL主机新建曲 保存 删除(D) 保存的连接(E): mdb_linux” .jfficFj 取消】)卿试连接将网页中的s q 1脚本导入到linu x下的mysql数据库中 启动m ysql:启动MySQL服务1 .用原本源代码的方式去使用和启动m y s ql/usr/1

3、 o cal / mysql/b i n/m y s q ld_safe -us e r =my s ql &2 重启以后还要生效:Vi /etc/rc 1 ocal/ usr/1 oca 1 /mysql / bin/mysqld_safe-user=mysq 1 & 进入mysq 1命令行/ u sr/ 1 ocal/m y s q I/b i n/mysq 1 -u root p5 5 01 2 04.在windows下用浏览器访问1 9 2 . 1 68.1.1 /网站目录注意:先创建/lam p文件夹使用WinS CP把要安装的压缩文件放到/lamp文件夹下./con

4、figure执行的时候要注意不能有换行Appehe安装的时候一沱要确认之前的安装已经卸载h t t p:/ 19 268 255.1/index. html 这个地址要改成1 9 2.1 6 8.80.8/usr/lo c al / apache2/ b in/apachectl sta r t 有时候要用 s tart 有时候要用 res t ar t/u sr/lo c al/mem c a che/b i n/m e mcac h ed uni e me ache & 中的一可能会有问题,要注意1、安装编译工具gec、gccc+、make注意解决依赖关系,推荐使用yum安装,若不

5、能联网可使用安装光盘做为yum源一一1)编辑yum配置文件:Mount / d ev/edrom /med i av i/e tc/yuni. repos, d /CentOS-Medi a .repoc5-median ame=CentOS Sreleasever - Me d i abascurl= f ile: /medi a *修改为光盘挂载点ena b 1 ed=l *改为1意为启用gpgcheck=Og p gk e y=f i Ie:/etc/pk i /r p m-gpg/RPM GPG-KE Y-C e ntOS-52)设置a 1 ias值:Vi / etc/ b ashre

6、a 1 i a s y u m= H yum -dis able repo=* -enab 1 ere p o= c 5-me d iaM3)依次安装 gcc、gcc- c +4-Y u m -y install gc c *2、卸载系统Apache、MySQL和P1IP的RPM安装包下载前需关闭启动的服务,如http d、mys q Idser v i c e htt p d stopse r vic e my s qld st o p卸载 RPM 包的 Apache、MySQL. PHPy uni remove h ttpdyum r e mo v e mysql建议使用rpm -e h

7、t tp-123.rpm -n o d e ps (截断这个r pm包的依赖性)3、关闭SELinux,允许防火墙80端口访问1 )关闭 SELinuxvi /etc /selin u x/conf i gS ELINUX=dis a bled * 若安装时没有禁用 SELi n ux e n fo rcing 改为 disab led 修改后需垂新启动L i mix方可生效!2)关闭防火墙 N e tf i 11 e r /i p table s因尚未做防火墙讲解,直接简单的关闭所有防火墙设置:ipt a bles -F*如势 i禁川防火墙默认80端口禁止访问se r v i c e i p

8、t a bl e s save防火墙策略写到 / etc/sy scon fig/ i ptabl e s,以后计算机重启再加载这个文件时,防火墙策略就会永久淸空.二.编译安装*每个源码包配置编译安装完成后,确认安装目录下是否生成安装文件# 安装 libxml 2t a r xzf I i b xml 2 -2 6.3 0 .ta r .gzcd /lamp / I ib x m 12-2.6 30 / co n figur e -p r efi x =/us r /lo c al/1 i b x m 1 2/make && m a ke in s tai 1# 安装 I ib

9、mc r ypttar xzf 1 i b m c ryp t 2.5.& t ar.gzcd /I a mp/li b mcryp t -2.5.8 / conf i g u re -pref i x= / usr/local/ 1 i b mcr y pt/ma k e && mak e ins t all*需调用gcc-c+编译器,未安装会报错#安装libltdL也在libm c r y pt源码目录中,非新软件c d /1 amp / libmcrypt2.5.8/libItdl./confi g u ree n a b I eIt d 1 i n s t a

10、11mak e && make i n stall#安装zlibcd /lamp/zlib-1.2.3/confi g u r emake && make install* z I ib指圧安装目录可能造成libpng安装失败,故不指定,为卸载方便,建议m a kc inst a 1 1 执行结果输出到安装日志文件,便于日后卸载# 安装 libpngcd /I a mp / li b p n g 1 2 31 /configu r e prefi x =/us r/ I o c al / libpng/m a ke && ma kc i nsta

11、 1 I#安装jpeg 6mk d i r /u s r/ 1 o c al/j p e g 6mkd i r /u sr / I o cal / j p e g 6 /binmkdi r /u s r /local/ j p e g6/1 i b mkdir /us r / 1 ocal/jpe g 6 /in c 1 ude mkdir -p /u s r/Ioca 1 / jp e g 6 /m an/ manltar xzf j pegsr c .v6b.tar.g zc d / 1 a mp/jp e g6b / c o nf i gure -pr e fi x =/ u s r/l

12、oc a 1/j p eg6/en a bl e s h a red -en a b 1 e-staticmake & & m a ke in s tai 1* -ena b le-shared与 e n a ble s tatic参数分别为建立共享库和静态库使用的1 i btoo i# 安装 freet y pec d / I a mp/fr e e typ e 2. 3 .5./con figure pr e fi x =/ u sr / loc a 1/freetype/make && mak e i n sta 1 1# 安装 autoc o nfcd

13、/lamp/au t oc o n f 2 61/conf i g uremake && make i nstall# 安装GD库m k d ir /u s r / loc a 1 / gd 2c d /lamp/ g d- 2 0.35#p ng错误,修改方法:vi gd_png.c把# i nclud换#i n c 1 u d e H / usr / loc a 1 / libp n g/includ e/p ng.h"/co n f i g ure -pref i x= / u s r / loca 1 /g d 2/ -with-jpe g =/usr/ 1

14、ocal/ j p eg6 / -withf r eetype=/ usr/ local /free type/-with p ng=/usr/Iocal/ 1 i b png/m a k e && make i nstal 1mak e#如果出现错误,把上而的两步重新执行一次.m a ke i n s t all*若前而配垃Zlib时没有指左安装目录,gd配置时不要添加-wit h 一 z lib=/usr/1 O a 1/zlib/参 数安装到这里了! !# 安装 A pa c hec d / lamp / h t tp d -2 2 .9./confi g u r e p

15、refix=/ u s r / 1 o c a 1 / a p a che2/ -sysc o n fdi r =/us r / loc a l/apac h e2/etc/ -wit h i n clu d ed a p renab 1 e -so -en a ble-def 1 ate = s h a r ed enab 1 e e x pi r es=sha r ed enable r e wri t e =shar e dm a ke & & make install启动A p ache测试:/usr/1 oc a 1 / a p ac h e 2/b i n/apac

16、 h e c tl res t a r t查看进程:ps -le I grep h ttpd查看ap a che模块:/ u sr/ 1 oca 1 /a p ache2/bin/apa c h ec t 1 -h# s ha r e 动态模块或动态库文件Php 5 rewrite#static静态模块或表态库文件Serv e r st a t usUserdi rV i rt u al host测试:http:/ 1 9 2 . 1 6 8 .255. 1/ i ndex.html"it w o rks"设置A pac h e随机启动V i /et c /rc.local

17、/usr / lo c al/ apache 2in/ap a c hectl restart我配宜的la0913环境到这里# 安装 nc u rs e sl. yum y i n s t all n cur s es*2 源代码编译:cd /lamp/ncu r ses-5.6./ c onfigu r e -with shared -without d e bu g wit h o u t-adae nable-o v erwri t em a kc && make install*若不安装ncu rscs编译M y S QL时会报错* -w i th o ut-ad a参

18、数为设定不编译为ada绑立,因进入ch r oot环境不能使用ad a :- e n a ble-ove r wri t e 参数为定义把头文件安装到/t o ol s /i n cl u d e 下而不是/t o ols / include/ncurscs 目录#安装MySQLuser add m y s ql* 添加用户组m ysql ,将mysq I用户默认组设置为mys q 1用户组 ???t ar xzf mysq 1 5 1.5 9.tar.gzc d / 1 amp/mys q 1 5.1. 5 9 /con fig u re -with o u t-deb u g -enabl

19、et h r ead-sa f e-clie nt wi t h-pt h r e ad -e n a ble-ass e mbl e r -ena b I e -pr o f iling -w i th-mysq 1 d ldflags= a II sta t i c with-clientld f I a gs=-al 1 -static wi t h-extracha r sets=a 1 I with-plu g ins二 a II withpostg res u ser= p o stgr e swithou t -emb e d ded-server -with s e r ver

20、-suffix=-commu nit y w i t h-uni x- s o c k et path=/tmp / pos t g r e s sockma ke && make i nst a 11* -withex t r acha r sets= a 11参数为安装所有字符集#如果不行的话,make clean后再make ;make install.这样去试一下,默认是不支持innod b存储引 擎的其-with-plu g ins=all可以把innodb加载进来.cp /usr/1 o cal/my s ql/sha re/ mysql/my-me d i f /

21、etc/ f修改mys q 1配置文件vi/etc/my. c n f1. c 1 ientdefault-c h aracte r -set= u t f 8#客户端字符集昴连接字符集2. mysqldchar a cter-s e ts e r v e r = u tf8#服务器字符集#数据库字符集collati o i卜 s er v e r = u t f8_gen e ral_ci#服务器,库,表的校验字符集#d e fault- s t orage-eng i ne=i n nodb这句话要注释掉 不然m y s ql登录不上#把默认的表引擎改为inno d b*生成M y SQL

22、配宜文件se t fa c 1 -m u: mysqknvx R / u s r /local/my s qlsetfac I -m d : u :m y sql:rw x -R / usr / Io c al/mysq 1*用a c 1来让my s ql用户对/usr/local / mysq 1有所有权限/ u sr/1 o c al / mysql/bin / m y sq 1 _ i n s t a ll_db -us e r=mysql*创建数据库授权表启动MySQL服务1 用原本源代码的方式去使用和启动my s ql/usr/1 o c a 1 /my s ql / bin / m

23、 y sqld_s a f e -user=m y s q 1 &2重启以后还要生效:V i /et c / r co c al/ usr/ I ocal/my s q 1 /b in /m y s qld_safc -user=m y s ql &4 /us r / lo c al/mysql/bin/mys q 1 admin u root pa s s w o r d 550120#给mysq 1用户r oot加密码密码为5 501 2 0/ u sr/1 ocal/mysql/ b in /my s ql -u r o ot -p 5 5 0 120 te s tmy

24、s q l>sho w da t abases;mysql> u se t e s tmy s ql>show t a bles;#进入m y s q 1以后用se t来改密码.m y sql> exi t登录MyS QL客戸端控制台设置指左root密码#安装PHP编译前确保系统已经安装了 1 ibtool和lib t o o 1-1 t dl软件包,若没有安装使用y u m或rpm安装 下:yum instal 1 I i b t ool*yum ins t all I i b too 1 1 t dl*cd /1 amp/php5.2.6 /conf igue -

25、p ref ix=/u s r/lo c al/php / -w i t h c o nf i g-f i I e -path = /us r /local / php/et c / -wit h a px s 2=/usr / I o ca 1 /a p ache 2 /bin / apxs w i th-m y sql=/usr / I oca 1 /my s ql / wit h libxm 1 -di r =/u s r/local/li bxm 1 2 / -wi t h-j p e g d ir=/u s r/local / jpeg6/w i t h png-dir=/usr /

26、 loca I / 1 ib p ng / 一wit h f reetype dir=/us r /local/f r e e t y p e /w i th g d =/usr/lo c a 1/ g d 2 /w ith-mcrypt=/ u s r/l o cal/l i b me r y p t / -w i th-mysq 1 i =/ u sr/ 1 ocal/m y sql / b in/m y s q 1 _confige nab le-soap e na b I e mb s tr i ng=all -enable so ckets*若前而配置Z1 ib时没有指定安装目录,P

27、HP配置时不要添加-with-zlib-dir=/u sr/local / zl i b/参数mak e & & ma k e ins t al 1生成php. ini( p叩的配置文件)c p / 1 amp / p hp-5.2. 6 /php i ni-dist / u s r /I o cal/php/ e t c/ph p i ni测试apac h e与php的连通性,看apac h e是否能解析php文件让ap a c h e支持php代码:v i /usr/1 o c a I / apache2/ e t c/li t tpd.confA d dType a pp

28、i i cati o n /x-httpd-p h p . php .phps重启Apache服务:/usr/lo c al / apache2/bin/apach e ctl s t a rt测试:vi /usr/local/apach e2/ht d ocs/ t est. php<?ph p沖 h p i nfo();? >通过浏览器测试:http:/l 9 2.16 8 2 5 5.1 / 1 e s t.php编译安装m e m c acheta r z x v f memcache 2 25t g zc d memca che-2.2 5/ u sr/ 1 oca 1

29、/php/ b in/ph p iz e / c on f igu r e -with php-c o nfig=/usr / I o c a l/php / bi n /php c onfig make && make install编译安装PDOMYS QLt a r z xvf /lamp / PDO_MYS Q L 1 .0.2.t g zta r x zf /lamp/P DO_MYSQ L-l O.2.tgzcd /la mp/PDO_MYS Q L-l. 0 .2/ usr/ 1 ocal/php / b i n / p h pize / co n f i gu

30、r e -w i th-php-config=/u s r /loca I /php/bi n /phpc o nfig -with- p d omysql=/u s r/lo c a l/mysqlm a k e && make install修改 p h p.inivi / usr/loc a 1/p h p/et c / p hp.i n iextensi o n_dir = " / usr/l o cal/p h p/ / I i b/php/ex t e nsions/n o -debu g -non-z t s-20060613 / “exte n si o n=”m e m c ac h e so";extension二 M pdo_my s ql.s o ";修改php文件生效:/ u s r/ 1 o cal/a p ache2/bi n/a p ach e c

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论