簡體   English   中英

使用CentOS 6安裝highcharts服務器

[英]installing a highcharts server with CentOS 6

我在查找有關創建highcharts服務器的良好教程方面遇到困難。 他們的安裝頁面似乎沒有所需的內容。

http://docs.highcharts.com/#installation

這個github頁面看起來更接近我的需求,但是我對Tomcat還是很陌生,並且在遵循它時遇到了麻煩

https://github.com/highslide-software/highcharts.com/tree/master/exporting-server/java

到目前為止,我有:

 #!/bin/bash

 #allow access for tomcat
 /sbin/iptables -I INPUT -p tcp -m tcp --dport 8080 -j ACCEPT
 echo "[OK]"
 echo -n "Saving new rules"
 (/etc/init.d/iptables save &&  echo "[OK]") || echo "[FAILED]"
 service iptables restart

 yum -y install tomcat6*
 yum -y install java-1.7.0-openjdk java-1.7.0-openjdk-devel
 service tomcat6 start
 chkconfig --levels 35 tomcat6 on

 wget http://download.nextag.com/apache/maven/maven-3/3.0.5/binaries/apache-maven-3.0.5-bin.tar.gz
 tar -xzvf apache-maven-3.0.5-bin.tar.gz
 mv apache-maven-3.0.5/ /usr/local/
 echo 'export PATH=/usr/local/apache-maven-3.0.5/bin:$PATH' >> /etc/profile.d/maven.sh

 yum -y install freetype freetype-devel
 yum -y install fontconfig fontconfig-devel

 wget https://phantomjs.googlecode.com/files/phantomjs-1.9.0-linux-x86_64.tar.bz2
 tar -xjvf phantomjs-1.9.0-linux-x86_64.tar.bz2

 yum -y install ant-* ant-apache* ant-commons-logging
 yum -y install git

 git clone https://github.com/highslide-software/highcharts.com.git
 cd highcharts.com
 ant assemble
 ant lint
 ant build

我想我需要編譯highcharts,然后將其移到tomcat目錄/ var / lib / tomcat6 / webapps中。 但是我運行ant build時遇到錯誤

 # ant build
 Buildfile: build.xml

 set.properties:

 clean:
     [mkdir] Created dir: /root/highcharts.com/build/dist/js/adapters
     [mkdir] Created dir: /root/highcharts.com/build/dist/js/modules
     [mkdir] Created dir: /root/highcharts.com/build/dist/highcharts/gfx
     [mkdir] Created dir: /root/highcharts.com/build/dist/highcharts/js/adapters
     [mkdir] Created dir: /root/highcharts.com/build/dist/highcharts/js/modules
     [mkdir] Created dir: /root/highcharts.com/build/dist/highstock/gfx
     [mkdir] Created dir: /root/highcharts.com/build/dist/highstock/js/adapters
     [mkdir] Created dir: /root/highcharts.com/build/dist/highstock/js/modules
     [mkdir] Created dir: /root/highcharts.com/build/tests
     [mkdir] Created dir: /root/highcharts.com/build/coverage-report

 assemble:

 check-crlf:

 do-lint:

 lint:

 minify:

 compile:

 BUILD FAILED
 /root/highcharts.com/build.xml:378: The following error occurred while executing this line:
 /root/highcharts.com/build.xml:336: java.lang.ClassNotFoundException: org.apache.bsf.engines.javascript.JavaScriptEngine

 Total time: 9 seconds

但老實說,我什至不確定我是否會以正確的方式進行。 我在正確的軌道上嗎? 有什么建議么?

看來我是完全以錯誤的方式來做。 我不需要安裝tomcat,java或任何其他軟件。 我安裝了字體,phantomjs和highcharts,並且可以通過通過apache發送Web請求來生成圖表。

這是我的設置腳本:

    #!/bin/bash
    /sbin/iptables -I INPUT -p tcp -m tcp --dport 80 -j ACCEPT
    echo "[OK]"
    echo -n "Saving new rules"
    (/etc/init.d/iptables save &&  echo "[OK]") || echo "[FAILED]"
    service iptables restart
    service httpd start
    chkconfig --levels 35 httpd on


    yum -y install urw-fonts

    wget -O /root/phantomjs-1.9.0-linux-x86_64.tar.bz2
    https://phantomjs.googlecode.com/files/phantomjs-1.9.0-linux-x86_64.tar.bz2
    tar -C /root/ -xjvf /root/initial_install/phantomjs-1.9.0-linux-x86_64.tar.bz2
    cp /root/phantomjs-1.9.0-linux-x86_64/bin/phantomjs /usr/local/bin/


    cd /var/www/html
    wget http://www.highcharts.com/downloads/zips/Highcharts-3.0.1.zip
    unzip Highcharts-3.0.1.zip
    mkdir /var/www/html/exporting-server/phantomjs/tmp
    chmod 777 /var/www/html/exporting-server/phantomjs/tmp

    perl -pi -e 's/phantomjs\/highcharts-convert.js/\/var\/www\/html\/exporting-server\/phantomjs\/highcharts-convert.js/g' /var/www/html/exporting-server/php/php-phantomjs/index.php
    perl -pi -e "s/phantomjs\/tmp/\/var\/www\/html\/exporting-server\/phantomjs\/tmp/g" /var/www/html/exporting-server/php/php-phantomjs/index.php

    perl -pi -e "s/highstock.js/\/var\/www\/html\/exporting-server\/java\/highcharts-export\/src\/main\/webapp\/WEB-INF\/phantomjs\/highstock.js/g" /var/www/html/exporting-server/phantomjs/highcharts-convert.js
    perl -pi -e "s/highstock-more.js/\/var\/www\/html\/js\/highcharts-more.js/g" /var/www/html/exporting-server/phantomjs/highcharts-convert.js
    perl -pi -e "s/jquery-1.8.2.min.js/\/var\/www\/html\/exporting-server\/java\/highcharts-export\/src\/main\/webapp\/WEB-INF\/phantomjs\/jquery-1.8.2.min.js/g" /var/www/html/exporting-server/phantomjs/highcharts-convert.js

這是可以生成圖形的示例PHP:

(從/exporting-server/php/php-phantomjs/demo.html填寫$ hc_options和$ hc_svg)

    <?php
    $url = 'http://highcharts-server/exporting-server/php/php-phantomjs/index.php';
    $filename = 'test.png';

    $hc_options = <<<EOF
    EOF;
    $hc_svg = <<<EOF
    EOF; 
    $hc_type = 'image/png';
    $hc_width = '600';
    $hc_scale = '';
    $hc_product = 'highcharts';
    $hc_callback = "function(){alert('hallo from highcharts')}";

    $post_data = array('options'=>$hc_options,'svg'=>$hc_svg,'type'=>$hc_type,'width'=>$hc_width,'scale'=>$hc_scale,'product'=>$hc_product,'callback'=>$hc_callback);
    $curl_data = http_build_query($post_data);

    $options[CURLOPT_RETURNTRANSFER] = true; // return web page
    $options[CURLOPT_HEADER] = false; // don't return headers 
    $options[CURLOPT_FOLLOWLOCATION] = true; // follow redirects
    $options[CURLOPT_ENCODING] = ""; // handle all encodings
    $options[CURLOPT_USERAGENT] = "ap testing highcharts"; // who am i
    $options[CURLOPT_AUTOREFERER] = true; // set referer on redirect
    $options[CURLOPT_CONNECTTIMEOUT] = 10; // timeout on connect
    $options[CURLOPT_TIMEOUT] = 20; // timeout on response
    $options[CURLOPT_MAXREDIRS] = 10; // stop after 10 redirects

    $options[CURLOPT_POST] = 1; // i am sending post data
    $options[CURLOPT_POSTFIELDS] = $curl_data; // the post data in get format (e.g. name=Bob&age=12

    $options[CURLOPT_SSL_VERIFYHOST] = 0;
    $options[CURLOPT_SSL_VERIFYPEER] = false; 

    #$options[CURLOPT_VERBOSE] = 1; // outputs the web page

    $ch      = curl_init($url); 
    curl_setopt_array($ch,$options);

    $content = curl_exec($ch); 
    $err     = curl_errno($ch);
    $errmsg  = curl_error($ch) ;
    $header  = curl_getinfo($ch);
    curl_close($ch);

    file_put_contents($filename, $content);
    ?>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM