openshift安装client工具,创建第一个app

Installing OpenShift Client Tools

The OpenShift Client tools known as rhc are built and packaged using the Ruby programming language. OpenShift integrates with the Git version control system to provide powerful, decentralized version control for your application source code.

OpenShift rhc can be run on any operating system with Ruby 1.8.7 or higher if you have the requisite user permissions to install programs.  Instructions for specific operating systems are provided below. It is assumed that you are running the commands from a command line window, such as Command Prompt, or Terminal.  If you are usingRuby Version Manager (rvm) see the instructions below.

Windows

RubyInstaller 1.9 provides the best experience for installing Ruby on Windows XP, Vista, and Windows 7.  Download the newest version fromthe download page and launch the installer.

Important: During the installation you can accept all of the defaults, but it is mandatory that you select the "Add Ruby executables to your PATH" check box in order to run Ruby from the command line.

After the installation is completed, to verify that the installation is working run:

C:\Program Files\> ruby -e 'puts "Welcome to Ruby"'
Welcome to Ruby

If the 'Welcome to Ruby' message does not display, the Ruby executable may not have been added to the path.  Restart the installation process and ensure the "Add Ruby executables to your PATH" check box is selected.

Installing Git

The next step is to install Git for Windows so that you can synchronise your local application source and your OpenShift application.  Git for Windows offers the easiest Git experience on the Windows operating system and is the recommended default - if you use another version of Git please ensure it can be executed from the command line and continue to the next section.

Download and install the latest version of Git for Windows.  Ensure that Git is added to your PATH so that it can be run from the command line.  After the installation is completed, to verify that Git is correctly configured run:

C:\Program Files\> git --version
git version 1.7.11.msysgit.1

Installing the OpenShift gem

After Ruby and Git are correctly installed, use the RubyGems package manager (included in Ruby) to install the OpenShift client tools. Run:

C:\Program Files\> gem install rhc

RubyGems downloads and installs the rhc gem from www.rubygems.org/gems/rhc.  The installation typically proceeds without errors.  After installation is complete, run:

C:\Program Files\> rhc

The OpenShift interactive setup wizard displays and prompts you to complete the rest of the process.  If you cannot run OpenShift client tools at this point, please contact us onIRC or post inour forums for more assistance.

 

2. Setup your environment

Using your OpenShift login and password, run rhc setup to connect to OpenShift and create a unique namespace for your applications.

$ rhc setup

Starting Interactive Setup for OpenShift's command line interface

We'll help get you setup with just a couple of questions.

To connect to openshift.redhat.com enter your OpenShift login (email or Red Hat login id):

The wizard will help you upload your SSH keys so you can communicate with Git, check to see if you are missing any required configuration, and then help you create a domain name. On OpenShift, domain names make up part of your app's url. They are also unique across all OpenShift users so choose wisely and be creative!

When the wizard runs it creates a configuration file in <your home directory>/.openshift/express.conf which includes your login id. If you ever need to set your machine up a second time, just run rhc setup again.

3. Create your first application

Now you can create an application.

$ rhc app create -a myapp -t php-5.3
Password: (Enter your account password)

This will create a remote git repository for your application, and clone it locally in your current directory.

OpenShift offers many application stacks. Run rhc app create -h to see all of your options.

Your application's domain name will be <your app name>-<your domain name>.rhcloud.com. So, the application created by the example commands would be located at myapp-mydomain.rhcloud.com

Creating an application video walkthrough

4. Make a change, publish

Getting an application running is only the first step. Now you are on the road to making it your own. Here's an example for the php framework.

$ cd myapp
$ vim php/index.php
(Make a change...  :wq)
$ git commit -a -m "My first change"
$ git push

Use whichever IDE or editor works best for you. Chances are, it'll have git support. Even if it doesn't, you're just two simple commands away from glory!

Now, check your URL - your change will be live.

Check out these great guides for deploying popular frameworks

5. Next steps

While this has gotten you started, there is a lot more information out there to really get you going. Check out the following pages for videos, blogs, and tutorials:

 

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值