centos7中安装elasticsearch-head、git、nodejs
2017-03-18 21:19
531 查看
环境
操作系统: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.git cd elasticsearch-head npm install grunt server open http://localhost:9100/[/code]安装git
使用yum来安装yum install git配置yum源
但是这样是从国外网站下载,所以我们先改下yum的源。
我们配置aliyun,根据官网的步骤:
http://mirrors.aliyun.com/help/centos1、备份 mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup 2、下载新的CentOS-Base.repo 到/etc/yum.repos.d/ CentOS 5 wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo CentOS 6 wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo CentOS 7 wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo 3、之后运行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.8 export JAVA_HOME=/usr/programe_files/jdk1.8.0_121 export JAVA_BIN=/usr/programe_files/jdk1.8.0_121/bin export PATH=$PATH:$JAVA_HOME/bin export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar # set for nodejs export NODE_HOME=/usr/programe_files/node-v6.10.0-linux-x64 export PATH=$NODE_HOME/bin:$PATH export 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 -v v6.10.0 [yutao@localhost ~]$ npm -v 3.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 -version grunt-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: true http.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
相关文章推荐
- 【elasticsearch】(2)centos7 超简单安装elasticsearch 的监控、测试的集群工具elasticsearch head
- Centos7环境ElasticSearch5.2.2安装head插件
- centos7安装elasticsearch之head插件
- centos7 安装nodejs,git
- centos7 部署Elasticsearch单机/集群并安装head插件实现ES集群的可视化管理
- centos7安装elasticsearch-head
- centos7安装nodejs
- elasticsearch 的head 插件安装
- elasticsearch-head插件安装
- [置顶] centos7安装git服务端
- ElasticSearch安装和配置head、bigdesk、IkAnalyzer
- Elasticsearch集群管理工具head插件安装
- elasticsearch插件一——-head插件安装详解
- CentOS7 yum 安装git
- centos7安装最新版git及免密码登录配置
- centos7虚拟机安装elasticsearch5.0.x-安装篇
- 【elasticsearch】elasticsearch 2.x 环境搭建以及常用插件(head,hq,ik)安装
- ubuntu下安装git,sublime,nodejs
- CentOS7 yum安装git
- ElasticSearch 2 (6) - 插件安装Head、Kopf与Bigdesk