LAMP 환경의 구축

6428 단어 lamp
이 글 은 초보 자 들 이 참고 하도록 제공 할 수 있다.
첫째: mysql 설치
1): my sql 설치 패 키 지 를 다운로드 합 니 다. 설치 패 키 지 를 / usr / local / src / 이 디 렉 터 리 에 두 는 습관 이 있 습 니 다.
cd /usr/local/src/
wget http://syslab.comsenz.com/downloads/linux/mysql-5.1.40-linux-i686-icc-glibc23.tar.gz
2): 압축 풀기:
tar zxvf /usr/local/src/mysql-5.1.40-linux-i686-icc-glibc23.tar.gz
3):  압축 해 제 된 데 이 터 를 / usr / local / mysql 로 이동 합 니 다. (이 디 렉 터 리 자체 가 존재 하지 않 습 니 다. 직접 만들어 야 합 니 다)
[root@localhost src]#mv mysql-5.1.40-linux-i686-icc-glibc23 /usr/local/mysql  (my sql 디 렉 터 리 를 직접 이동 하고 만 듭 니 다)
4): mysql 사용자 만 들 기
[root@localhost src]#useradd -s /sbin/nologin mysql
5):  데이터베이스 초기 화
[root@localhost src]#cd /usr/local/mysql
[root@localhostmysql]# mkdir -p /data/mysql ; chown -R mysql:mysql /data/mysql
[root@localhostmysql]# ./scripts/mysql_install_db --user=mysql --datadir=/data/mysql   // 데이터베이스 초기 화 (여기 서 잘못 보고 하면 데이터베이스 버 전과 시스템 버 전이 일치 하지 않 을 수 있 습 니 다)
설명: -- user 데이터베이스 의 소속 주 를 정의 합 니 다. --datadir 데이터 베 이 스 를 어디 에 설치 할 지 정의 합 니 다. 큰 공간의 파 티 션 에 두 는 것 을 권장 합 니 다. 이 디 렉 터 리 는 스스로 만들어 야 합 니 다.이 절 차 는 매우 중요 하 다. 만약 당신 이 두 개의 "OK" 를 보면 집행 이 정확 하 다 는 것 을 설명 한다.
6):  프로필 복사
[root@localhostmysql]# cp support-files/my-large.cnf /etc/my.cnf
7): 시작 스 크 립 트 파일 을 복사 하고 속성 을 수정 합 니 다.
[root@localhostmysql]# cp support-files/mysql.server /etc/init.d/mysqld
[root@localhostmysql]# chmod 755 /etc/init.d/mysqld
8):  시작 스 크 립 트 수정
[root@localhostmysql]# vim /etc/init.d/mysqld
수정 해 야 할 부분 은 "datadir = / data / my sql" (앞에서 데이터 베 이 스 를 초기 화 할 때 정 의 된 디 렉 터 리) 과 Basedir = / usr / local / my sql 입 니 다.
9): 시작 스 크 립 트 를 시스템 서비스 항목 에 추가 하고 시작 설정, my sql 시작
[root@localhostmysql]# chkconfig --add mysqld
[root@localhostmysql]# chkconfig mysqld on
[root@localhostmysql]# service mysqld start
성공 적 으로 시작 할 수 있 는 지 확인 합 니 다.
두 번 째: apache 설치
1 다운로드 하 다.
[root@localhost mysql]# cd /usr/local/src/
[root@localhost src]# wget 
http://syslab.comsenz.com/downloads/linux/httpd-2.2.16.tar.gz
2  :
[root@localhost src]# tar zxvf httpd-2.2.16.tar.gz

3   :
[root@localhost src]# cd httpd-2.2.16
[root@localhost httpd-2.2.16]# ./configure \
--prefix=/usr/local/apache2 \
--with-included-apr \              ( apache )
--enable-so \
--enable-deflate=shared \      
--enable-expires=shared \
--enable-rewrite=shared \
--with-pcre
:--prefix  , --enable-so 
, : :
error: mod_deflate has been requested but can not be built due to prerequisite failures
:
yum install -y zlib-devel
error: checking for gcc…….no 
:yum install �Cy gcc
echo $? , 0  , 。

4    make && make install   echo $? 。
: php

1):  [root@localhost src]# wget http://am1.php.net/distributions/php-5.3.27.tar.gz

2): :  tar zvxf php-5.3.27.tar.gz

3): :
[root@localhost src]# cd php-5.3.27
[root@localhost php-5.3.27]# ./configure \
--prefix=/usr/local/php \
--with-apxs2=/usr/local/apache2/bin/apxs \
--with-config-file-path=/usr/local/php/etc  \
--with-mysql=/usr/local/mysql \
--with-libxml-dir \
--with-gd \
--with-jpeg-dir \
--with-png-dir \
--with-freetype-dir \
--with-iconv-dir \
--with-zlib-dir \
--with-bz2 \
--with-openssl \
--with-mcrypt \
--enable-soap \
--enable-gd-native-ttf \
--enable-mbstring \
--enable-sockets \
--enable-exif \
--disable-ipv6
: , , :
configure: error:xml2-config not found. Please check your libxml2 installation.
:
yum install -y libxml2-devel
:
configure: error:Cannot find OpenSSL's <evp.h>
:
yum install -y openssl openssl-devel
:
checking for BZip2 indefault path... not found
configure: error:Please reinstall the BZip2 distribution
:
yum install -y bzip2 bzip2-devel
:
configure: error:png.h not found.
:
yum install -y libpng libpng-devel
:
configure: error:freetype.h not found.
:
yum install -y freetype freetype-devel
configure: error:mcrypt.h not found. Please reinstall libmcrypt.
:
 
linux , yum ,
  "rpm -ivh "http://www.aminglinux.com/bbs/data/attachment/forum/month_1211/epel-release-6-7.noarch.rpm "   yum install -y  libmcrypt-devel 
 
:configure:error:jpeglib.h.notfound
 

:yum install�Cy libjpeg-devel
echo $?



4): 
 make
 make install 


:apache php


vim /usr/local/apache2/conf/httpd.conf
:
AddType application/x-gzip .gz .tgz
:
AddType application/x-httpd-php .php( :”.” )
:
<IfModule dir_module>
    DirectoryIndex index.html
</IfModule>
:
<IfModule dir_module>
    DirectoryIndex index.html index.htm index.php
</IfModule>
:
#ServerName www.example.com:80
:
ServerName localhost:80

: LAMP

apache :
/usr/local/apache2/bin/apachectl -t

apacche /usr/local/apache2/bin/apachectl start

:
[root@localhost ~]# netstat -lnp |grep httpd
tcp        0      0 :::80                       :::*   LISTEN      7667/httpd
, 。  curl :
[root@localhost ~]# curl localhost
<html><body><h1>It works!</h1></body></html>

IP

php:
vim /usr/local/apache2/htdocs/1.php
:
<?php
    echo "php ";
    ?>
, :
curl localhost/1.php
  :”php [root@localhost ~]#“
 
         lamp      ,       ,        。




좋은 웹페이지 즐겨찾기