Redfish:Accessing Redfish enabled systems using Python
Jump to navigation
Jump to search
Introduction
- This documents contains preparation on the OS to make redfish runs from the OS command line console.
- One sample python script is provided, with sample output.
- As of this writing, only Red Hat 6.x is supported (tested)
- This document only covers additional steps needed to make redfish run on the OS. It does not cover OS installation instructions.
Installation of Chrome Browser
- Not actually vital but useful for when you have to do individual manual test, launching RESTful API commands, etc
- Installation must be done as root
[root@localhost ~]# cd Downloads/
[root@localhost Downloads]# wget http://chrome.richardlloyd.org.uk/install_chrome.sh
--2016-01-11 03:50:00-- http://chrome.richardlloyd.org.uk/install_chrome.sh
Resolving chrome.richardlloyd.org.uk... 193.110.246.53
Connecting to chrome.richardlloyd.org.uk|193.110.246.53|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 79768 (78K) [application/x-sh]
Saving to: “install_chrome.sh”
100%[================================================================================>] 79,768 --.-K/s in 0.1s
2016-01-11 03:50:01 (541 KB/s) - “install_chrome.sh” saved [79768/79768]
[root@localhost Downloads]# chmod +x install_chrome.sh
[root@localhost Downloads]# ./install_chrome.shInstallation of Python 2.7
- Next, you will need to install Python 2.7, since Red Hat default Python version is 2.6
- Warning: Red Hat OS depends on Python version 2.6, therefore, Python version 2.7 must coexist, and you are not allowed to replace version 2.6
- This should be done as root
[root@localhost Downloads]# yum groupinstall "development tools" -y
[root@localhost Downloads]# mkdir tmp
[root@localhost Downloads]# cd tmp
[root@localhost tmp]# wget http://python.org/ftp/python/2.7.3/Python-2.7.3.tgz
[root@localhost tmp]# tar zxvf Python-2.7.3.tgz
[root@localhost tmp]# cd Python-2.7.3
[root@localhost Python-2.7.3]# ./configure --prefix=/opt/python2.7 --enable-shared
[root@localhost Python-2.7.3]# make
[root@localhost Python-2.7.3]# make altinstall
[root@localhost Python-2.7.3]# echo "/opt/python2.7/lib" >> /etc/ld.so.conf.d/opt-python2.7.conf
[root@localhost Python-2.7.3]# ldconfigSetup Path
- Go to your home directory, then edit your .bashrc file
- Note: You don’t have to be root to edit .bashrc, since this is your own account’s file
- Add this line to your .bashrc file:
export PATH=${PATH}:/opt/python2.7/bin
- For example:
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# User specific aliases and functions
export PATH=${PATH}:/opt/python2.7/bin- Then source
.bashrc
[jon@localhost ~]$ source ./.bashrc- Confirm the Python 2.7 binary directory is now in your path:
[jon@localhost ~]$ echo $PATH
/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/jon/bin:/opt/python2.7/bin