我用 CentOS7
要先安裝
[root@test ~]# yum -y install yum-utils git
[root@test ~]# yum-config-manager --enable centos-optional-7
[root@test ~]# yum install gem
[root@test ~]# git init
安裝 openshift 工具 & 設定 :
[chio@test ~]$ gem install rhc
[chio@test ~]$ rhc setup
........
........
Created: /home/chio/.ssh/id_rsa.pub
Your public SSH key must be uploaded to the OpenShift server to access code. Upload now? (yes|no) yes
.............
裝 meteor (安裝時需要 root 權限 會問密碼)
[chio@test ~]$ curl https://install.meteor.com | sh
...........
[sudo] password for chio: XXXXXX
...........
看一下範例 :
[chio@test leaderboard]$ meteor create --list
Available examples:
clock: https://github.com/meteor/clock
leaderboard: https://github.com/meteor/leaderboard
localmarket: https://github.com/meteor/localmarket
simple-todos: https://github.com/meteor/simple-todos
simple-todos-react: https://github.com/meteor/simple-todos-react
simple-todos-angular: https://github.com/meteor/simple-todos-angular
todos: https://github.com/meteor/todos
todos-react: https://github.com/meteor/todos#react
angular2-boilerplate: https://github.com/bsliran/angular2-meteor-base
To create an example, simply git clone the relevant repository and branch (run 'meteor create --example <name>' to see the full command).
下載範例
[chio@test ]$ git clone https://github.com/meteor/leaderboard
Cloning into 'leaderboard'...
remote: Counting objects: 607, done.
remote: Total 607 (delta 0), reused 0 (delta 0), pack-reused 607
Receiving objects: 100% (607/607), 77.56 KiB | 0 bytes/s, done.
Resolving deltas: 100% (195/195), done.
啟動 meteor 看一下範例結果 :
[chio@test ~]$ cd leaderboard/
[chio@test leaderboard]$ meteor
[[[[[ ~/leaderboard ]]]]]
=> Started proxy.
=> Started MongoDB.
=> Meteor 1.4.2.7 is available. Update this project with 'meteor update'.
=> Started your app.
=> App running at: http://localhost:3000/
用 cheome 開 :
建立 openshift 的 meteor
[chio@test ~]$ rhc app create meteor nodejs-0.10 mongodb-2.4 --from-code=https://github.com/openshift-quickstart/openshift-meteorjs-quickstart.git
..............
...............
看一下安裝的 rhc meteor
[chio@test ~]$ ls -l meteor/
total 16
-rw-rw-r-- 1 chio chio 3539 Feb 20 11:20 meteorshim.js
drwxrwxr-x 2 chio chio 20 Feb 20 11:20 node_modules
-rw-rw-r-- 1 chio chio 762 Feb 20 11:20 package.json
-rw-rw-r-- 1 chio chio 4141 Feb 20 11:20 README.md
將 leaderboard 打包 (要用 meteor 打包 , 打包好看一下 是否有 bundle.tar.gz ...)
[chio@test ~]$ cd leaderboard ; meteor bundle bundle.tar.gz
.......
[chio@test leaderboard]$ ls -l
total 5940
-rw-rw-r-- 1 chio chio 6064446 Feb 20 11:25 bundle.tar.gz
-rw-rw-r-- 1 chio chio 4421 Feb 20 10:44 leaderboard.css
-rw-rw-r-- 1 chio chio 968 Feb 20 10:44 leaderboard.html
-rw-rw-r-- 1 chio chio 1367 Feb 20 10:44 leaderboard.js
將打包好的檔案解到 rhc 的 meteor 目錄
[chio@test leaderboard]$ tar -xvf bundle.tar.gz --transform 's|^bundle/||' -C ../meteor/
...........
放好了 就可將 檔案 push 到 openshift 上去
[chio@test leaderboard]$ cd ../meteor
[chio@test meteor]$ git add --all
[chio@test meteor]$ git commit -am "Adding a meteor.js application bundle"
......
[chio@test meteor]$ git push
看一下結果 :