日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
CentOS6.7編譯安裝LAMP

centos 6.7 編譯安裝LAMP

創(chuàng)新互聯(lián)是創(chuàng)新、創(chuàng)意、研發(fā)型一體的綜合型網(wǎng)站建設(shè)公司,自成立以來公司不斷探索創(chuàng)新,始終堅(jiān)持為客戶提供滿意周到的服務(wù),在本地打下了良好的口碑,在過去的十余年時(shí)間我們累計(jì)服務(wù)了上千家以及全國政企客戶,如成都咖啡廳設(shè)計(jì)等企業(yè)單位,完善的項(xiàng)目管理流程,嚴(yán)格把控項(xiàng)目進(jìn)度與質(zhì)量監(jiān)控加上過硬的技術(shù)實(shí)力獲得客戶的一致贊揚(yáng)。

一、環(huán)境和軟件包準(zhǔn)備

使用163的yum源

cd /etc/yum.repos.d/
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo

關(guān)閉防火墻和selinux

setenforce 0
service iptables stop

需要準(zhǔn)備的軟件包

    mkdir  /tools; cd /tools

        apr-1.5.2.tar.gz

        apr-util-1.5.4.tar.gz

        httpd-2.4.16.tar.gz

        curl-7.45.0.tar.gz   

        gettext-0.19.5.tar

        libmcrypt-2.5.7.tar.gz

        mcrypt-2.6.8.tar.gz

        lpng1618.zip

        mod_fastcgi-2.4.6.tar.gz

        MySQL-5.6.26.tar.gz

        php-5.5.30.tar.gz

        phpMyAdmin-4.5.0.2-all-languages.zip

        libpng-1.2.53.tar

        freetype-2.4.0.tar

        jpegsrc.v9.tar

        opencart-2.1.0.1.zip

        zlib-1.2.3.tar

        ……………….

        注.版本不一定要一樣。

二、安裝依賴環(huán)境

yum -y groupinstall"Development Libraries"
yum -y groupinstall"Desktop Platform Development"
yum -y groupinstall "X Software Development"
yum -y install wget gcc gcc-c++ ncurses ncurses-devel cmakemake perl bison openssl openssl-devel gcc* libxml2 libxml2-devel curl-devellibjpeg* libpng* freetype* pcre-devel bzip2-devel libmcrypt-devel

三、編譯安裝apr
1、編譯安裝apr

cd /tools
tar xjvfapr-1.5.2.tar.bz2 -C /usr/src/;cd /usr/src/apr-1.5.2/
./configure--prefix=/usr/local/apr
make && makeinstall

2、編譯安裝apr-util

cd /tools/
tar xjvfapr-util-1.5.4.tar.bz2 -C /usr/src/;cd /usr/src/apr-util-1.5.4
./configure--prefix=/usr/local/apr-util --with-apr=/usr/local/apr/
make  && make install
 

四、編譯安裝apache

cd  /tools
tar xjvf httpd-2.4.17.tar.bz2  -C /usr/src/;cd /usr/src/httpd-2.4.17
 
./configure--prefix=/usr/local/apache2 --with-apr=/usr/local/apr--with-apr-util=/usr/local/apr-util/ --with-mpm=event --enable-so--enable-mods-shared=all --enable-proxy=shared --enable-proxy-balancer=shared--enable-prosy-http=shared --enable-proxy-ajp --enable-deflate --enable-cache--enable-disk-cache --enable-mem-cachemake &&  make  install

五、編譯安裝mysql
1、安裝mysql

cd  /tools
tar xzvfmysql-5.6.26.tar.gz -C /usr/src/;cd /usr/src/mysql-5.6.26
cmake-DENABLE_DOWNLOADS=1 -DCMAKE_INSTALL_PREFIX=/opt/mysql --with-mysql=mysqlnd --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd
make&& make install
 
2、創(chuàng)建相關(guān)設(shè)置
mkdir/data/mysql/{mysql-data,mysql-logs} –pv
groupadd -r -g 306 mysql
useradd -r -g 306 -u 306mysql
chown -R mysql.mysql/data/mysql/

編輯配置文件

vim  /etc/my.cnf

添加如下內(nèi)容

[mysql]
prompt= (\u@\h)[\d]>
 
[client]
port            = 3306
socket          = /tmp/mysql3306.sock
default_character_set = utf8 
 
[mysqld]
user= mysql
port            = 3306
socket          = /tmp/mysql3306.sock 
datadir              =/data/mysql/mysql-data
pid_file        = /data/mysql/mysql-data/mysql.pid                       
log-bin        = /data/mysql/mysql-logs/mysql-bin
log-error  = /data/mysql/mysql-logs/mysql.err

 

編輯啟動(dòng)腳本

vim/etc/rc.d/init.d/mysqld

添加和修改如下三行

basedir=/opt/mysql
datadir=/data/mysql/mysql-data
defaultconf=/etc/my.cnf

設(shè)置啟動(dòng)腳本權(quán)限

chmod +x/etc/rc.d/init.d/mysqld

3、初始化數(shù)據(jù)庫并啟動(dòng)
初始化數(shù)據(jù)庫,執(zhí)行完成后如果看到有兩個(gè)OK,說明初始化成功了。

/opt/mysql/scripts/mysql_install_db--user=mysql --datadir=/data/mysql/mysql-data/ --basedir=/opt/mysql/  --defaults-file=/etc/my.cnf

啟動(dòng)數(shù)據(jù)庫

 

把mysql命令加入環(huán)境變量

 

使用service命令管理mysql進(jìn)程

 

六、編譯安裝php
        1、安裝curl
cd  /tools
tar xzvf curl-7.45.0.tar.gz-C /usr/src/;cd /usr/src/curl-7.45.0
./configure--prefix=/usr/local/curl && make && make install

        2、安裝libmcrypt
cd  /tools
tar xzvflibmcrypt-2.5.8.tar.gz -C /usr/src/;cd /usr/src/libmcrypt-2.5.8/
./configure  --prefix=/usr/local/libmcrypt && make&& make install

        3、安裝mhash

cd  /tools
tar xzvfmhash-0.9.9.9.tar.gz -C /usr/src/;cd /usr/src/mhash-0.9.9.9
./configure--prefix=/usr/local/mhash && make && make install
    ln -s /usr/local/lib/libmhash.a/usr/lib/libmhash.a
    ln -s /usr/local/lib/libmhash.la/usr/lib/libmhash.la
    ln -s /usr/local/lib/libmhash.so/usr/lib/libmhash.so
    ln -s /usr/local/lib/libmhash.so.2/usr/lib/libmhash.so.2
    ln -s/usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1
 
echo “/usr/local/lib” >>/etc/ld.so.conf
ldconfig

        4、安裝mcrypt

cd  /tools
tar xzvf mcrypt-2.6.8.tar.gz -C /usr/src/;cd/usr/src/mcrypt-2.6.8
./configure --prefix=/usr/local/mcrypt  --with-libmcrypt=/usr/local/libmcrypt/&& make && make install

        5、安裝gettext

cd  /tools
tar xvf gettext-0.19.5.tar-C /usr/src/;cd /usr/src/gettext-0.19.5
./configure--prefix=/usr/local/gettext && make && make install

        6、安裝libxml2
cd  /tools
tar xzvflibxml2-2.6.30.tar.gz -C /usr/src/;cd /usr/src/libxml2-2.6.30/
./configure--prefix=/usr/local/libxml2  &&make && make install

 
7、安裝php
cd  /tools
tarxzvf php-5.5.30.tar.gz -C /usr/src/;cd /usr/src/php-5.5.30
./configure--prefix=/opt/php --with-apxs2=/usr/local/apache2/bin/apxs--with-curl=/usr/local/curl/ --with-mcrypt=/usr/local/mcrypt/--with-mysql=/opt/mysql/ --with-gettext=/usr/local/gettext/    --with-mysqli --with-bz2 --with-mhash--enable-sockets --enable-mbstring --enable-zip --enable-bcmath--enable-calendar --enable-exif --enable-ftp --enable-fpm  --with-openssl--with-libxml-dir=/usr/local/libxml2/
make&& make install

      8、設(shè)置phpinfo和phpadmin
        (1)、設(shè)置phpinfo頁面

cd/usr/local/apache2/htdocs/
 
cat > index.php <phpinfo();
?>
EOF

修改apache配置文件

vim  /usr/local/apache2/conf/httpd.conf

在DirectoryIndex 后加上index.php,如下

DirectoryIndexindex.php  index.html

在末尾加上

AddTypeapplication/x-httpd-php .php .phtml
AddType application/x-httpd-php-source.phps 

訪問http://yourip

看到如下界面,說明lamp安裝成功。

        (2)、設(shè)置phpadmin

        cd  /tools
        unzipphpMyAdmin-4.5.0.2-all-languages.zip
        mvphpMyAdmin-4.5.0.2-all-languages /usr/local/apache2/htdocs/phpadmin
        cd/usr/local/apache2/htdocs/phpadmin
        cpconfig.sample.inc.php config.inc.php
        vim  config.inc.php

        修改如下內(nèi)容,在$cfg['blowfish_secret'] 后面加上任意字符,給密碼加密

        把$cfg['Servers'][$i]['host']的localhost改成127.0.0.1

設(shè)置mysql密碼

mysqladmin -u root password abc123
mysqladmin -u root -h 127.0.0.1 passwordabc123

登陸mysql

mysql -u root -pabc123
(root@127.0.0.1)[(none)]>grant allprivileges on *.* to root@'%' identified by 'root';
Query OK, 0 rows affected (0.00 sec)

用瀏覽器訪問http://yourip/phpadmin

看到如下界面,使用你的mysql用戶名和密碼登陸。

            (3)、修改php.in
到此LAMP基本安裝完成,可通過調(diào)整php.ini實(shí)現(xiàn)一些自定義的功能。

cd /usr/src/php-5.5.30/
cp php.ini-production /opt/php/lib/php.ini

七、擴(kuò)展PHP模塊
有時(shí)候我們安裝完成php后,發(fā)現(xiàn)有有需要的模塊沒有安裝,但我們又不希望重新編譯安裝php,這時(shí)就可以使用動(dòng)態(tài)擴(kuò)展的方法安裝php的擴(kuò)展模塊。

以下以GD模塊和zlib模塊為例子:

1、安裝freetype

cd  /tools
tar xjvffreetype-2.4.0.tar.bz2 -C /usr/src/;cd /usr/src/freetype-2.4.0/
./configure--prefix=/usr/local/freetype && make && make install

2、安裝jpeg

cd  /tools
tar xzvf jpegsrc.v9.tar.gz-C /usr/src/;cd /usr/src/jpeg-9
CFLAGS="-O3-fPIC" ./configure --prefix=/usr/local/jpeg && make &&make install
 
        mkdir -p /usr/local/jpeg/include
        mkdir -p /usr/local/jpeg/lib
        mkdir -p /usr/local/jpeg/bin
        mkdir -p /usr/local/jpeg/man/man1

3、安裝libpng

cd /tools
tar xzvflibpng-1.2.53.tar.gz -C /usr/src/;cd /usr/src/libpng-1.2.53
CFLAGS="-O3-fPIC" ./configure --prefix=/usr/local/libpng && make &&make install

4、安裝gd

 
./configure--with-php-config=/opt/php/bin/php-config --with-jpeg-dir=/usr/local/jpeg --with-png-dir=/usr/local/libpng  --with-freetype-dir=/usr/local/freetype && make && makeinstall

5、安裝zlib

6、編輯php.ini文件
vim /opt/php/lib/php.ini

在末尾添加如下幾行內(nèi)容

extension_dir =/opt/php/lib/php/extensions/no-debug-zts-20121212/
extension=gd.so
extension=zlib.so

 
/opt/php/bin/php –m

重啟httpd服務(wù)

/usr/local/apache2/bin/apachectlrestart

7、驗(yàn)證是否安裝成功
用瀏覽器訪問phpinfo查看是否有了GD模塊和zlib模塊

http://youip

Php GD模塊和zlib模塊安裝完成。

八、搭建網(wǎng)站服務(wù)
我們使用opencart這個(gè)開源項(xiàng)目作為WEB站點(diǎn)實(shí)驗(yàn)

cd /tools
unzip opencart-2.1.0.1.zip;cd opencart-2.1.0.1
mv upload/ /usr/local/apache2/htdocs/opencart

瀏覽器訪問http://youip/opencart

站點(diǎn)搭建完成。

九、設(shè)置防火墻

本文相關(guān)附件下載

具體下載目錄在 /2015年資料/10月/27日/CentOS 6.7 編譯安裝LAMP/

下面關(guān)于LAMP相關(guān)的內(nèi)容你可能也喜歡


名稱欄目:CentOS6.7編譯安裝LAMP
URL鏈接:http://www.5511xx.com/article/coeedip.html