天天看点

Centos7 安装HUE 实录并设置开机自启动

使用了HUE的docker 版本后,发现了很多问题,于是干脆自己手动安装一个。

[[email protected] mysql]# uname -a

Linux hadoop-namenode1 4.4.58-1.el7.elrepo.x86_64 #1 SMP Thu Mar 30 11:18:53 EDT 2017 x86_64 x86_64 x86_64 GNU/Linux

[[email protected] mysql]# cat /etc/redhat-release

CentOS Linux release 7.5.1804 (Core)

[[email protected] mysql]#

#1 环境准备:

#centos7 安装python2.7-devel

yum install epel-release -y

yum install centos-release-scl-rh -y

yum install python27-python-devel -y

yum install -y gcc gcc-c++ libffi-devel

yum install -y cyrus-sasl-devel cyrus-sasl-gssapi cyrus-sasl-plain krb5-devel libffi-devel libxml2-devel libxslt-devel make mysql mysql-devel openldap-devel python-devel sqlite-devel gmp-devel

#2.下载源代码

#https://github.com/cloudera/hue/

#先安装工具

yum install git -y

git clone https://github.com/cloudera/hue.git

cd hue

#3.编译

make apps

#运行

#build/env/bin/hue runserver

build/env/bin/hue runserver 0.0.0.0:8000

#封装为docker to do

#调试配置为和非docker 一样的功能. todo

Centos7 安装HUE 实录并设置开机自启动

设置自动化启动:

[[email protected] system]# pwd

/usr/lib/systemd/system

[[email protected] system]# more hue.service

[Unit]

Description=Apache HUE

After=network.target

Wants=network.target

[Service]

ExecStart=/var/server/hue4.3/hue/build/env/bin/start-hueserver.sh

ExecStop=/var/server/hue4.3/hue/build/env/bin/stop-hueserver.sh

Restart=always

RestartSec=60

Restart=always

PIDFile=/tmp/hue.pid

[Install]

WantedBy=multi-user.target

[[email protected] server]# more /var/server/hue4.3/hue/build/env/bin/start-hueserver.sh

#!/bin/bash

#确保shell 切换到当前shell 脚本文件夹

current_file_path= ( c d " (cd " (cd"(dirname “$0”)"; pwd)

cd ${current_file_path}

/var/server/hue4.3/hue/build/env/bin/hue runserver 0.0.0.0:8000

[[email protected] server]# more /var/server/hue4.3/hue/build/env/bin/stop-hueserver.sh

#!/bin/bash

#确保shell 切换到当前shell 脚本文件夹

current_file_path= ( c d " (cd " (cd"(dirname “$0”)"; pwd)

cd c u r r e n t f i l e p a t h e c h o ′ 当 前 进 程 p i d = ′ {current_file_path} echo '当前进程pid=' currentf​ilep​athecho′当前进程pid=′$

app=‘hue’

oldProcessIdSet=$(ps aux | grep $app | grep -v grep | awk ‘{print $2}’)

for pid in $oldProcessIdSet

do

if [ $$ != p i d ] ; t h e n e c h o " 关 闭 了 " pid ] ; then echo "关闭了" pid];thenecho"关闭了"{app}“原先的进程pid=”$pid

sudo kill -KILL $pid

fi

done

[[email protected] server]#

chmod +x /var/server/hue4.3/hue/build/env/bin/start-hueserver.sh

chmod +x /var/server/hue4.3/hue/build/env/bin/stop-hueserver.sh

systemctl enable hue.service

systemctl start hue

ps aux | grep ‘hue’

#如果修改了 hue.service ,记得运行: systemctl daemon-reload

继续阅读