⼀ 、搭建前期准备
==注:操作系统centos7.0以上 64位,客户服务器是否需要添加域名⽩名单(ip可以访问,域名不能访问)==
安全组需要开通端⼝:22 80 3306 6379 ftp:有则开(21,20000/30000)
(1)⽣成软件包信息缓存
1 yum makecache
(2)安装更新
1 yum update -y
(3)安装必要软件
1 yum install -y zip unzip wget curl git vim zsh nano screen
(4)安装oh my zsh(有助于补全和选择⽬录)
1 sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
⼆、搭建LNMP环境
1 wget http://mirrors.linuxeye.com/oneinstack-full.tar.gz //获取压缩包
3 tar xzvf oneinstack-full.tar.gz //解压压缩包
5 cd oneinstack //到解压的目录下
7 ./install.sh #注:请勿sh install.sh或者bash install.sh这样执行
根据自己的需求安装选项选择安装即可
设置SSH端口(默认22),回车即可
Do you want to enable iptables? [y/n]: n
三、redis配置
配置redis密码:执⾏命令修改/usr/local/redis/etc/redis.conf⽂件,(也可以⼿动修改redis.conf ⽂件)
echo requirepass redis的密码 >> /usr/local/redis/etc/redis.conf
重启redis:systemctl restart redis-server //service redis-server restart 在centos7.x中不支持
四、创建数据库
==使⽤oneinstack⼀键搭建中的phpMyAdmin插件==
vim /etc/my.cnf 在my.cnf 里面设置 添加语句 sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVIS ION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'