<b>CentOS 6.0下搭建LAMP环境(源码安装)</b>[服务器安全]
本文“<b>CentOS 6.0下搭建LAMP环境(源码安装)</b>[服务器安全]”是由七道奇为您精心收集,来源于网络转载,文章版权归文章作者所有,本站不对其观点以及内容做任何评价,请读者自行判断,以下是其具体内容:
历史两日,终于在centos 6.0上搭建好了完好的LAMP开辟环境,中间有很多麻烦,但还是一点点办理了.并且写好了这份安装文档,留给自己和今后再安装中碰到问题的人.予人玫瑰,手留余香.
1、搭建环境:
1、CentOS 6.0虚拟机(最小安装)
2、putty
3、ssh shell
2、预备工作:
1、源码包
2、安装gcc、gcc-c++编译器(yum安装)
若虚拟机能联网,直接输入号令yum install gcc和yum install gcc-c++;若不能联网,将centos光盘镜像挂载上,改正yum的本地源,使机械从本地源yum方法安装
3、查抄机械上能否已经安装了mysql、php、apache,利用号令rpm -qa mysql.若安装了,则利用号令rpm -e 包的全名 --nodeps卸载
5、开放80、3306、22端口
因为默许情形下,防火墙的80、3306、22端口是关闭的,这样的话关于客户机拜候虚拟机上的web,会呈现拜候不到的现象.所以要开启.
service iptables stop
#/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT //那是大写的英文字母I,不是数字1
#/sbin/iptables -I INPUT -p tcp --dport 22 -j ACCEPT
#/sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT
然后保存:
#/etc/rc.d/init.d/iptables save
重启防火墙
service iptables restart
6、在linux下成立目录lamp,存放上传的源码
7、利用ssh shell将windows下下载好的14个源码包上传到/lamp
8、解包
因为包很多,这里编写shell脚本/lamp/tar.sh举行解包
tar.sh
view plaincopy to clipboardprint?
- #!/bin/sh
- cd /lamp
- ls *.tar.gz > ls.list
- for TAR in `cat ls.list`
- do
- tar -zxvf $YAR
- done
履行脚本tar.sh举行解包
9、将源码包*.tar.gz全都删除
3、安装历程:
1、为便利操作,编写安装脚本/lamp/lamp.sh举行安装
lamp.sh
view plaincopy to clipboardprint?
- cd /lamp/libxml2-2.6.30
- ./configure --prefix=/usr/local/libxml2/
- make
- make install
- cd /lamp/libmcrypt-2.5.8
- ./configure --prefix=/usr/local/libmcrypt/
- make
- make install
- cd /lamp/libmcrypt-2.5.8/libltdl
- ./configure --enable-ltdl-install
- make
- make install
- cd /lamp/zlib-1.2.3
- ./configure
- make
- make install
- cd /lamp/libpng-1.2.31
- ./configure --prefix=/usr/local/libpng/
- make
- make install
- mkdir /usr/local/jpeg6
- mkdir /usr/local/jpeg6/bin
- mkdir /usr/local/jpeg6/lib
- mkdir /usr/local/jpeg6/include
- mkdir -p /usr/local/jpeg6/man/man1
- cd /lamp/jpeg-6b
- ./configure --prefix=/usr/local/jpeg6/ --enable-shared --enable-static
- make
- make install
- cd /lamp/freetype-2.3.5
- ./configure --prefix=/usr/local/freetype/
- make
- make install
- cd /lamp/autoconf-2.61
- ./configure
- make
- make install
- cd /lamp/gd-2.0.35
- ./configure --prefix=/usr/local/gd2/ --with-jpeg=/usr/local/jpeg6/ --with-freetype=/usr/local/freetype/
- make
- make install
- cd /lamp/httpd-2.2.9
- ./configure --prefix=/usr/local/apache2/ --sysconfdir=/etc/httpd/ --with-included-apr --disable-userdir --enable-so --enable-deflate=shared --enable-expires=shared --enable-rewrite=shared --enable-static-support
- make
- make install
- /usr/local/apache2/bin/apachectl start
- echo "/usr/local/apache2/bin/apachectl start" >> /etc/rc.d/rc.sysinit
- cd /lamp/ncurses-5.6
- ./configure --with-shared --without-debug --without-ada --enable-overwrite
- make
- make install
- groupadd mysql
- useradd -g mysql mysql
- cd /lamp/mysql-5.0.41
- ./configure --prefix=/usr/local/mysql/ --with-extra-charsets=all
- make
- make install
- cp support-files/my-medium.cnf /etc/my.cnf
- /usr/local/mysql/bin/mysql_install_db --user=mysql
- chown -R root /usr/local/mysql
- chown -R mysql /usr/local/mysql/var
- chgrp -R mysql /usr/local/mysql
- /usr/local/mysql/bin/mysqld_safe --user=mysql &
- cp /lamp/mysql-5.0.41/support-files/mysql.server /etc/rc.d/init.d/mysqld
- chown root.root /etc/rc.d/init.d/mysqld
- chmod 755 /etc/rc.d/init.d/mysqld
- chkconfig --add mysqld
- chkconfig --list mysqld
- chkconfig --levels 245 mysqld off
- cd /lamp/php-5.2.6
- ./configure --prefix=/usr/local/php/ --with-config-file-path=/usr/local/php/etc/ --with-apxs2=/usr/local/apache2/bin/apx --with-mysql=/usr/local/mysql/ --with-libxml-dir=/usr/local/libxml2/ --with-jpeg-dir=/usr/local/jpeg6/ --with-freetype-dir=/usr/local/freetype/ --with-gd=/usr/local/gd2/ --with-mcrypt=/usr/local/libmcrypt/ --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-soap --enable-mbstring=all --enable-sockets
- make
- make install
- <b>hosts是什么 hosts文件在什么位置 若何改正hosts</b>
- <b>在 Windows 8 中手动安装语言包</b>
- <b>五个常见 PHP数据库问题</b>
- Windows中Alt键的12个高效快速的利用本领介绍
- <b>MySQL ORDER BY 的实现解析</b>
- <b>详解MySQL存储历程参数有三种范例(in、out、inout)</b>
- <b>Win8系统恢复出来经典的开始菜单的办法</b>
- <b>Win8系统花屏怎么办 Win8系统花屏的办理办法</b>
- <b>Windows 7系统下无线网卡安装</b>
- <b>为什么 Linux不需求碎片整理</b>
- <b>Windows 8中删除账户的几种办法(图)</b>
- <b>教你如安在win7下配置路由器</b>
以上是“<b>CentOS 6.0下搭建LAMP环境(源码安装)</b>[服务器安全]”的内容,如果你对以上该文章内容感兴趣,你可以看看七道奇为您推荐以下文章:
本文地址: | 与您的QQ/BBS好友分享! |