自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

如何在Linux下安裝lamp

運維 系統(tǒng)運維
如何在Linux下安裝lamp:LAMP(Linux-Apache-MySQL-PHP)是目前國際流行的Web框架。LAMP框架包括:Linux操作系統(tǒng),Apache網(wǎng)絡(luò)服務(wù)器,MySQL數(shù)據(jù)庫,Perl、PHP或者Python編程語言。LAMP所有組成產(chǎn)品均是開源軟件,具有資源豐富、開發(fā)快速等等特點。本文講述的是如何在Linux下安裝lamp。

  linux安裝配置lamp

  mysql + apache + openssl + PHP + gd + libpng + libjpeg + freetype2 + zlib(這個很重要很多都要用.) + ZendOptimizer +libxml

  MySQL安裝

  1.   tar -zxvf mysql.tar.gz  
  2.  
  3.   groupadd mysql  
  4.  
  5.   useradd -g mysql mysql  
  6.  

  到解壓好的那個目錄下

  初始化數(shù)據(jù)庫: ./scripts/mysql_install_db --user=mysql

  1.   chown -R root .  
  2.  
  3.   chown -R mysql data  
  4.  
  5.   chgrp -R mysql .  
  6.  

  加入到系統(tǒng)啟動組(red hat): cp ./support-files/mysql.server /etc/init.d/mysqld

  1.   chkconfig mysqld reset  
  2.  

  加配置cp ./support-files/my-medium.cnf /etc/my.cnf

  bin/mysqld_safe --user=mysql &

  這里又出了點小問題 , 系統(tǒng)啟動出現(xiàn)錯誤 . 因為找不到 mysql, 當(dāng)然要修改 /etc.init.d/mysqld 這個文件 , 把里面的 /usr/local/mysql 改成我的目錄 ,OK

  還有一點要到 /usr/local/bin 下面去 ln -fs /usr/myz/mysql/bin/mysql mysql

  當(dāng)然還有 mysqladmin mysqldump

  1.   grant all on *.* to root@"202.11.10.253" Identified by "dboomysql"  
  2.  

  OK...MySQL是安裝完了 ...

#p#

  MySQL 配置

  設(shè)置其實剛才就做了一些

  mysqladmin -u root password XXX

  現(xiàn)在應(yīng)該只剩下設(shè)置字符集了

  找到客戶端配置[client] 在下面添加

  default-character-set=utf8 默認(rèn)字符集為utf8

  在找到[mysqld] 添加

  default-character-set=utf8 默認(rèn)字符集為utf8

  init_connect='SET NAMES utf8' (設(shè)定連接mysql數(shù)據(jù)庫時使用utf8編碼,以讓mysql數(shù)據(jù)庫為utf8運行)

  修改好后,重新啟動mysql(/etc/init.d/mysql restart) 即可,查詢一下show variables like 'character%';

#p#

  Zlib

  這個很重要....吸取以前的教訓(xùn).直接默認(rèn)安裝

  1.   # tar -zxvf zlib-1.2.2.tar.gz  
  2.  
  3.   # cd zlib-1.2.2  
  4.  
  5.   # ./configure  
  6.  
  7.   # make  
  8.  
  9.   # make install  
  10.  

#p#

  libjpeg

  這個很傻帽.不能自己創(chuàng)建文件夾.試了就知道,在make install那步當(dāng)中

  1.   # ./configure --prefix=/usr/local/jpeg --enable-shared --enable-static  
  2.  
  3.   # make  
  4.  
  5.   # make install  
  6.  

  出現(xiàn)問題的文件夾就自己創(chuàng)建一下.OK

#p#

  libpng

  1.   # cp scripts/makefile.linux makefile  
  2.  
  3.   # make (若是提示找不到zlib庫文件或者頭文件,多半是makefile文件里zlib的默認(rèn)路徑有誤??删庉媘akefile文件,找到zlib項并重新指定路徑到zlib路徑,建議還是默認(rèn)安裝)。  
  4.  
  5.   # make install  
  6.  
  7.   freetype  
  8.  
  9.   ./configure --prefix=/usr/local/ freetype  
  10.  
  11.   make  
  12.  
  13.   make install  
  14.  

#p#

  libxml

  1.   ./configure --prefix=/usr/local/libxml2  
  2.  
  3.   make  
  4.  
  5.   make install  
  6.  
  7.   cp xml2-config /usr/bin 這個在php編譯的時候會用到  
  8.  

  gd

  注意 :png 和 zlib 都是默認(rèn)安裝

  1.   # ./configure --prefix=/usr/local/gd2 --with-jpeg=/usr/local/jpeg --with-png=/usr/local/lib --with-zlib=/usr/local/lib --with-freetype=/usr/local/freetype  
  2.  
  3.   # make  
  4.  
  5.   # make install  
  6.  

  如果不出現(xiàn)以上那幾個的東西的 no的話就是安裝成功了.終于 ..... 接下來該 apache 了

#p#

  apache

  1.   # ./configure --prefix=/usr/myz/apache --sysconfdir=/etc --enable-so --enable-track-vars --enable-rewrite --with-z-dir=/usr/local/lib  
  2.  
  3.   # make  
  4.  
  5.   # make install  
  6.  

  sysconfdir是配置文件目錄

  so是允許so

  track-vars為啟動cookie的get/post等追蹤功能

  rewrite重寫

  zdir zlib壓縮

  apache 配置

  1.   vi /etc/httpd.conf  
  2.  

  要改的有如下幾處:

  找到LoadModule php5_module modules/libphp5.so

  讓php5以動態(tài)模塊方式(DSO)加載在apache上。apache在啟動后去加載php。

  前面的#號去掉(默認(rèn)已去掉注釋)

  1.   #AddType application/x-gzip .gz .tgz  
  2.  

  下面加二行

  1.   AddType application/x-httpd-php .php  
  2.  
  3.   AddType application/x-httpd-php-source .phps  
  4.  

  ***句是讓apache在遇到.php文件后綴的時候,調(diào)用php模塊解釋php里面的代碼。第二句是在遇到.phps文件后綴的時候以語法高亮方式顯示php源代碼。這里可以做很多文章,比如AddType application/x-httpd-php .html,這樣apache會把.html文件也通過php去解釋,很多網(wǎng)站的"偽靜態(tài)"就是這里做的手腳。

  找到DirectoryIndex index.html

  改為 DirectoryIndex index.html index.htm index.php,這是在給apache設(shè)置默認(rèn)首頁。并且是有先后順序的。

  1.   # cp /usr/lamp/apache2/bin/apachectl /etc/init.d/httpd  
  2.  

  設(shè)置開機自啟動

  1.   # chkconfig --add httpd  
  2.  

  這里會出現(xiàn)錯誤 . 在 httpd 里的***行下面加上 :

  1.   # myz  
  2.  
  3.   # chkconfig: 2345 60 40  
  4.  
  5.   # description: MyZ Server  
  6.  

  將apache添加為系統(tǒng)服務(wù)

  1.   # service httpd start  
  2.  

  就會開啟服務(wù)了,同理service httpd stop就是停止服務(wù)。還可以service httpd restart。不過這個沒有什么提示信息,你可以自己編寫個shell腳本,加入一些提示信息就顯得好看多了。

  這里啟動會出現(xiàn)一點錯誤:

  httpd could not reliably determine

  需要在httpd.conf 中的ServerName:www.example.com:80下面加上

  www.yourdomain.com:80

  php

  1.   # ./configure --prefix=/usr/myz/php \  
  2.  
  3.   --with-apxs2=/usr/myz/apache/bin/apxs \  
  4.  
  5.   --with-config-file-path=/etc \  
  6.  
  7.   --enable-safe-mode \  
  8.  
  9.   --with-zlib=/usr/local/lib \  
  10.  
  11.   --with-libxml-dir=/usr/local/lib \  
  12.  
  13.   --enable-mbstring \  
  14.  
  15.   --with-mysql=/usr/myz/mysql \  
  16.  
  17.   --with-mysql-sock=/tmp \  
  18.  
  19.   --with-pdo-mysql=/usr/myz/mysql \  
  20.  
  21.   --enable-soap \  
  22.  
  23.   --with-xmlrpc \  
  24.  
  25.   --enable-sockets \  
  26.  
  27.   --with-curl=/user/local/lib \  
  28.  
  29.   --enable-xsl=/usr/local/lib \  
  30.  
  31.   --with-openssl=/usr/local/lib \  
  32.  
  33.   --with-gd=/usr/local/lib \  
  34.  
  35.   --with-jpeg-dir=/usr/local/lib \  
  36.  
  37.   --with-png-dir=/usr/local/lib \  
  38.  
  39.   --with-freetype-dir=/usr/loca/lib \  
  40.  

  有的是需要裝的.比如apache,zlib,libxml2,libcurl,libxslt,libxslt

  我用的是5.2.5有的東西是默認(rèn)的enable 比如cli

  1.   make  
  2.  
  3.   make install  
  4.  

  復(fù)制php.ini-recommended為php.ini,并存放到/etc/目錄下.

  在Linux下安裝lamp就這么簡單。結(jié)束 ...

【編輯推薦】

  1. Ubuntu下LAMP的搭建
  2. Centos下搭建LAMP
  3. Linux下LAMP的安裝方法
責(zé)任編輯:zhaolei 來源: csdn
相關(guān)推薦

2017-01-05 12:21:00

LinuxPyCharm安裝

2011-03-10 08:59:04

Ubuntu安裝LAMP

2011-03-09 13:02:15

LinuxLAMP安裝

2011-03-09 10:25:25

Linux安裝LAMP

2015-11-24 13:27:35

Linuxcool-retro-復(fù)古終端

2017-08-07 16:41:39

LinuxOpenCV

2017-05-08 18:10:54

2011-03-08 10:35:23

2011-03-22 10:25:54

UbuntuLAMP

2011-03-14 13:07:23

Ubuntu安裝LAMP

2011-01-21 09:54:44

LinuxSendmail

2009-12-03 16:40:30

ADSL軟路由

2011-03-10 15:44:18

CentOSLAMP安裝

2011-03-10 15:44:18

CentOSLAMP安裝

2011-01-06 13:22:00

2013-07-29 13:49:23

UbuntuLAMP服務(wù)器

2011-03-09 09:30:45

Linux安裝LAMP

2011-03-09 13:46:47

SUSElamp安裝

2011-03-09 10:52:04

ContOSLAMP安裝

2016-08-16 08:26:19

Linuxsignalsigaction
點贊
收藏

51CTO技術(shù)棧公眾號