猫不急

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

 

构建服务器使用centos7,8G内存。建议使用8G内存,因为内存不够失败了好几次。

系统需要提前安装一下组件:

yum install -y gcc bzip2 rpm-build rpmdevtools rpmlint

 

1.安装jdk1.8

    vi /etc/profile

export JAVA_HOME=/opt/jdk/jdk1.8.0_161
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

 

2.安装maven

访问maven网站,找一个合适的版本

http://maven.apache.org/download.cgi

wget http://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.6.1/binaries/apache-maven-3.6.1-bin.tar.gz
tar zxvf apache-maven-3.6.1-bin.tar.gz

解压后放在合适的目录,这里以/opt/maven/为例

 

vi /etc/profile

export M2_HOME=/opt/maven/apache-maven-3.6.1
export PATH=$PATH:$JAVA_HOME/bin:$M2_HOME/bin

source /etc/profile

 

修改本地仓库位置

vi /opt/maven/apache-maven-3.6.1/conf/settings.xml

设置本地存储库

<localRepository>/opt/maven/localRepo</localRepository>

 设置阿里云镜像

    <mirror>  
       <id>nexus-aliyun</id>  
       <mirrorOf>central</mirrorOf>    
       <name>Nexus aliyun</name>  
       <url>http://maven.aliyun.com/nexus/content/groups/public</url>  
    </mirror> 

 

设置运行内存

vi /opt/maven/apache-maven-3.6.1/bin/mvn

 MAVEN_OPTS="$MAVEN_OPTS -Xms512m -Xmx1024m"

 

mvn -v

Apache Maven 3.6.1 (d66c9c0b3152b2e69ee9bac180bb8fcc8e6af555; 2019-04-05T03:00:29+08:00)
Maven home: /opt/maven/apache-maven-3.6.1
Java version: 1.8.0_161, vendor: Oracle Corporation, runtime: /opt/jdk/jdk1.8.0_161/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.10.0-693.el7.x86_64", arch: "amd64", family: "unix"

 maven安装完成

 

编译kylo

参考文章

http://www.treselle.com/blog/kylo-setup-for-data-lake-management/

下载并使用maven进行编译

mkdir /opt/kylobuild
cd /opt/kylobuild
wget https://github.com/Teradata/kylo/archive/v0.10.1.tar.gz
tar zxvf v0.10.1.tar.gz
cd kylo-0.10.1

设置npm代理

我本地的环境需要增加-/,才能下载npm.但在腾讯云上则不用

<npmDownloadRoot>https://registry.npm.taobao.org/npm/-/</npmDownloadRoot>

 

vi /opt/kylobuild/kylo-0.10.1/ui/ui-app/pom.xml

          <execution>
            <id>install node and npm</id>
            <goals>
              <goal>install-node-and-npm</goal>
            </goals>
            <configuration>
              <nodeVersion>${node.version}</nodeVersion>
              <npmVersion>${npm.version}</npmVersion>
              <nodeDownloadRoot>https://npm.taobao.org/mirrors/node/</nodeDownloadRoot>
              <npmDownloadRoot>https://registry.npm.taobao.org/npm/-/</npmDownloadRoot>
            </configuration>
          </execution>
          <execution>
            <id>npm install</id>
            <goals>
              <goal>npm</goal>
            </goals>
            <configuration>
              <arguments>install</arguments>
              <npmRegistryURL>https://registry.npm.taobao.org</npmRegistryURL>
            </configuration>
          </execution>

 

vi /opt/kylobuild/kylo-0.10.1/install/install-inspector/install-inspector-app/pom.xml

273行左右

                    <executions>
                            <execution>
                                <id>install node and yarn</id>
                                <goals>
                                    <goal>install-node-and-yarn</goal>
                                </goals>
                                <configuration>
                                    <nodeVersion>${node.version}</nodeVersion>
                                    <yarnVersion>${yarn.version}</yarnVersion>
                                    <nodeDownloadRoot>https://npm.taobao.org/mirrors/node/</nodeDownloadRoot>
                                    <npmDownloadRoot>https://registry.npm.taobao.org/npm/-/</npmDownloadRoot>
                                </configuration>
                            </execution>
                            <execution>
                                <id>webpack build dev</id>
                                <goals>
                                    <goal>yarn</goal>
                                </goals>
                                <phase>generate-resources</phase>
                                <configuration>
                                    <arguments>run webpack:build</arguments>
                                    <yarnInheritsProxyConfigFromMaven>false</yarnInheritsProxyConfigFromMaven>
                                    <npmRegistryURL>https://registry.npm.taobao.org</npmRegistryURL>
                                </configuration>
                            </execution>
                        </executions>

396行左右

 <execution>
                                <id>install node and yarn</id>
                                <goals>
                                    <goal>install-node-and-yarn</goal>
                                </goals>
                                <configuration>
                                    <nodeVersion>${node.version}</nodeVersion>
                                    <yarnVersion>${yarn.version}</yarnVersion>
                                    <nodeDownloadRoot>https://npm.taobao.org/mirrors/node/</nodeDownloadRoot>
                                    <npmDownloadRoot>https://registry.npm.taobao.org/npm/-/</npmDownloadRoot>
                                </configuration>
                            </execution>

 

 

开始编译

mvn clean install -DskipTests

 

构建十分漫长,可能需要一到两个小时。

 

查看打出的tar:

cd /opt/kylobuild/kylo-0.10.1/install/install-tar/target

查看打出的rpm

/opt/kylobuild/kylo-0.10.1/install/install-rpm/target/rpm/kylo/RPMS/noarch

 

 

构建失败的处理:

1.maven内存不足,执行过程中被kill

   设置MAVEN_OPS

2.maven包下载慢或下载失败

   设置阿里云maven镜像

3.ui工程构建失败(npm下载失败)

   设置淘宝的npm代理

4.执行过程中提示命令失败

   安装操作系统的工具包

5.其它

    再构建一次

posted on 2019-05-06 18:01  猫不急  阅读(1590)  评论(1编辑  收藏  举报