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

debian7.7源码编译安装lamp

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2014-11-7 08:47:20 | 显示全部楼层 |阅读模式
操作系统是Debian7.7 X64,系统是最小化安装。
首先安装基本的系统组件
apt-get install gcc g++ cmake automake libncurses5-dev ntpdate bison chkconfig curl  iftop sysstat dstat iotop  zlib1g-dev libssl1.0.0 libssl-dev openssl   libcurl4-openssl-dev pkg-config libgdbm-dev -y


#安装zlib
tar xzvf zlib-1.2.8.tar.gz
cd zlib-1.2.8
./configure --prefix=/usr/local/zlib
make && make install
cd ..
#安装pcre
tar xzvf pcre-8.36.tar.gz
cd pcre-8.36/
./configure --prefix=/usr/local/pcre
make && make install
cd ..


#安装Apache
tar xzvf httpd-2.4.10-deps.tar.gz
tar xzvf httpd-2.4.10.tar.gz
cd httpd-2.4.10/
./configure --prefix=/usr/local/apache2 --enable-so --enable-rewrite --with-pcre=/usr/local/pcre --with-zlib=/usr/local/zlib
make && make install
cd ..

cp /usr/local/apache2/bin/apachectl /etc/init.d/httpd

#修改Apache开机脚本,以只支持debian,将这些配置文件写到httpd的开头即可

#!/bin/sh
### BEGIN INIT INFO
# Provides:          apache2
# Required-Start:    $local_fs $remote_fs $network $syslog
# Required-Stop:     $local_fs $remote_fs $network $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: starts the apache2 daemon
# Description:       starts apache2 using start-stop-daemon
### END INIT INFO

chkconfig --add httpd
chkconfig httpd on



#安装mysql
groupadd -g 600 mysql
useradd -g mysql -u 600 -s /usr/sbin/nologin mysql
tar xzvf mysql-5.6.21.tar.gz
cd mysql-5.6.21/
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=all -DWITH_DEBUG=0
make -j 4
make install

cd /usr/local/mysql/
chown -R mysql .
chgrp -R mysql .
cd scripts/
./mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
chmod 755 /etc/init.d/mysqld

chkconfig mysqld on

#修改my.cnf
vim /usr/local/mysql/my.cnf
basedir = /usr/local/mysql
datadir = /usr/local/mysql/data
socket = /tmp/mysql.sock

echo "/usr/local/mysql/lib">> /etc/ld.so.conf
ldconfig


/etc/init.d/mysqld start


echo 'export PATH=$PATH:/usr/local/mysql/bin' >>/etc/profile
source /etc/profile


#安装freetype
tar xzvf freetype-2.4.9.tar.gz
cd freetype-2.4.9
./configure --prefix=/usr/local/freetype
make && make install
cd ..

#安装libpng
tar xzvf libpng-1.5.10.tar.gz
cd libpng-1.5.10
./configure --prefix=/usr/local/libpng
make && make install
cd ..

#安装jpeg
tar xzvf jpegsrc.v9.tar.gz
cd jpeg-9/
./configure --prefix=/usr/local/jpeg9
make && make install
cd ..

#安装gd
tar xzvf gd-2.0.33.tar.gz
cd gd-2.0.33/
./configure --prefix=/usr/local/gd2 --with-zlib=/usr/local/zlib --with-png=/usr/local/libpng --with-jpeg=/usr/local/jpeg9 --with-gd=shared

#修改文件
vim gd_png.c   修改第十五行如下

#include "/usr/local/libpng/include/png.h"              /* includes zlib.h and setjmp.h */

make && make install
cd ..

#安装libiconv
tar xzvf libiconv-1.14.tar.gz
cd libiconv-1.14
./configure --prefix=/usr/local/libiconv
make && make install
cd ..

#安装libmcrypt
tar xzvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
./configure --prefix=/usr/local/libmcrypt
make && make install
cd ..

#安装mhash
tar xzvf mhash-0.9.9.9.tar.gz
cd mhash-0.9.9.9
./configure --prefix=/usr/local/mhash
make && make install
cd ..

#安装curl
tar xzvf curl-7.39.0.tar.gz
cd curl-7.39.0/
./configure --prefix=/usr/local/curl
make && make install
cd ..

#安装libxml2
tar xzvf libxml2-2.8.0.tar.gz
cd libxml2-2.8.0
./configure --prefix=/usr/local/libxml2
make && make install
cd ..


#修改编译错误
vim /usr/local/gd2/include/gd_io.h


typedef struct gdIOCtx
{
  int (*getC) (struct gdIOCtx *);
  int (*getBuf) (struct gdIOCtx *, void *, int);

  void (*putC) (struct gdIOCtx *, int);
  int (*putBuf) (struct gdIOCtx *, const void *, int);

  /* seek must return 1 on SUCCESS, 0 on FAILURE. Unlike fseek! */
  int (*seek) (struct gdIOCtx *, const int);

  long (*tell) (struct gdIOCtx *);

  void (*gd_free) (struct gdIOCtx *);
  void (*data)     #增加此行
}


#php
tar xzvf php-5.4.34.tar.gz
cd php-5.4.34/
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc/ --with-mysql=/usr/local/mysql/ --with-apxs2=/usr/local/apache2/bin/apxs  --with-jpeg-dir=/usr/local/jpeg9 --with-freetype-dir=/usr/local/freetype --with-png-dir=/usr/local/libpng --with-libxml-dir=/usr/local/libxml2 --with-gd=/usr/local/gd2 --with-mcrypt=/usr/local/libmcrypt --with-mhash=/usr/local/mhash  --with-zlib=/usr/local/zlib --with-pcre-dir=/usr/local/pcre --enable-mbstring=cn --enable-sockets --enable-pcntl --with-gdbm --enable-ftp --with-openssl --with-curl=/usr/local/curl

make && make install


cp php.ini-production /usr/local/php/etc/php.ini

#php结合apache
sed -i '/AddType application\/x-gzip .gz .tgz/a\    AddType application\/x-httpd-php .php\n    AddType application\/x-httpd-php-source .phps' /usr/local/apache2/conf/httpd.conf

#添加首页支持
sed -i '/DirectoryIndex index.html/c\     DirectoryIndex index.php index.html' /usr/local/apache2/conf/httpd.conf


service httpd -t
service httpd start
cd ..
php测试页
echo "<?php phpinfo(); ?>" >/usr/local/apache2/htdocs/index.php




运维网声明 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-27277-1-1.html 上篇帖子: Linux下查看nginx,apache,mysql,php的编译参数 下篇帖子: debian7.7快速构建lamp和lnmp环境
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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

扫描微信二维码查看详情

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


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


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


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



合作伙伴: 青云cloud

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