搭建LAMP网站 Discuz论坛

本文涉及的产品
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
云数据库 RDS MySQL,集群系列 2核4GB
推荐场景:
搭建个人博客
RDS MySQL Serverless 高可用系列,价值2615元额度,1个月
简介:

Table of Contents

1. Install Required System Packages

2. Install Extra Packages

3. Compile and Install MySQL

4. Compile and Install Apache

5. Compile and Install PHP

6. Install Zend Optimizer

7. Integrate Apache and PHP

8. Test PHP and Improve its Security

9. Install and Configure Discuz6.0

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:

1
2
3
4
5
6
7
8
9
10
11
12
13
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

1
[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:

  1. GD2

  2. LibXML2

  3. LibMcrypt

  4. OpenSSL

I'll show how to compile and install, yeah, it's simple!

  1. GD2

    1
    2
    3
    4
    5
    6
    [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


  2. LibXML2

    1
    2
    3
    4
    5
    6
    [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


  3. LibMcrypt

    1
    2
    3
    4
    5
    6
    [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


  4. OpenSSL

    1
    2
    3
    4
    5
    6
    7
    [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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
[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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
[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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
[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

1
2
3
[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:

1
2
3
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:

1
[root@lamp ~] # emacs /usr/local/apache2/conf/httpd.conf

Find this line,

1
AddType application /x-gzip  .gz .tgz

Add one line under this line

1
AddType application /x-httpd-php  .php

Find these lines,

1
2
3
<IfModule dir_module>
     DirectoryIndex index.html
<IfModule>

Change them like this,

1
2
3
<IfModule dir_module>
     DirectoryIndex index.html index.htm index.php
<IfModule>

Find and uncomment these lines,

1
2
3
4
#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

1
[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.

1
[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.

1
[root@lamp ~] # emacs /usr/local/php/etc/php.ini

Find this line,

1
disable_functions =

Chang this line to this,

1
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

1
2
3
4
5
6
7
[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://<ip_addr>/bbs/install.php


Date: 2011-11-12

Author: LavenLiu

Created: 2014-03-18 周二 17:41

Emacs 24.3.1 (Org mode 8.2.5c)

Validate


本文转自   bigstone2012  51CTO博客,原文链接:

http://blog.51cto.com/lavenliu/1378926


相关实践学习
如何快速连接云数据库RDS MySQL
本场景介绍如何通过阿里云数据管理服务DMS快速连接云数据库RDS MySQL,然后进行数据表的CRUD操作。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助 &nbsp; &nbsp; 相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
目录
打赏
0
0
0
0
95
分享
相关文章
快速用Discuz搭建论坛网站教程
Discuz! 是全球成熟度最高、覆盖率最大的论坛网站软件系统之一,被200多万网站用户使用,本文教你一步一步快速用阿里云免费的Discuz官方系统搭建论坛网站。
44073 0
快速搭建phpwind论坛系统
phpwind 是采用 PHP + MySQL 方式运行的开源社区程序。轻架构,高效率简易开发,帮助您快速搭建并轻松管理社区站点。本文介绍如何使用云市场的 PHPWind论坛系统(含智慧云虚机面板) 快速搭建论坛。
15428 0
Linux服务器---论坛discuz
Discus        Discuz是一款免费的论坛管理系统,大量的使用了AJAX,内部有丰富的模板风格。 1、下载discuz软件(https://cn.wordpress.org/download/releases/")2、为discuz创建一个自己的数据库,我们起名为“discuz”3、...
1401 0
阿里云虚拟主机安装Discuz论坛图文教程
准备工具 阿里云虚拟主机一台 FTP工具:推荐使用xftp家庭教育版(免费) Discuz安装包:Discuz_X3.2_SC_GBK 已备案的域名 基本配置过程 下载地址:产品介绍Discuz! X2.5 在继承和完善 Discuz! X2.0 的基础上,针对“系统架构”、“负载性能”等几大方面,进行了全面升级。
6692 0