设为首页 收藏本站
查看: 830|回复: 0

编译安装LAMP小结

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2015-8-19 10:11:57 | 显示全部楼层 |阅读模式
  选取Debian为环境。
  1. apache2
  如果要让apache完全在root用户下运行
  #vi ~/.bashrc
  export CFLAGS='-Wall -DBIG_SECURITY_HOLE'。
  并且安装完后要修改apache配置文件
  #vi /usr/local/apache2/conf/httpd.conf
  修改User和Group为root。
  
  安装apr:
  #tar xvf httpd-2.2.15.tar.gz
  #cd httpd-2.2.15
  #cd srclib/apr
  #./configure --prefix=/usr/local/apr
  #make
  #make install
  #make clean
  #make distclean
  
  安装apr-util:
  #cd ../apr-util
  #./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
  #make
  #make install
  #make clean
  #make distclean
  
  安装apache:
  最后安装apache
  #./configure --prefix=/usr/local/apache2 --enable-mods-shared=all --enable-cache --enable-file-cache --enable-mem-cache --enable-disk-cache --enable-static-support --enable-static-htpasswd --enable-static-htdigest --enable-static-rotatelogs --enable-static-logresolve --enable-static-htdbm --enable-static-ab --enable-static-checkgid --disable-cgi --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-dav --enable-so
  如果提示apr-util版本过低,那么可能是你的Linux发行版内置了apr库,所以将自己安装的apr和apr-util库卸载,并且将apache的配置参数中的--with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util,修改为--with-included-apr和--with-included-apr-util。
  如果编译的时候zlib有问题,安装zlib,而且要按照默认路径/usr/local安装。
  Ubuntu用sudo apt-get install zlib1g-dev
  #make
  #make install
  #make clean
  #make distclean
  #vi /etc/rc.local
  在exit 0之前添加:/usr/local/apache2/bin/apachectl start
  
  如出现错误:
  /usr/lib/libexpat.so: could not read symbols: File in wrong format
  解决方法:
  编译时增加编译参数 --with-expat=builtin 好像在64位服务器下编译脚本在定位系统expat支持时有些问题。通过指定expat,用系统自带的expat来编译就不存在这个问题了。
  测试
  
  /usr/local/apache2/bin/apachectl start如果出现错误。
  httpd: Could not reliably determine the server's fully qualified domain name, using 192.168.1.201 for ServerName
  修改apache配置文件
  # vi /usr/local/apache2/conf/httpd.conf
  找到ServerName localhost:80,将注释取消掉。
  -------------------------------------------------------------------------------apache安装完毕------------------------------------------------------------------------------
  2.安装MySQL
  #tar -zxvf mysql-5.1.30.tar.gz
  #cd mysql-5.1.30
  #groupadd -r mysql //添加mysql用户组
  #useradd -m -r -g mysql -d /var/lib/mysql -s /bin/bash -c "MySQL Server" mysql  //添加mysql用户
  #./configure --prefix=/usr/local/mysql --sysconfdir=/etc --localstatedir=/var/lib/mysql --enable-local-infile
  debian如果出现checking for termcap functions library... configure: error: No curses/termcap library found
  #apt-get install libncurses5-dev安装之。
  #make
  如果出现do_abi_check error,
  #vi Makefile 将do_abi_check以后的语句都注释掉即可,再次make
  #make
  #make install
  #make clean
  #make distclean
  #cd /usr/local/mysql
  #/bin/mysql_install_db //初始化系统数据库  
  #ls /var/lib/mysql //查看存放数据库中的目录内容
  #chown -R mysql:mysql /var/lib/mysql  //修改数据库目录所有者
  #cp /usr/local/mysql/share/mysql/my-large.cnf /etc/my.cnf //一般正常安装之后已经有该文件,可以不用拷贝
  #cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysql  复制生成Linux Mysql服务器的自动与停止脚本
  #chkconfig --list | grep mysql //查询当前是否有mysql服务
  #chkconfig --add mysql //添加mysql服务到服务器管理中
  如果出现insserv: FATAL: service network is missed in the runlevels XXX to use service
  根据Google的结果是:
  Actual Results:
  In default configuration, mysql cannot be enabled as a service to start at boot
  Expected Results:
  Should be able to enable mysql service
  所以采用以下办法:
  # vi /etc/init.d/mysql
  将Default-Start反注释掉。
  然后再
  #chkconfig --add mysql
  #chkconfig --list | grep mysql //查询此时mysql服务器的启动状态
  #chkconfig --level 35 mysql on //设置在3、5运行级别也自启动
  #service mysql start 或 /etc/init.d/mysql start
  如果mysql命令不能正常使用的话
  #vi ~/.bashrc
  添加一句alias mysql='/usr/local/mysql/bin/mysql'
  
  在编译PHP源码时,会使用到部分MySQL的库文件和头文件,若服务器还需提供PHP动态网页服务,会导致找不到相应的文件,解决办法是为目录创建一个符号连接,其实现的操作命令如下:
  
  #ln -s /usr/local/mysql/lib/mysql /usr/lib/mysql
  
  #ln -s /usr/local/mysql/include/mysql /usr/include/mysql
  

  Starting MySQL.Manager of pid-file quit without updating fi[Failed]解决办法只要将/etc/my.cnf里面的 skip federated注释掉即可。
  -------------------------------------------------------------------------------apache安装完毕------------------------------------------------------------------------------
  3.安装PHP
  安装jpeg8库
  #tar -xvf jpegsrc.v8b.tar.gz
  #cd jpeg-8b
  #./configure --prefix=/usr/local/jpeg8/ --enable-shared --enable-static
  #make
  #make install
  #make clean
  #make disclean
  

  安装libpng库
  #tar -xvf libpng-1.2.42.tar.gz
  #cd libpng-1.2.42
  #./configure
  #make
  #make install
  #make clean
  #make distclean
  

  安装freetype库
  #tar -xvf freetype-2.3.12.tar.gz
  #cd freetype-2.3.12
  #./configure --prefix=/usr/local/freetype
  #make
  #make install
  #make clean
  #make distclean
  

  安装gd库
  #tar -xvf gd-2.0.35.tar.gz
  #cd gd-2.0.35
  #./configure --prefix=/usr/local/gd2 --with-jpeg=/usr/local/jpeg8/ --with-png --with-zlib --with-freetype=/usr/local/freetype/
  #make
  #make install
  #make clean
  #make distclean
  

  安装php
  #tar -xvf php-5.2.13.tar.gz
  #cd php-5.2.13
  安装unixODBC到/usr/local/unixODBC#./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-pear=/usr/share/php --with-zlib-dir --with-bz2 --with-libxml-dir --with-gd=/usr/local/gd2 --enable-gd-native-ttf --enable-gd-jis-conv --with-freetype-dir=/usr/local/freetype --with-jpeg-dir=/usr/local/jpeg8 --with-png-dir --enable-mbstring --with-unixODBC=/usr/local/unixODBC --with-config-file-path=/etc --with-iconv --disable-ipv6 --enable-static --enable-maintainer-zts --enable-zend-multibyte --enable-inline-optimization --enable-zend-multibyte --enable-sockets --enable-soap --mysql-with=/usr/local/mysql
  如果提示BZip2有问题,重新编译默认安装bzip2。
  # make
  # make install
  修改php配置
  # vim php.ini-recommended
  找到register_globals = Off,修改为:register_globals = On
  找到short_open_tag = Off,修改为:short_open_tag = On
  找到error_reporting = E_ALL,修改为:error_reporting = E_ALL & ~E_NOTICE
  找到date.timezone = ,加上 Asia/Chongqing
  最后把php.ini-recommanded拷贝到/etc/php.ini去
  如果安装的版本是5.3.X,除了上面的目录名变为php-5.3.X,php配置文件也变成php.ini-development
  

  如果php make时出现错误:libbz2.a需要重新加参数-fPIC来编译
  #tar -xvf bzip2-1.0.5.tar.gz
  #cd bzip2-1.0.5
  #make clean
  #vim Makefile
  找到CFLAGS 在最后加入 -fPIC
  #make
  #make install
  

  整合apache 与php
  #vi /usr/local/apache2/conf/httpd.conf
  在最后一行加上:
  AddType application/x-httpd-php .php
  查找:(设置 WEB 默认文件)
  DirectoryIndex index.html
  替换为:
  DirectoryIndex index.php index.html index.htm //在 WEB 目录不到默认文件,httpd 就会执行 /var/www/error/noindex.html
  找到这一段:
  #AllowOverride controls what directives may be placed in .htaccess files.
  #It can be "All", "None", or any combination of the keywords:
  #Options FileInfo AuthConfig Limit
  #
  AllowOverride none
  更改为AllowOverride all(允许apache rewrite)
  保存httpd.conf,退出。
  #/usr/local/apache2/bin/apachectl restart //重启 Apache
  

  

  

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-101010-1-1.html 上篇帖子: yum安装lamp 下篇帖子: CentOS LAMP配置记录
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表