Table of Contents
什么是 OpenShift
使用 SSH 连接 OpenShift
问题 1:Your public key is not loaded into a running ssh-agent
Home php教程 php手册 在Mac OS X下使用终端连接OpenShift的SSH并部署应用

在Mac OS X下使用终端连接OpenShift的SSH并部署应用

Jun 06, 2016 pm 08:08 PM
mac openshift ssh use terminal connect deploy

今天折腾了一整天 OpenShift,早就听说 OpenShift 的大名,却一直无缘一试。从今天早上 10 点到现在(下午5点30分),终于摸透了 Mac 下使用 Terminal(终端)SSH 登陆 OpenShift 的方法,记下来与大家分享。 什么是 OpenShift 由大名鼎鼎的 RedHat 推出的一

今天折腾了一整天 OpenShift,早就听说 OpenShift 的大名,却一直无缘一试。从今天早上 10 点到现在(下午5点30分),终于摸透了 Mac 下使用 Terminal(终端)SSH 登陆 OpenShift 的方法,记下来与大家分享。

什么是 OpenShift

由大名鼎鼎的 RedHat 推出的一款 PaaS 服务,有免费的 Plan,支持创建 3 个应用,支持 PHP、Pyhton、Ruby、NodeJS 等语言。

使用 SSH 连接 OpenShift

阅读下面的文字假设你已有以下准备:

  • 已经注册 OpenShift 账号,并创建了一个 Gear(即一个应用)
  • 使用 Mac OS X 10.6 及更高版本的系统
  • 了解 vim 的基本使用方法
  • 已经通过终端安装了 rhc(OpenShift 的部署工具,安装指令 gem install rhc)

首先,先使用 rhc 检测一下当前的状态,打开终端,输入

rhc-chk

需要先输入你的 OpenShift 对应的密码,回车。

一般会遇到如下的结果:

Password: *********

Analyzing system

....F.F

=================================================

||  Your system did not pass all of the tests  ||

=================================================

1) Your public key is not loaded into a running ssh-agent: /var/root/.ssh/id_rsa.pub

If this is your only error, your connection may still work, depending on your SSH configuration.

2) Cannot SSH into your app: xxxxx-ooooo.rhcloud.com.

需要明确的是,如果你运行 rhc-chk 一切正常,那么就无需继续看下去了,直接使用原本的 git / ssh 的操作指令进行管理和部署即可。

下面的内容针对解决上述两个问题。

问题 1:Your public key is not loaded into a running ssh-agent

首先我们需要创建 SSH 需要用到的公钥和私钥

如果你已经创建,可以使用如下命令查看:

ls ~/.ssh/

若结果找两个形如 xx_rsa 和 xx_rsa.pub 两个文件则不需要执行如下的生成步骤,否则继续

输入命令

ssh-keygen

一路回车,最后会提示成功创建

下面需要为秘钥和目录设置正确的权限

依次输入命令:

chmod 700 ~/.ssh

chmod 600 ~/.ssh/id_rsa*

这样就设置了正确的权限。

将公钥内容提交到 OpenShift 控制面板

输入如下命令

vim ~/.ssh/id_rsa.pub

会打开刚才生成的秘钥中公钥的内容,全选复制。打开 OpenShift 控制面板

https://openshift.redhat.com/app/account

将全部内容粘贴到右下角【Public Keys】的那个文本框里。若已经提交了公钥,则建议删除现有的公钥再提交新的公钥。

接下来添加 ssh key 到 ssh-agent 中

输入如下命令

ssh-add ~/.ssh/id_rsa

控制台回返回如下信息:

Enter passphrase for /var/root/.ssh/id_rsa: 

之前我们在创建秘钥时并没有设置 passphrase,所以直接按回车即可。系统返回:

Identity added: /var/root/.ssh/id_rsa (/var/root/.ssh/id_rsa)

一劳永逸,将 key 添加到 config 中

打开控制台,输入如下指令

vim ~/.ssh/config

在打开的新界面立输入以下内容(提示,按下 i 键进入编辑模式,按下 ESC 键退出编辑模式,按下 :wq 保存退出…… 说过了要有 vim 基础的哈)

Host *.rhcloud.com

IdentityFile ~/.ssh/id_rsa

VerifyHostKeyDNS yes

StrictHostKeyChecking no

保存后整个为 ssh 添加秘钥的过程就就解决了。现在再运行 rhc-chk 命令肯定不会再出现 Your public key is not loaded into a running ssh-agent 这样的错误了。

问题2:Cannot SSH into your app: xxxxx-ooooo.rhcloud.com.

其实这个问题很简单,你的这个应用的 IP 地址 SSH 被封了,虽然能 ping 通,但是 SSH 连不上。

解决方法:删除这个应用,重新创建。

本文网址:http://dev.ppios.com/2013/01/ssh-openshift-using-mac-os-x/

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What software is crystaldiskmark? -How to use crystaldiskmark? What software is crystaldiskmark? -How to use crystaldiskmark? Mar 18, 2024 pm 02:58 PM

CrystalDiskMark is a small HDD benchmark tool for hard drives that quickly measures sequential and random read/write speeds. Next, let the editor introduce CrystalDiskMark to you and how to use crystaldiskmark~ 1. Introduction to CrystalDiskMark CrystalDiskMark is a widely used disk performance testing tool used to evaluate the read and write speed and performance of mechanical hard drives and solid-state drives (SSD). Random I/O performance. It is a free Windows application and provides a user-friendly interface and various test modes to evaluate different aspects of hard drive performance and is widely used in hardware reviews

How to download foobar2000? -How to use foobar2000 How to download foobar2000? -How to use foobar2000 Mar 18, 2024 am 10:58 AM

foobar2000 is a software that can listen to music resources at any time. It brings you all kinds of music with lossless sound quality. The enhanced version of the music player allows you to get a more comprehensive and comfortable music experience. Its design concept is to play the advanced audio on the computer The device is transplanted to mobile phones to provide a more convenient and efficient music playback experience. The interface design is simple, clear and easy to use. It adopts a minimalist design style without too many decorations and cumbersome operations to get started quickly. It also supports a variety of skins and Theme, personalize settings according to your own preferences, and create an exclusive music player that supports the playback of multiple audio formats. It also supports the audio gain function to adjust the volume according to your own hearing conditions to avoid hearing damage caused by excessive volume. Next, let me help you

How to use Baidu Netdisk app How to use Baidu Netdisk app Mar 27, 2024 pm 06:46 PM

Cloud storage has become an indispensable part of our daily life and work nowadays. As one of the leading cloud storage services in China, Baidu Netdisk has won the favor of a large number of users with its powerful storage functions, efficient transmission speed and convenient operation experience. And whether you want to back up important files, share information, watch videos online, or listen to music, Baidu Cloud Disk can meet your needs. However, many users may not understand the specific use method of Baidu Netdisk app, so this tutorial will introduce in detail how to use Baidu Netdisk app. Users who are still confused can follow this article to learn more. ! How to use Baidu Cloud Network Disk: 1. Installation First, when downloading and installing Baidu Cloud software, please select the custom installation option.

How to use NetEase Mailbox Master How to use NetEase Mailbox Master Mar 27, 2024 pm 05:32 PM

NetEase Mailbox, as an email address widely used by Chinese netizens, has always won the trust of users with its stable and efficient services. NetEase Mailbox Master is an email software specially created for mobile phone users. It greatly simplifies the process of sending and receiving emails and makes our email processing more convenient. So how to use NetEase Mailbox Master, and what specific functions it has. Below, the editor of this site will give you a detailed introduction, hoping to help you! First, you can search and download the NetEase Mailbox Master app in the mobile app store. Search for "NetEase Mailbox Master" in App Store or Baidu Mobile Assistant, and then follow the prompts to install it. After the download and installation is completed, we open the NetEase email account and log in. The login interface is as shown below

How to set up WeChat Mac to automatically convert voice messages into text - How to set up voice to text conversion How to set up WeChat Mac to automatically convert voice messages into text - How to set up voice to text conversion Mar 19, 2024 am 08:28 AM

Recently, some friends have consulted the editor about how to set up WeChat Mac to automatically convert voice messages into text. The following is a method for setting up WeChat Mac to automatically convert voice messages into text. Friends in need can come and learn more. Step 1: First, open the Mac version of WeChat. As shown in the picture: Step 2: Next, click "Settings". As shown in the picture: Step 3: Then, click "General". As shown in the picture: Step 4: Then check the option "Automatically convert voice messages in chat to text". As shown in the picture: Step 5: Finally, close the window. As shown in the picture:

BTCC tutorial: How to bind and use MetaMask wallet on BTCC exchange? BTCC tutorial: How to bind and use MetaMask wallet on BTCC exchange? Apr 26, 2024 am 09:40 AM

MetaMask (also called Little Fox Wallet in Chinese) is a free and well-received encryption wallet software. Currently, BTCC supports binding to the MetaMask wallet. After binding, you can use the MetaMask wallet to quickly log in, store value, buy coins, etc., and you can also get 20 USDT trial bonus for the first time binding. In the BTCCMetaMask wallet tutorial, we will introduce in detail how to register and use MetaMask, and how to bind and use the Little Fox wallet in BTCC. What is MetaMask wallet? With over 30 million users, MetaMask Little Fox Wallet is one of the most popular cryptocurrency wallets today. It is free to use and can be installed on the network as an extension

3 Ways to Convert HEIC Photos to JPG on Mac 3 Ways to Convert HEIC Photos to JPG on Mac Mar 15, 2024 pm 08:43 PM

By default, iPhone takes photos from the camera in HEIC format. HEIC stands for High Efficiency Image Container and can hold more pixel data than PNG or JPG files, taking up significantly less space on iPhone storage compared to other formats. These files work best on iPhones but are not widely accepted on the internet because they often result in blurry/grainy pictures when you share them with non-Apple devices. To ensure that HEIC images are compatible on other devices, you may need to convert them to JPG format. This article will introduce how to convert HEIC images to JPG on Mac. How to Convert HEIC Photos to JPG on Mac [3 Methods] Method

How to connect OnePlus watch to Bluetooth headset_How to connect OnePlus watch to Bluetooth headset How to connect OnePlus watch to Bluetooth headset_How to connect OnePlus watch to Bluetooth headset Mar 23, 2024 pm 01:16 PM

1. Place the earphones in the earphone box and keep the lid open. Press and hold the button on the box to enter the pairing state of the earphones. 2. Turn on the watch music function and select Bluetooth headphones, or select Bluetooth headphones in the watch settings function. 3. Select the headset on the watch to pair successfully.

See all articles