基础环境搭建
服务器配置
免密登录,配置公钥连接
-
将本地的公钥复制到服务器
$ ssh-copy-id -i ~/.ssh/id_rsa.pub root@192.168.100.80
更换阿里Yum源
-
更换Centos-7.repo
wget http://mirrors.aliyun.com/repo/Centos-7.repo # 备份 mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup mv Centos-7.repo /etc/yum.repos.d/CentOS-Base.repo yum makecache yum update
添加CentOS 7 EPEL仓库
-
安装一个第三方的yum源,这里用了Fedora的epel仓库
$ sudo yum install epel-release
编译环境
-
安装编译环境
yum groupinstall -y 'Development Tools' sudo yum install -y gcc gcc-c++ autoconf automake openssl openssl-devel curl curl-devel cmake cmake3 gdbm-devel re2c flex bison nano libtool libxml2-devel libjpeg-devel libpng-devel freetype-devel libmcrypt-devel bzip2-devel libcurl-devel libicu-devel libwebp-devel libzip-dev zlib-devel
安装Git
-
安装git
$ yum install -y git
安装nginx
-
安装Nginx
yum install -y nginx
-
启动Nginx
sudo systemctl start nginx.service
-
开机启动Nginx
sudo systemctl enable nginx.service
安装Redis
-
安装Redis
$ yum install redis
-
启动Redis
$ service redis start
-
修改端口号/密码等配置
$ vim /etc/redis.conf
-
测试登录
$ redis-cli -h 127.0.0.1 -p 6379
-
设置开机自启动
systemctl enable redis
安装MySQL
-
安装
# 下载mysql源安装包 $ wget http://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm # 安装mysql源 $ yum localinstall mysql80-community-release-el7-1.noarch.rpm # 安装mysql $ yum install mysql-community-server # 启动MySQL服务 $ systemctl start mysqld $ systemctl status mysqld # 开机启动 $ systemctl enable mysqld $ systemctl daemon-reload # 查看密码 $ grep 'temporary password' /var/log/mysqld.log # 生成的密码root@localhost: kqeIpRI1pU-Dev # 登录 $ mysql -uroot -p # 修改密码 $ ALTER USER 'root'@'localhost' IDENTIFIED BY 'kqeIpRI1pU-Dev';
安装php
-
安装PHP
yum install epel-release rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm yum install php72w-fpm php72w-opcache yum install php72w-zts php72w-cli php72w-mysql php72w-mbstring php72w-xml php72w-gd php72w-devel yum install php72w-bcmath php72w-soap php72w-amqplib