CentOS 上部署Discuz!X論壇2

來源:互聯網
上載者:User

標籤:discuz   論壇   mysql   使用者   

緊接上一篇,廢話少說,直接實戰。詳細內容請參考《編譯安裝LAMP一》

《MySQL-5.5.38通用二進位安裝》

2、安裝MySQL

# 建立mysql使用者和組[[email protected] ~]# groupadd -r mysql[[email protected] ~]# useradd -r -g mysql -s /sbin/nologin mysql# 目錄規劃[[email protected] ~]# mkdir -pv /mydata/datamkdir: created directory `/mydata‘mkdir: created directory `/mydata/data‘[[email protected] ~]# chown -R mysql:mysql /mydata/data/# 解壓源碼包[[email protected] lamp]# tar xf mysql-5.5.38-linux2.6-i686.tar.gz -C /usr/local/src[[email protected] lamp]# cd /usr/local/[[email protected] local]# ln -sv src/mysql-5.5.38-linux2.6-i686 mysql`mysql‘ -> `src/mysql-5.5.38-linux2.6-i686‘# 初始化資料庫[[email protected] local]# cd mysql/       [[email protected] mysql]# scripts/mysql_install_db --basedir=/usr/local/mysql --datadir=/mydata/data --user=mysql[[email protected] mysql]# chown -R root:root /usr/local/src/mysql-5.5.38-linux2.6-i686/# 提供設定檔和服務啟動指令碼[[email protected] mysql]# cp support-files/mysql.server /etc/init.d/mysqld[[email protected] mysql]# chkconfig --add mysqld[[email protected] mysql]# chkconfig mysqld on[[email protected] mysql]# cp support-files/my-medium.cnf /etc/my.cnf# 編輯設定檔[[email protected] mysql]# vi /etc/my.cnf # The following options will be passed to all MySQL clients[client]#password       = your_passwordport            = 3306socket          = /tmp/mysql.sockcharacter-set-server = utf8 # Here follows entries for some specific programs # The MySQL server[mysqld]port            = 3306socket          = /tmp/mysql.sockpid-file         = /mydata/data/mysqld.pidcharacter-set-server = utf8collation-server = utf8_unicode_cibasedir         = /usr/local/mysqldatadir         = /mydata/datauser            = mysqlskip-name-resolve# 啟動mysql服務[[email protected] ~]# service mysqld startStarting MySQL.. SUCCESS! [[email protected] ~]# netstat -tulpn | grep 3306tcp        0      0 0.0.0.0:3306        0.0.0.0:*        LISTEN      708/mysqld [[email protected] ~]# vi /etc/profile.d/mysql.shexport PATH=$PATH:/usr/local/mysql/bin[[email protected] ~]# . /etc/profile.d/mysql.sh[[email protected] ~]# /usr/local/mysql/bin/mysql_secure_installation[[email protected] ~]# vim /etc/man.configMANPATH /usr/local/mysql/man[[email protected] ~]# ln -sv /usr/local/mysql/include/ /usr/include/mysql`/usr/include/mysql‘ -> `/usr/local/mysql/include/‘[[email protected] ~]# vi /etc/ld.so.conf.d/mysql.conf[[email protected] ~]# /sbin/ldconfig # 使用TCMalloc為MySQL加速[[email protected] lib]# pwd/usr/local/mysql/lib[[email protected] lib]# ls | grep libtcmalloclibtcmalloc_minimal.solibtcmalloc_minimal.so.0# 編輯mysqld_safe檔案[[email protected] bin]# vi /usr/local/mysql/bin/mysqld_safe# 再# executing mysqld_safe行之後,添加下面這一行export LD_PRELOAD="/usr/local/mysql/lib/libtcmalloc_minimal.so" # 重啟mysql服務[[email protected] ~]# service mysqld restartShutting down MySQL.. SUCCESS! Starting MySQL... SUCCESS! [[email protected] bin]# lsof -n | grep -i tcmamysqld    4793   mysql  mem       REG        8,2   888700      14655 /usr/local/src/mysql-5.5.38-linux2.6-i686/lib/libtcmalloc_minimal.so

3、編譯安裝PHP,以模組方式整合

如果我們先前沒有安裝: libxml2 libxml2-devel bzip2-devel libmcrypt libmcrypt-devel,則需要安裝這些包:

[[email protected] ~]# yum -y install libxml2 libxml2-devel bzip2-devel libmcrypt libmcrypt-devel

不過,我這邊沒有libmcrypt*包:

No package libmcrypt available.

No package libmcrypt-devel available.

可以到這個網站下載rpm包:http://rpm.pbone.net/

[[email protected] lamp]# ls lib*libmcrypt-2.5.7-1.2.el6.rf.i686.rpm  libmcrypt-devel-2.5.7-1.2.el6.rf.i686.rpm[[email protected] lamp]# rpm -ivh lib*warning: libmcrypt-2.5.7-1.2.el6.rf.i686.rpm: Header V3 DSA/SHA1 Signature, key ID 6b8d79e6: NOKEYPreparing...                ########################################### [100%]   1:libmcrypt              ########################################### [ 50%]   2:libmcrypt-devel        ########################################### [100%]

好了, 前期準備好了,就開始安裝PHP吧

[[email protected] lamp]# tar xf php-5.4.32.tar.gz -C /usr/local/src[[email protected] lamp]# cd /usr/local/src[[email protected] src]# cd php-5.4.32/# 需要指定 --enable-fpm 以啟用fastCGI,以備後續改為fastCGI模式[[email protected] php-5.4.32]# ./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-openssl --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-mbstring --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --enable-sockets --enable-fpm --with-apxs2=/usr/local/apache/bin/apxs --with-mcrypt --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --with-bz2 --enable-maintainer-zts  --enable-fpm[[email protected] php-5.4.32]# make && make install[[email protected] php-5.4.32]# cp php.ini-production /etc/php.ini

4、整合apache和php

編輯 /etc/httpd/httpd.conf設定檔, 定位到 AddType, 添加如下兩行
[[email protected] ~]# vi /etc/httpd/httpd.conf  AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps # 然後定位到: DirectoryIndex, 添加index.php<IfModule dir_module>    DirectoryIndex index.php index.html</IfModule># 測試[[email protected] ~]# httpd -tSyntax OK[[email protected] ~]# service httpd restartStopping httpd:                                            [  OK  ]Starting httpd: AH00558: httpd: Could not reliably determine the server‘s fully qualified domain name, using localhost.localdomain. Set the ‘ServerName‘ directive globally to suppress this message                                                           [  OK  ][[email protected] ~]# vi /usr/local/apache/htdocs/index.php<?phpphpinfo();?>

通過瀏覽器訪問,出現下面介面說明OK

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M02/49/8C/wKioL1QUVPeBnULtAAGWn6nOVtY574.jpg" title="1.png" alt="wKioL1QUVPeBnULtAAGWn6nOVtY574.jpg" />

5、配置Xcache為PHP提速

詳細資料請參考《Xcache為PHP提速》

[[email protected]alhost lamp]# tar xf xcache-3.0.4.tar.gz -C /usr/local/src[[email protected] lamp]# cd /usr/local/src[[email protected] src]# cd xcache-3.0.4/### 用本地的解譯器探測模組所依賴的版本號碼/擴充API,產生序號標記,而後才能產生configure檔案,才能編譯[[email protected] xcache-3.0.4]# /usr/local/php/bin/phpize  [[email protected] xcache-3.0.4]# ./configure --enable-xcache --enable-xcache-coverager --enable-xcache-optimizer --with-php-config=/usr/local/php/bin/php-config[[email protected] xcache-3.0.4]# make && make install## 安裝完成後,會提示xcache.so模組的路徑, 我們把xcache.so移動到/usr/local/php/include/php/ext目錄下,方便管理# Installing shared extensions:     /usr/local/php/lib/php/extensions/no-debug-zts-20100525/[[email protected] xcache-3.0.4]# mv /usr/local/php/lib/php/extensions/no-debug-zts-20100525/xcache.so /usr/local/php/include/php/ext/## 產生Xcache管理員的密碼(MD5密文)[[email protected] ~]# echo -n ‘123456‘ | md5sume10adc3949ba59abbe56e057f20f883e### 整合php和xcache[[email protected] ~]# cd /usr/local/src/xcache-3.0.4/[[email protected] xcache-3.0.4]# cp xcache.ini /etc/php.d/[[email protected] ~]# vi /etc/php.d/xcache.ini ### 編輯xcache.ini ##通常僅編輯如下4項即可extension = xcache.admin.enable_auth =xcache.admin.user = xcache.admin.pass = #####################################[xcache-common]extension = "/usr/local/php/include/php/ext/xcache.so";xcache.so路徑[xcache.admin]xcache.admin.enable_auth = On;開啟驗證xcache.admin.user = "xcache";驗證名xcache.admin.pass = "e10adc3949ba59abbe56e057f20f883e";md5後的驗證密碼, 亦即echo -n "123456" | md5sum,留空則禁用管理頁面.[xcache]xcache.shm_scheme ="mmap"; 決定 XCache 如何從系統分配共用記憶體xcache.size=60M; 0 禁止, 非 0 則啟用緩衝器. 請注意您系統所允許的 mmap 最大值.xcache.count =1; 指定將 cache 切分成多少塊.(cat/proc/cpuinfo |grep -c processor)xcache.slots =8K; 只是作為 hash 槽個數的參考值, 您可以放心地緩衝超過這個個數的項目.xcache.ttl=0; 設定緩衝項目的 Ttl (Time To Live) 值, 0=永不到期.xcache.gc_interval =0; 檢查到期項目, 回收記憶體空間的間隔.xcache.var_size=4Mxcache.var_count =1xcache.var_slots =8K; 同上, 不過用於資料緩衝而不是 opcode 緩衝.xcache.var_ttl=0; xcache_(get|set|inc|dec) 等的預設 ttl 值.xcache.var_maxttl=0; 最大 ttl 值, 程式無法指定超過這個最大值的 ttl.xcache.var_gc_interval =300xcache.test =Offxcache.readonly_protection = On;如果啟用了 ReadonlyProtection, 將會略微降低效能, 但是會提高一定的安全係數. 這個選項對於xcache.mmap_path = /dev/zero 無效.xcache.mmap_path ="/tmp/xcache";快取檔案,不是目錄,需要手動建立xcache.coredump_directory =""xcache.cacher =On;使用/不使用 opcode 緩衝器. xcache.size = 0 時無效.xcache.stat=On;使用 stat() 發現檢查指令碼更新.xcache.optimizer =Off[xcache.coverager]xcache.coverager =On;啟用代碼覆蓋資訊採集到. 啟用後xcache.coveragedump_directory 設定以及xcache_coverager_start/stop/get/clean() 才可以使用. (啟用後會對降低影響)xcache.coverager_autostart = On;每個頁面請求自動調用 xcache_coverager_startxcache.coveragedump_directory =""## 產生xcache緩衝[[email protected] ~]# touch /tmp/xcache[[email protected] ~]# chmod 777 /tmp/xcache

可以通過phpinfo來驗證PHP是否已經支援 Xcache。

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M01/49/8B/wKiom1QUWkyAzZ41AAFrZS8rnLo433.jpg" title="1.png" alt="wKiom1QUWkyAzZ41AAFrZS8rnLo433.jpg" />


安裝Discuz!X


[[email protected] lamp]# unzip Discuz_X3.2_SC_UTF8.zip[[email protected] lamp]# cp -r readme/ /www/[[email protected] lamp]# cp -r upload/ /www/[[email protected] lamp]# cp -r utility/ /www/# 這三個目錄全部要copy到網站目錄下upload目錄下所有的檔案是我們論壇主程式檔案。readme目錄為產品介紹、授權、安裝、升級、轉換以及版本更新日誌說明utility目錄為論壇附帶工具,包括升級程式。### 配置虛擬機器主機,編輯/etc/httpd/httpd.conf## 注釋中心主機#DocumentRoot "/usr/local/apache/htdocs"## 開啟虛擬機器主機# Virtual hostsInclude /etc/httpd/extra/httpd-vhosts.conf### 編輯 /etc/httpd/extra/httpd-vhosts.conf<virtualHost *:80>    ServerAdmin [email protected]    DocumentRoot "/www/upload"    ServerName www.discuz.com    ErrorLog logs/discuz-error_log    CustomLog logs/discuz-access_log common        <Directory "/www/upload">    Options Indexes FollowSymLinksAllowOverride NoneRequire all granted    </Directory></virtualHost>## 重啟httpd服務[[email protected] ~]# service httpd restart

然後,通過瀏覽器訪問,即可進入安裝介面

第一步,你懂的,不同意也得同意,650) this.width=650;" src="http://img.baidu.com/hi/jx2/j_0063.gif" alt="j_0063.gif" />

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M00/49/8C/wKiom1QUYUKCVBGkAAOs0wJNhmo793.jpg" title="1.png" alt="wKiom1QUYUKCVBGkAAOs0wJNhmo793.jpg" />

檢查安裝環境,出現好多紅叉,怎麼辦?

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M02/49/8C/wKiom1QUYb3iXH5GAAJCEF-WsZk022.jpg" title="1.png" alt="wKiom1QUYb3iXH5GAAJCEF-WsZk022.jpg" />

參考這篇教程《Discuz!X3全新安裝圖文教程》

我們需要設定相關目錄的檔案屬性,以便資料檔案可以被程式正確讀寫。將伺服器上以下目錄、以及該目錄下的所有檔案屬性設定為777。

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M00/49/8C/wKiom1QUY12wbcERAAE7PTBlfP8381.jpg" title="1.png" alt="wKiom1QUY12wbcERAAE7PTBlfP8381.jpg" />

# 曉得怎麼做了,就動手[[email protected] ~]# cd /www/upload/[[email protected] upload]# chmod -R 777 config[[email protected] upload]# chmod -R 777 data[[email protected] upload]# chmod -R 777 uc_server/[[email protected] upload]# chmod -R 777 uc_client/data/cache/

OK,在瀏覽器上重新整理,許可權檢查全部通過,好了繼續“下一步”

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M00/49/8E/wKioL1QUZI7jVCT0AAIQvMdsclY681.jpg" title="1.png" alt="wKioL1QUZI7jVCT0AAIQvMdsclY681.jpg" />

設定運行環境

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M00/49/8E/wKioL1QUZMfAtyERAAGlTjy6gD4166.jpg" title="1.png" alt="wKioL1QUZMfAtyERAAGlTjy6gD4166.jpg" />

進入資料庫設定介面,如所示

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M01/49/8E/wKioL1QUZbSyIhWUAAFZUpR9xwM138.jpg" title="1.png" alt="wKioL1QUZbSyIhWUAAFZUpR9xwM138.jpg" />

填寫好Discuz!X資料庫相關資訊及管理員資訊之後,點擊“下一步”,系統會自動安裝資料庫直至完畢。

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M01/49/8D/wKiom1QUZk7BYu1QAAMY1xeahCQ769.jpg" title="1.png" alt="wKiom1QUZk7BYu1QAAMY1xeahCQ769.jpg" />

點擊“馬上去裝應用”,重新登入後台,選擇要安裝的應用,安裝即可。 

OK,到此Discuz!X 論壇就已經安裝完畢,更多設定,下一篇繼續。


http://coolnull.com/1293.html

http://blog.chinaunix.net/uid-26963748-id-3267204.html

http://www.vfeelit.com/76.html

http://www.fanli7.net/a/JAVAbiancheng/ANT/20140403/444902.html

http://www.discuz.net/thread-3258186-1-1.html

http://www.linuxidc.com/Linux/2011-04/34621.htm


本文出自 “Share your knowledge” 部落格,請務必保留此出處http://skypegnu1.blog.51cto.com/8991766/1552384

CentOS 上部署Discuz!X論壇2

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.