Wednesday 29 April 2020

How to Install OCI CLI on Linux

How to Install OCI CLI on Linux

To install the OCL CLI on Linux

  1. Open a terminal.
  2. To run the installer script, run the following command.
[root@dev02 ~]# bash -c "$(curl -L https://raw.githubusercontent.com/oracle/oci-cli/master/scripts/install/install.sh)"
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 14867  100 14867    0     0   8588      0  0:00:01  0:00:01 --:--:--  8583

    ******************************************************************************
    You have started the OCI CLI Installer in interactive mode. If you do not wish
    to run this in interactive mode, please include the --accept-all-defaults option.
    If you have the script locally and would like to know more about
    input options for this script, then you can run:
    ./install.sh -h
    If you would like to know more about input options for this script, refer to:
    https://github.com/oracle/oci-cli/blob/master/scripts/install/README.rst
    ******************************************************************************
Downloading Oracle Cloud Infrastructure CLI install script from https://raw.githubusercontent.com/oracle/oci-cli/v2.9.3/scripts/install/install.py to /tmp/oci_cli_install_tmp_XGiv.
########################################################################################################################################################################################### 100.0%
Python not found on system PATH
Running install script.
python3 /tmp/oci_cli_install_tmp_XGiv
-- Verifying Python version.
-- Python version 3.6.8 okay.

===> In what directory would you like to place the install? (leave blank to use '/root/lib/oracle-cli'):
-- Creating directory '/root/lib/oracle-cli'.
-- We will install at '/root/lib/oracle-cli'.

===> In what directory would you like to place the 'oci' executable? (leave blank to use '/root/bin'):
-- Creating directory '/root/bin'.
-- The executable will be in '/root/bin'.

===> In what directory would you like to place the OCI scripts? (leave blank to use '/root/bin/oci-cli-scripts'):
-- Creating directory '/root/bin/oci-cli-scripts'.
-- The scripts will be in '/root/bin/oci-cli-scripts'.

===> Currently supported optional packages are: ['db (will install cx_Oracle)']
What optional CLI packages would you like to be installed (comma separated names; press enter if you don't need any optional packages)?: db
-- The optional packages installed will be 'db'.
-- Trying to use python3 venv.
-- Executing: ['/usr/bin/python3', '-m', 'venv', '/root/lib/oracle-cli']
-- Executing: ['/root/lib/oracle-cli/bin/pip', 'install', '--upgrade', 'pip']
Collecting pip
  Downloading https://files.pythonhosted.org/packages/54/2e/df11ea7e23e7e761d484ed3740285a34e38548cf2bad2bed3dd5768ec8b9/pip-20.1-py2.py3-none-any.whl (1.5MB)
    100% |████████████████████████████████| 1.5MB 198kB/s
Installing collected packages: pip
  Found existing installation: pip 9.0.3
    Uninstalling pip-9.0.3:
      Successfully uninstalled pip-9.0.3
Successfully installed pip-20.1
-- Executing: ['/root/lib/oracle-cli/bin/pip', 'install', '--cache-dir', '/tmp/tmpo8naa29h', 'wheel', '--upgrade']
Collecting wheel
  Downloading wheel-0.34.2-py2.py3-none-any.whl (26 kB)
Installing collected packages: wheel
Successfully installed wheel-0.34.2
-- Executing: ['/root/lib/oracle-cli/bin/pip', 'install', '--cache-dir', '/tmp/tmpo8naa29h', 'oci_cli[db]', '--upgrade']
Collecting oci_cli[db]
  Downloading oci_cli-2.10.1-py2.py3-none-any.whl (8.2 MB)
     |████████████████████████████████| 8.2 MB 44 kB/s
Collecting retrying==1.3.3
  Downloading retrying-1.3.3.tar.gz (10 kB)
Collecting pyOpenSSL==18.0.0
  Downloading pyOpenSSL-18.0.0-py2.py3-none-any.whl (53 kB)
     |████████████████████████████████| 53 kB 186 kB/s
Collecting terminaltables==3.1.0
  Downloading terminaltables-3.1.0.tar.gz (12 kB)
Collecting python-dateutil<3.0.0,>=2.5.3
  Downloading python_dateutil-2.8.1-py2.py3-none-any.whl (227 kB)
     |████████████████████████████████| 227 kB 98 kB/s
Collecting jmespath==0.9.4
  Downloading jmespath-0.9.4-py2.py3-none-any.whl (24 kB)
Collecting certifi
  Downloading certifi-2020.4.5.1-py2.py3-none-any.whl (157 kB)
     |████████████████████████████████| 157 kB 117 kB/s
Collecting PyYAML==5.1.2
  Downloading PyYAML-5.1.2.tar.gz (265 kB)
     |████████████████████████████████| 265 kB 190 kB/s
Collecting arrow==0.14.7
  Downloading arrow-0.14.7-py2.py3-none-any.whl (39 kB)
Collecting cryptography==2.8
  Downloading cryptography-2.8-cp34-abi3-manylinux2010_x86_64.whl (2.3 MB)
     |████████████████████████████████| 2.3 MB 118 kB/s
Collecting idna<2.7,>=2.5
  Downloading idna-2.6-py2.py3-none-any.whl (56 kB)
     |████████████████████████████████| 56 kB 91 kB/s
Collecting configparser==4.0.2
  Downloading configparser-4.0.2-py2.py3-none-any.whl (22 kB)
Collecting oci==2.14.0
  Downloading oci-2.14.0-py2.py3-none-any.whl (4.2 MB)
     |████████████████████████████████| 4.2 MB 300 kB/s
Collecting click==6.7
  Downloading click-6.7-py2.py3-none-any.whl (71 kB)
     |████████████████████████████████| 71 kB 62 kB/s
Collecting six==1.14.0
  Downloading six-1.14.0-py2.py3-none-any.whl (10 kB)
Collecting pytz>=2016.10
  Downloading pytz-2020.1-py2.py3-none-any.whl (510 kB)
     |████████████████████████████████| 510 kB 429 kB/s
Collecting cx-Oracle==7.0; extra == "db"
  Downloading cx_Oracle-7.0.0-cp36-cp36m-manylinux1_x86_64.whl (675 kB)
     |████████████████████████████████| 675 kB 422 kB/s
Collecting cffi!=1.11.3,>=1.8
  Downloading cffi-1.14.0-cp36-cp36m-manylinux1_x86_64.whl (399 kB)
     |████████████████████████████████| 399 kB 69 kB/s
Collecting pycparser
  Downloading pycparser-2.20-py2.py3-none-any.whl (112 kB)
     |████████████████████████████████| 112 kB 536 kB/s
Building wheels for collected packages: retrying, terminaltables, PyYAML
  Building wheel for retrying (setup.py) ... done
  Created wheel for retrying: filename=retrying-1.3.3-py3-none-any.whl size=11430 sha256=08791050cbdbf315306c58daba16697b4b2e4af65e773fb178d72931707ea6d9
  Stored in directory: /tmp/tmpo8naa29h/wheels/ac/cb/8a/b27bf6323e2f4c462dcbf77d70b7c5e7868a7fbe12871770cf
  Building wheel for terminaltables (setup.py) ... done
  Created wheel for terminaltables: filename=terminaltables-3.1.0-py3-none-any.whl size=15354 sha256=a725115503c88152be08c0a5e8066e777ac8b23f15e3e730c6cbc2ff98ca6c4b
  Stored in directory: /tmp/tmpo8naa29h/wheels/86/1b/58/c23af2fe683acd8edc15d5a1268f0242be1ff2cf827fe34737
  Building wheel for PyYAML (setup.py) ... done
  Created wheel for PyYAML: filename=PyYAML-5.1.2-cp36-cp36m-linux_x86_64.whl size=44104 sha256=dd749f808cb88be452034330e4e75b3e053661a73726b6f441ddc636e5703319
  Stored in directory: /tmp/tmpo8naa29h/wheels/d8/9b/e7/75af463b873c119dd444151fc54a8e190c87993593e1fa194a
Successfully built retrying terminaltables PyYAML
Installing collected packages: six, retrying, pycparser, cffi, cryptography, pyOpenSSL, terminaltables, python-dateutil, jmespath, certifi, PyYAML, arrow, idna, configparser, pytz, oci, click, cx-Oracle, oci-cli
Successfully installed PyYAML-5.1.2 arrow-0.14.7 certifi-2020.4.5.1 cffi-1.14.0 click-6.7 configparser-4.0.2 cryptography-2.8 cx-Oracle-7.0.0 idna-2.6 jmespath-0.9.4 oci-2.14.0 oci-cli-2.10.1 pyOpenSSL-18.0.0 pycparser-2.20 python-dateutil-2.8.1 pytz-2020.1 retrying-1.3.3 six-1.14.0 terminaltables-3.1.0

===> Modify profile to update your $PATH and enable shell/tab completion now? (Y/n): y

===> Enter a path to an rc file to update (leave blank to use '/root/.bashrc'):
-- Backed up '/root/.bashrc' to '/root/.bashrc.backup'
-- Tab completion set up complete.
-- If tab completion is not activated, verify that '/root/.bashrc' is sourced by your shell.
--
-- ** Run `exec -l $SHELL` to restart your shell. **
--
-- Installation successful.
-- Run the CLI with /root/bin/oci --help
[root@dev02 ~]#


[root@dev02 ~]# oci -v
2.10.1
[root@dev02 ~]#
It shows the OCI version as 2.10.1 

This completes the OCI CLI installation on Linux

Saturday 25 April 2020

How to create Yum respository in RHEL 7

This blog shows the various steps needed to create a Yum repository in RHEL 7

1. Mount the ISO CD to your server

2. Navigate to the Packages directory under the ISO CD

[root@dev1 RHEL-7.3 Server.x86_64]# pwd
/run/media/root/RHEL-7.3 Server.x86_64
[root@dev1 RHEL-7.3 Server.x86_64]# ls -ltr
total 894
-r--r--r--.  1 root root  18092 Mar  6  2012 GPL
-r--r--r--.  1 root root   8266 Apr  4  2014 EULA
-r--r--r--.  1 root root   3211 Sep 27  2016 RPM-GPG-KEY-redhat-release
-r--r--r--.  1 root root   3375 Sep 27  2016 RPM-GPG-KEY-redhat-beta
-r--r--r--.  1 root root    114 Oct 19  2016 media.repo
-r--r--r--.  1 root root   1568 Oct 19  2016 TRANS.TBL
dr-xr-xr-x.  2 root root   4096 Oct 19  2016 repodata
dr-xr-xr-x. 24 root root   6144 Oct 19  2016 release-notes
dr-xr-xr-x.  2 root root 858112 Oct 19  2016 Packages
dr-xr-xr-x.  2 root root   2048 Oct 19  2016 LiveOS
dr-xr-xr-x.  2 root root   2048 Oct 19  2016 isolinux
dr-xr-xr-x.  3 root root   2048 Oct 19  2016 images
dr-xr-xr-x.  3 root root   2048 Oct 19  2016 EFI
dr-xr-xr-x.  4 root root   2048 Oct 19  2016 addons
[root@dev1 RHEL-7.3 Server.x86_64]#


3. Create a folder to copy the packages on the server. 

[root@dev1 ~]# pwd
/root
[root@dev1 ~]# mkdir repo

[root@dev1 repo]# pwd
/root/repo


4. Copy Packages from ISO cd to the folder created above (Step 3)

[root@dev1 RHEL-7.3 Server.x86_64]# cp Packages/* /root/repo/

....
....

[After files are copies]

[root@dev1 repo]# pwd
/root/repo
[root@dev1 repo]# ls -ltr *.rpm | wc -l
4751
[root@dev1 repo]#


5. Install createrepo package
[root@dev1 repo]# rpm -ivh createrepo-0.9.9-26.el7.noarch.rpm
warning: createrepo-0.9.9-26.el7.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing...                          ################################# [100%]
        package createrepo-0.9.9-26.el7.noarch is already installed
[root@dev1 repo]#

[In my case, its already installed]

6.  Create the repository using createrepo command

[root@dev1 repo]# createrepo /root/repo
Spawning worker 0 with 4751 pkgs
Workers Finished
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete
[root@dev1 repo]#


7. 

XX_XXXXXXX is not a valid responsibility for the current user. Please contact your System Administrator.

  XX_XXXXXXX is not a valid responsibility for the current user. Please contact your System Administrator. Issue : When user logs into EBS, ...