搭建LAMP网站 Discuz论坛
Table of Contents
1 Install Required System Packages
Needless to say, you should install required system packages. So you cancontinue the next steps. :-)
Be sure these packages are installed:
gcc gcc-c++ flex bison autoconf automake bzip2-devel ncurses-devel libjpeg-devel libpng-devel libtiff-devel freetype-devel pam-devel
Well, you can use a command to check them whether installed
[root@lamp ~]# for i in gcc gcc-c++ flex bison autoconf automake bzip2-devel ncurses-devel libjpeg-devel libpng-devel libtiff-devel freetype-devel pam-devel ; do rpm -q ${i} ; done
2 Install Extra Packages
In this section, we need to compile and install four packages:
GD2
LibXML2
LibMcrypt
OpenSSL
I‘ll show how to compile and install, yeah, it‘s simple!
GD2
[root@lamp ~] # cd /usr/local/src [root@lamp src] # tar xzvf gd-2.0.34.tar.gz [root@lamp src] # cd gd-2.0.34 [root@lamp gd-2.0.34] # ./configure --prefix=/usr/local/gd2 [root@lamp gd-2.0.34] # make [root@lamp gd-2.0.34] # make install
LibXML2
[root@lamp ~] # cd /usr/local/src [root@lamp src] # tar xzvf libxml2-2.6.29.tar.gz [root@lamp src] # cd libxml2-2.6.29 [root@lamp libxml2-2.6.29] # ./configure --prefix=/usr/local/libxml2 [root@lamp libxml2-2.6.29] # make [root@lamp libxml2-2.6.29] # make install
LibMcrypt
[root@lamp ~] # cd /usr/local/src [root@lamp src] # tar xjvf libmcrypt-2.5.8.tar.bz2 [root@lamp src] # cd libmcrypt-2.5.8 [root@lamp libmcrypt-2.5.8] # ./configure 鈥損refix=/usr/local/libmcrypt [root@lamp libmcrypt-2.5.8] # make [root@lamp libmcrypt-2.5.8] # make install
OpenSSL
[root@lamp ~] # cd /usr/local/src [root@lamp src] # tar xzvf openssl-0.9.8e.tar.gz [root@lamp src] # cd openssl-0.9.8e [root@lamp openssl-0.9.8e] # ./config --prefix=/usr/local/openssl [root@lamp openssl-0.9.8e] # make [root@lamp openssl-0.9.8e] # make test [root@lamp openssl-0.9.8e] # make install
3 Compile and Install MySQL
[root@lamp ~] #tar xzvf mysql-5.0.27.tar.gz [root@lamp ~] # cd mysql-5.0.27 [root@lamp mysql-5.0.27] # ./configure "--prefix=/usr/local/mysql" "--localstatedir=/var/lib/mysql" "--with-mysqld-user=mysql" "--without-debug" "--with-big-tables" "--with-extra-charsets=all" "--with-pthread" "--enable-static" "--enable-thread-safe-client" "--with-client-ldflags=-all-static" "--with-mysqld-ldflags=-all-static" "--enable-assembler" "--without-isam" "--without-innodb" "--without-ndb-debug" [root@lamp msyql-5.0.27] # make [root@lamp mysql-5.0.27] # make install [root@lamp mysql-5.0.27] # useradd mysql [root@lamp mysql-5.0.27] # cd /usr/local/mysql [root@lamp mysql] # bin/mysql_install_db --user=mysql [root@lamp mysql] # chown -R root:mysql . [root@lamp mysql] # chown -R mysql /var/lib/mysql [root@lamp mysql] # cp share/mysql/my-huge.cnf /etc/my.cnf [root@lamp mysql] # cp share/mysql/mysql.server /etc/rc.d/init.d/mysqld [root@lamp mysql] # chmod 755 /etc/rc.d/init.d/mysqld [root@lamp mysql] # chkconfig --add mysqld [root@lamp mysql] # chkconfig --level 3 mysqld on [root@lamp mysql] # /etc/rc.d/init.d/mysqld start [root@lamp mysql] # bin/mysqladmin -u root password ‘clear123‘
4 Compile and Install Apache
[root@lamp src] # cd /usr/local/src [root@lamp src] # tar xjvf httpd-2.2.4.tar.bz2 [root@lamp src] # cd httpd-2.2.4 [root@lamp httpd-2.2.4] # ./configure "--prefix=/usr/local/apache2" "--with-included-apr" "--enable-so" "--enable-deflate=shared" "--enable-expires=shared" "--enable-rewrite=shared" "--enable-static-support" "--disable-userdir" [root@lamp httpd2.2.4] # make [root@lamp httpd2.2.4] # make install [root@lamp httpd2.2.4] # echo ‘/usr/local/apache2/bin/apachectl start ‘ >> /etc/rc.local
5 Compile and Install PHP
[root@lamp ~] # cd /usr/local/src [root@lamp src] # tar xjvf php-5.2.3.tar.bz2 [root@lamp php-5.2.3] # cd php-5.2.3 [root@lamp php-5.2.3] # ./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=/usr/local/libxml2" "--with-gd=/usr/local/gd2" "--with-jpeg-dir" "--with-png-dir" "--with-bz2" "--with-freetype-dir" "--with-iconv-dir" "--with-zlib-dir " "--with-openssl=/usr/local/openssl" "--with-mcrypt=/usr/local/libmcrypt" "--enable-soap" "--enable-gd-native-ttf" "--enable-memory-limit" "--enable-ftp" "--enable-mbstring" "--enable-exif" "--disable-ipv6" "--disable-cgi" "--disable-cli" [root@lamp php-5.2.3] # make [root@lamp php-5.2.3] # make install [root@lamp php-5.2.3] # mkdir /usr/local/php/etc [root@lamp php-5.2.3] # cp php.ini-dist /usr/local/php/etc/php.ini
6 Install Zend Optimizer
[root@lamp ~]# cd /usr/local/src [root@lamp ~]# tar xf ZendOptimizer-3.2.8-linux-glibc21-i386.tar.gz [root@lamp ~]# ./ZendOptimizer-3.2.8-linux-glibc21-i386/install.sh
Note:
Then pop up a dialog, just type "accept" to continue, it will prompt you input the php.ini file‘s path. Ok, input like this: "/usr/local/php/etc" without double quotes.
7 Integrate Apache and PHP
We should modify configure file httpd.conf:
[root@lamp ~]# emacs /usr/local/apache2/conf/httpd.conf
Find this line,
AddType application/x-gzip .gz .tgz
Add one line under this line
AddType application/x-httpd-php .php
Find these lines,
<IfModule dir_module> DirectoryIndex index.html <IfModule>
Change them like this,
<IfModule dir_module> DirectoryIndex index.html index.htm index.php <IfModule>
Find and uncomment these lines,
#Include conf/extra/httpd-mpm.conf #Include conf/extra/httpd-info.conf #Include conf/extra/httpd-vhosts.conf #Include conf/extra/httpd-default.conf
When finished, save it! Then restart apache service
[root@lamp ~]# /usr/local/apache2/bin/apachectl restart
8 Test PHP and Improve its Security
PHP provides a function phpinfo() to test php is available, so we need to write a .php file in the root document of our web site.
[root@lamp ~]# emacs /usr/local/apache2/docs/dummy-host.example.com/phpinfo.php
<?php phpinfo(); ?>
Open our browser, locate this file
http://<ip_addr>/phpinfo.php
After this test, we should disable some functions of php, just to improve its security. We need to modify php.ini file.
[root@lamp ~]# emacs /usr/local/php/etc/php.ini
Find this line,
disable_functions =
Chang this line to this,
disable_functions = phpinfo,passthru,exec,system,chroot,scandir,chgrp,chown,escapeshellcmd,escapeshellarg,shell_exec,proc_open,proc_get_status,error_log,ini_alter,ini_alter,ini_restore,dl,pfsockopen,openlog,syslog,readlink,symlink,leak,popepassthru,stream_socket_server
9 Install and Configure Discuz6.0
[root@lamp ~]# tar xf discuz.tar.gz -C /usr/local/src [root@lamp ~]# mv /usr/local/src/discuz/upload /usr/local/apache2/docs/dummy-host [root@lamp ~]# mysql -uroot -pclear123 mysql> create database discuz; mysql> grant all on discuz.* to discuz@‘localhost‘ identified by ‘clear123‘; mysql> flush privileges; mysql> quit
Install it, open your browser, input this address: http://<ipaddr>/bbs/install.php
<?xml>?xml>
本文出自 “我的博客” 博客,请务必保留此出处http://lavenliu.blog.51cto.com/5060944/1378926
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。