魏蓝

以梦为马

导航

利用LNMP实现可道云私有云

一、环境准备

 

 

10.0.0.20:centos7 nginx1.18 php-fpm7.4 kodbox1.31
10.0.0.22: centos8 mysql8.0 redis5.0.3

二、部署

1、10.0.0.20(LNP)

1)安装nginx,可以通过官方源安装(我是编译安装)都一样

官方源
https://nginx.org/en/linux_packages.html#RHEL-CentOS
vim /etc/yum.repos.d/nginx.repo
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true

[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true

sudo yum-config-manager --enable nginx-mainline

sudo yum install nginx

 

 2)安装php-fpm(这里我们直接通过清华大学的源安装)

yum install -y https://mirrors.tuna.tsinghua.edu.cn/remi/enterprise/remi-release-7.rpm
yum list php74* | grep redis5

 

 安装php相关配置包

yum install -y php74-php-fpm php74-php-mysqlnd php74-php-pecl-redis5 php74-php-xml php74-php-gd php74-php-mbstring

 

 

2.10.0.0.22(mysql、redis)

1)安装mysql

centos8直接yum

yum install -y mysql-server

2)安装redis

centos8直接yum

yum install -y redis

 

三、配置服务

1.10.0.0.22(mysql、redis)

1)配置mysql

创建数据库及账号并赋予权限

systemctl enable --now mysqld
mysql
>create database kodbox; >create user kodbox@'10.0.0.%' identified by '123456'; >grant all on kodbox.* to kodbox@'10.0.0.%';

2)配置redis

sed -i 's/^bind.*/bind 0.0.0.0/' /etc/redis.conf

启动服务

systemctl enable --now redis

 

 

2.10.0.0.20(LNP)

1)配置nginx服务

创建一个文件夹来存放可道云的程序

mkdir -pv /data/html

捣鼓nginx配置文件

vim /usr/local/nginx/conf/nginx.conf
#在http的最后的大括号前追加
include /data/nginx/conf/*.conf;
#检查语法
nginx -t
#创建相对应的文件
mkdir -pv /data/nginx/conf
#配置
vim /data/nginx/conf/kodbox.conf
server {
        listen 80;
        server_name www.weige.org;
        root /data/html;
        location / {
                index index.php index.html;
        }
        location ~ \.php$ {
                fastcgi_pass 127.0.0.1:9000;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;
        }
}

nginx -t
nginx -s reload

2)配置php支持redis服务

vim /etc/opt/remi/php74/php-fpm.d/www.conf
user = nginx
group = nginx

#文件最后修改以下两行
php_value[session.save_handler] = redis
php_value[session.save_path] = "tcp://10.0.0.22.6379"

启动php-fpm

systemctl enable --now php74-php-fpm.service

 

 3.准备可道云

wget https://static.kodcloud.com/update/download/kodbox.1.31.zip
unzip kodbox.1.31.zip -d /data/html/
chown -R nginx.nginx /data/html/

 

四、初始化和登录可道云

 

 

 

 

 

 

 

 

 

 结束!

 

posted on 2022-05-25 00:18  魏蓝  阅读(163)  评论(0编辑  收藏  举报