Showing posts with label Redhat. Show all posts
Showing posts with label Redhat. Show all posts

Saturday, February 2, 2019

Display lP address of machine on the banner without login

Add following lines to /etc/rc.local:

# initial setup, cp /etc/issue /etc/issue.orig
cp /etc/issue.orig /etc/issue
ip addr|grep inet |grep -i enp|awk {'print $NF, $2'}|awk -F'/' {'print $1'} >> /etc/issue
echo "" >> /etc/issue


Saturday, December 2, 2017

Install Python Packages without internet connection

Step 1: Install base packages from installation media (DVD)

[root@localhost pip-9.0.1]# yum install gcc python-devel python-setuptools

[root@localhost pip-9.0.1]# rpm -ql python-setuptools.noarch |grep easy_install.py
/usr/lib/python2.7/site-packages/easy_install.py
/usr/lib/python2.7/site-packages/easy_install.pyc
/usr/lib/python2.7/site-packages/easy_install.pyo
/usr/lib/python2.7/site-packages/setuptools/command/easy_install.py
/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyc
/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyo

Step 2: Install pip offline (Refer to step in appendix A to download pip-x.y.z.tar.gz)


[root@localhost pip-9.0.1]# python /usr/lib/python2.7/site-packages/easy_install.py ./pip-9.0.1.tar.gz
Processing pip-9.0.1.tar.gz
Writing /tmp/easy_install-LUeyTI/pip-9.0.1/setup.cfg
Running pip-9.0.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-LUeyTI/pip-9.0.1/egg-dist-tmp-8Ygk34
/usr/lib64/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'python_requires'
  warnings.warn(msg)
warning: no previously-included files found matching '.coveragerc'
warning: no previously-included files found matching '.mailmap'
warning: no previously-included files found matching '.travis.yml'
warning: no previously-included files found matching '.landscape.yml'
warning: no previously-included files found matching 'pip/_vendor/Makefile'
warning: no previously-included files found matching 'tox.ini'
warning: no previously-included files found matching 'dev-requirements.txt'
warning: no previously-included files found matching 'appveyor.yml'
no previously-included directories found matching '.github'
no previously-included directories found matching '.travis'
no previously-included directories found matching 'docs/_build'
no previously-included directories found matching 'contrib'
no previously-included directories found matching 'tasks'
no previously-included directories found matching 'tests'
Adding pip 9.0.1 to easy-install.pth file
Installing pip script to /usr/bin
Installing pip2.7 script to /usr/bin
Installing pip2 script to /usr/bin

Installed /usr/lib/python2.7/site-packages/pip-9.0.1-py2.7.egg
Processing dependencies for pip==9.0.1
Finished processing dependencies for pip==9.0.1

Step 3: Install python packages (use ipython as example) (Refer to step in appendix B to download these package)


[root@localhost python]# ls -l ipython-deps/
total 2640
-rw-r--r--. 1 root root   6497 Dec  2 09:10 backports.shutil_get_terminal_size-1.0.0-py2.py3-none-any.whl
-rw-r--r--. 1 root root   9052 Dec  2 09:10 decorator-4.1.2-py2.py3-none-any.whl
-rw-r--r--. 1 root root  12427 Dec  2 09:10 enum34-1.1.6-py2-none-any.whl
-rw-r--r--. 1 root root 758874 Dec  2 09:10 ipython-5.5.0-py2-none-any.whl
-rw-r--r--. 1 root root  26343 Dec  2 09:10 ipython_genutils-0.2.0-py2.py3-none-any.whl
-rw-r--r--. 1 root root  16631 Dec  2 09:10 pathlib2-2.3.0-py2.py3-none-any.whl
-rw-r--r--. 1 root root  55699 Dec  2 09:10 pexpect-4.3.0-py2.py3-none-any.whl
-rw-r--r--. 1 root root   6864 Dec  2 09:10 pickleshare-0.7.4-py2.py3-none-any.whl
-rw-r--r--. 1 root root 247937 Dec  2 09:10 prompt_toolkit-1.0.15-py2-none-any.whl
-rw-r--r--. 1 root root  39072 Dec  2 09:10 ptyprocess-0.5.2-py2.py3-none-any.whl
-rw-r--r--. 1 root root 841734 Dec  2 09:10 Pygments-2.2.0-py2.py3-none-any.whl
-rw-r--r--. 1 root root  29670 Dec  2 09:10 scandir-1.6.tar.gz
-rw-r--r--. 1 root root 489406 Dec  2 09:10 setuptools-38.2.3-py2.py3-none-any.whl
-rw-r--r--. 1 root root  12663 Dec  2 09:10 simplegeneric-0.8.1.zip
-rw-r--r--. 1 root root  10702 Dec  2 09:10 six-1.11.0-py2.py3-none-any.whl
-rw-r--r--. 1 root root  74730 Dec  2 09:10 traitlets-4.3.2-py2.py3-none-any.whl
-rw-r--r--. 1 root root  21014 Dec  2 09:10 wcwidth-0.1.7-py2.py3-none-any.whl


# --no-index: Ignore package index (Base URL of Python Package Index), only looking at --find-links URLs instead

[root@localhost python]# pip install --no-index --find-links=ipython-deps/ ipython
Collecting ipython
Collecting prompt-toolkit<2.0.0,>=1.0.4 (from ipython)
Requirement already satisfied: decorator in /usr/lib/python2.7/site-packages (from ipython)
Collecting pexpect; sys_platform != "win32" (from ipython)
Collecting backports.shutil-get-terminal-size; python_version == "2.7" (from ipython)
Collecting setuptools>=18.5 (from ipython)
Collecting pygments (from ipython)
Collecting pathlib2; python_version == "2.7" or python_version == "3.3" (from ipython)
Collecting traitlets>=4.2 (from ipython)
Collecting simplegeneric>0.8 (from ipython)
Collecting pickleshare (from ipython)
Collecting wcwidth (from prompt-toolkit<2.0.0,>=1.0.4->ipython)
Collecting six>=1.9.0 (from prompt-toolkit<2.0.0,>=1.0.4->ipython)
Collecting ptyprocess>=0.5 (from pexpect; sys_platform != "win32"->ipython)
Collecting scandir; python_version < "3.5" (from pathlib2; python_version == "2.7" or python_version == "3.3"->ipython)
Collecting ipython-genutils (from traitlets>=4.2->ipython)
Collecting enum34; python_version == "2.7" (from traitlets>=4.2->ipython)
Installing collected packages: wcwidth, six, prompt-toolkit, ptyprocess, pexpect, backports.shutil-get-terminal-size, setuptools, pygments, scandir, pathlib2, ipython-genutils, enum34, traitlets, simplegeneric, pickleshare, ipython
  Found existing installation: setuptools 0.9.8
    Uninstalling setuptools-0.9.8:
       Successfully uninstalled setuptools-0.9.8
  Running setup.py install for scandir ... done
  Running setup.py install for simplegeneric ... done
Successfully installed backports.shutil-get-terminal-size-1.0.0 enum34-1.1.6 ipython-5.5.0 ipython-genutils-0.2.0 pathlib2-2.3.0 pexpect-4.3.0 pickleshare-0.7.4 prompt-toolkit-1.0.15 ptyprocess-0.5.2 pygments-2.2.0 scandir-1.6 setuptools-38.2.3 simplegeneric-0.8.1 six-1.11.0 traitlets-4.3.2 wcwidth-0.1.7
[root@localhost python]#

Step 4: Post Verification


[root@localhost python]# ipython
Python 2.7.5 (default, Aug  4 2017, 00:39:18)
Type "copyright", "credits" or "license" for more information.

IPython 5.5.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: quit

Appendix A: Download PIP (https://pypi.python.org/simple/pip/)

[root@localhost python]# curl -o pip-9.0.1.tar.gz https://pypi.python.org/packages/11/b6/abcb525026a4be042b486df43905d6893fb04f05aac21c32c638e939e447/pip-9.0.1.tar.gz#md5=35f01da33009719497f01a4ba69d63c9
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1169k  100 1169k    0     0   460k      0  0:00:02  0:00:02 –:--:--  460k


Appendix B: Download Packages and their dependencies

[root@localhost python]# pip download ipython -d ipython-deps
Collecting ipython
  Downloading ipython-5.5.0-py2-none-any.whl (758kB)
    100% |████████████████████████████████| 768kB 373kB/s
  Saved ./ipython-deps/ipython-5.5.0-py2-none-any.whl
Collecting prompt-toolkit<2.0.0,>=1.0.4 (from ipython)
  Downloading prompt_toolkit-1.0.15-py2-none-any.whl (247kB)
    100% |████████████████████████████████| 256kB 583kB/s
  Saved ./ipython-deps/prompt_toolkit-1.0.15-py2-none-any.whl
Collecting decorator (from ipython)
  Downloading decorator-4.1.2-py2.py3-none-any.whl
  Saved ./ipython-deps/decorator-4.1.2-py2.py3-none-any.whl
Collecting pexpect; sys_platform != "win32" (from ipython)
  Downloading pexpect-4.3.0-py2.py3-none-any.whl (55kB)
    100% |████████████████████████████████| 61kB 872kB/s
  Saved ./ipython-deps/pexpect-4.3.0-py2.py3-none-any.whl
Collecting backports.shutil-get-terminal-size; python_version == "2.7" (from ipython)
  Downloading backports.shutil_get_terminal_size-1.0.0-py2.py3-none-any.whl
  Saved ./ipython-deps/backports.shutil_get_terminal_size-1.0.0-py2.py3-none-any.whl
Collecting setuptools>=18.5 (from ipython)
  Downloading setuptools-38.2.3-py2.py3-none-any.whl (489kB)
    100% |████████████████████████████████| 491kB 658kB/s
  Saved ./ipython-deps/setuptools-38.2.3-py2.py3-none-any.whl
Collecting pygments (from ipython)
  Downloading Pygments-2.2.0-py2.py3-none-any.whl (841kB)
    100% |████████████████████████████████| 849kB 830kB/s
  Saved ./ipython-deps/Pygments-2.2.0-py2.py3-none-any.whl
Collecting pathlib2; python_version == "2.7" or python_version == "3.3" (from ipython)
  Downloading pathlib2-2.3.0-py2.py3-none-any.whl
  Saved ./ipython-deps/pathlib2-2.3.0-py2.py3-none-any.whl
Collecting traitlets>=4.2 (from ipython)
  Downloading traitlets-4.3.2-py2.py3-none-any.whl (74kB)
    100% |████████████████████████████████| 81kB 2.0MB/s
  Saved ./ipython-deps/traitlets-4.3.2-py2.py3-none-any.whl
Collecting simplegeneric>0.8 (from ipython)
  Downloading simplegeneric-0.8.1.zip
  Saved ./ipython-deps/simplegeneric-0.8.1.zip
Collecting pickleshare (from ipython)
  Downloading pickleshare-0.7.4-py2.py3-none-any.whl
  Saved ./ipython-deps/pickleshare-0.7.4-py2.py3-none-any.whl
Collecting wcwidth (from prompt-toolkit<2.0.0,>=1.0.4->ipython)
  Downloading wcwidth-0.1.7-py2.py3-none-any.whl
  Saved ./ipython-deps/wcwidth-0.1.7-py2.py3-none-any.whl
Collecting six>=1.9.0 (from prompt-toolkit<2.0.0,>=1.0.4->ipython)
  Downloading six-1.11.0-py2.py3-none-any.whl
  Saved ./ipython-deps/six-1.11.0-py2.py3-none-any.whl
Collecting ptyprocess>=0.5 (from pexpect; sys_platform != "win32"->ipython)
  Downloading ptyprocess-0.5.2-py2.py3-none-any.whl
  Saved ./ipython-deps/ptyprocess-0.5.2-py2.py3-none-any.whl
Collecting scandir; python_version < "3.5" (from pathlib2; python_version == "2.7" or python_version == "3.3"->ipython)
  Downloading scandir-1.6.tar.gz
  Saved ./ipython-deps/scandir-1.6.tar.gz
Collecting ipython-genutils (from traitlets>=4.2->ipython)
  Downloading ipython_genutils-0.2.0-py2.py3-none-any.whl
  Saved ./ipython-deps/ipython_genutils-0.2.0-py2.py3-none-any.whl
Collecting enum34; python_version == "2.7" (from traitlets>=4.2->ipython)
  Downloading enum34-1.1.6-py2-none-any.whl
  Saved ./ipython-deps/enum34-1.1.6-py2-none-any.whl
Successfully downloaded ipython prompt-toolkit decorator pexpect backports.shutil-get-terminal-size setuptools pygments pathlib2 traitlets simplegeneric pickleshare wcwidth six ptyprocess scandir ipython-genutils enum34

Sunday, October 18, 2015

Expand OCRVOTE diskgroup size before upgrading to 12c



[root@rac01 ~]# oracleasm createdisk VOTE2 /dev/sdd1
Writing disk header: done
Instantiating disk: done

SQL> select path, name, header_status from v$asm_disk;

PATH                 NAME                           HEADER_STATU
-------------------- ------------------------------ ------------
ORCL:VOTE2                                          PROVISIONED
ORCL:DATA1           DATA1                          MEMBER
ORCL:FRA1            FRA1                           MEMBER
ORCL:VOTE1           VOTE1                          MEMBER

SQL> alter diskgroup OCRVOTE add disk 'ORCL:VOTE2' drop disk VOTE1;

Diskgroup altered.

SQL> select path, name, header_status from v$asm_disk;

PATH                 NAME                           HEADER_STATU
-------------------- ------------------------------ ------------
ORCL:VOTE1                                          FORMER
ORCL:DATA1           DATA1                          MEMBER
ORCL:FRA1            FRA1                           MEMBER
ORCL:VOTE2           VOTE2                          MEMBER

Wednesday, September 9, 2009

Quick guide: how to manage Redhat Cluster in RHEL 5

Check cluster status


[root@ncs-db-1 ~]# clustat
Cluster Status for ncs_dbcluster @ Wed Sep 1 15:22:08 2009
Member Status: Quorate

Member Name ID Status
------ ---- ---- ------
ncs-db-n1 1 Online, Local, rgmanager
ncs-db-n2 2 Online, rgmanager

Service Name Owner (Last) State
------- ---- ----- ------ -----
service:clusvc ncs-db-n1 started


Disable cluster status
After disable, resource group shutdown and will not affect by server reboot and/or failover.


[root@ncs-db-1 ~]# clusvcadm -d clusvc
Local machine disabling service:clusvc...Success



Enable cluster status


[root@ncs-db-1 ~]# clusvcadm -e clusvc
Local machine trying to enable service:clusvc...Success
service:clusvc is now running on ncs-db-n1


Freeze cluster resource group
After freeze resource group, it will not being monitored by the cluster manager. But current resource group state will not be affected by this command.


[root@ncs-db-1 ~]# clusvcadm -Z clusvc
Local machine freezing service:clusvc...Success


Unfreeze cluster resource group


[root@ncs-db-1 ~]# clusvcadm -U clusvc
Local machine unfreezing service:clusvc...Success



Stop cluster resource group
Resource group can failover if current node due to fencing.


[root@ncs-db-1 ~]# clusvcadm -s clusvc
Local machine stopping service:clusvc...Success



Restart cluster resource group
Resource group can failover if current node due to fencing.


[root@ncs-db-1 ~]# clusvcadm -s clusvc
Local machine stopping service:clusvc...Success


Relocate resource to another member in the failover domain


[root@ncs-db-1 ~]# clusvcadm -r clusvc -m ncs-db-n2
Trying to relocate service:clusvc to ncs-db-n2...Success
service:clusvc is now running on ncs-db-n2


Other useful commands


[root@ncs-db-1 ~]# ccs_tool lsnode

Cluster name: ncs_dbcluster, config_version: 21

Nodename Votes Nodeid Fencetype
ncs-db-n1 1 1 ncs-db-1-ilo1
ncs-db-n2 1 2 ncs-db-2-ilo2



[root@ncs-db-1 ~]# cman_tool status
Version: 6.1.0
Config Version: 21
Cluster Name: ncs_cluster
Cluster Id: 27444
Cluster Member: Yes
Cluster Generation: 1796
Membership state: Cluster-Member
Nodes: 2
Expected votes: 1
Total votes: 2
Quorum: 1
Active subsystems: 9
Flags: 2node Dirty
Ports Bound: 0 11 177
Node name: ncs-db-n1
Node ID: 1
Multicast addresses: xxx.xxx.xxx.xxx
Node addresses: xxx.xxx.xxx.xxx

Tuesday, September 8, 2009

How to differentiate RHEL releases correctly

Please take note, this artical is only focusing on Server relate product, not Desktop product.

Before RHEL5, we usually talked about AS & ES for server editions.

  • AS: Red Hat Enterprise Linux AS ("advanced server")
  • ES: Red Hat Enterprise Linux ES ("entry/mid server")

Key limitations with RHEL3 ES (kernel foundation Linux 2.4.21)

  • Maximum 2 CPU sockets
  • Maximum 8 GB RAM
  • No support on IBM Power

Key limitations with RHEL4 ES (kernel foundation Linux 2.6.9)

  • Maximum 2 CPU sockets
  • Maximum 8 GB RAM
  • No support on IBM Power

Start with RHEL 5, Redhat starts to use "RHEL" and "RHEL Advanced Platform" to replace "ES" & "AS".

Key limitations with RHEL5 (kernel foundation Linux 2.6.18)

  • Maximum 2 CPU sockets
  • Maximum 4 virtualized guests/instances
  • No support for Storage virtualization (with Red Hat GFS and Cluster Suite)

Reference:

http://www.redhat.com/rhel/compare/

http://www.redhat.com/whitepapers/rhel/RHEL3FamOverWPSO.pdf

http://www.tips5.com/difference-between-as-ws-es-and-desktop-of-redhat-enterprise-linux