centos6.3下搭建LAMP环境

系统:centos6.3_x64

安装包:

httpd-2.2.19.tar.gz

php-5.4.14.tar.bz2

libmcrypt-2.5.8.tar.gz

mcrypt-2.6.8.tar.gz

mhash-0.9.9.9.tar.gz


1.cd httpd-2.2.19

2../configure  --prefix=/usr/local/apache  --enable-vhost-alias  --enable-rewrite  --enable-info

3.Make

4.Make install

5.cp build/rpm/httpd.init /etc/init.d/httpd

6.chmod 755 /etc/init.d/httpd

7.chkconfig --add httpd

8.chkconfig --level 35 httpd on

9.cd /etc

10.ln -s /usr/local/apache/   httpd

11.cd /usr/sbin/

12.ln -fs/usr/local/apache/bin/httpd

13.ln -fs/usr/local/apache/bin/apachectl

14.cd /var/log

15.ln -s /usr/local/apache/logs   httpd

16./etc/init.d/httpd start

安装php

yum install libxml2

yum install libxml2-devel �Cy

yum install libjpeg libpng freetype libjpeg-devel libpng-devel freetype-devel openssl-devel bzip2-devel libcurl-devel libxslt-devel

安装Libmcrypt

#tar -zxvf libmcrypt-2.5.8.tar.gz

#cd libmcrypt-2.5.8

#./configure

#make

#make install 说明:libmcript默认安装在/usr/local

安装mhash

#tar -zxvf mhash-0.9.9.9.tar.gz

#cd mhash-0.9.9.9

#./configure

#make

#make install

安装mcrypt

#tar -zxvf mcrypt-2.6.8.tar.gz

#cd mcrypt-2.6.8

#LD_LIBRARY_PATH=/usr/local/lib ./configure  //放在一起执行

#make

#make install

1

./configure '--with-apxs2=/usr/local/apache/bin/apxs' '--prefix=/usr/local/php' '--with-iconv' '--with-mysql' '--with-mysqli' '--with-gd' '--with-zlib' '--with-jpeg-dir=/usr/lib64' '--with-png-dir' '--with-freetype-dir=/usr/lib64' '--with-curl=/usr/bin' '--with-openssl' '--with-openssl-dir=/usr'  '--with-xsl=/usr' '--with-xmlrpc' '--enable-exif' '--enable-cli' '--enable-calendar' '--with-mhash' '--enable-mbstring' '--enable-mbregex' '--enable-soap' '--enable-sockets' '--enable-sysvmsg' '--enable-sysvsem' '--enable-sysvshm' '--enable-zip' '--enable-ftp ''--with-pear' '--disable-debug' '--with-bz2' '--with-mcrypt' '--with-mhash'

说明:

--with-jpeg-dir 字段关联libjpeg.so

--with-freetype-dir字段关联libfreetype.so


2、make

3、make install

4、拷贝php配置文件

cp php-5.4.14/php.ini-production   /usr/local/php/lib/php.ini

修改php.ini时区

date.timezone = "Asia/Shanghai"

修改上传文件大小

post_max_size = 10M
upload_max_filesize = 10M

启用短标签

short_open_tag = On

安装Mysql

yum install mysql mysql-server php-mysql mysql-libs �Cy

创建用户

 
 

grant all privileges on *.* to 'aixue'@'%' identified by '123456';

数据库配置文件:

cp /usr/share/mysql/my-small.cnf/etc/my.conf

设置字符集

[client]

default-character-set=utf8

[mysqld]

default-character-set=UTF8

/etc/init.d/mysqld restart

然后导入数据 (要在设置字符集之后,负责要重新导入数据)

修改数据库用户名和密码



配置Apache

cd /etc/httpd/conf

vim httpd.conf

添加内容

ServerName 127.0.0.1
NameVirtualHost *:80
include /etc/httpd/conf/vhost_*.conf
Addtype application/x-httpd-php  .php
Addtype application/x-httpd-php-source  .phps
AddType application/x-httpd-php .html
AddType application/x-httpd-php  .htm

创建配置文件

vim vhost_5aixue.com.conf

内容为:

<VirtualHost *:80>
ServerName test1.5aixue.com
ServerAlias test1.5aixue.com
DocumentRoot /home/aixue/public_html
ErrorLog /var/log/test.5aixue.com_error_log
CustomLog /var/log/test.5aixue.com_access_log combined
DirectoryIndex index.php index.html index.htm index.php4 index.php5
<Directory /home/aixue/public_html>
Options -Indexes +IncludesNOEXEC +FollowSymLinks
allow from all
AllowOverride All
</Directory>
</VirtualHost>



将aixue包解压到/home下,

cd /home/aixue/public_html/system/config

vim config.php

修改两项内容:

WEBROOT','/home/aixue/public_html/
LOCAL_IP','192.168.10.103

vim db_config.php


你可能感兴趣的:(centos,lamp)