centos 必要安装
更新源
yum -y update
下载redis5.0 wget 安装
yum -y install wget
安装redis
下载redis包
wget http://download.redis.io/releases/redis-5.0.0.tar.gz
解压
tar -xvzf redis-5.0.0.tar.gz
复制到对应目录
cp -Rf redis-5.0.0/* /data/server/redis
cd /data/server/redis5/
安装redis
make
如果出现上面错误执行 make MALLOC=libc
如果报下面错
linux redis release.c:37:10: fatal error: release.h: No such file or directory37 | #include “release.h”
解决方法:cd 到文件中的src目录
chmod +x mkreleasehdr.sh
在安装
make
新建文件目录用于后面自定义启动使用
mkdir my_redis_conf
cp redis.conf /data/server/redis5/my_redis_conf
设置对外可以访问
将 bind 127.0.0.1 使用#注释掉,改为# bind 127.0.0.1(bind配置的是允许连接的ip,默认只允许本机连接;若远程连接需注释掉,或改为0.0.0.0)
将 protected-mode yes 改为 protected-mode no(3.2之后加入的新特性,目的是禁止公网访问redis cache,增强redis的安全性)
将 requirepass foobared 注释去掉,foobared为密码,也可修改为别的值(可选,建议设置) 遮拦设置了 外部连接时密码就是foobared
daemonize no 把no改为yes(后台运行进程)
启动
src/redis-server /data/server/redis5/my_redis_conf/redis.conf
测试
$ src/redis-cli
127.0.0.1:6379> set name sean
OK
127.0.0.1:6379> get name
"sean"
127.0.0.1:6379>
以后台进程方式启动redis
第一步:修改redis.conf文件将
daemonize no
修改为
daemonize yes
安装参考案例
https://www.cnblogs.com/zuidongfeng/p/8032505.html
https://blog.csdn.net/m0_37027631/article/details/103766194
MySQL 安装
下载mysql源安装包 wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
安装mysql源 yum localinstall mysql57-community-release-el7-8.noarch.rpm
安装MySQL
yum install mysql-community-server
重启MySQL服务
systemctl restart mysqld
获取默认密码
grep 'temporary password' /var/log/mysqld.log
修改编码为utf-8
在/etc/my.cnf中 在mysqld标签下添加character_set_server = utf8
下面图错误解决方法
https://blog.csdn.net/memory6364/article/details/82426052
设置远程登录权限
设置允许远程连接数据库,命令如下: use mysql
update user set user.Host='%' where user.User='root';
刷新权限,命令如下:
flush privileges;
安装nginx
sudo yum install gcc-c++
sudo yum install -y pcre pcre-devel
sudo yum install -y openssl openssl-devel
添加用户
groupadd nginx
useradd -r -g nginx nginx
https://www.nginx.cn/install nginx官网安装
下载源码包:https://nginx.org/en/download.html
wget http://nginx.org/download/nginx-1.18.0.tar.gz
解压 tar -zxvf nginx-1.18.0.tar.gz
在目录 /data/soft/nginx-1.18.0/ 执行
./configure --prefix=/data/server/nginx
sudo make && make install
启动
/data/server/nginx/sbin/nginx -s reload
错误提示
nginx: [error] open() "/usr/local/nginx/logs/nginx.pid" failed (2: No such file or directory)
处理方法
/data/server/nginx/sbin/nginx -c /data/server/nginx/conf/nginx.conf
nginx 配置
include golang/*.conf;
server {
listen 8081;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
root /data/web/tp/public;
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
安装php
yum -y install bzip2-devel libcurl-devel libmcrypt-devel
yum install php-mcrypt
yum -y install libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel MySQL pcre-devel
yum -y install bison
yum -y install autoconf
yum -y install curl-devel
yum -y install libxslt-devel
yum install bzip2 bzip2-devel
wget https://www.php.net/distributions/php-7.2.11.tar.gz
tar -zxvf php-7.2.11.tar.gz
cp -Rf /data/soft/php-7.2.11/* /data/server/php7.2/
执行编译
./configure --prefix=/data/server/php7.2 --enable-fpm --disable-fileinfo
make && make install
编译出错 清除 重新编译make distclean
make clean 清除 继续编译
拷贝配置文件: 到对应目录去 cp
cp php.ini-production /data/server/php7.2/lib/php.ini
cp /data/server/php7.2/etc/php-fpm.conf.default php-fpm.conf
cp /data/server/php7.2/etc/php-fpm.d/www.conf.default www.conf
修改配置文件
https://www.cnblogs.com/houss/p/11296285.html 安装说明
https://www.cnblogs.com/fengqyuan/p/12107686.html