centos7中安装elasticsearch-head、git、nodejs
来源:互联网 发布:动物建模软件 编辑:程序博客网 时间:2024/05/16 17:25
环境
操作系统:centos7
nodejs: v6.10.0
elasticsearch:5.2.2
步骤
首先已经安装好了elasticsearch
。
由于现在elasticsearch
不建议使用plugins
即插件的方式来安装。而是把其作为一个独立的应用程序。所以以前的插件安装方式在版本5里不建议使用啦。
步骤一、
根据官网:
https://github.com/mobz/elasticsearch-head#running-with-built-in-server
git clone git://github.com/mobz/elasticsearch-head.gitcd elasticsearch-headnpm installgrunt serveropen http://localhost:9100/
安装git
使用yum
来安装
yum install git
配置yum源
但是这样是从国外网站下载,所以我们先改下yum
的源。
我们配置aliyun
,根据官网的步骤:
http://mirrors.aliyun.com/help/centos
1、备份mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup2、下载新的CentOS-Base.repo 到/etc/yum.repos.d/CentOS 5wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repoCentOS 6wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repoCentOS 7wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo3、之后运行yum makecache生成缓存
在执行第三步时,由于我开启了外墙软件,结果不行,所以第三步,需要关闭翻墙软件。
安装nodejs
当执行npm install
,时会出现无此命令,这时,就需要安装nodejs
第一次安装根据网上教程是从源码–编译 –安装,结果编译时,出现2个错误。
想想还是自己摸索改成安装编译好的版本。
注:刚开始由于它是tar.xz
,这个格式,我懵逼的不敢用,后来才知道xz
只是压缩的一种格式。
在window
中把它下载好,再在CRT
中敲击rz
进行上传到Linux
环境或是服务器中。(我使用的是虚拟机)
解压命令:
tar -xJf node-v6.10.0-linux-x64.tar.xz
得到node-v6.10.0-linux-x64
目录。
在这里网上搜了下大写J
的作用:
-J, --xz filter the archive through xz 翻译软件:通过xz过滤归档
参考地址:http://blog.csdn.net/s464036801/article/details/8351638
把解压后的目录node-v6.10.0-linux-x64
放到自己喜欢的安装目录,
我放到/usr/programe_files/
。
配置nodejs的环境变量
这里我把我的环境变量贴出来
# jdk1.8export JAVA_HOME=/usr/programe_files/jdk1.8.0_121export JAVA_BIN=/usr/programe_files/jdk1.8.0_121/binexport PATH=$PATH:$JAVA_HOME/binexport CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar# set for nodejsexport NODE_HOME=/usr/programe_files/node-v6.10.0-linux-x64export PATH=$NODE_HOME/bin:$PATHexport JAVA_HOME JAVA_BIN PATH CLASSPATH
安装cnpm
因为原版的 npm 在国内安装东西是很慢的,要解决慢就一定要用镜像。国内比较好的镜像就淘宝的 NPM 镜像。为了方便使用镜像并且不影响原本的 npm,我们建议安装 cnpm 作为 npm 的代替。cnpm 就是使用了淘宝的 NPM 镜像的 npm。
安装方法也很简单:
npm install -g cnpm --registry=https://registry.npm.taobao.org
只需要一步就可以安装好 cnpm。
运行 cnpm -v 可以看到安装好了的 cnpm 的版本。
安装cnpm
的时候,建议把翻墙软件关闭。
验证nodejs安装是否成功
[yutao@localhost ~]$ node -vv6.10.0[yutao@localhost ~]$ npm -v3.10.10
接着我们执行:grunt server
的时候,会报grunt
命令不存在。
安装grunt
npm install -g grunt-cli
如果安装过程比较慢,建议临时使用taobao镜像;(我使用的上面的那种方式)
npm install -g grunt-cli --registry=https://registry.npm.taobao.org
[yutao@localhost ~]$ grunt -versiongrunt-cli v1.2.0
当我们启动grunt server
后,命令窗口会被占用。
可以使用grunt server &
让其在后台启动。或者再开一个终端窗口接着其他操作。
访问 http://localhost:9100/
由于我elasticsearch
中的conf/elasticsearch.yml
中的网络配置中,配置了网址,所以我访问的地址是:
http://192.168.116.131:9100/
结果显示:
我们可以看到,head主控页面是可以显示的,但是显示连接失败;
集群健康值: 未连接
我们可以参考官网Enable CORS in elasticsearch跨域的问题解决办法如下:
elasticsearch5 跨域的问题
在elasticsearch
的配置文件中elasticsearch.yml
,添加:
http.cors.enabled: truehttp.cors.allow-origin: "*"
yml格式注意:冒号后面需要一个空格
然后我们在重启elasticsearch
,在访问http://192.168.116.131:9100/,就可以看到:
参考地址:
http://www.itdadao.com/articles/c15a1179718p0.html
http://www.infocool.net/kb/OtherCloud/201702/288096.html
https://blog.micblo.com/2017/01/19/CentOS7%E9%87%8D%E8%A3%85%E4%B9%8B%E8%B7%AF-Node-js%E5%AE%89%E8%A3%85%E4%BD%BF%E7%94%A8%E7%AF%87/
http://mirrors.aliyun.com/help/centos
- centos7中安装elasticsearch-head、git、nodejs
- elasticsearch 二、elasticsearch-head安装
- elasticsearch head插件安装
- elasticsearch-head插件安装
- elasticsearch head插件安装
- Elasticsearch 安装 head 插件
- Elasticsearch Head安装
- Elasticsearch Head插件安装
- elasticsearch 5.4 head 安装
- elasticsearch head插件安装
- 安装Elasticsearch-Head
- centos7 部署Elasticsearch单机/集群并安装head插件实现ES集群的可视化管理
- elasticsearch centos7安装
- elasticsearch centos7安装
- Centos7上安装ElasticSearch
- centos7-elasticsearch安装配置
- CentOS7 安装Elasticsearch
- Elasticsearch Centos7 安装
- 5. 产品经理思维的层次
- Android中应用的性能优化学习笔记
- 使用ViewPager实现一页显示多个ImageView的滑动切换视图
- AS指定调试模式下的appkey
- MySQL5.7.*免安装版配置方法
- centos7中安装elasticsearch-head、git、nodejs
- Java TCP/UDP socket 编程流程总结
- 【Java NIO的深入研究6】JAVA NIO之Scatter-Gather
- LeetCode 题目:312. Burst Balloons
- 关于在图库中图片进行多选
- 《REWORK》摘录及感想----理想世界和现实世界真的无法平衡吗?
- 专治win各种110120140.dll丢失
- eclipse 安装 scala
- 数据结构实验:连通分量个数——并查集