peak学Linux--基于centos 6.5搭建LAMP并安装Discuz X3.2

实验环境:

VMware Workstation 10.0.0 build-1295980

centos 6.5 32位(系统ip:192.168.10.50,与物理机桥接,保证可以上外网)

所需的压缩包及下载地址

mysql-5.1.72-linux-i686-glibc23

http://mirrors.sohu.com/mysql/MySQL-5.1/mysql-5.1.72-linux-i686-glibc23.tar.gz

php-5.3.28

http://mirrors.sohu.com/php/php-5.3.28.tar.gz

httpd-2.2.31

http://mirrors.sohu.com/apache/httpd-2.2.31.tar.gz

Discuz_X3.2_SC_GBK

http://download.comsenz.com/DiscuzX/3.2/Discuz_X3.2_SC_GBK.zip

安装配置过程

  1. 安装mysql

[[email protected] ~]# cd /usr/local/src/

[[email protected] src]# wget http://mirrors.sohu.com/mysql/MySQL-5.1/mysql-5.1.72-linux-i686-glibc23.tar.gz

[[email protected] src]# tar zxvf mysql-5.1.72-linux-i686-glibc23.tar.gz

[[email protected] src]# mv mysql-5.1.72-linux-i686-glibc23 /usr/local/mysql

[[email protected] src]# useradd -s /sbin/nologin mysql

[[email protected] src]# cd /usr/local/mysql/

[[email protected] mysql]# mkdir -p /data/mysql

[[email protected] mysql]# chown -R mysql:mysql /data/mysql

[[email protected] mysql]# ./scripts/mysql_install_db --user=mysql --datadir=/data/mysql

WARNING: The host ‘peak‘ could not be looked up with resolveip.

This probably means that your libc libraries are not 100 % compatible

with this binary MySQL version. The MySQL daemon, mysqld, should work

normally with the exception that host name resolving will not work.

This means that you should use IP addresses instead of hostnames

when specifying MySQL privileges !

Installing MySQL system tables...

OK

Filling help tables...

OK

To start mysqld at boot time you have to copy

support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !

To do so, start the server, then issue the following commands:

./bin/mysqladmin -u root password ‘new-password‘

./bin/mysqladmin -u root -h peak password ‘new-password‘

Alternatively you can run:

./bin/mysql_secure_installation

which will also give you the option of removing the test

databases and anonymous user created by default.  This is

strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:

cd . ; ./bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl

cd ./mysql-test ; perl mysql-test-run.pl

Please report any problems with the ./bin/mysqlbug script!

#这里进行初始化,有两个OK表示没有问题#

[[email protected] mysql]# cp support-files/my-large.cnf /etc/my.cnf

[[email protected] mysql]# cp support-files/mysql.server /etc/init.d/mysqld

[[email protected] mysql]# chmod 755 /etc/init.d/mysqld

[[email protected] mysql]# vim /etc/init.d/mysqld

basedir=    #大概在46行#

datadir=    #大概在47行#

改为

basedir=/usr/local/mysql

datadir=/data/mysql

保存退出

[[email protected] mysql]# chkconfig --add mysqld

[[email protected] mysql]# chkconfig mysqld on

[[email protected] mysql]# service mysqld start

Starting MySQL..                                           [确定]

[[email protected] mysql]# ps aux |grep mysql  #可以看下mysql是否启动#

2.安装Apache

[[email protected] mysql]# cd /usr/local/src/

[[email protected] src]# wget http://mirrors.sohu.com/apache/httpd-2.2.31.tar.gz

[[email protected] src]# tar zxvf httpd-2.2.31.tar.gz

[[email protected] src]# cd httpd-2.2.31

[[email protected] httpd-2.2.31]# ./configure --prefix=/usr/local/apache2  --enable-mods-shared=most  --enable-so

[[email protected] httpd-2.2.31]# echo $?  #初始化配置完成后,可以通过该命令检查是否有错误,返回值是0则表示OK#

[[email protected] httpd-2.2.31]# make

[[email protected] httpd-2.2.31]# echo $?

0

[[email protected] httpd-2.2.31]# make install

[[email protected] httpd-2.2.31]# echo $?

0

[[email protected] httpd-2.2.31]# /usr/local/apache2/bin/apachectl start

#通过浏览器访问192.168.10.50,浏览器会显示It works!证明Apache已经安装好了#

apache加入chkconfig  #可以不用每次开机都自己启动Apache了#

[[email protected] www]# cp /usr/local/apache2/bin/apachectl /etc/init.d/httpd

cp:是否覆盖"/etc/init.d/httpd"? y

[[email protected] www]# vim /etc/init.d/httpd

在第一行#!/bin/sh下增加两行文字

# chkconfig: 35 70 30

# description: Apache

保存退出

[[email protected] www]# chkconfig --level 35 httpd on

3.安装php

[[email protected] httpd-2.2.31]# cd /usr/local/src/

[[email protected] src]# wget http://mirrors.sohu.com/php/php-5.3.28.tar.gz

[[email protected] src]# tar zxvf php-5.3.28.tar.gz

[[email protected] src]# cd php-5.3.28

[[email protected] php-5.3.28]# ./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   --with-gd   --with-jpeg-dir   --with-png-dir   --with-freetype-dir   --with-iconv-dir   --with-zlib-dir   --with-bz2   --with-openssl   --with-mcrypt   --enable-soap   --enable-gd-native-ttf   --enable-mbstring   --enable-sockets   --enable-exif   --disable-ipv6

[[email protected] php-5.3.28]# echo $?

0

一些常见的报错

configure: error: jpeglib.h not found.

解决方法:

yum -y install libjpeg-devel

继续编译参数

configure: error: mcrypt.h not found. Please reinstall libmcrypt.

解决方法:

[[email protected] php-5.3.28]# yum install -y epel-release.noarch

[[email protected] php-5.3.28]# yum -y install libmcrypt-devel

继续编译参数

[[email protected] php-5.3.28]# make

[[email protected] php-5.3.28]# echo $?

0

[[email protected] php-5.3.28]# make install

[[email protected] php-5.3.28]# echo $?

0

4.配置Apache结合php

[[email protected] php-5.3.28]# vim /usr/local/apache2/conf/httpd.conf

#ServerName www.example.com:80   #大概145行#

改为

ServerName localhost:80

<Directory />    #大概在162开始#

Options FollowSymLinks

AllowOverride None

Order deny,allow

Deny from all

</Directory>

改为

<Directory />

Options FollowSymLinks

AllowOverride None

Order deny,allow

Allow from all

</Directory>

<IfModule dir_module>   #大概213行#

DirectoryIndex index.html

</IfModule>

改为

<IfModule dir_module>

DirectoryIndex index.html index.htm index.php

</IfModule>

AddType application/x-gzip .gz .tgz  #大概356行#

下面增加

AddType application/x-httpd-php .php

保存退出

5.测试php解析

[[email protected] ~]# vim /usr/local/apache2/htdocs/1.php

写入:

<?php

echo "php解析正常";

?>

保存退出

[[email protected] ~]# curl localhost/1.php

php解析正常

#如果不能正常解析php,查看/usr/local/apache2/conf/httpd.conf#

[[email protected] ~]# vim /usr/local/apache2/htdocs/info.php

写入:

<?php

phpinfo();

?>

保存退出

通过浏览器访问192.168.10.50/info.php

6.安装Discuz

[[email protected] ~]# mkdir /data/www

[[email protected] ~]# cd /data/www/

[[email protected] www]# wget http://download.comsenz.com/DiscuzX/3.2/Discuz_X3.2_SC_GBK.zip

[[email protected] www]# unzip Discuz_X3.2_SC_GBK.zip

[[email protected] www]# mv upload/* ./

配置Apache配置文件启动虚拟主机

[[email protected] www]# vim /usr/local/apache2/conf/httpd.conf

#Include conf/extra/httpd-vhosts.conf  #大概444行#

改为

Include conf/extra/httpd-vhosts.conf

修改虚拟主机配置文件

[[email protected] www]# vim /usr/local/apache2/conf/extra/httpd-vhosts.conf

只留一个虚拟机配置

<VirtualHost *:80>

ServerAdmin [email protected]

DocumentRoot "/usr/local/apache2/docs/dummy-host.example.com"

ServerName dummy-host.example.com

ServerAlias www.dummy-host.example.com

ErrorLog "logs/dummy-host.example.com-error_log"

CustomLog "logs/dummy-host.example.com-access_log" common

</VirtualHost>

改为

<VirtualHost *:80>

DocumentRoot "/data/www"

ServerName www.peak.com

#ErrorLog "logs/dummy-host.example.com-error_log"

#CustomLog "logs/dummy-host.example.com-access_log" common

</VirtualHost>

保存退出

[[email protected] www]# /usr/local/apache2/bin/apachectl -t

Syntax OK

修改discuz目录权限

[[email protected] www]# chown -R daemon config/ data/ uc_client/data/ uc_server/data/

配置mysql

[[email protected] www]# mysql

mysql> create database discuz;

Query OK, 1 row affected (0.00 sec)

mysql> grant all on discuz.* to ‘peak‘@‘localhost‘ identified by ‘123456‘;

Query OK, 0 rows affected (0.04 sec)

mysql> quit

Bye

[[email protected] www]# /usr/local/apache2/bin/apachectl restart

在C:\Windows\System32\drivers\etc修改hosts文件添加dns解析

192.168.10.50 www.peak.com

浏览器访问192.168.10.50

出现Discuz安装界面,点我同意,环境检查点下一步,设置运行环境,选择全新安装点下一步,数据库配置如图,下一步,直到安装完成。

浏览器再访问192.168.10.50就可以访问自己的论坛了,至此大功告成!

时间: 2024-12-20 02:17:36

peak学Linux--基于centos 6.5搭建LAMP并安装Discuz X3.2的相关文章

基于CentOS 5.4搭建nginx+php+spawn-fcgi+mysql高性能php平台

一.安装准备 1.1平台环境: CentOS 5.4 x86_64 GNU/Linux nginx-0.8.21 php-5.2.9 spawn-fcgi-1.6.3 mysql-5.1.34 .2系统安装及分区:1.2.1操作系统安装:         安装过程中选择最少的包,采用文本模式安装,不安装图形.1.2.3系统分区:         /boot  100M    (大约100左右)          SWAP  4G      物理内存的2倍(如果你的物理内存大于4G,分配4G即可)

基于CentOS与VmwareStation10搭建hadoop环境

基于CentOS与VmwareStation10搭建hadoop环境     目  录 1.         概述.... 1 1.1.     软件准备.... 1 1.2.     硬件准备.... 1 2.         安装与配置虚拟机.... 2 2.1.     创建虚拟机.... 2 2.1.1.     创建虚拟机节点1.. 2 2.1.2.     创建虚拟机节点2.. 4 2.1.3.     创建虚拟机节点3.. 4 2.2.     安装操作系统CentOS6.0..

基于CentOS与VmwareStation10搭建Oracle11G RAC 64集群环境:3.安装Oracle RAC-3.6.集群管理命令

3.6. 集群管理命令 3.6.1. RAC的启动与关闭 oracle rac默认会开机自启动,如需维护时可使用以下命令: 关闭: crsctl stop cluster 停止本节点集群服务 crsctl stop cluster –all 停止所有节点服务 开启: crsctl start cluster 开启本节点集群服务 crsctl stop cluster –all 开启所有节点服务 注:以上命令需以 root用户执行 3.6.2.RAC检查运行状况 以grid 用户运行 [[emai

基于CentOS 6.6搭建Zabbix2.4.x

基于CentOS 6.6搭建Zabbix2.4.x 安装YUM源 wget http://mirrors.163.com/.help/CentOS6-Base-163.repo wget http://repo.zabbix.com/zabbix/2.4/rhel/6/x86_64/zabbix-release-2.4-1.el6.noarch.rpm wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noar

基于RHEL5.9系统搭建LAMP平台

LAMP平台的搭建 LAMP平台是指:Linux操作系统,Apache网站服务,Mysql数据库,PHP脚本支持 LAMP平台安装方式有两种:RPM方式安装和源码包安装 两种安装方式的优缺点: RPM方式:安装过程简易方便但不支持用户对功能模块的自定义,灵活性较差 源码包编译方式:安装过程繁琐,支持用户自定义安装路径与功能模块,灵活性较好,应用广泛 一.RPM方式搭建LAMP平台: 实验要求:使用RHEL5.9x64操作系统,配置yum仓库 实验步骤: 1.配置yum源 (略) 2.yum安装软

Centos 6.4搭建LAMP

网上关于LAMP的文章很多,但是一部分因为系统环境或软件升级原因不能使用或者有一些小小的问题,本文由网上资料整理得出,在centos6.4及6.2系统上经过验证,如有问题可以留言大家相互讨论,本人新手,希望能够一起学习进步. 需要软件列表 apr-1.5.0.tar.bz2 apr-util-1.5.3.tar.bz2 zlib-1.2.8.tar.gz pcre-8.34.tar.gz httpd-2.4.9.tar.gz php-5.5.6.tar.gz mysql-5.5.25.tar.g

Linux之使用rpm包搭建LAMP

如今,众多的大中小型企业都在使用LAMP来运行动态网站或者服务器,那么LAMP到底是什么呢? 一.LAMP简介 LAMP是一组自由软件,由Linux.Apache.Mysql.PHP组成,这些本来是各自独立的程序,但是由于实际环境中常常放在一起来使用,所以这些程序之间的兼容性也越来越好,就共同组成了一个强大的WEB应用程序平台. 二.各程序介绍 由于Linux和Apache之前的博文已经介绍过了,这里就不再过多的叙述. Mysql是一种多用户多线程的数据库管理系统 数据模型:层析模型 网状模型

Linux(CentOS 6.4)系统中安装mplayer

整了一个上午终于把mplayer安装上了,我的系统是centos 6.4,真是不容易啊! 一.准备工作 需要的安装包及下载地址:1.mplayer源代码包(MPlayer-1.0rc4.tar.bz2)下载:http://www.mplayerhq.hu/MPlayer/releases/2.解码器安装包(all-20110131.tar.bz2)下载:http://www.mplayerhq.hu/MPlayer/releases/codecs/3.win32解码器安装包(windows-al

基于CentOS7的服务器搭建(LAMP环境)

基于CentOS7的服务器环境搭建(LAMP环境) 一.安装MySQL组件 1.由于在CentOS7中,默认yum安装库中不含有mysql,我们可以下载mysql的分支MariaDB,如果必须要下mysql,可以通过下载mysql官方的yum库,再利用yum install *进行mysql的安装 yum -y install mariadb-server 2.启动服务 service mysqld restart systemctl restart mysqld.service 3.修改mys