192.168.80.102布置SVN
192.168.80.103布置nginx
192.168.80.104布置PHP
192.168.80.100布置mysql
192.168.80.106布置安装Discuz

在192.168.80.102上:
systemctl stop firewalld
yum install -y subversion

svnserve --version //查看版本信息

vi /etc/sysconfig/svnserve
/var/svn => /opt/svn 将默认修改为/opt/svn

使用svnadmin建立版本库
mkdir -p /opt/svn/repo //创建/opt/svn/repo目录
svnadmin create /opt/svn/repo/ //创建一个新的仓库

调整SVN参数
cd /opt/svn/repo/conf/

vi svnserve.conf //总体配置
去掉注释,修改以下内容:
anon-access = none //匿名用户没有任何权限
auth-access = write //认证用户具有写权限
password-db = /opt/svn/repo/conf/passwd //用户的密码文件
authz-db = /opt/svn/repo/conf/authz //用户信息文件

启动SVN服务
svnserve -d -r /opt/svn/repo/ //以守护模式启动SVN服务,关闭用kill pid
netstat -anptu | grep svnserve //3690端口监听

vi passwd //配置账户密码文件
andrew = andrewpass //格式:用户名 = 用户密码

vi authz //配置权限文件
[/]
andrew = r

[/webphp] //指定目录
andrew = r //运维工程师账户具有读权限,用于部署

mkdir /opt/svn/repo/webphp //创建要被管理的目录
cd /opt/svn/repo/
vi webphp/index.php

<?phpphpinfo();?>

svn import webphp file:///opt/svn/repo/webphp/ -m “init web” //初始化目录,导入webphp

在192.168.80.103上:
yum -y install pcre-devel zlib-devel gcc gcc-c++ make

useradd -M -s /sbin/nologin nginx

tar xzvf nginx-1.13.7.tar.gz -C /opt

cd /opt/nginx-1.13.7

./configure
–prefix=/usr/local/nginx
–user=nginx
–group=nginx
–with-http_stub_status_module

make && make install

ln -s /usr/local/nginx/sbin/nginx /usr/local/sbin/

nginx -t

制作管理角本
vi /etc/init.d/nginx
#!/bin/bash

chkconfig: 35 99 20

description: Nginx Service Control Script

PROG="/usr/local/nginx/sbin/nginx"
PIDF="/usr/local/nginx/logs/nginx.pid"
case “$1” in
start)
$PROG
;;
stop)
kill -s QUIT $(cat $PIDF)
;;
restart)
$0 stop
$0 start
;;
reload)
kill -s HUP $(cat $PIDF)
;;
*)
echo “Usage: $0 {start|stop|restart|reload}”
exit 1
esac
exit 0

chmod +x /etc/init.d/nginx
chkconfig --add nginx

vi /usr/local/nginx/conf/nginx.conf

user nginx nginx;
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
location / {
root html/webphp;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$ {
proxy_pass http://192.168.80.104:9000;
expires 30d;
}
location ~ .php$ {
root /var/www/html/webphp;
fastcgi_pass 192.168.80.104:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/html/webphp$fastcgi_script_name;
include fastcgi_params;
}
}
}

service nginx restart
netstat -anpt | grep nginx

安装svn
yum install subversion -y
cd /usr/local/nginx/html/
svn co svn://192.168.80.102/webphp
mv index.html webphp/
在浏览器上访问192.168.80.103进行测试
mkdir -p /var/www/html
cd /var/www/html
svn co svn://192.168.80.102/webphp

yum install nfs-utils -y
mount 192.168.80.106:/opt/web/ /usr/local/nginx/html/webphp/

在192.168.80.104上:
yum -y install
libjpeg
libjpeg-devel
libpng libpng-devel
freetype freetype-devel
libxml2
libxml2-devel
zlib zlib-devel
curl curl-devel
openssl openssl-devel

yum install -y gcc gcc-c++ make

tar xjvf php-7.1.24.tar.bz2
cd php-7.1.24
./configure
–prefix=/usr/local/php
–with-mysql-sock=/usr/local/mysql/mysql.sock
–with-mysqli
–with-zlib
–with-curl
–with-gd
–with-jpeg-dir
–with-png-dir
–with-freetype-dir
–with-openssl
–enable-mbstring
–enable-xml
–enable-session
–enable-ftp
–enable-pdo
–enable-tokenizer
–enable-zip
–enable-fpm

make && make install

cp php.ini-development /usr/local/php/lib/php.ini
vi /usr/local/php/lib/php.ini
mysqli.default_socket = /usr/local/mysql/mysql.sock
date.timezone = Asia/Shanghai

cd /usr/local/php/etc/
cp php-fpm.conf.default php-fpm.conf
cd /usr/local/php/etc/php-fpm.d/
cp www.conf.default www.conf

vi www.conf
listen = 0.0.0.0:9000

cd /usr/local/php/etc/
vi php-fpm.conf

;pid = run/php-fpm.pid
;user = nginx
;group = nginx

/usr/local/php/sbin/php-fpm -c /usr/local/php/etc/php.ini
netstat -anpt | grep 9000
ln -s /usr/local/php/bin/* /usr/local/bin/
ps aux | grep -c “php-fpm”

yum install subversion -y
mkdir -p /var/www/html
cd /var/www/html
svn co svn://192.168.80.102/webphp

进行对Disczu的挂载
yum install nfs-utils -y
mount 192.168.80.106:/opt/web/ /var/www/html/webphp/

在192.168.80.100上:
yum install -y gcc gcc-c++ make

yum -y install
ncurses
ncurses-devel
bison
cmake

useradd -s /sbin/nologin mysql

tar xf mysql-boost-5.7.20.tar.gz
cd mysql-5.7.20/

cmake
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql
-DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock
-DSYSCONFDIR=/etc
-DSYSTEMD_PID_DIR=/usr/local/mysql
-DDEFAULT_CHARSET=utf8
-DDEFAULT_COLLATION=utf8_general_ci
-DWITH_INNOBASE_STORAGE_ENGINE=1
-DWITH_ARCHIVE_STORAGE_ENGINE=1
-DWITH_BLACKHOLE_STORAGE_ENGINE=1
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1
-DMYSQL_DATADIR=/usr/local/mysql/data
-DWITH_BOOST=boost
-DWITH_SYSTEMD=1

make && make install

chown -R mysql.mysql /usr/local/mysql/

vi /etc/my.cnf

[client]
port = 3306
default-character-set=utf8
socket = /usr/local/mysql/mysql.sock

[mysql]
port = 3306
default-character-set=utf8
socket = /usr/local/mysql/mysql.sock

[mysqld]
user = mysql
basedir = /usr/local/mysql
datadir = /usr/local/mysql/data
port = 3306
character_set_server=utf8
pid-file = /usr/local/mysql/mysqld.pid
socket = /usr/local/mysql/mysql.sock
server-id = 1

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_AUTO_VALUE_ON_ZERO,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,PIPES_AS_CONCAT,ANSI_QUOTES

echo ‘PATH=/usr/local/mysql/bin:/usr/local/mysql/lib:$PATH’ >> /etc/profile
echo ‘export PATH’ >> /etc/profile
source /etc/profile

bin/mysqld
–initialize-insecure
–user=mysql
–basedir=/usr/local/mysql
–datadir=/usr/local/mysql/data

cp usr/lib/systemd/system/mysqld.service /usr/lib/systemd/system/
systemctl daemon-reload
systemctl start mysqld
netstat -anpt | grep 3306

systemctl enable mysqld

进入数据库
mysql
CREATE DATABASE bbs;
GRANT all ON bbs.* TO ‘bbsadm’@’%’ IDENTIFIED BY ‘admin123’;
GRANT all ON bbs.* TO ‘bbsadm’@‘localhost’ IDENTIFIED BY ‘admin123’;
flush privileges;
在192.168.80.106上:
yum install nfs-utils lrz* -y

mkdir /opt/web

vi /etc/exports

/opt/web 192.168.80.0/24(rw,sync)

systemctl start rpcbind
systemctl start nfs
systemctl enable rpcbind
systemctl enable nfs
yum install unzip -y
unzip Discuz_X3.4_SC_UTF8_0101.zip -d /opt/
cd /opt/dir_SC_UTF8/
cp -rf upload/* /opt/web/
cd /opt/web/
cd …
chmod -R 777 web/

最后在浏览器上进行测试
http://192.168.80.103/web/install/index.php
我们会进入到discuz论坛的安装界面。

12-10 03:42