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

LAMP环境配置安装注意安装步骤及说明事项

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2014-8-13 10:10:05 | 显示全部楼层 |阅读模式
(一)           安装gcc   gcc
      glibc-devel
        glibc-headers
           kernel-headers
      libgomp
   gcc-c++
      libstdc++-devel
(二)           安装zlib压缩库zlib-1.2.5.tar.gz
shell> cd /home/shuhua/tar
shell> tar –zxvf zlib-1.2.5.tar.gz
shell> cd zlib-1.2.5
shell> ./configure //这个配置编译命令不要加目录参数
shell>make && make install
(三)           安装apacheshell> cd /home/shuhua/tar
shell> tar -jxvf httpd-2.2.19.tar.bz2
shell> cd httpd-2.2.19
shell>./configure --prefix=/usr/local/http2  \
      --enable-modules=all \
      --enable-rewrite \
      --enable-mods-shared=all \
      --enable-so
shell> make && make install
#启动Apache
shell> /usr/local/http2/bin/apachectl start
#测试apache
浏览器打开: http://虚拟机IP
看到 "it works!",即为成功
配置虚拟主机
1)配置host文件
打开C:/windows/system32/drivers/etc/hosts 文件
增加域名记录
如:
192.168.1.246 www.ec1.com
192.168.1.246 www.ec2.com
2) 增加虚拟主机
vi /usr/local/http2/conf/httpd.conf
取消#Include conf/extra/httpd-vhosts.conf
这一行前面的#号
保存退出
vi /usr/local/http2/conf/extra/httpd-vhosts.conf
增加虚拟主机记录
<VirtualHost *:80>
           ServerAdmin webmaster@dummy-host.example.com
           DocumentRoot "/usr/local/http2/htdocs/ec1"
           ServerName www.ec1.com
           ServerAlias www.dummy-host.example.com
           ErrorLog "logs/dummy-host.example.com-error_log"
           CustomLog "logs/dummy-host.example.com-access_log" common
</VirtualHost>
<VirtualHost *:80>
           ServerAdmin webmaster@dummy-host2.example.com
            DocumentRoot "/usr/local/http2/htdocs/ec2"
           ServerName www.ec2.com
           ErrorLog "logs/dummy-host2.example.com-error_log"
           CustomLog "logs/dummy-host2.example.com-access_log" common
</VirtualHost>
3)
      shell> cd /usr/local/http2/htdocs
      shell> mkdir ec1 ec2
      shell> echo this is ec1.com > ec1/index.html
      shell> echo this is ec2.com > ec2/index.html
4)重启apache
/usr/local/http2/bin/apachectl restart
5)浏览器打开www.ec1.com,和www.ec2.com
看到不同的网站内容,虚拟主机创建完毕!
安装图形库,为编译PHP做准备
libxml2-2.7.2.tar.gz
jpegsrc.v8b.tar.gz
libpng-1.4.3.tar.gz     
freetype-2.4.1.tar.gz
gd-2.0.35.tar.gz
(四)             安装libxml2shell> cd /home/shuhua/tar
shell> tar zxvf libxml2-2.7.2.tar.gz
shell> cd libxml2-2.7.2
shell>./configure --prefix=/usr/local/libxml2
shell> make && make install
(五)             安装jpeg8shell> cd /home/shuhua/tar
shell> tar -zxvf jpegsrc.v8b.tar.gz
shell> cd jpeg-8b
shell>./configure --prefix=/usr/local/jpeg \
--enable-shared --enable-static
shell> make && make install
(六)             安装libpngshell> cd /home/shuhua/tar
shell> tar zxvf libpng-1.4.3.tar.gz
shell> cd libpng-1.4.3
shell>./configure  #和zlib一样不要带参数,让它默认安装到相应目录
shell> make && make install
(七)             安装freetypeshell> cd /home/shuhua/tar
shell> tar zxvf freetype-2.4.1.tar.gz
shell> cd freetype-2.4.1
shell>./configure --prefix=/usr/local/freetype
shell> make && make install
(八)             安装GD库shell> cd /home/shuhua/tar
shell> tar -zvxf gd-2.0.35.tar.gz
shell> mkdir -p /usr/local/gd
shell> cd gd-2.0.35
shell>./configure --prefix=/usr/local/gd  \
         --with-jpeg=/usr/local/jpeg/   \
         --with-png --with-zlib \
         --with-freetype=/usr/local/freetype
shell> make && make install
(九)             安装 php5shell> cd /home/shuhua/tar
shell> tar -jxvf php-5.3.6.tar.bz
shell> cd php-5.3.6
shell>./configure --prefix=/usr/local/php \
         --with-apxs2=/usr/local/http2/bin/apxs \
         --with-mysql=mysqlnd \
         --with-pdo-mysql=mysqlnd \
         --with-mysqli=mysqlnd \
         --with-freetype-dir=/usr/local/freetype \
         --with-gd=/usr/local/gd \
         --with-zlib --with-libxml-dir=/usr/local/libxml2 \
         --with-jpeg-dir=/usr/local/jpeg \
         --with-png-dir \
         --enable-mbstring=all \
         --enable-mbregex \
         --enable-shared
shell> make && make install
shell> cp php.ini-development /usr/local/php/lib/php.ini
       配置Apache使其支持php
       vi /usr/local/http2/conf/httpd.conf
1)        在httpd.conf(Apache主配置文件)中增加:
AddType application/x-httpd-php .php  
2)        找到下面这段话:
<IfModule dir_module>
    DirectoryIndex index.html
</IfModule>
在index.html 前面添加index.php
3)        建立php测试网页
vi /usr/local/apache2/htdocs/index.php
输入如下内容:
<?php
phpinfo();
?>
4)        重启apache
shell> /usr/local/http2/bin/apachectl restart
5)        再次浏览器查看http://虚拟机IP
如果看到php信息,工作就完成了!
(十)             安装MySQL1)        编译安装MySQL
shell> cd /home/shuhua/tar
shell> tar -xzvf mysql-5.1.58.tar.gz
shell> cd mysql-5.1.58
shell> ./configure --prefix=/usr/local/mysql \
      --with-charset=utf8 \      
      --with-extra-charsets=gbk,gb2312,binary
shell> mount .....挂载光盘
shell>rpm -ivh libtermcap-devel-2.0.8-46....
shell> make && make install
2)       配置并初始化MySQL
shell> groupadd mysql
shell> useradd -g mysql mysql
shell> cp support-files/my-medium.cnf/etc/my.cnf
shell> cd /usr/local/mysql
shell> chown -R mysql.mysql .  
shell> bin/mysql_install_db --user=mysql \
--datadir=/usr/local/mysql/var
创建mysql测试数据库和系统的数据库
shell> chown -R root .
      把当前目录文件的主人都改为root,避免数据库恢复为出厂设置。
shell> chown -R mysql var
shell> bin/mysqld_safe --user=mysql &  
      启动mysql,& 后台运行mysql服务
3)       测试数据库
shell>bin/mysql –uroot
mysql> showdatabases;
4)       接上步,修改mysql密码(可不做此步,默认无密码)
mysql>UPDATEuser SET
password=PASSWORD('new_password')     
WHEREuser='root';
mysql>flushprivileges;
安装出现问题解决1)     php模块安装完毕后重启apache如果提示如下信息(apache重启失败):
[iyunv@localhost php-5.3.6]#/usr/local/http2/bin/apachectl restart
httpd: Syntax error online 105 of /usr/local/http2/conf/httpd.conf: Cannot load/usr/local/http2/modules/libphp5.so into server:/usr/local/libxml2/lib/libxml2.so.2: symbol gzopen64, version ZLIB_1.2.3.3not defined in file libz.so.1 with link time reference
解决办法:
[iyunv@localhostsbin]# echo "/usr/local/lib" >> /etc/ld.so.conf
[iyunv@localhost sbin]#ldconfig
2)     重新安装apache启动失败
[iyunv@localhost httpd-2.2.19]#/usr/local/htt2/bin/apachectl restart
httpd not running,trying to start
(98)Address already inuse: make_sock: could not bind to address [::]:80
(98)Address already inuse: make_sock: could not bind to address 0.0.0.0:80
no listening socketsavailable, shutting down
Unable to open logs
原因是80端口被占用
解决:
查看80端口使用情况
[root@localhosthttpd-2.2.19]# netstat-lnp|grep 80
tcp        0     0 :::80                       :::*                        LISTEN      28195/httpd         
unix  2     [ ACC ]     STREAM     LISTENING     6580  1957/gpm            /dev/gpmctl
unix  2     [ ACC ]     STREAM     LISTENING     5422  1800/pcscd         /var/run/pcscd.comm
查看80的使用者是谁端口
[iyunv@localhost httpd-2.2.19]# ps 28195
  PIDTTY      STAT   TIME COMMAND
28195 ?        Ss    0:00 /usr/local/http2/bin/httpd -k restart
经过分析知道了80端口被系统的一个进程占用,这个进程是旧的apache服务
将这个进程杀之
[root@localhosthttpd-2.2.19]# kill -928195
[root@localhosthttpd-2.2.19]#


运维网声明 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-23687-1-1.html 上篇帖子: Centos6.5之yum安装LAMP+wordpress 下篇帖子: Windows XP下安装和配置Apache2.2.22服务器+PHP5+Mysql5
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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

扫描微信二维码查看详情

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


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


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


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



合作伙伴: 青云cloud

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