Today, I have been tossing OpenShift for a whole day. I have heard of the name of OpenShift, but I have never tried it. From 05:30 P.M. this morning to now (), I finally figured out how to log on to OpenShift using Terminal (Terminal) SSH on Mac, and I will share it with you. What is OpenShift one launched by the famous RedHat?
Today, I have been tossing OpenShift for a whole day. I have heard of the name of OpenShift, but I have never tried it. From 05:30 P.M. this morning to now (), I finally figured out how to log on to OpenShift using Terminal (Terminal) SSH on Mac, and I will share it with you. What is OpenShift one launched by the famous RedHat?
Today, I have been tossing OpenShift for a whole day. I have heard of the name of OpenShift, but I have never tried it. From 05:30 P.M. this morning to now (), I finally figured out how to log on to OpenShift using Terminal (Terminal) SSH on Mac, and I will share it with you.
What is OpenShift?
A PaaS service launched by the famous RedHat, which has a free Plan and supports the creation of three applications. It supports PHP, Pyhton, Ruby, NodeJS, and other languages.
Use SSH to connect to OpenShift
Read the following text to assume that you have prepared the following:
- You have registered an OpenShift account and created a Gear (an application)
- Mac OS X 10.6 and later versions
- Measure the test taker's understanding about the basic usage of vim.
- Rhc has been installed through the terminal (OpenShift deployment tool, installation command gem install rhc)
First, use rhc to check the current status, open the terminal, and enter
Rhc-chk
Enter your OpenShift password and press Enter.
Generally, the following results are returned:
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.
It should be clear that if you run rhc-chk normally, you do not need to continue looking at it. simply use the original git/ssh operation commands for management and deployment.
The following content addresses the above two problems.
Problem 1: Your public key is not loaded into a running ssh-agent
First, we need to create the public key and Private Key Required for SSH.
If you have already created a file, run the following command to view the file:
Ls ~ /. Ssh/
If you find two files in the form of xx_rsa and xx_rsa.pub, you do not need to perform the following steps. Otherwise, continue
Enter the command
Ssh-keygen
Press enter. A message is displayed, indicating that the instance is successfully created.
Set the correct permissions for the key and directory.
Run the following commands in sequence:
Chmod 700 ~ /. Ssh
Chmod 600 ~ /. Ssh/id_rsa *
In this way, the correct permissions are set.
Submit the public key content to the OpenShift Control Panel
Enter the following command
Vim ~ /. Ssh/id_rsa.pub
The contents of the public key in the generated key are opened, and all copies are selected. Open OpenShift Control Panel
Https://openshift.redhat.com/app/account
Paste all the content into the text box in the lower right corner of Public Keys. If the public key has been submitted, we recommend that you Delete the existing public key and then submit the new public key.
Next, add the ssh key to the ssh-agent.
Enter the following command
Ssh-add ~ /. Ssh/id_rsa
The console returns the following information:
Enter passphrase for/var/root/. ssh/id_rsa:
We didn't set passphrase when creating the key, so press enter directly. System return:
Identity added:/var/root/. ssh/id_rsa (/var/root/. ssh/id_rsa)
Add the key to config once and for all
Open the console and enter the following command:
Vim ~ /. Ssh/config
Enter the following content in the new interface (Prompt: press I to enter edit mode, Press ESC to exit edit mode, and press: wq to save and exit ...... I have said that we need to have vim basics)
Host * .rhcloud.com
IdentityFile ~ /. Ssh/id_rsa
VerifyHostKeyDNS yes
StrictHostKeyChecking no
After the key is saved, the entire process of adding a key to ssh is fixed. If you run the rhc-chk command again, the Your public key is not loaded into a running ssh-agent error will no longer occur.
Question 2: Cannot SSH into your app: xxxxx-ooooo.rhcloud.com.
In fact, this problem is very simple. SSH is blocked for the IP address of your application. Although it can be pinged, SSH cannot be connected.
Solution: Delete the application and recreate it.
URL: http://dev.ppios.com/2013/01/ssh-openshift-using-mac-os-x/