坑爹的东西,花了我2天时间才成功编译!主要一个问题卡的太久 - 。 -。把我的踩坑过程记录一下,希望可以帮助大家,有其他问题可以在评论区留言,我会一一解答。
一、编译环境
contOS7
JDK8
Maven 3.6
部署包:2.1.0 https://atlas.apache.org/#/Downloads
mvn仓库地址:http://maven.aliyun.com/nexus/content/groups/public
编译环境不一样,问题肯能不一样。
二、安装atlas
1、下载好包,移到/opt目录下执行tar-xzvf进行解压,目录如下
2、进入apache-atlas-sources-2.1.0目录,然后执行
mvn clean -DskipTests package -Pdist,embedded-hbase-solr(自带hbase和solr)
如果出现node-saas安装目录没有权限,则执行(此处我踩了2天坑,( Ĭ ^ Ĭ ))
sudo mvn clean -DskipTests package -Pdist,embedded-hbase-solr
注意:root的环境变量和sudo的环境变量不一定一样的。我就是root状态下执行命令结果安装node-saas的时候提示没权限。sudo 执行之后编译环境版本存在问题。
如果sudo执行命令出现编译错误,sudo mvn -v 查看环境信息是否一致。如果不一致,则需要将sudo下的环境变量改为和root一致。具体修改方法如下
- 执行 sudo visudo
- 将Defaults env_reset改为Defaults !env_reset 取消掉对PATH变量的重置
- 修改~/.bashrc中环境变量 ,最后添加alias sudo='sudo env PATH=$PATH'
这样sudo执行命令时所搜寻的路径就是系统的PATH变量中的路径,如想添加其他变量也是类似
安装完成之后:会查看到所有jar都显示SUCCESS
三、安装过程问题解决
1、安装node-saas失败
gyp verb command install [ '6.17.1' ] gyp ERR! UNCAUGHT EXCEPTION gyp ERR! stack /mnt/hswx/apache-atlas-sources-2.1.0/node_modules/_mkdirp@1.0.4@mkdirp/lib/opts-arg.js:7 gyp ERR! stack opts = { mode: 0o777, fs, ...opts } gyp ERR! stack ^^^ gyp ERR! stack gyp ERR! stack SyntaxError: Unexpected token ... gyp ERR! stack at createScript (vm.js:56:10) gyp ERR! stack at Object.runInThisContext (vm.js:97:10) gyp ERR! stack at Module._compile (module.js:549:28) gyp ERR! stack at Object.Module._extensions..js (module.js:586:10) gyp ERR! stack at Module.load (module.js:494:32) gyp ERR! stack at tryModuleLoad (module.js:453:12) gyp ERR! stack at Function.Module._load (module.js:445:3) gyp ERR! stack at Module.require (module.js:504:17) gyp ERR! stack at require (internal/module.js:20:19) gyp ERR! stack at Object.<anonymous> (/mnt/hswx/apache-atlas-sources-2.1.0/node_modules/_mkdirp@1.0.4@mkdirp/index.js:1:79) gyp ERR! System Linux 3.10.0-1127.19.1.el7.x86_64 gyp ERR! command "/usr/bin/node" "/mnt/hswx/apache-atlas-sources-2.1.0/node_modules/_node-gyp@7.1.2@node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library=" gyp ERR! cwd /mnt/hswx/apache-atlas-sources-2.1.0/node_modules/_node-sass@5.0.0@node-sass gyp ERR! node -v v6.17.1 gyp ERR! node-gyp -v v7.1.2 gyp ERR! Node-gyp failed to build your package. gyp ERR! Try to update npm and/or node-gyp and if it does not help file an issue with the package author. Build failed with error code: 7 [npminstall:runscript:error] node-sass@* scripts.postinstall run "node scripts/build.js" error: RunScriptError: Run "sh -c node scripts/build.js" error, exit code 1 ? Install fail! RunScriptError: post install error, please remove node_modules before retry! Run "sh -c node scripts/build.js" error, exit code 1 RunScriptError: post install error, please remove node_modules before retry! Run "sh -c node scripts/build.js" error, exit code 1 at ChildProcess.proc.on.code (/usr/lib/node_modules/cnpm/node_modules/runscript/index.js:96:21) at emitTwo (events.js:106:13) at ChildProcess.emit (events.js:191:7) at maybeClose (internal/child_process.js:920:16) at Process.ChildProcess._handle.onexit (internal/child_process.js:230:5) npminstall version: 3.28.0 npminstall args: /usr/bin/node /usr/lib/node_modules/cnpm/node_modules/npminstall/bin/install.js --fix-bug-versions --china --userconfig=/root/.cnpmrc --disturl=https://npm.taobao.org/mirrors/node --registry=https://r.npm.taobao.org node-sass --save-dev
此问题困扰了我好多天,单独编译不行,该npm源也不行。就是很纳闷root账号执行创建居然没有权限。所以最后只好采用sudo 方式执行命令。
使用该命令:
sudo mvn clean -DskipTests package -Pdist,embedded-hbase-solr
使用sudo会出现和root编译环境不一致问题,按照我上面说的,sudo和root使用一套环境变量的修改方法即可。
2、Sqoop.Jar无法下载
[ERROR] Failed to execute goal on project sqoop-bridge-shim: Could not resolve dependencies for project org.apache.atlas:sqoop-bridge-shim:jar:2.1.0: Could not find artifact org.apache.sqoop:sqoop:jar:1.4.6.2.3.99.0-195 in nexus-aliyun (http://maven.aliyun.com/nexus/content/groups/public) -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
atlas编译用的sqoop.jar比较扯淡,1.4.6.2.3.99.0-195这个版本不太好找。我是用的是阿里的仓库http://maven.aliyun.com/nexus/content/groups/public下载,阿里仓库不存在该jar包。
可以手动下载该jar包
下载地址:Index of /repositories/releases/org/apache/sqoop/sqoop/1.4.6.2.3.99.0-195
执行下面命令安装到本地仓库
mvn install:install-file -Dfile=sqoop-1.4.6.2.3.99.0-195.jar -DgroupId=org.apache.sqoop -DartifactId=sqoop -Dversion=1.4.6.2.3.99.0-195 -Dpackaging=jar
之后在执行编译命令即可。