国语自产精品视频在线看:您身边最放心的安全下载站! 最新软件|热门排行|软件分类|软件专题|厂商大全

国语自产精品视频在线看

技术教程
您的位置:首页服务器类Linux服务器 → Centos6.0 x64下搭建LAMP环境

Centos6.0 x64下搭建LAMP环境

我要评论 2013/07/07 01:30:32 来源:国语自产精品视频在线看 编辑:zbbingyang.com [ ] 评论:0 点击:311次

系统环境:Centos6.0 x64

1、确认搭建🔫LAMP所需要【suǒ xū yào】的环境【de huán jìng】是否已🏠经安装

[root@centos6 ~]# rpm -q make gcc gcc-c++ zlib-devel libaio

备注【bèi zhù】:安装🗝libpng时候需要【yào】😫zlib-devel

             安装mysql时候需【shí hòu xū】要🍑libaio

2、如果没安装则yum安装

[root@centos6 ~]# yum install make gcc gcc-c++ zlib-devel libaio -y

3、由于要使用编🥍译安装【zhuāng】🚚,所以查看【kàn】httpd、mysql、php是否安😇装【zhuāng】🚚,如果安【rú guǒ ān】装【zhuāng】🚚则卸载

[root@centos6 ~]# rpm -q httpd mysql php

4、编译安装libxml2

注🍤:libxml2是一个【shì yī gè】xml的c语言版的解析🥢器,不仅支持【chí】📔c语言,还支持【chí】🎄c++、php、Pascal、Ruby、Tcl等语言【děng yǔ yán】的绑定【de bǎng dìng】

[root@centos6 LAMP]# pwd

/tmp/LAMP

[root@centos6 LAMP]# tar -zxvf libxml2-2.7.8.tar.gz

[root@centos6 LAMP]# cd ./libxml2-2.7.8

[root@centos6 libxml2-2.7.8]# ./configure  --prefix=/usr/local/libxml2/

[root@centos6 libxml2-2.7.8]# make;make install

5、编译安装libmcrypt

注:libmcrypt是加密算法扩【suàn fǎ kuò】展库👎。支持DES, 3DES, RIJNDAEL, Twofish, IDEA, GOST, CAST-256, ARCFOUR, SERPENT, SAFER+等算法【děng suàn fǎ】🌘。

[root@centos6 LAMP]# pwd

/tmp/LAMP

[root@centos6 LAMP]# tar -zxvf libmcrypt-2.5.8.tar.gz

[root@centos6 LAMP]# cd ./libmcrypt-2.5.8

[root@centos6 libmcrypt-2.5.8]# ./configure  --prefix=/usr/local/libmcrypt/

[root@centos6 libmcrypt-2.5.8]# make;make install

6、编译安装zlib

注:zlib是提供数据压缩用的函式库

[root@centos6 LAMP]# pwd

/tmp/LAMP

[root@centos6 LAMP]# tar -zxvf zlib-1.2.5.tar.gz

[root@centos6 LAMP]# cd ./zlib-1.2.5

[root@centos6 zlib-1.2.5]# ./configure  --prefix=/usr/local/zlib/

[root@centos6 zlib-1.2.5]# make ; make install

7、编译安装libpng

[root@centos6 LAMP]# pwd

/tmp/LAMP

[root@centos6 LAMP]# tar -zxvf libpng-1.5.4.tar.gz

[root@centos6 LAMP]# cd ./libpng-1.5.4

[root@centos6 libpng-1.5.4]#

./configure --prefix=/usr/local/libpng/  --enable-shared

[root@centos6 libpng-1.5.4]# make ; make install

8、编译安装jpeg

[root@centos6 LAMP]# pwd

/tmp/LAMP

[root@centos6 LAMP]# tar -zxvf jpegsrc.v8c.tar.gz

[root@centos6 LAMP]# cd ./jpeg-8c/

[root@centos6 jpeg-8c]# mkdir /usr/local/jpeg/(创建【chuàng jiàn】jpeg软件的【ruǎn jiàn de】✂安装目🏃录)

[root@centos6 jpeg-8c]# mkdir /usr/local/jpeg/bin/(创建存放命令🚏的目录【de mù lù】)

[root@centos6 jpeg-8c]# mkdir /usr/local/jpeg/lib/(创建【chuàng jiàn】jpeg库文件所在目【suǒ zài mù】⛵录💟)

[root@centos6 jpeg-8c]# mkdir /usr/local/jpeg/include/(创建存🔐放头文件目录【jiàn mù lù】)

[root@centos6 jpeg-8c]# mkdir -p /usr/local/jpeg/man/man1(建立存放手册的目录【de mù lù】⏮)

[root@centos6 jpeg-8c]#

 ./configure --prefix=/usr/local/jpeg/ --enable-shared --enable-static(建立共【jiàn lì gòng】👴享库使用【kù shǐ yòng】👒的【de】❣GNU的【de】❣libtool和静态库使用【kù shǐ yòng】👒的【de】❣GNU的【de】❣libtool)

[root@centos6 jpeg-8c]# make ; make install

9、编译安装freetype

[root@centos6 LAMP]# pwd

/tmp/LAMP

[root@centos6 LAMP]# tar -zxvf freetype-2.4.6.tar.gz

[root@centos6 LAMP]# cd ./freetype-2.4.6

[root@centos6 freetype-2.4.6]#

 ./configure --prefix=/usr/local/freetype/ --enable-shared

[root@centos6 freetype-2.4.6]# make ;make install

10、      编译安装【zhuāng】🤔autoconf

[root@centos6 LAMP]# pwd

/tmp/LAMP

[root@centos6 LAMP]# tar -zxvf autoconf-2.68.tar.gz

[root@centos6 LAMP]# cd ./autoconf-2.68

[root@centos6 autoconf-2.68]# ./configure

[root@centos6 autoconf-2.68]# make ; make install

11、      编译安💽装【zhuāng】GD

[root@centos6 LAMP]# pwd

/tmp/LAMP

[root@centos6 LAMP]# tar -zxvf gd-2.0.35.tar.gz

[root@centos6 LAMP]# cd ./gd-2.0.35

[root@centos6 gd-2.0.35]#

 ./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/

[root@centos6 gd-2.0.35]# make ; make install

12、      安装【ān zhuāng】💁apache

[root@centos6 LAMP]# pwd

/tmp/LAMP

[root@centos6 LAMP]# tar -zxvf httpd-2.2.19.tar.gz

[root@centos6 LAMP]# cd ./httpd-2.2.19

[root@centos6 httpd-2.2.19]#

 ./configure --prefix=/usr/local/apache/ --enable-so --enable-rewrite

[root@centos6 httpd-2.2.19]# make ; make install

[root@centos6 LAMP]# /usr/local/apache/bin/apachectl start

[root@centos6 LAMP]#

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

[root@centos6 LAMP]# chmod +x /etc/init.d/httpd

[root@centos6 ~]# chkconfig --add httpd

注意🔲:如果提示【shì】📻service httpd does not support chkconfig错误【cuò wù】

解决办法:编辑【biān jí】/etc/rc.d/init.d/httpd在文件💥第二行【dì èr háng】🔮加入

           #chkconfig:2345 10 90

           #description:Activates/Deactivates Apache Web Server

[root@centos6 ~]# chkconfig --level 2345 httpd on

[root@centos6 LAMP]# service httpd restart

开机自动启动apache的另一种方法:

修改/etc/rc.local文件

# vim /etc/rc.local

在文件【zài wén jiàn】中添加⤴/usr/local/apache/bin/apachectl start

13、      编译安【biān yì ān】🆖装mysql

[root@centos6 LAMP]# pwd

/tmp/LAMP

[root@centos6 LAMP]# tar -zxvf mysql-5.5.15-linux2.6-x86_64.tar.gz

[root@centos6 LAMP]# cd ./mysql-5.5.15-linux2.6-x86_64

[root@centos6 mysql-5.5.15-linux2.6-x86_64]# groupadd mysql

[root@centos6 mysql-5.5.15-linux2.6-x86_64]# useradd -r -g mysql mysql(创建【chuàng jiàn】🗜mysql用户【hù】🧀,并将用户【hù】🧀指定至mysql组)

[root@centos6 mysql-5.5.15-linux2.6-x86_64]# cd /usr/local/

[root@centos6 local]# ln -s /tmp/LAMP/mysql-5.5.15-linux2.6-x86_64 mysql

[root@centos6 local]# cd ./mysql/

[root@centos6 mysql]# chown -R mysql .(将该目【jiāng gāi mù】录的用户权限全部更💵改为【gǎi wéi】💅mysql用户)

[root@centos6 mysql]# chgrp -R mysql .(将该目⛱录的用户组【yòng hù zǔ】🤽全部改为mysql用户组【yòng hù zǔ】🤽)

[root@centos6 mysql]# ./scripts/mysql_install_db --user=mysql(将mysql目录的🍍数据库👕使用权【shǐ yòng quán】限指定【xiàn zhǐ dìng】为mysql)

[root@centos6 mysql]# chown -R root .

[root@centos6 mysql]# chown -R mysql data

[root@centos6 mysql]# cp support-files/my-medium.cnf  /etc/my.cnf(将当前目录下【mù lù xià】的配置🏗文件拷【wén jiàn kǎo】贝到系🚩统配置文件下🚾,并更名【bìng gèng míng】为my.cnf)

[root@centos6 mysql]# cp support-files/mysql.server  /etc/init.d/mysqld

[root@centos6 mysql]# chmod +x /etc/init.d/mysqld

[root@centos6 mysql]# chkconfig --add mysqld

[root@centos6 mysql]# chkconfig --level 345 mysqld on

[root@centos6 mysql]# service mysqld restart

[root@centos6 mysql]#

 /usr/local/mysql/bin/mysqladmin -u root password '123456'(设置【shè zhì】root用户登录🥞mysql的密码【de mì mǎ】🔊)

[root@centos6 mysql]# /usr/local/mysql/bin/mysql -u root –p(进入并访问mysql数据【shù jù】🙎)

Enter password:

Welcome to the MySQL monitor. Commands end with ; or g.

Your MySQL connection id is 2

Server version: 5.5.15-log MySQL Community Server (GPL)

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

mysql>(成功登录【lù】👵mysql)

14、      编译安【biān yì ān】装⛩php

[root@centos6 LAMP]# pwd

/tmp/LAMP

[root@centos6 LAMP]#

关键词【guān jiàn cí】🙂:CentOS,LAMP

阅读本文后您有什么感想? 已有 人给出评价!

  • 0 欢迎喜欢
  • 0 白痴
  • 0 拜托
  • 0 哇
  • 0 加油
  • 0 鄙视