光辉岁月吉他谱怎么样,好不好的默认点评

Linux下LAMP环境搭建
我的图书馆
Linux下LAMP环境搭建
CentOS环境下配置&&&&Linux操作系统下载地址:
Apache+MySQL+PHP及相关的组件 下载地址:
LAMP环境是一个开源的可以免费使用的PHP开发环境组合。
下载的安装包解压命令:
]#tar zxvf 压缩包文件位置
第一步.安装libxml2
]#cd /soft/libxml2-2.6.30& //进入安装目录
使用如下命令配置libxml2库文件
]#./configure --prefix=/usr/local/libxml2& //执行libxml2库的配置命令并指定安装目录(/usr/jsj/libxml2为指定安装目录可以自己指定需要安装到某个目录)
]#make && make install& //使用此命令编译并安装libxml2
安装时若提示:make: *** No targets specified and no makefile found.& Stop.错误,则说明该Linux操作系统没有安装GCC导致无法编译
安装GCC方法如下:
在命令行模式敲入如下命令:# yum install gcc gcc-c++ autoconf automake
Linux会自动下载安装GCC,此命令需要预安装yum
第二步.安装libmcrypt库文件
]#./configure --prefix=/usr/local/libmcrypt&&& //执行libmcrypt库的配置命令并指定安装目录
]#make && make install&&&&&&&&&&&&&&&&&&&&&&&&& //编译并安装libmcrypt
第三步.安装zlib库文件
]#./configure&&&&&&&&&&&&&&&&&&&& //执行zlib库的配置命令
]#make && make install&& //编译并安装zlib
第四步.安装libpng库文件
]#./configure --prefix=/usr/local/libpng&&& //执行libpng库的配置命令并指定安装目录
]#make && make install&& //编译并安装libpng
第五步.安装jpeg6库文件
]#mkdir /usr/local/jpeg6&& //为安装jpeg6建立安装目录
]#mkdir /usr/local/jpeg6/bin&& //为安装jpeg6建立命令存放目录
]#mkdir /usr/local/jpeg6/lib&&& //为安装jpeg6建立库文件存放目录
]#mkdir /usr/local/jpeg6/include&& //为安装jpeg6建立头文件存放目录
]#mkdir /usr/local/jpeg6/man/man1&& //为jpeg6建立手册存放目录
]#./configure \&&&&&&&&&&&&&&&&&&&&&&&& //执行jpeg6库的配置命令
&--prefix=/usr/local/jpeg6 \&&&& //指定jpeg6的安装目录
&--enable-shared \&&&&&&&&&&
//建立共享库使用的GNU的libtool
&--enable-static&&&&&&&&&&&&&&&
//建立静态库使用的GNU的libtool
]#make && make install&&& //编译并安装jpeg6
第六步.安装freetype库文件
]#./configure --prefix=/usr/local/freetype& //执行freetype库配置命令并指定安装目录
]#make && make install&&&&&&&&&&&&&&&&&&&&&&&&&& //编译并安装freetype
第七步.安装autoconf库文件
]#./configure&&&&& //执行autoconf库的配置命令
]#make && make install //编译并安装autoconf
第八步.安装GD库文件
]#./configure \&&&&&&&&&&&&&&&&&&&&& //执行gd库配置命令
&--prefix=/usr/local/gd2 \&&& //指定dg2的安装目录
&--with-jpeg=/usr/local/jpeg6 \& //指定jpeg6的安装目录
&--with-png=/usr/local/libpng \&&//指定libpng的安装目录
&--with-treetype=/usr/local/treetype& //指定treetype的安装目录
此处编译时若出现如下错误:
gd_png.c:16:53: error: png.h: No such file or directory
gd_png.c:47: error: expected specifier-qualifier-list before ‘jmp_buf’
gd_png.c:54: error: expected ‘)’ before ‘png_ptr’
gd_png.c:82: error: expected ‘)’ before ‘png_ptr’
gd_png.c:92: error: expected ‘)’ before ‘png_ptr’
gd_png.c:98: error: expected ‘)’ before ‘png_ptr’
gd_png.c: In function ‘gdImageCreateFromPngCtx’:
gd_png.c:125: error: ‘png_byte’ undeclared (first use in this function)
gd_png.c:125: error: (Each undeclared identifier is reported only once
gd_png.c:125: error: for each function it appears in.)
gd_png.c:125: error: expected ‘;’ before ‘sig’
gd_png.c:126: error: ‘png_structp’ undeclared (first use in this function)
gd_png.c:126: error: expected ‘;’ before ‘png_ptr’
gd_png.c:127: error: ‘png_infop’ undeclared (first use in this function)
gd_png.c:127: error: expected ‘;’ before ‘info_ptr’
gd_png.c:128: error: ‘png_uint_32′ undeclared (first use in this function)
gd_png.c:128: error: expected ‘;’ before ‘width’
gd_png.c:131: error: ‘png_colorp’ undeclared (first use in this function)
gd_png.c:131: error: expected ‘;’ before ‘palette’
gd_png.c:132: error: ‘png_color_16p’ undeclared (first use in this function)
gd_png.c:132: error: expected ‘;’ before ‘trans_gray_rgb’
gd_png.c:133: error: expected ‘;’ before ‘trans_color_rgb’
gd_png.c:134: error: ‘png_bytep’ undeclared (first use in this function)
gd_png.c:134: error: expected ‘;’ before ‘trans’
gd_png.c:135: error: expected ‘;’ before ‘image_data’
gd_png.c:136: error: ‘png_bytepp’ undeclared (first use in this function)
gd_png.c:136: error: expected ‘;’ before ‘row_pointers’
gd_png.c:144: error: ‘sig’ undeclared (first use in this function)
gd_png.c:157: error: ‘png_ptr’ undeclared (first use in this function)
gd_png.c:157: error: ‘PNG_LIBPNG_VER_STRING’ undeclared (first use in this function)
gd_png.c:157: error: ‘gdPngErrorHandler’ undeclared (first use in this function)
gd_png.c:166: error: ‘info_ptr’ undeclared (first use in this function)
gd_png.c:182: error: ‘jmpbuf_wrapper’ has no member named ‘jmpbuf’
gd_png.c:192: error: ‘gdPngReadData’ undeclared (first use in this function)
gd_png.c:195: error: ‘width’ undeclared (first use in this function)
gd_png.c:195: error: ‘height’ undeclared (first use in this function)
gd_png.c:196: error: ‘PNG_COLOR_TYPE_RGB’ undeclared (first use in this function)
gd_png.c:196: error: ‘PNG_COLOR_TYPE_RGB_ALPHA’ undeclared (first use in this function)
gd_png.c:204: error: ‘image_data’ undeclared (first use in this function)
gd_png.c:205: error: ‘row_pointers’ undeclared (first use in this function)
gd_png.c:220: error: ‘jmpbuf_wrapper’ has no member named ‘jmpbuf’
gd_png.c:233: error: ‘PNG_COLOR_TYPE_PALETTE’ undeclared (first use in this function)
gd_png.c:234: error: ‘palette’ undeclared (first use in this function)
gd_png.c:238: error: ‘PNG_INFO_tRNS’ undeclared (first use in this function)
gd_png.c:246: error: ‘trans’ undeclared (first use in this function)
gd_png.c:258: error: ‘PNG_COLOR_TYPE_GRAY’ undeclared (first use in this function)
gd_png.c:259: error: ‘PNG_COLOR_TYPE_GRAY_ALPHA’ undeclared (first use in this function)
gd_png.c:261: error: expected ‘)’ before ‘gdMalloc’
gd_png.c:280: error: ‘trans_gray_rgb’ undeclared (first use in this function)
gd_png.c:305: error: ‘trans_color_rgb’ undeclared (first use in this function)
gd_png.c:322: error: ‘rowbytes’ undeclared (first use in this function)
gd_png.c:327: error: expected ‘;’ before ‘gdMalloc’
gd_png.c:345: error: expected ‘;’ before ‘gdMalloc’
gd_png.c:357: error: ‘h’ undeclared (first use in this function)
gd_png.c:381: error: ‘PNG_INTERLACE_ADAM7′ undeclared (first use in this function)
gd_png.c:389: error: ‘w’ undeclared (first use in this function)
gd_png.c:390: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘r’
gd_png.c:390: error: ‘r’ undeclared (first use in this function)
gd_png.c:391: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘g’
gd_png.c:391: error: ‘g’ undeclared (first use in this function)
gd_png.c:392: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘b’
gd_png.c:392: error: ‘b’ undeclared (first use in this function)
gd_png.c:401: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘r’
gd_png.c:402: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘g’
gd_png.c:403: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘b’
gd_png.c:410: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘a’
gd_png.c:410: error: ‘a’ undeclared (first use in this function)
gd_png.c:419: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘idx’
gd_png.c:419: error: ‘idx’ undeclared (first use in this function)
gd_png.c: In function ‘gdImagePngCtxEx’:
gd_png.c:499: error: ‘png_byte’ undeclared (first use in this function)
gd_png.c:499: error: expected ‘;’ before ‘trans_values’
gd_png.c:500: error: ‘png_color_16′ undeclared (first use in this function)
gd_png.c:500: error: expected ‘;’ before ‘trans_rgb_value’
gd_png.c:501: error: ‘png_color’ undeclared (first use in this function)
gd_png.c:501: error: expected ‘;’ before ‘palette’
gd_png.c:502: error: ‘png_structp’ undeclared (first use in this function)
gd_png.c:502: error: expected ‘;’ before ‘png_ptr’
gd_png.c:503: error: ‘png_infop’ undeclared (first use in this function)
gd_png.c:503: error: expected ‘;’ before ‘info_ptr’
gd_png.c:508: error: ‘png_ptr’ undeclared (first use in this function)
gd_png.c:508: error: ‘PNG_LIBPNG_VER_STRING’ undeclared (first use in this function)
gd_png.c:509: error: ‘gdPngErrorHandler’ undeclared (first use in this function)
gd_png.c:520: error: ‘info_ptr’ undeclared (first use in this function)
gd_png.c:524: error: ‘png_infopp’ undeclared (first use in this function)
gd_png.c:529: error: ‘jmpbuf_wrapper’ has no member named ‘jmpbuf’
gd_png.c:537: error: ‘gdPngWriteData’ undeclared (first use in this function)
gd_png.c:538: error: ‘gdPngFlushData’ undeclared (first use in this function)
gd_png.c:595: error: ‘PNG_INTERLACE_ADAM7′ undeclared (first use in this function)
gd_png.c:595: error: ‘PNG_INTERLACE_NONE’ undeclared (first use in this function)
gd_png.c:602: error: ‘PNG_COLOR_TYPE_RGB_ALPHA’ undeclared (first use in this function)
gd_png.c:603: error: ‘PNG_COMPRESSION_TYPE_DEFAULT’ undeclared (first use in this function)
gd_png.c:604: error: ‘PNG_FILTER_TYPE_DEFAULT’ undeclared (first use in this function)
gd_png.c:609: error: ‘PNG_COLOR_TYPE_RGB’ undeclared (first use in this function)
gd_png.c:617: error: ‘PNG_COLOR_TYPE_PALETTE’ undeclared (first use in this function)
gd_png.c:623: error: ‘trans_rgb_value’ undeclared (first use in this function)
gd_png.c:672: error: ‘trans_values’ undeclared (first use in this function)
gd_png.c:694: error: ‘palette’ undeclared (first use in this function)
gd_png.c:725: error: ‘png_bytep’ undeclared (first use in this function)
gd_png.c:725: error: ‘row_pointers’ undeclared (first use in this function)
gd_png.c:731: error: ‘prow_pointers’ undeclared (first use in this function)
gd_png.c:747: error: expected ‘)’ before ‘gdMalloc’
gd_png.c:804: error: expected ‘)’ before ‘gdMalloc’
make[2]: *** [gd_png.lo] 错误 1
make[2]:正在离开目录 `/usr/local/src/modules/gd-2.0.35′
make[1]: *** [all-recursive] 错误 1
make[1]:正在离开目录 `/usr/local/src/modules/gd-2.0.35′
make: *** [all] 错误 2
则是因为gd库源文件中的 gd_png.c 文件里面的第十六行代码 #include "png.h"&&&&&&&&&&&&& /* includes zlib&&&&&&& .h and setjmp.h */中的php.h路径错误,修改为 /usr/local/libpng/png.h 即可
具体修改方法如下:
]#vi gd_png.c&& //用vi编辑器编辑gd_png.c文件
进入文档编辑画面后按Shift+;键切换到输入vi命令模式 输入set number命令显示行号找到第十六行按i键进入文档编辑模式做上述相应的修改,按Esc键退出文档编辑模式,继续按Shift+;键切换到vi命令模式输入wq保存退出该文档即可
]#make && make install&&& //编译并安装gd库
第九步.安装Apache服务器
]#./configure \&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& //执行Apache服务器配置命令
&--prefix=/usr/local/apache2 \&&&&&&&&& //指定Apache服务器的安装目录
&--sysconfdir=/etc/httpd \&&&&&&&&&&&&&&&& //指定Apache服务器配置文件的存放位置
&--with-included-apr \&&&&&&&&&&&&&&&&&&&&&& //使用捆绑APR/APR-Util的副本
&--enable-so \&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& //以动态共享对象(DSO)编译
&--enable-deflate=shared \&&&&&&&&&&&&&& //添加缩小传输编码的支持
&--enable-expires=shared \&&&&&&&&&&&&& //期满头控制
&--enable-rewrite=shared \&&&&&&&&&&&&&& //基于规则的URL控制
&--enable-static-support&&&&&&&&&&&&&&&&&& //建立静态链接版本的支持
]#make && make install&&&&&&&&&&&&&&&&&&&//编译并安装
测试Apache服务器
启动Apache服务器命令:
]#/usr/local/apache2/bin/apachectl start
打开浏览器在地址栏输入: 测试Apache服务器若显示 It works!则说明Apache服务器可以正常运行
停止Apache服务器命令:
]#/usr/local/apache2/bin/apachectl stop
添加Apache服务器到开机自动启动
]#echo "/usr/local/apache2/bin/apachectl start"&&/etc/rc.d/rc.local
第十步.安装MySQL数据库服务器
]#groupadd mysql&&&&&&&&&&&&&&& //创建mysql组
]#useradd -g mysql mysql&&& //创建mysql用户并添加到mysql组
]#./configure \&&&&&&&&&&&&&&&&&&&&&& //执行mysql的配置命令
&--prefix=/usr/local/mysql \&& //指定mysql的安装目录
&--with-extra-charsets=all&&&& //使MySQL支持所有的字符集
]#make && make install&&&&&&&&//编译并安装mysql数据库
配置时提示如下信息:
checking for termcap functions library... configure: error: No curses/termcap library found
编译时提示如下错误:
make: *** No targets specified and no makefile found.& Stop.
上述错误提示显示:Linux操作系统缺少curses/termcap库
使用如下命令查找curses安装包
]#yum list|grep ncurses
使用如下命令安装curses库
]#yum -y install ncurses-devel
安装完成后重新执行上述mysql的安装命令即可成功安装MySQL数据库
配置MySQL数据库
]#cp support-files/f /f&& //创建MySQL数据库配置文件,此处为拷贝安装包目录下的配置文件到/etc目录下面并更名为my.cnf
]#/usr/local/mysql/bin/mysql_install_db --user=mysql&&& //创建授权表
]#cd /usr/local/mysql&& //进入到mysql安装目录
]#chown -R root .&& //将所有文件的属性修改为root用户
]#chown -R mysql var&& //将数据目录的属性修改为mysql用户
]#chgrp -R mysql .&& //将所有文件的组属性修改为mysql组
]#/usr/local/mysql/bin/mysqld_safe --user=mysql &&& //后台启动MySQL数据库
]#netstat -tnl|grep 3306 //查看3306端口是否打开
]#/usr/local/mysql/bin/mysqladmin version& //查看版本信息
]#/usr/local/mysql/bin/mysqladmin variables& //查看所有MySQL参数
]#/usr/local/mysql/bin/mysql -u root&& //登陆MySQL服务器(刚安装完无密码可以直接登陆服务器,需要设置MySQL服务器密码)
mysql& DELETE FROMmysql.user WHERE Host='localhost'
AND User='';&& --使用此SQL命令删除匿名用户信息
mysql& DELETE&FROM mysql.user&WHERE Host='127.0.0.1'&OR Host='localhost.localdomain';--删除除了localhost以外的其他用户
mysql& FLUSH PRIVILEGES; --使用该命令刷新系统权限相关表
mysql& SET PASSWORD FOR 'root'@'localhost' = PASSWORD('123456');--为root用户设置密码
mysql& EXIT --退出MySQL数据库
]#/usr/local/mysql/bin/mysql -u root -p&& //进入MySQL客户端
password:&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& //输入密码进入SQL
第十一步.安装PHP模块
]# ./configure \&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& &//执行PHP的配置命令
& --prefix=/usr/local/php
\& &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
//设置PHP的安装路径
& --with-config-file-path=/usr/local/php/etc
\ &&&&&&&&&&&//指定PHP配置文件的放置路径
& --with-apxs2=/usr/local/apache2/bin/apxs
\&&&&&&&&&&//指定Apache 2的安装目录
& --with-mysql=/usr/local/mysql/
\&&&&&&&&&&&&&&&&&&&&&&&&&&& //指定MySQL的安装目录
& --with-libxml-dir=/usr/local/libxml2/
\ &&&&&&&&&&&&&&&&&&& //指定libxml2库的安装目录
& --with-png-dir=/usr/local/libpng/
\ &&&&&&&&&&&&&&&&&&&&&&&& //指定libpng库的安装目录
& --with-jpeg-dir=/usr/local/jpeg6/
\&& &&&&&&&&&&&&&&&&&&&&&& //指定jpeg库的安装目录
& --with-freetype-dir=/usr/local/freetype/
\& &&&&&&&&&&&&& //指定freetype库的安装目录
& --with-gd=/usr/local/gd2/
\&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&//指定gd库的安装目录
& --with-mcrypt=/usr/local/libmcrypt/
\ &&&&&&&&&&&&&&&&&&& &//指定libmcrypt库的安装目录
& --with-mysqli=/usr/local/mysql/bin/mysql_config
\&//变量激活新增加的MySQLi功能
& --enable-soap \&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&//变量激活SOAP和Web
services支持
& --enable-mbstring=all \&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&//使PHP支持多字节字符串
& --enable-sockets&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& &//变量激活socket通讯特性
]#make && make install&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& //编译并安装PHP模块
PHP模块配置
]#cp php.ini-dist /usr/local/php/etc/php.ini&&&&&&&&&&&&& //创建PHP配置文件
]#vi /etc/httpd/httpd.conf&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& //编辑Apache配置文件
在Apache配置文件的315行添加如下配置:
AddType application/x-httpd-php .php .phtml&&&&&& #添加该配置,使Apache服务器支持.php、.phtml文件
第十二步.安装Zend加速器
]#./install.sh&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& //安装Zend加速器
安装过程中指定PHP配置文件的目录为:/usr/local/php
第十三步.安装PHPMyAdmin
]# cp -a phpMyAdmin-3.0.0-rc1-all-languages/ /usr/local/apache2/htdocs/phpmyadmin //拷贝phpMyAdmin目录到Apache服务器的htdocs目录下
]# cd /usr/local/apache2/htdocs/phpmyadmin/&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&//进入phpmyadmin目录
]# cp config.samplc.inc.php config.inc.php&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&//重命名配置文件为config.inc.php
配置phpMyAdmin
]# vi /usr/local/apache2/htdocs/phpmyadmin/config.inc.php&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& //打开phpmyadmin的配置文件
?$cfg['blowfish_secret']&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& //查找到该属相写入一个属性值
:wq!&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& //退出VI文本编辑器
到此为止整个LAMP环境配置完成,之后会添加一些更详细的配置。
TA的最新馆藏[转]&[转]&今天看啥 热点:
年终福利,PHP7+Apache2.4+MySQL5.6 源码编译安装,环境配置,搭建你自己的LAMP环境,php7apache2.4PHP7 都出来了,你还在玩PHP5吗?
MySQL5.6 早都出来了,你还在玩MySql5.2吗?
Apache2.4 早都出来了,你还在玩Apache2.2吗?
笔者不才,愿意亲自搭建环境,供搭建参考。这里是源码安装的奥,什么一键安装包,什么yum安装,什么rpm安装都统统略过(笔者是一个自虐狂,就像windows下安装软件一样,不喜欢安装在默认的位置也就是C盘了,否则系统盘就爆了)
安装之前了,要说明下,要保证PHP在最后安装,原因后面揭晓。安装任何一个软件之前,都要确保它所依赖的库都安装了。
(本处安装环境 centos6.4)
首先来安装apache2.4
先到apache官方网站 下载&http://httpd.apache.org/download.cgi 最新版本&&httpd-2.4.18.tar.gz
然后进行解压
tar -zxvf httpd-2.4.18.tar.gz
进入到解压后的目录
cd httpd-2.4.18
先不要急着安装,先确保它所依赖的库是否有,怎样查看软件是否安装(rpm -q xxx),如果没有安装依赖则进行安装(笔者一般安装依赖库直接使用yum 默认安装,这样在软件安装的时候就不需要知道依赖库的安装路径,省去不少麻烦)
这些安装包是: zlib-devel&pcre-devel pcre apr apr-util
在安装前笔者遇到yum 无法访问源的问题,这里我们把yum的源指定为网易163的,具体指定方法请查看&/.help/centos.html,上面有详细步骤
然后安装&zlib-devel&pcre-devel pcre&apr apr-util (apr apr-util 这两个库,笔者在安装时发现使用yum安装不可取,编译时找不到类库,因此笔者这里采用源码安装方式)
yum install zlib-devel pcre-devel pcre
然后我们使用源码安装apr apr-util 这两个库,这两个库的源码安装包可以到(http://apr.apache.org/download.cgi)找到
wget http://mirrors.noc.im/apache//apr/apr-1.5.2.tar.gz
wget http://mirrors.noc.im/apache//apr/apr-util-1.5.4.tar.gz
然后分别解压,并安装(一定要确保安装了 gcc-c++ 没有的话使用 yum install gcc-c++ 进行安装)
tar -zxvf apr-1.5.2.tar.gz
cd apr-1.5.2
./configure --prefix=/usr/local/apr/make && make install
tar -zxvf apr-util-1.5.4.tar.gz
cd apr-util-1.5.4
./configure --prefix=/usr/local/apr-util/
--with-apr=/usr/local/apr/
make && make install
下面开始对Apache进行安装配置,可以使用
./configure --help
查看安装时可以配置哪些参数,下面我们开始配置一些参数并进行检查
./configure
--prefix=/usr/local/apache/ \
--with-apr=/usr/local/apr/ \
--with-apr-util=/usr/local/apr-util/ \
--enable-so \
--enable-deflate=shared \
--enable-expires=shared \
--enable-rewrite=shared \
--enable-static-support
检查无误,然后开始编译安装
make && make install
然后,漫长等待,大概半个小时。。。
等安装完以后进入到安装目录,开启apache服务
cd /usr/local/apache/bin/
./apachectl start
哎,发现报错
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message
额,原来就是配置文件中没有serverName,那就在httpd.conf 中增加 ServerName&
vim /usr/local/apache/conf/httpd.conf
ServerName localhost
完了之后再重新启动apache,发现一切正常,然后我们访问下看看是否OK
好了,这里算是大功告成了,apache2.4 安装完毕
好了,现在我们开始安装mysql
先要下载mysql源码安装包,我们这里使用mysql-5.6.28.tar.gz ,这个可以到官网上下载,然后解压
tar -zxvf mysql-5.6.28.tar.gz
还是老话,先不急着安装,先看看mysql依赖的类库是否安装,没有的话就安装
yum -y install make gcc-c++ cmake bison-devel
ncurses-devel
进入到解压后的mysql目录,你会惊奇的发现没有configure 文件,这下如何是好。这个主要是新版本的mysql使用了cmake 进行安装,所以没有之前的configure文件了
现在我们就使用cmake 进行安装配置
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_DATADIR=/usr/local/mysql/data \
-DSYSCONFDIR=/etc \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock \
-DMYSQL_TCP_PORT=3306 \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DEXTRA_CHARSETS=all \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci
上面几个重要的地方
'-DCMAKE_INSTALL_PREFIX' 是安装目录
'-DMYSQL_DATADIR' 是数据文件存放目录
'-DSYSCONFDIR' 配置文件目录
'-DMYSQL_UNIX_ADDR' SOCK文件存放目录
'-DMYSQL_TCP_PORT' 端口号
检查无误后,就开始编译安装了
make && make install
然后,然后,然后就是半个小时的等待。。。
等一切就绪后,我们需要确保存在 mysql组和mysql用户
cat /etc/group|grep 'mysql'
cat /etc/passwd|grep 'mysql'
没有的话就添加
groupadd mysql
useradd -g mysql mysql
然后将目录'/usr/local/mysql'的所有者改为mysql
chown -R mysql:mysql /usr/local/mysql
这时算是已经安装完成了,但是mysql中是没有数据的(即使系统自带的数据都没有),这时需要执行自带脚本,初始化mysql数据
/usr/local/mysql/scripts/mysql_install_db \
--basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql
执行完成后,你会发现/usr/local/mysql/data 目录下多了一些文件,这些就是mysql的数据文件了
然后启动mysql,这时要注意,我们上面指定配置文件位于'/etc'目录下,但是我们为了方便,想把mysql配置文件放到'/usr/local/mysql/',这时我们需要把'/etc/my.conf'更改一下名称
这时mysql 在'/etc'目录下找不到,就会到'$basedir'下去找,也就是'/usr/local/mysql/'目录
此时mysql的安装工作算是完了,下面就要启动了,你会发现使用使用
/usr/local/mysql/bin/mysql start
无法启动,报错为
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
之前笔者怎么弄都不行,即使建立'/var/lib/mysql/mysql.sock' 后来终于知道,原来不是怎么启动的,而是
/usr/local/mysql/support-files/mysql.server start
然后,测试下
/usr/local/mysql/bin/mysql -u root
好了,到这里mysql 算是安装成功了!
最后一步,我们要安装PHP7了,最为激动人心的时刻到了
首先还是要下载PHP7 ,这个可以到官网上下载,然后就是解压,和上面一样的命令(笔者这里使用 PHP7.0.2)
安装之前还是老生常谈,依赖包要先安装上
php-mcrypt libmcrypt libmcrypt-devel &autoconf &freetype&gd&jpegsrc&libmcrypt&libpng libpng-devel libjpeg&libxml2 libxml2-devel&zlib curl curl-devel &
挺繁琐,一堆依赖
yum -y install php-mcrypt libmcrypt libmcrypt-devel &autoconf &freetype&gd&jpegsrc&libmcrypt&libpng&libpng-devel libjpeg&libxml2&libxml2-devel&zlib curl curl-devel&
./configure
--prefix=/usr/local/php/
--with-apxs2=/usr/local/apache/bin/apxs
--enable-mbstring
--with-curl
--enable-fpm
--enable-mysqlnd
--with-pdo-mysql=mysqlnd
--with-config-file-path=/usr/local/php/etc/
--with-mysqli=mysqlnd
--with-mysql-sock=/var/lib/mysql/mysql.sock
上面编译时配置支持了很多东西,大家可以按照自己的需求添加,但是有一个基础的必须配置好
--prefix 安装目录
--with-apxs2 apache文件所在地
--with-mysql-sock=/var/lib/mysql/mysql.sock mysql的sock文件地址
--enable-mbstring
支持mbstring
--with-curl 支持curl --with-gd 支持gd
--enable-fpm
--enable-mysqlnd --with-pdo-mysql
检查没有错误了,就可以安装了,当然了如果有错误,多少依赖没有安装上去,根据提示依次安装相关依赖库
然后就开始编译安装了
make && make install
经过半个小时漫长的等待....
安装完成后,我们要把源码包中的配置文件复制到PHP安装目录下,源码包中有两个配置&&php.ini-development &php.ini-production &,看名字就知道,一个是开发环境,一个是生产环境,我们这里就复制开发环境的
cp php.ini-development
/usr/local/php/etc/php.ini
到这里,还最后一个工作没有做,就是让apache去解析PHP文件,在apache配置文件httpd.conf 中加上一条
Addtype application/x-httpd-php .php .phtml
然后重新启动apache&
/usr/local/apache/bin/apachectl restart
然后在目录/usr/local/apache/htdocs/ 目录下增加test.php&
phpinfo();
我们开始访问 localhost/test.php, 然后显示出激动人心的画面
到这里,专属你的全部最新版本的LAMP环境就算搭建成功了!!!!
后面在讲述点小知识,有时你需要为php添加扩展,windows下弄两个dll 然后改下php.ini 就OK了,但是centos下就不行,还得编译。这样要是让你重新编译PHP,那笔者就要受人唾骂了,我们这里讲述的就是不需要重新编译PHP,就可以为PHP添加扩展
这里例子我们要安装openssl 扩展,在你的源码安装包 ext 下会有 openssl 目录, 进入到该目录
首先调用我们已经编译好的 &phpize
/usr/local/php/bin/phpize
发现会报错
Cannot find config.m4. Make sure that you run '/usr/local/php/bin/phpize' in the top level source directory of the module
好,然后我们就把该目录下的 config0.m4 复制到 &config.m4 中
cp config0.m4 config.m4
然后再次执行
/usr/local/php/bin/phpize
诶,这下OK了,弄完之后,你会发现里面多了些文件 其中有configure文件,这个就是我们想要的
./configure \--with-php-config=/usr/local/php/bin/php-config
编译完成后,就开始安装
make && make install
这是你会在你的扩展目录下发现 so 文件(扩展目录没有指定的话,就位于 /usr/local/php/lib/php/extensions/no-debug-zts-xxx 里面&)
然后在php.ini 加上该扩展
extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-/openssl.so
然后重启apache 再次访问test.php 就会发现扩展就安装上去了
OK,这里关于LAMP安装的东东算是完了,其实安装倒不是很复杂,复杂的是各种依赖,真是醉了,各种依赖啊,有木有!!!!
相关搜索:
相关阅读:
相关频道:
&&&&&&&&&&&&
Linux教程最近更新

我要回帖

更多关于 光辉岁月mp3 的文章

 

随机推荐