源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

64位CentOS 6.0下搭建LAMP环境详细步骤

  • 时间:2020-04-06 00:43 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:64位CentOS 6.0下搭建LAMP环境详细步骤
1、确认搭建LAMP所需要的环境是否已经安装
[b][root@centos6 ~]# rpm -q make gcc gcc-c++ zlib-devel libaio[/b]
[b]备注:安装libpng时候需要zlib-devel[/b]
[b]             [/b][b]安装mysql时候需要libaio[/b]
2、如果没安装则yum安装
[b][root@centos6 ~]# yum install make gcc gcc-c++ zlib-devel libaio -y[/b]
3、由于要使用编译安装,所以查看httpd、mysql、php是否安装,如果安装则卸载
[b][root@centos6 ~]# rpm -q httpd mysql php[/b]
4、编译安装libxml2
注:libxml2是一个xml的c语言版的解析器,不仅支持c语言,还支持c++、php、Pascal、Ruby、Tcl等语言的绑定
[b][root@centos6 LAMP]# pwd[/b]
[b]/tmp/LAMP[/b]
[b][root@centos6 LAMP]# tar -zxvf libxml2-2.7.8.tar.gz[/b]
[b][root@centos6 LAMP]# cd ./libxml2-2.7.8[/b]
[b][root@centos6 libxml2-2.7.8]# ./configure  --prefix=/usr/local/libxml2/[/b]
[b][root@centos6 libxml2-2.7.8]# make;make install[/b]
5、编译安装libmcrypt
注:libmcrypt是加密算法扩展库。支持DES, 3DES, RIJNDAEL, Twofish, IDEA, GOST, CAST-256, ARCFOUR, SERPENT, SAFER+等算法。
[b][root@centos6 LAMP]# pwd[/b]
[b]/tmp/LAMP[/b]
[b][root@centos6 LAMP]# tar -zxvf libmcrypt-2.5.8.tar.gz[/b]
[b][root@centos6 LAMP]# cd ./libmcrypt-2.5.8[/b]
[b][root@centos6 libmcrypt-2.5.8]# ./configure  --prefix=/usr/local/libmcrypt/[/b]
[b][root@centos6 libmcrypt-2.5.8]# make;make install[/b]
6、编译安装zlib
注:zlib是提供数据压缩用的函式库
[b][root@centos6 LAMP]# pwd[/b]
[b]/tmp/LAMP[/b]
[b][root@centos6 LAMP]# tar -zxvf zlib-1.2.5.tar.gz[/b]
[b][root@centos6 LAMP]# cd ./zlib-1.2.5[/b]
[b][root@centos6 zlib-1.2.5]# ./configure  --prefix=/usr/local/zlib/[/b]
[b][root@centos6 zlib-1.2.5]# make ; make install[/b]
7、编译安装libpng
[b][root@centos6 LAMP]# pwd[/b]
[b]/tmp/LAMP[/b]
[b][root@centos6 LAMP]# tar -zxvf libpng-1.5.4.tar.gz[/b]
[b][root@centos6 LAMP]# cd ./libpng-1.5.4[/b]
[b][root@centos6 libpng-1.5.4]#[/b]
[b]./configure --prefix=/usr/local/libpng/  --enable-shared[/b]
[b][root@centos6 libpng-1.5.4]# make ; make install[/b]
8、编译安装jpeg
[b][root@centos6 LAMP]# pwd[/b]
[b]/tmp/LAMP[/b]
[b][root@centos6 LAMP]# tar -zxvf jpegsrc.v8c.tar.gz[/b]
[b][root@centos6 LAMP]# cd ./jpeg-8c/[/b]
[b][root@centos6 jpeg-8c]# mkdir /usr/local/jpeg/[/b](创建jpeg软件的安装目录)
[b][root@centos6 jpeg-8c]# mkdir /usr/local/jpeg/bin/[/b](创建存放命令的目录)
[b][root@centos6 jpeg-8c]# mkdir /usr/local/jpeg/lib/[/b](创建jpeg库文件所在目录)
[b][root@centos6 jpeg-8c]# mkdir /usr/local/jpeg/include/[/b](创建存放头文件目录)
[b][root@centos6 jpeg-8c]# mkdir -p /usr/local/jpeg/man/man1[/b](建立存放手册的目录)
[b][root@centos6 jpeg-8c]#[/b]
[b] ./configure --prefix=/usr/local/jpeg/ --enable-shared --enable-static[/b][b][/b]建立共享库使用的GNU的libtool和静态库使用的GNU的libtool)
[b][root@centos6 jpeg-8c]# make ; make install[/b]
9、编译安装freetype
[b][root@centos6 LAMP]# pwd[/b]
[b]/tmp/LAMP[/b]
[b][root@centos6 LAMP]# tar -zxvf freetype-2.4.6.tar.gz[/b]
[b][root@centos6 LAMP]# cd ./freetype-2.4.6[/b]
[b][root@centos6 freetype-2.4.6]#[/b]
[b] ./configure --prefix=/usr/local/freetype/ --enable-shared[/b]
[b][root@centos6 freetype-2.4.6]# make ;make install[/b]
10、      编译安装autoconf
[b][root@centos6 LAMP]# pwd[/b]
[b]/tmp/LAMP[/b]
[b][root@centos6 LAMP]# tar -zxvf autoconf-2.68.tar.gz[/b]
[b][root@centos6 LAMP]# cd ./autoconf-2.68[/b]
[b][root@centos6 autoconf-2.68]# ./configure[/b]
[b][root@centos6 autoconf-2.68]# make ; make install[/b]
11、      编译安装GD
[b][root@centos6 LAMP]# pwd[/b]
[b]/tmp/LAMP[/b]
[b][root@centos6 LAMP]# tar -zxvf gd-2.0.35.tar.gz[/b]
[b][root@centos6 LAMP]# cd ./gd-2.0.35[/b]
[b][root@centos6 gd-2.0.35]#[/b]
[b] ./configure --prefix=/usr/local/gd/ --with-zlib=/usr/local/zlib/ --with-jpeg=/usr/local/jpeg/ --with-png=/usr/local/libpng/ --with-freetype=/usr/local/freetype/[/b]
[b][root@centos6 gd-2.0.35]# make ; make install[/b]
12、      安装apache
[b][root@centos6 LAMP]# pwd[/b]
[b]/tmp/LAMP[/b]
[b][root@centos6 LAMP]# tar -zxvf httpd-2.2.19.tar.gz[/b]
[b][root@centos6 LAMP]# cd ./httpd-2.2.19[/b]
[b][root@centos6 httpd-2.2.19]#[/b]
[b] ./configure --prefix=/usr/local/apache/ --enable-so --enable-rewrite[/b]
[b][root@centos6 httpd-2.2.19]# make ; make install[/b]
[b][root@centos6 LAMP]# /usr/local/apache/bin/apachectl start[/b]
[b][root@centos6 LAMP]#[/b]
[b]cp /usr/local/apache/bin/apachectl /etc/init.d/httpd[/b]
[b][root@centos6 LAMP]# chmod +x /etc/init.d/httpd[/b]
[b][root@centos6 ~]# chkconfig --add httpd[/b]
[b]注意:如果提示[/b][b]service [/b][b]httpd[/b][b] does not support chkconfig[/b][b]错误[/b]
[b]解决办法:编辑/[/b][b]etc[/b][b]/rc.d/init.d/httpd[/b][b]在文件第二行加入[/b]
[b]           #chkconfig:[/b][b]2345[/b][b] 10 90[/b]
[b]           #description:[/b][b]Activates[/b][b]/Deactivates Apache Web Server[/b]
[b][root@centos6 ~]# chkconfig --level 2345 httpd on[/b]
[b][root@centos6 LAMP]# service httpd restart[/b]
[b]开机自动启动apache的另一种方法:[/b]
[b]修改/etc/rc.local文件[/b]
[b]# vim /etc/rc.local[/b]
[b]在文件中添加/usr/local/apache/bin/apachectl start[/b]
13、      编译安装mysql
[b][root@centos6 LAMP]# pwd[/b]
[b]/tmp/LAMP[/b]
[b][root@centos6 LAMP]# tar -zxvf mysql-5.5.15-linux2.6-x86_64.tar.gz[/b]
[b][root@centos6 LAMP]# cd ./mysql-5.5.15-linux2.6-x86_64[/b]
[b][root@centos6 mysql-5.5.15-linux2.6-x86_64]# groupadd mysql[/b]
[b][root@centos6 mysql-5.5.15-linux2.6-x86_64]# useradd -r -g mysql mysql[/b](创建mysql用户,并将用户指定至mysql组)
[b][root@centos6 mysql-5.5.15-linux2.6-x86_64]# cd /usr/local/[/b]
[b][root@centos6 local]# ln -s /tmp/LAMP/mysql-5.5.15-linux2.6-x86_64 mysql[/b]
[b][root@centos6 local]# cd ./mysql/[/b]
[b][root@centos6 mysql]# chown -R mysql .[/b](将该目录的用户权限全部更改为mysql用户)
[b][root@centos6 mysql]# chgrp -R mysql .[/b](将该目录的用户组全部改为mysql用户组)
[b][root@centos6 mysql]# ./scripts/mysql_install_db --user=mysql[/b](将mysql目录的数据库使用权限指定为mysql)
[b][root@centos6 mysql]# chown -R root .[/b]
[b][root@centos6 mysql]# chown -R mysql data[/b]
[b][root@centos6 mysql]# cp support-files/my-medium.cnf  /etc/my.cnf[/b](将当前目录下的配置文件拷贝到系统配置文件下,并更名为my.cnf)
[b][root@centos6 mysql]# cp support-files/mysql.server  /etc/init.d/mysqld[/b]
[b][root@centos6 mysql]# chmod +x /etc/init.d/mysqld[/b]
[b][root@centos6 mysql]# chkconfig --add mysqld[/b]
[b][root@centos6 mysql]# chkconfig --level 345 mysqld on[/b]
[b][root@centos6 mysql]# service mysqld restart[/b]
[b][root@centos6 mysql]#[/b]
[b] /usr/local/mysql/bin/mysqladmin -u root password '123456'[/b](设置root用户登录mysql的密码)
[b][root@centos6 mysql]# /usr/local/mysql/bin/mysql -u root –p
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部