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

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

[root@hadoop-namenode1 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
[root@hadoop-namenode1 mysql]# cat /etc/redhat-release
CentOS Linux release 7.5.1804 (Core)
[root@hadoop-namenode1 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 实录并设置开机自启动_第1张图片

设置自动化启动:
[root@hadoop-namenode1 system]# pwd
/usr/lib/systemd/system

[root@hadoop-namenode1 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

[root@hadoop-namenode1 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

[root@hadoop-namenode1 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=' currentfilepathechopid=$
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

[root@hadoop-namenode1 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

你可能感兴趣的:(HUE,hive,大数据)