全新的镜像虚拟机
centos7.0
给主机改名
hostnamectl set-hostname G1
ctrl +d 重启服务器
vi /etc/hosts 进入hosts文件 加入本机ip地址和用户名
配置YUM源
进入配置文件
vi /etc/yum.repos.d/local.repo
具体配置YUM源过程不在讲述 可以查看我前面的文章(所用的yum源文件可在我的资源里下载)
安装Java 因为Java包是准备好的 所以直接星号安装 速度快
yum install -y java-*
安装redis缓存服务
yum install redis -y
安装elasticsearch
安装nginx服务
yum install nginx -y
安装 Mariadb数据库
yum install mariadb mariadb-server
安装 zookeeper 服务
先解压zookeeper安装包 (这里我已经把安装包放到了root目录下)
tar -zxvf zookeeper-3.4.14.tar.gz
进入zookeeper-3.4.14/conf/目录下
将zoo_sample.cfg文件重命名为zoo.cfg
mv zoo_sample.cfg zoo.cfg
进入 zookeeper-3.4.14/bin/下
启动 zookeeper服务
./zkServer.sh start
查看状态
./zkServer.sh status
安装kafka服务
tar -zxvf kafka_2.11-1.1.1.tgz
进入到kafka_2.11-1.1.1/bin目录下,启动Kafka服务
./kafka-server-start.sh -daemon …/config/server.properties
使用 jps查看是否安装成功
也可使用 netstat -ntpl 命令 但首先需要安装
yum install -y net-tools
执行netstat -ntpl命令 可以看见 kafka 和 9092端口
启动数据库并配置
修改配置文件
vi /etc/my.cnf
添加
[mysqld]
init_connect=‘SET collation_connection = utf8_unicode_ci’
init_connect=‘SET NAMES utf8’
character-set-server=utf8
collation-server=utf8_unicode_ci
skip-character-set-client-handshake
完成 退出
启动数据库
mysql_secure_installation
/usr/bin/mysql_secure_installation: line 379: find_mysql_client: command not found
设置密码 为123456
登录
设置用户权限
grant all privileges on . to root@localhost identified by ‘123456’ with grant option;
grant all privileges on . to root@"%" identified by ‘123456’ with grant option;
上传 gpmall.sql文件 到root下
创建 gpmall数据库 并导入 gpmall.sql文件
create database gpmall;
use gpmall;
source /root/gpmall.sql
退出数据库
修改redis配置文件
vi /etc/redis.conf
将bind 127.0.0.1这一行注释掉;将protected-mode yes 改为 protected-mode no
启动 redis
systemctl start redis
systemctl enable redis
配置elasticsearch
vi /etc/elasticsearch/elasticsearch.yml
在文件最上面加入3条语句如下:
http.cors.enabled: true
http.cors.allow-origin: “*”
http.cors.allow-credentials: true
将如下4条语句前的注释符去掉,并修改network.host的IP为本机IP。
cluster.name: my-application
node.name: node-1
network.host: 192.168.130.30
http.port: 9200
保存退出
重启 设置开机自启
systemctl start elasticsearch
systemctl enable elasticsearch
启动nginx设置 开机自启
systemctl start nginx
systemctl enable nginx
完成