实战从源码编译LAMP架构+Discuz搭建bbs论坛

实验环境:RHEL6.5  server1.example.com 172.25.254.1

实验环境:RHEL6.5

实验内容:1.MYSQL源码编译

                2.NGINX源码编译

                3.PHP源码编译

                4.搭建论坛

安装包:cmake-2.8.12.2-4.el6.x86_64.rpm 

             mysql-boost-5.7.11.tar.gz

             gd-devel-2.0.35-11.el6.x86_64.rpm  

             nginx-1.9.14.tar.gz  

             re2c-0.13.5-1.el6.x86_64.rpm

             php-5.6.19.tar.bz2

    Discuz_X3.2_SC_UTF8.zip

1.MYSQL源码编译

1)

[[email protected] 1.mysql编译]# ls

cmake-2.8.12.2-4.el6.x86_64.rpm   mysql-boost-5.7.11.tar.gz

[[email protected] 1.mysql编译]# tar -zxf mysql-boost-5.7.11.tar.gz

[[email protected] 1.mysql编译]# cd mysql-5.7.11

2 )

[[email protected] 1.mysql编译]# yum update cmake-2.8.12.2-4.el6.x86_64.rpm 

[[email protected] mnt]# yum install cmake gcc gcc-c++ ncurses-devel bison -y

3) cmake \          #检查编译环境

-DCMAKE_INSTALL_PREFIX=/usr/local/lnmp/mysql  \    ##安装路径

-DMYSQL_DATADIR=/usr/local/lnmp/mysql/data \    ##数据路径

-DMYSQL_UNIX_ADDR=/usr/local/lnmp/mysql/data/mysql.sock \    #套接字接口

-DWITH_MYISAM_STORAGE_ENGINE=1  \       ##mysql引擎

-DWITH_INNOBASE_STORAGE_ENGINE=1  \

-DDEFAULT_CHARSET=utf8    \        ##使用utf8字符

-DDEFAULT_COLLATION=utf8_general_ci     \        ##校验字符

-DEXTRA_CHARSETS=all \            ##安装所有扩展字符集

-DWITH_BOOST=boost/boost_1_59_0/ \        ##boost路径

[[email protected] mysql-5.7.11]# make             ###编译

[[email protected] mysql-5.7.11]# make install     ###安装

注意:

rm -fr CMakeCache.txt    ##错误解决完毕每次删除

lscpu   ##检测cpu

top  按1     ##检测每个cpu负载

make -j2##用两个cpu做编译

4)设定mysql信息

[[email protected] php-5.6.19]# groupadd -g 27 mysql

[[email protected] php-5.6.19]# useradd -u 27 -g 27 -s /bin/false mysql

[[email protected] php-5.6.19]# cp /usr/local/lnmp/mysql/support-files/mysql.server /etc/init.d/

[[email protected] php-5.6.19]# mv /etc/my.cnf /etc/my.cnf.bak

[[email protected] php-5.6.19]# cp /usr/local/lnmp/mysql/support-files/my-default.cnf /etc/my.cnf

[[email protected] php-5.6.19]# vim /etc/profile

PATH=$PATH:/usr/local/lnmp/mysql/bin

[[email protected] php-5.6.19]# source /etc/profile

[[email protected] php-5.6.19]# chown -R mysql.mysql /usr/local/lnmp/mysql

[[email protected] php-5.6.19]# mysqld --initialize --user=mysql

( --initialize-insecure ##密码为空,--user=mysql ##运行用户 --basedir=    ##mysql基本目录 --datadir= ##mysql数据目录)

2016-09-15T04:12:17.004704Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

。。。。。。。。。。。。。。

2016-09-15T04:12:17.626882Z 1 [Note] A temporary password is generated for [email protected]: jT!#LrMg-5t1    《《《数据库密码(安全初始化时需要使用)

[[email protected] php-5.6.19]# chown -R root /usr/local/lnmp/mysql/

[[email protected] php-5.6.19]# chown -R mysql /usr/local/lnmp/mysql/data/

[[email protected] php-5.6.19]# /etc/init.d/mysql.server start

[[email protected] php-5.6.19]# mysql_secure_installation   ####安全初始化

Securing the MySQL server deployment.

Enter password for user root:         ###此处输入前边产生的密码

Press y|Y for Yes, any other key for No: y

Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 1    ##选择密码类型

Change the password for root ? ((Press y|Y for Yes, any other key for No) : y   ###修改密码

New password:

Re-enter new password:

Estimated strength of the password: 100

Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y

Remove anonymous users? (Press y|Y for Yes, any other key for No) : y

Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y

All done!

2.NGINX源码编译

    2.1关闭debug调式模式,屏蔽nginx版本号

[[email protected] mnt]# tar -zxf nginx-1.9.14.tar.gz 

[[email protected] mnt]# cd nginx-1.9.14

[[email protected] nginx-1.9.14]# vim src/core/nginx.h    ##伪装版本

#define nginx_version      1009014

#define NGINX_VERSION      "1.9.14"

#define NGINX_VER          "willis/"

[[email protected] nginx-1.9.14]# vim auto/cc/gcc  ##关闭debug调式

178 # debug

179 #CFLAGS="$CFLAGS -g"

[[email protected] fpm]# groupadd -g 666 nginx

[[email protected] fpm]# useradd -u 666 -g 666 -s /sbin/nologin nginx

 2.2编译安装

[[email protected] nginx-1.9.14]# yum  insall pcre-devel openssl-devel -y

[[email protected] nginx-1.9.14]# ./configure \

> --prefix=/usr/local/lnmp/nginx \

> --with-http_ssl_module \

> --with-http_stub_status_module    ##监控模块

[[email protected] nginx-1.9.14]# make

[[email protected] nginx-1.9.14]# make  install

[[email protected] nginx-1.9.14]# cd /usr/local/lnmp/nginx/

[[email protected] nginx]# vim /etc/profile

export PATH=$PATH:/usr/local/lnmp/mysql/bin:/usr/local/lnmp/nginx/sbin

[[email protected] nginx]# source /etc/profile

[[email protected] nginx]# nginx     ##开启nginx

[[email protected] nginx]# netstat -antple |grep nginx

tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      0          181762     29192/nginx

[[email protected] nginx]# curl -I localhost   ##检测http协议提供程序

HTTP/1.1 200 OK

Server: willis/       ###显示版本已经隐藏

Date: Thu, 15 Sep 2016 04:48:49 GMT

Content-Type: text/html

Content-Length: 612

Last-Modified: Wed, 14 Sep 2016 21:26:20 GMT

Connection: keep-alive

ETag: "57d9c07c-264"

Accept-Ranges: bytes

[[email protected] nginx]# du -sh /usr/local/lnmp/nginx/      ###轻量级nginx

944K /usr/local/lnmp/nginx/

[[email protected] nginx]# nginx -t          ##检测nginx配置

nginx: the configuration file /usr/local/lnmp/nginx/conf/nginx.conf syntax is ok

nginx: configuration file /usr/local/lnmp/nginx/conf/nginx.conf test is successful

[[email protected] nginx]# nginx -s reload     ##加载配置

3.PHP源码编译

    3.1编译安装php

[[email protected] mnt]# ls

gd-devel-2.0.35-11.el6.x86_64.rpm   re2c-0.13.5-1.el6.x86_64.rpm   php-5.6.19.tar.bz2

[[email protected] mnt]# yum install libxml2-devel  curl-devel  gd-devel-2.0.35-11.el6.x86_64.rpm   gmp-devel  net-snmp-devel.x86_64  re2c-0.13.5-1.el6.x86_64.rpm  -y

[[email protected] mnt]# tar -jxf php-5.6.19.tar.bz2 

[[email protected] mnt]# cd php-5.6.19

[[email protected] php-5.6.19]# ./configure --prefix=/usr/local/lnmp/php \

> --with-config-file-path=/usr/local/lnmp/php/etc \

> --with-mysql=mysqlnd \##自动加载mysql信息

> --with-mysqli=mysqlnd \

> --with-pdo-mysql=mysqlnd \

> --with-openssl \

> --with-snmp \##加载简单网管协议

> --with-gd \##支持图形

> --with-zlib \##支持网页压缩

> --with-curl \##支持文本浏览

> --with-libxml-dir \##支持xml

> --with-png-dir \##支持png图片

> --with-jpeg-dir \##支持jpeg

> --with-freetype-dir \

> --without-pear \##不联网安装

> --with-gettext \##

> --with-gmp \##支持gmp

> --enable-inline-optimization \

> --enable-soap \##支持动态加载模块

> --enable-ftp \##支持ftp

> --enable-sockets \##支持套结字

> --enable-mbstring \

> --enable-fpm \

> --with-fpm-user=nginx \##使php和nginx权限一致

> --with-fpm-group=nginx

[[email protected] php-5.6.19]# make

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

    3.2php 配置

[[email protected] php-5.6.19]# cp php.ini-production /usr/local/lnmp/php/etc/php.ini

[[email protected] php-5.6.19]# cd /usr/local/lnmp/php/etc

[[email protected] etc]# cp php-fpm.conf.default  php-fpm.conf

[[email protected] etc]# vim php-fpm.conf

25 pid = run/php-fpm.pid

[[email protected] etc]# vim php.ini 

925 date.timezone = Asia/Shanghai

1001 pdo_mysql.default_socket=/usr/local/lnmp/mysql/data/mysql.sock

1150 mysql.default_socket=/usr/local/lnmp/mysql/data/mysql.sock

1209 mysqli.default_socket=/usr/local/lnmp/mysql/data/mysql.sock

[[email protected] etc]# cd /mnt/php-5.6.19/sapi/fpm/

[[email protected] fpm]# mv  init.d.php-fpm  /etc/init.d/fpm     

[[email protected] fpm]# chmod +x /etc/init.d/fpm 

[[email protected] fpm]# chmod 775 /usr/local/ln

[[email protected] fpm]# /etc/init.d/fpm start

[[email protected] fpm]# vim /etc/profile

export  PATH=$PATH: /usr/local/lnmp/php/bin: /usr/local/lnmp/php/sbin

[[email protected] fpm]# source /etc/profile

[[email protected] fpm]# php -m ##查看php支持插件

    3.3配置nginx使其支持php

[[email protected] fpm]# vim /usr/local/lnmp/nginx/html/index.php  ##php测试页

<?php

phpinfo();

?>

[[email protected] fpm]# vim /usr/local/lnmp/nginx/conf/nginx.conf

47         location / {

48             root   html;

49             index  index.php index.html index.htm;

50         }

73         location ~ \.php$ {

74             root           html;

75             fastcgi_pass   127.0.0.1:9000;

76             fastcgi_index  index.php;

77             fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;

78             include        fastcgi.conf;   ##修改成存在的名称

79         }

[[email protected] fpm]# nginx -t

nginx: the configuration file /usr/local/lnmp/nginx/conf/nginx.conf syntax is ok

nginx: configuration file /usr/local/lnmp/nginx/conf/nginx.conf test is successful

[[email protected] fpm]# nginx -s reload

    3.4 测试nginx对php支持





4.搭建论坛

    4.1新建数据库并赋权限

[[email protected] mnt]# ls

Discuz_X3.2_SC_UTF8.zip

[[email protected] mnt]# unzip Discuz_X3.2_SC_UTF8.zip  -d /usr/local/lnmp/nginx/html

[[email protected] mnt]# cd /usr/local/lnmp/nginx/html

[[email protected] html]# mv upload/ bbs

[[email protected] html]# chmod -R 777 bbs/

[[email protected] html]# mysql -uroot -p

    mysql> CREATE DATABAsE discuz;

Query OK, 1 row affected (0.00 sec)

    mysql> CREATE USER [email protected] identified by ‘Willis123./‘;

Query OK, 0 rows affected (0.00 sec)

    mysql> GRANT ALL ON discuz.* to [email protected] identified by ‘Willis123./‘;

Query OK, 0 rows affected, 1 warning (0.00 sec)

4.2网页搭建论坛















    搞定.

时间: 2024-10-04 16:40:53

实战从源码编译LAMP架构+Discuz搭建bbs论坛的相关文章

实战LAMP架构+Discuz搭建bbs论坛

LAMP架构:Lnux+Apache+Mysql+Php 实验环境:RHEL7.0 server1.example.com 172.25.254.6 实验内容:1.Linux环境配置                     2.Apache环境                     3.php环境                     4.Mysql环境                     5.论坛搭建测试 论坛安装包:Discuz_X3.2_SC_UTF8.zip     1.Linu

在CentOS6上使用源码编译LAMP平台

最近在学习重要的Web服务,当然也就少不了很重要的httpd和php.而动态网站必定又会使用数据库如mysql之类的,那么,今天就总结一下最近做的LAMP平台编译实验.具体过程如下. 实验名:在CentOS6上使用源码编译LAMP平台 实验环境:CentOS6.5,安装时选择了使用最多的两个开发包组. 使用系统默认基本yum源+epel6源(aliyun: http://mirrors.aliyun.com/repo/epel-6.repo) 使用源码包:httpd-2.4.9 ;二进制安装包m

源码安装LAMP架构

一. 实验目的通过源码部署LAMP环境并在此基础上部署phpmyadmin二. 实验内容在虚拟机中搭建网络YUM仓库,依次安装httpd php php-server mysql(mairadb)及各自的依赖的库和相关的工具包,并分别验证php和httpd的勾连,php和mysql的勾连,之后在网页根路径部署phpmyadmin,在浏览器验证即可,三. 实验环境与准备一台Centos6虚拟机,网卡设置为桥接模式,并连接xshell四. 实验分析与设计思路在Centos6搭建LAMP架构,首先搭建

实战Nginx源码编译安装与配置

实验环境:RHEL7.0    server1.example.com  172.25.254.1 实验内容:   1.准备                      2. 安装                      3.配置                      4.添加https                      5.虚拟主机                      6.<<nginx 监控小插件>>网站信息统计                      7.

生产场景:实战nginx源码编译安装

生产场景:nginx实战安装 一.准备环境: 1.1 操作系统:centos 6.7     安装常用软件 yum install tree telnet dos2unix sysstat lrzsz nc nmap zip unzip -y 1.2 官网下载ngnx源码包nginx-1.12.2.tar.gz,并隐藏nginx版本号和修改nginx软件名 下载nginx源码包nginx-1.12.2.tar.gz,并隐藏nginx版本号和修改nginx软件名(此步骤省略). 二.开始安装ngi

nodejs源码编译-mipse64el架构

下载nodejs,node-v6.1.0.tar.gz 链接: https://pan.baidu.com/s/1eCtNBWD5yaKiQIHp3pRKew 提取码: faun 注意对应版本的gcc,node-6.1.0需要最低版本gcc是4.3.8 x86 架构编译 解压node-v6.1.0.tar.gz tar zxvf node-v6.1.0.tar.gz 生成MakeFile文件 [[email protected] node]$ cd node-v6.1.0 [[email pro

源码编译安装Mysql5.7版本

1.源码编译安装mysql(5.7版本) 下载地址: https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-boost-5.7.18.tar.gz #(MySQL从5.7版本之后,boost是必须的,建议把系统自带的boost库卸载,源码编译安装高版本 Boost库是为C++语言标准库提供扩展的一些C++程序库的总称) (1)环境准备: [[email protected] ~]# ls mysql-boost-5.7.18.tar.gz  nginx

源码编译搭建LAMP架构

前述: 本次源码编译安装LAMP平台架构在一台CentOs 7虚拟机完成(穿插叙述叙述mariadb在另一台主机上配置方法),php5以模块形式编译安装到httpd服务器上,httpd服务器Apace多路处理模块(MPM)采用prefork机制. 下面为安装所用的的以下软件叙述: CentOS  7 IP:172.16.49.2:Kernel:3.10.0-229.el7.x86_64 MariaDB 通用二进制格式mariadb-5.5.46-linux-x86_64.tar httpd 编译

九周第四次课(2月26日) 11.1 LAMP架构介绍 11.2 MySQL、MariaDB介绍 11.3/11.4/11.5 MySQL安装 扩展 mysql5.5源码编译安装

11.1 LAMP架构介绍11.2 MySQL.MariaDB介绍11.3/11.4/11.5 MySQL安装扩展mysql5.5源码编译安装   http://www.aminglinux.com/bbs/thread-1059-1-1.html mysql5.7二进制包安装(变化较大)  http://www.apelearn.com/bbs/thread-10105-1-1.html =====================================================