LAMP平臺搭建+論壇安裝流程(包括遇到的一些問題)

餘二五發表於2017-11-14
1.安裝包準備: 
   #cp bao/* /usr/local/scr/lamp 
2.安裝Apache httpd-2.4.3.tar.gz 
  ->安裝依賴包:apr-1.4.6.tar.bz2 
      # tar jxf apr-1.4.6.tar.bz2  
         #cd apr-1.4.6 
         #yum install gcc* -y 需要安裝gcc編譯環境 
         #./configure –prefix=/usr/local/apr 
         #make && make isntall 
      #tar jxf apr-util-util-1.5.1 
         #cd apr-util-1.5.1 
         #./configure –prefix=/usr/local/apr-util –with-apr=/usr/local/apr 
         #make && make install 
  ->安裝httpd-2.4.3.tar.gz 
     #yum install zlib-devel openssl-devel pcre-devel -y 安裝環境 
     # tar zxf httpd-2.4.3.tar.gz  
     #cd httpd-2.4.3 
     # ./configure –prefix=/usr/local/apache2 –with-apr=/usr/local/apr –with-apr-util=/usr/local/apr-util/ –enable-module=so –enable-deflate=shared –enable-expires=shared –enable-rewrite=shared –enable-cache –enable-file-cache –enable-men-cache –enable-disk-cache –enable-static-support –enable-static-ab –disable-userdir –with-mpm=prefork –enable-nonportable-atomics –disable-ipv6 –with-senfile 
     #make && make install 
     #/usr/local/apache2/bin/apachectl -k start開啟服務 
      cd /usr/local/apache2/bin/  -> ./apachectl start 開啟Apache服務 
      cd /usr/local/apache2/bin/  -> ./apachectl stop  關閉Apache服務 
     #ps -ef | grep httpd 檢視Apache服務的狀態 
     #ps -aux | grep apache 
        Warning: bad syntax, perhaps a bogus `-`? See /usr/share/doc/procps-3.2.7/FAQ 
        root     17844  0.0  0.4   4576  2212 ?        Ss   11:07   0:00 /usr/local/apache2/bin/httpd -k start 
        daemon   17852  0.0  0.3   4576  1716 ?        S    11:07   0:00 /usr/local/apache2/bin/httpd -k start 
        daemon   17853  0.0  0.3   4576  1716 ?        S    11:07   0:00 /usr/local/apache2/bin/httpd -k start 
        daemon   17854  0.0  0.3   4576  1716 ?        S    11:07   0:00 /usr/local/apache2/bin/httpd -k start 
        daemon   17855  0.0  0.3   4576  1716 ?        S    11:07   0:00 /usr/local/apache2/bin/httpd -k start 
        daemon   17856  0.0  0.3   4576  1716 ?        S    11:07   0:00 /usr/local/apache2/bin/httpd -k start 
     #killall httpd 關閉http功能 
3.MySql原始碼安裝: 
   #rpm -ivh cmake-2.6.4-7.el5.i386.rpm  安裝cmake編譯包 
   # groupadd mysql  建立使用者組 
   # useradd -g mysql mysql 建立使用者 
   #yum remove mysql-server mysql mysql-devel -y 刪除系統自帶的mysql功能 
   # mkdir -pv /usr/local/mysql/data  建立使用者資料目錄 
      mkdir: 已建立目錄 “/usr/local/mysql” 
      mkdir: 已建立目錄 “/usr/local/mysql/data” 
   # yum install ncurses-devel -y  編譯安裝時會報錯,提示安裝這個環境包 
   # tar zxf mysql-5.5.29.tar.gz  
   # cd mysql-5.5.29 
   #cmake  
   -DCMAKE_INSTALL_PREFIX=/usr/local/mysql  
   -DMYSQL_DATADIR=/usr/local/mysql/data/ -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock  
   -DWITH_INNOBASE_STORAGE_ENGINE=1  
   -DENABLE_LOCAL_INFILE=1  
   -DEXTAR_CHARSETS=all  
   -DDEFAULT_CHARSET=utf8  
   -DDEFAULT_COLLATION=utf8_general_ci  
   -DMYSQL_USER=mysql  
   -DWITH_DEBUG=0  
   -DWITH_EMBEDED_SERVER=0 
   (cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data/ -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock -DWITH_INNOBASE_STORAGE_ENGINE=1 -DENABLE_LOCAL_INFILE=1 -DEXTAR_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DMYSQL_USER=mysql -DWITH_DEBUG=0 -DWITH_EMBEDED_SERVER=0) 
  #make && make install 
  #cp support-files/my-innodb-heavy-4G.cnf /etc/my.cnf 
  # vim /etc/my.cnf 
    [mysqld] 
    port            = 3306 
    socket          = /usr/local/mysql/mysql.sock 
    skip-name-resolve = 1 
  將mysql的服務啟動項加到/init.d 
  #cp support-files/mysql.server /etc/init.d/mysqlsource   
  #chmod 755 /etc/init.d/mysqlsource  修改具有執行許可權 
  更改檔案目錄的所有者和屬組 
  #chown -R mysql.mysql /usr/local/mysql/ 
  初始化資料庫 
  # sh scripts/mysql_install_db –user=mysql –basedir=/usr/local/mysql –datadir=/usr/local/mysql/data/   
  將所需的資料、模組連結 
  #ln -s /usr/local/mysql/bin/* /usr/bin/ 
  #ln -s /usr/local/mysql/lib* /usr/lib/ 
  #ln -s /usr/local/mysql/libexec/* /usr/local/libexec/ 可執行的檔案 
  #ln -s /usr/local/mysql/share/man/man1/* /usr/share/man/man1 
  #ln -s /usr/local/mysql/share/man/man8/* /usr/share/man/man8 
  資料庫啟動 
  #/etc/init.d/mysqlsource start 
  檢視資料庫服務的狀態: 
  # /usr/local/mysql/bin/mysqladmin stauts 
4.安裝PHP 
  ->安裝依賴包libiconv-1.14.tar.gz 
   #tar zxf libiconv-1.14.tar.gz  
   #cd libiconv-1.14 
   #./configure –prefix=/usr/local –with-apr=/usr/local/apr 
   #make && make install 
  ->安裝依賴包libmcrypt-2.5.8.tar.gz 
   #tar zxf libmcrypt-2.5.8.tar.gz  
   #cd libmcrypt-2.5.8 
   #./configure && make && make install 
   # cd libltdl/ 
   #./configure –enable-ltdl-install && make && make install 
  ->安裝依賴包mhash-0.9.9.9.tar.gz和mcrypt-2.6.8.tar.gz 
   ->#tar zxf mhash-0.9.9.9.tar.gz  請注意先後順序和連結檔案操作 
     #cd mhash-0.9.9.9 
     #./configure && make && make install 
     #ln -s /usr/local/lib/* /usr/lib/  請注意不能重複連結,重複連結會報錯 
     #ln -s /usr/local/bin/libmcypt-config /usr/bin 
   ->#tar zxf mcrypt-2.6.8.tar.gz  
     #cd mcrypt-2.6.8 
     #./configure && make && make install 
  ->安裝php-5.4.11.tar.bz2 
   #yum install libxml2-devel libpng-devel bzip2-devel curl-devel libjpeg-devel freetype-devel net-snmp-devel -y 
   # yum install autoconf automake libtool re2c flex bison -y 
   #tar jxf php-5.4.11.tar.bz2  
   #cd php-5.4.11 
   #./configure –prefix=/usr/local/php –with-config-file-path=/usr/local/php/etc –with-mysql=/usr/local/mysql/ –with-mysqli=/usr/local/mysql/bin/mysql_config –with-pdo-mysql=/usr/local/mysql –with-iconv-dir=/usr/local/ –enable-fpm –with-fpm-user=apache –with-fpm-group=apache –with-pcre-regex –with-zlib –with-bz2 –enable-calendar –disable-phar –with-curl –enable-dba –with-libxml-dir –enable-ftp –with-gd –with-jpeg-dir –with-png-dir –with-zlib-dir –with-freetype-dir –enable-gd-native-ttf –enable-gd-jis-conv –with-mhash –enable-mbstring –with-mcrypt –enable-pcntl –enable-xml –disable-rpath –enable-shmop –enable-sockets –enable-zip –enable-bcmath –with-snmp –disable-ipv6 –disable-rpath –disable-debug –with-apxs2=/usr/local/apache2/bin/apxs 
   #make ZEND_EXTRA_LIBS=`-liconv` 
   #make install 
    (32位系統報錯:找不到libmysqlclient.so.18 。解決問題:#ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib/ ) 
   #cp php.ini-production /usr/local/php/etc/php.ini 
5.編輯httpd.conf 
   #vim /usr/local/apache2/conf/httpd.conf 
   搜尋關鍵字Addtype 
    新增:Addtype application/x-httpd-php .php 
   搜尋index.html(DirectoryIndex index.php) 
     更改為index.html->index.php 
   #cd /usr/local/apache2/htdocs 
     刪除index.html 
  新建一個測試頁面 
   #vim index.php 
       <?php 
              phpinfo(); 
       ?> 
  重新啟動Apache 
  #kill httpd(不建議使用) 
  #/usr/local/apache2/bin/apachectl start 
6.啟動資料庫 
  #/etc/init.d/mysqlsource start 
  排錯: 
     # /etc/init.d/mysqlsource start 
        Starting MySQL.The server quit without updating PID file (/usr/local/mysql/data/shen2.pid).                                                [失敗] 
     # /etc/init.d/mysqlsource status 
        MySQL is running but PID file could not be found           [失敗] 
 解決辦法:1.# ps aux | grep mysql 列印程式 
             # kill -9 pid1 pid2 殺死程式 
             再啟動 
           2.可能是配置檔案修改出錯引起 
             #vim /etc/my.cny  預設配置哦 
              [mysqld] 
              port  =3306 
              socket =/var/lib/mysql/mysql.sock 
7.安裝論壇 
  #unzip Discuz_7.2_FULL_SC_UTF8.zip  
  #mv upload/* /usr/local/apache2/htdocs 
  重新啟動Apache,完成論壇的安裝 
  瀏覽器輸入ip/install/index.php 
  配置論壇檔案 
  #vim /usr/local/php/etc/php.ini 
    修改:short_open_tag = On 
  #cd /usr/local/apache2/htdocs 
   chmod -R 777 * 
   資料庫使用者名稱:root 
   資料庫密碼:空 
   管理員密碼:123456 
    
    
    
rpmfind.net 搜尋rpm包網站
本文轉自 南非波波 51CTO部落格,原文連結:http://blog.51cto.com/nanfeibobo/1555974,如需轉載請自行聯絡原作者


相關文章