公有云上安装discuze,docker安装redis
服务器安装discuze
1.先下载discuze包
wget https://sandbox-experiment-resource-north-4.obs.cn-north-4.myhuaweicloud.com/discuz-deploy/Discuz_X3.2_SC_UTF8.zip
2.解压
unzip Discuz_X3.2_SC_UTF8.zip
3.把解压的upload下的所有文件复制到/var/www/html/
rm -rf /var/www/html/index.php //如果有安装php测试文件则需要删除
cp -r upload/* /var/www/html/
4.给文件赋权限
chmod -R 777 /var/www/html
5.重启apache服务
systemctl restart httpd
6.浏览器输入地址,进行web安装
http://弹性ip地址/install
…
ping 内网ip
容器安装redis
在一台redis服务器上操作(脚本)
1.安装docker,在docker中安装redis
touch docker.sh
cat >>/home/docker.sh<<EOF
#!/bin/bash
#
#*********************************
#Author: catgod007
#QQ: 2337563298
#Date: 2021-10-3
#FileName: docker.sh
#********************************
yum install docker -y
systemctl start docker.service
docker search redis
docker pull redis:latest
docker images
mkdir -p /home/docker/redis/{conf,data}
cd /home/docker/redis
wget https://raw.githubusercontent.com/antirez/redis/4.0/redis.conf -O conf/redis.conf
read -p "Please input password: " passwword
sed -i 's/^bind 127.0.0.1.*/#bind 127.0.0.1/' conf/redis.conf
sed -i 's/^protected-mode yes/protected-mode no/' conf/redis.conf
sed -i 's/logfile ""/logfile "access.log"/' conf/redis.conf
sed -i 's/# requirepass foobared/requirepass $passwword/' conf/redis.conf
sed -i 's/appendonly no/appendonly yes/' conf/redis.conf
systemctl status docker
docker run \
-p 6379:6379 \
-v $PWD/data:/data \
-v $PWD/conf/redis.conf:/etc/redis/redis.conf \
--privileged=true \
--name myredis \
-d redis redis-server /etc/redis/redis.conf
docker ps
#docker run -it --link myredis:redis --rm redis redis-cli -h redis_host -p 6379
EOF
chmod +x /home/docker.sh
docker exec -it docker id /bin/bash //换成自己容器的id
redis-cli -a 输入的密码
(客户端)
2.配置redis相关参数
在html目录中
vim config/config_global.php
输入/redis
加入如下:
server后加入redis的内网ip
requirepass后加入密码
保存退出wq
systemctl restart httpd
yum install gcc make -y
3.下载安装phpredis(phpredis测试插件)
wget -c https://github.com/phpredis/phpredis/archive/4.3.0.tar.gz
tar zvxf 4.3.0.tar.gz
cd phpredis-4.3.0/
phpize(php初始化)
./configure --with-php-config=/usr/bin/php-config --enable-redis(预编译)
make && make install(安装)
4.在php配置文件中添加redis模块
vim /etc/php.ini
extension_dir = "/usr/lib64/php/modules/" //可以不要
extension="redis.so"
5.重启httpd服务
systemctl restart httpd
感谢大家,点赞,收藏,关注,评论!