Tag Archives: linux

Changing command prompt in LINUX

1. Logon as the user which you which to change the prompt. NOTE: You have to add this to your .profile file to have it survive reboot. This file is normally located /home/ directory and it is a hidden file so will be preceded by a period.
2. Export a new PS1 value with the text you want: In this example I am using ‘username@machine_name promt’

$export PS1='[\u@mylinux \W ]\$’
[oracle@mylinux ~ ]$

3. This completes changing command prompt on LINUX.
Larry Catt, OCP

Determine the release of linux you are using

How determine what linux, you have installed.

Options:

1. Via release files in /etc directory.

[root@mylinux /# cat /etc/*-release
LSB_VERSION=base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Oracle Linux Server release 6.5
Red Hat Enterprise Linux Server release 6.5 (Santiago)
Oracle Linux Server release 6.5
[root@mylinux /]#

2. Via lsb_release command.

[root@mylinux /]# lsb_release
LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
[root@mylinux /]#

3. Via /proc/version file

[root@mylinux /]# cat /proc/version
Linux version 3.8.13-35.1.1.el6uek.x86_64 (mockbuild@ca-build44.us.oracle.com) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC) ) #2 SMP Fri Jun 6 10:52:33 PDT 2014
[root@mylinux /]#

Larry Catt
OCP

Rename LINUX Server

1. Logon as the root user to your Linux Server.

[larry@localmachine ~]$ su –
Password:
Last login: Thu Jun 11 12:29:24 EDT 2017 on pts/1
[root@localmachine ~]#

2. You must edit the file /etc/hostname to change the local machine name. You can generate a statement to update /etc/hostname with the following bash command:

cat /etc/hostname | awk -F. ‘{print “\n\n perl -pi.bak -e ‘”‘”‘s/”$1″//g'”‘”‘ /etc/hostname”}’

[root@localmachine ~]# cat /etc/hostname | awk -F. ‘{print “\n\n perl -pi.bak -e ‘”‘”‘s/”$1″//g'”‘”‘ /etc/hostname”}’

perl -pi.bak -e ‘s/localmachine//g’ /etc/hostname
[root@localmachine ~]#

3. Take the resulting string and replace the text with the name of the machine you wish for your server.

Original Perl Command output:
perl -pi.bak -e ‘s/localmachine//g’ /etc/hostname

Edited Perl Command output: (New Server Name)

perl -pi.bak -e ‘s/localmachine/linux1/g’ /etc/hostname

[root@localmachine ~]# perl -pi.bak -e ‘s/localmachine/linux1/g’ /etc/hostname
[root@localmachine ~]#

4. Reboot your Linux Server.

[root@localmachine ~]# reboot

5. Logon to your Linux Server after reboot completes and see new name of Server with command: hostname.

[larry@linux1 ~]$ su –
Password:
Last login: Thu Jun 11 14:31:50 EDT 2017 from 10.30.15.69 on pts/1
[root@linux1 ~]# hostname
linux1.localdomain
[root@linux1 ~]#

6. This completes changing LINUX Server name.

Larry Catt, OCP

Disable Linux Firewall

When preparing your RHEL server for an Oracle RDBMS or other application software installations, it is normally a good idea to temporarily disable the OS layer firewall to prevent possible communication errors. This can be performed with the command CHKCONFIG. Use the following procedures to check and disable or enable the RHEL firewall.

1. Logon as the root user.
Using username “root”.
Last login: Mon Jun 2 08:57:14 2014 from 192.168.10.1
[root@linuxpc ~]#
2. Check the current status of RHEL firewall with command ‘SERVICE’ command.
[root@linuxpc ~]# service iptables status
Table: filter
Chain INPUT (policy ACCEPT)
num target prot opt source destination
1 ACCEPT all — 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
2 ACCEPT icmp — 0.0.0.0/0 0.0.0.0/0
3 ACCEPT all — 0.0.0.0/0 0.0.0.0/0
4 ACCEPT tcp — 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22
5 REJECT all — 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited

Chain FORWARD (policy ACCEPT)
num target prot opt source destination
1 REJECT all — 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited

Chain OUTPUT (policy ACCEPT)
num target prot opt source destination

[root@linuxpc ~]#

3. As shown above the firewall is currently active, You can disable now with the ‘SERVICE’ command.
[root@linuxpc ~]# service iptables stop
iptables: Flushing firewall rules: [ OK ]
iptables: Setting chains to policy ACCEPT: filter [ OK ]
iptables: Unloading modules: [ OK ]
[root@linuxpc ~]#

4. Or you can use the ‘CHKCONFIG’ command to disable the RHEL firewall, which shuts the firewall down on reboot. This is done by adding references to the appropriate /etc/rc.d directory to either kill the service or start the service at given run level.
[root@linuxpc ~]# chkconfig iptables off
[root@linuxpc ~]#

Larry Catt, OCP

Changing network configuration on Linux

This procedure can be used to change anything related to your network card configuration and have that change be persistent on system reboot.

  1. Logon as the root user
  2. Change directory to /etc/sysconfig/network-scripts

 [root@oel1 ~]# cd /etc/sysconfig/network-scripts

[root@oel1 network-scripts]#

3. VI the file ifcfg-eth0 and make the changes you wish.   In the example below, we edited the IPADDR variable to value of 192.1638.1.220

DEVICE=eth0

HWADDR=08:00:27:8F:E8:7D

TYPE=Ethernet

UUID=3138ac97-98ca-40fe-b24a-adea56ab46a9

ONBOOT=yes

NM_CONTROLLED=yes

BOOTPROTO=static

BROADCAST=192.168.1.255

IPADDR=192.168.1.220

NETMASK=255.255.255.0

  1. Stop the network service

 service network stop

5. Start the network service

service network start

6.   See the new configuration detail of eth0 with ifconfig command.

[root@oel1 ~]# ifconfig eth0

eth0      Link encap:Ethernet  HWaddr 08:00:27:8F:E8:7D

          inet addr:19.168.1.220 Bcast:19.168.1.255  Mask:255.255.255.0

          inet6 addr: fe80::a00:27ff:fe8f:e87d/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:16595 errors:0 dropped:0 overruns:0 frame:0

          TX packets:659 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:3986311 (3.8 MiB) TX bytes:98819 (96.5 KiB)

 

[root@oel1 ~]#

 

Larry Catt

Fixing access denied error from Linux Server

You attempt to access a remote Linux machine and receive the following error after logon attempt with correct username/password combination.  This indicates that the machine is not accepting password authentication as an access method.   To resolve this issue, perform the following change to sshd_config file as follows:

 

Error:

 

login as: root

root@192.168.1.220’s password:

Access denied

root@192.168.1.220’s password:

 

 

Steps to resolve this issue:

  1. Logon directly to Linux console as the root user.
  2. Change directory to /etc/ssh

[root@oel1 ~]# cd /etc/ssh

  1. Open the file sshd_config

[root@oel1 ssh]# vi sshd_config

  1. Change the line <PasswordAuthentication no> to read <PasswordAuthentication yes>
  2. Stop the sshd service

[root@oel1 ssh]# service sshd stop

Stopping sshd:                                            [  OK  ]

[root@oel1 ssh]#

  1. Start the sshd service

[root@oel1 ssh]# service sshd start

Starting sshd:                                            [  OK  ]

[root@oel1 ssh]#

  1. Attempt to connect with username / password combination.

[root@oel1 ssh]# ssh 192.168.1.220

The authenticity of host ‘192.168.1.220 (192.168.1.220)’ can’t be established.

RSA key fingerprint is 74:e4:db:67:e9:7e:81:6f:dc:16:1d:06:25:7e:20:ae.

Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added ‘192.168.1.220’ (RSA) to the list of known hosts.

Password:

Last login: Thu Oct  3 11:09:46 2013 from 192.168.1.78

[root@oel1 ~]#

 

You have successfully logon with username and password.

 

Larry Catt

Removing Oracle 10g RAC components from LINUX server

The following procedure is used to remove all RAC components created during the clusterware and RDBMS installation of 10g from a Linux server. NOTE: Once executed, Clusterware will not be usable.

1. Logon to the server as root.

2. Run the following command from any location on your server to remove all Oracle 10g RAC components from your OS layer. Note: RAC will not be useable on the system once executed.

rm -rf /etc/oracle
rm -rf /etc/oraInst.loc
rm -rf /etc/oratab
rm -rf /etc/init.d/*crs*
rm -rf /etc/init.d/init.cssd
rm -rf /etc/init.d/init.evmd
rm -rf /etc/rc*/*crs*
rm -rf /etc/*crs*
rm -rf /tmp/Ora*
rm -rf /tmp/.oracle


Larry J. Catt
oracle@allcompute.com
www.allcompute.com

Creation of Oracle OS accounts for 11g RAC install on Linux

Deployment of Oracle software requires the creation of multiple groups and users on UNIX and Linux servers to properly configure and administrate. This procedure covers the basic creation of Oracle groups and users for a standard 11g RAC implementation.

1. Create group accounts on all nodes: NOTE: id must be exactly the same

/usr/sbin/groupadd -g 501 oinstall
/usr/sbin/groupadd -g 502 dba
/usr/sbin/groupadd -g 504 asmadmin
/usr/sbin/groupadd -g 506 asmdba
/usr/sbin/groupadd -g 507 asmoper

2. Create user accounts on all nodes: NOTE: id must be exactly the same

/usr/sbin/useradd -u 501 -g oinstall -G asmadmin,asmdba,asmoper grid
/usr/sbin/useradd -u 502 -g oinstall -G dba,asmdba oracle

3. Set password for GRID and ORACLE account to be the same on every node.

passwd oracle
Changing password for user oracle.
New UNIX password: password
retype new UNIX password: password
passwd: all authentication tokens updated successfully.
passwd grid
Changing password for user oracle.
New UNIX password: password
retype new UNIX password: password
passwd: all authentication tokens updated successfully.

This completes the standard configuration creation of Oracle groups and users on Linux.

Larry Catt, OCP 9i, 10g
oracle@allcompute.com
www.allcompute.com

Configuration of OCFS2 in LINUX

OCFS2 Oracle Cluster File System version 2 is a file system which allows for multiple machines to open the same files at the same time without corruption. This file system can be used for multiple reasons but is mostly seen in Oracle RAC systems. This article details the configuration of OCFS2 after the RPMs have been installed on your OS.

1. Logon to your Linux server as root.

2. Create the directory /etc/ocfs2 to house your oracle cluster.conf file. This file will contain the name of your cluster and all nodes with in that cluster.

[root@mylinux1 etc]# mkdir /etc/ocfs2
[root@mylinux1 etc]# chmod 775 /etc/ocfs2

3. Edit the file cluster.conf and enter the strings similar to below; changing the value of ip_address, name and cluster to values which are correct for your installation..

[root@mylinux1 etc]# vi /etc/ocfs2/cluster.conf

node:
ip_port = 7777
ip_address = 204.34.132.38
number = 0
name = mylinux1.mydomain.com
cluster = myrac

node:
ip_port = 7777
ip_address = 204.34.132.39
number = 1
name = mylinux2.mydomain.com
cluster = myrac

cluster:
node_count = 2
name = myrac

4. Configure the ocfs2 installed on each node of the RAC with the o2cb configure command. NOTE: Enter the following:


Load O2CB driver on boot (y/n) [y] = y
Cluster stack backing O2CB [o2cb] = o2cb
Cluster to start on boot (Enter “none” to clear) [ocfs2]: = name of the cluster in cluster.conf file for this example it is myrac
Specify heartbeat dead threshold (>=7) [31] = 31
Specify network idle timeout in ms (>=5000) [30000] = 30000
Specify network keepalive delay in ms (>=1000) [2000] = 2000
Specify network reconnect delay in ms (>=2000) [2000] = 2000

Example:
[root@mylinux1 etc]# /etc/init.d/o2cb configure
Configuring the O2CB driver.

This will configure the on-boot properties of the O2CB driver.
The following questions will determine whether the driver is loaded on
boot. The current values will be shown in brackets (‘[]’). Hitting
without typing an answer will keep that current value. Ctrl-C
will abort.

Load O2CB driver on boot (y/n) [y]:
Cluster stack backing O2CB [o2cb]:
Cluster to start on boot (Enter “none” to clear) [ocfs2]: myrac
Specify heartbeat dead threshold (>=7) [31]:
Specify network idle timeout in ms (>=5000) [30000]:
Specify network keepalive delay in ms (>=1000) [2000]:
Specify network reconnect delay in ms (>=2000) [2000]:
Writing O2CB configuration: OK
Starting O2CB cluster myrac: OK
[root@mylinux1 etc]#

[root@mylinux2 etc]# /etc/init.d/o2cb configure
Configuring the O2CB driver.

This will configure the on-boot properties of the O2CB driver.
The following questions will determine whether the driver is loaded on
boot. The current values will be shown in brackets (‘[]’). Hitting
without typing an answer will keep that current value. Ctrl-C
will abort.

Load O2CB driver on boot (y/n) [n]: y
Cluster stack backing O2CB [o2cb]:
Cluster to start on boot (Enter “none” to clear) [ocfs2]: myrac
Specify heartbeat dead threshold (>=7) [31]:
Specify network idle timeout in ms (>=5000) [30000]:
Specify network keepalive delay in ms (>=1000) [2000]:
Specify network reconnect delay in ms (>=2000) [2000]:
Writing O2CB configuration: OK
Loading filesystem “configfs”: OK
Mounting configfs filesystem at /sys/kernel/config: OK
Loading filesystem “ocfs2_dlmfs”: OK
Creating directory ‘/dlm’: OK
Mounting ocfs2_dlmfs filesystem at /dlm: OK
Starting O2CB cluster myrac: OK
[root@mylinux2 etc]#


This completes configuration of OCFS2 for Oracle RAC.

Larry J. Catt, OCP 9i, 10g
oracle@allcompute.com
www.allcompute.com

Download and Installation of OCFS2 RPMs for Linux

Oracle Cluster File System 2 (OCFS2) is a file system which allows for multiple hosts to access the same files on a shared storage at the same time. This type of access is required for deployment of an Oracle RAC system. In this article we will cover the procedure to download and install the RPMs for OCFS2 to support shared storage on an Oracle RAC system.

1. Determine the current Kernel installed on all RAC nodes. NOTE: The kernels must be the same on every RAC node.

NODE 1:
[root@mylinux1 etc]# uname -r
2.6.18-194.32.1.el5
[root@mylinux1 etc]#

NODE2:
[root@mylinux2 ~]# uname -r
2.6.18-194.32.1.el5
[root@mylinux2 ~]#

2. Go to the URL: http://oss.oracle.com/projects/ocfs2/ , select the download tab and navigate to the correct rpm download for your kernel.

2.6.18-194.32.1.el5
2011.01.20
Packages for RHEL5 2.6.18-194.32.1.el5

3. Go to the URL: http://oss.oracle.com/projects/ocfs2-tools/, select the download tab and navigate to the correct rpm downloads for your OS. Example for this OS we download the following files:

ocfs2-tools-1.4.4-1.el5.x86_64.rpm
2010.04.19 7a2f59a05f2cf1bea24dc04f34b09371
OCFS2 tools
ocfs2-tools-debuginfo-1.4.4-1.el5.x86_64.rpm
2010.04.19 91d6e65e902dedcd28e8e4f2d9fb4271
OCFS2 tools debuginfo
ocfs2-tools-devel-1.4.4-1.el5.x86_64.rpm
2010.04.19 2e47beaab89ebba8b1d276fb894184d5
OCFS2 tools libraries/header
ocfs2console-1.4.4-1.el5.x86_64.rpm
2010.04.19 78ccf0cf8564a6d5b48d534c7f3a07bc

4. Once the download completes transfer all the files to all nodes in the cluster. It is best at this point to create a temporary directory under /tmp, to store your files with the following command.

[root@mylinux1 tmp]# mkdir oracle_tmp
[root@mylinux1 tmp]# chmod 777 oracle_tmp
[root@mylinux1 tmp]#

5. Once the files are in location, logon as root and install using the rpm command on all nodes of the RAC.

rpm -Uvh ocfs2-tools-1.4.4-1.el5.x86_64.rpm
rpm -Uvh ocfs2-2.6.18-194.32.1.el5-1.4.7-1.el5.x86_64.rpm
rpm –Uvh ocfs2console-1.4.4-1.el5.x86_64.rpm

[root@mylinux1 oracle_tmp]# rpm -Uvh ocfs2-tools-1.4.4-1.el5.x86_64.rpm
warning: ocfs2-tools-1.4.4-1.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing… ########################################### [100%]
1:ocfs2-tools ########################################### [100%]
[root@mylinux1 oracle_tmp]# rpm -Uvh ocfs2-2.6.18-194.32.1.el5-1.4.7-1.el5.x86_64.rpm
warning: ocfs2-2.6.18-194.32.1.el5-1.4.7-1.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing… ########################################### [100%]
1:ocfs2-2.6.18-194.32.1.el########################################### [100%]
[root@mylinux1 oracle_tmp]# rpm -Uvh ocfs2console-1.4.4-1.el5.x86_64.rpm
warning: ocfs2console-1.4.4-1.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing… ########################################### [100%]
1:ocfs2console ########################################### [100%]
[root@mylinux1 oracle_tmp]#

This completes the download and installation of OCFS2 on Linux to support an Oracle RAC system.

Larry J. Catt, OCP 9i, 10g
oracle@allcompute.com
www.allcompute.com