Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Thursday, February 5, 2009

How to disable remote root logins using SSH in linux

For security reasons, it is best to disable remote root logins to a server. This can be done by the following steps.

- SSH into server and login as root.

- navigate to the directory /etc/ssh/sshd_config and open the file sshd_config for editing

- Scroll down the SSH server configuration file and locate the line below:

#PermitRootLogin yes


- Uncomment the line by removing the hash symbol (#), and then change the “yes” to “no”.

PermitRootLogin no


- Save and quit the config file.

- Restart SSH server using the following command at the prompt

/etc/rc.d/init.d/sshd restart

- remote root logins have now been disabled.

Monday, January 19, 2009

Automating startup/shutdown of Oracle database on Linux

The following script can be used to automate database startup/shutdown of an Oracle database on Linux platform.

- update the oratab file under /etc or /var/opt/oracle

"SID":"ORACLE_HOME":Y

where Y states that the database to be started up/shutdown

- Create the service script in the following location:

/etc/init.d/
vi dbora

- Modify the following script to match the specific environment and This becomes the content of the "dbora" service script.

===================================================================================

#!/bin/sh
# chkconfig: 35 99 10
# description: Starts and stops Oracle processes

DB_SCRIPTS=" FULL DATABASE SCRIPT LOCATION HERE"
APPS_SCRIPTS=:" FULL APPS SCRIPT LOCATION HERE"
ORADEV_OWNER=DB_USER
APPSDEV_OWNER=APPS_USER
LOG_FILE='touch /var/lock/subsys/dbora'

case "$1" in
'start') # Start the Oracle database,listener and apps
su - $ORADEV_OWNER -c "$DB_SCRIPTS/addbctl.sh start"
su - $ORADEV_OWNER -c "$DB_SCRIPTS/addlnctl.sh start SID"
sleep 100
su - $APPSDEV_OWNER -c "$APPS_SCRIPTS/adstrtal.sh apps/apps"
;;
'stop') # Stop the Oracle database,listener and apps
su - $APPSDEV_OWNER -c "$APPS_SCRIPTS/adstpall.sh apps/apps"
sleep 300
su - $ORADEV_OWNER -c "$DB_SCRIPTS/addlnctl.sh stop SID"
su - $ORADEV_OWNER -c "$DB_SCRIPTS/addbctl.sh stop immediate"
rm /var/lock/subsys/dbora
;;
esac

===================================================================================

Modify the sleep time according to the speed of the server and the time taken by the server to startup and shutdown the instance.

- Set script permissions:

chmod 755 /etc/init.d/dbora

- Register the Service

at the terminal prompt, issue the following command.

chkconfig --add dbora
The chkconfig creates the following symbolic links,

On SuSE SLES7:

* /etc/init.d/rc0.d/K10dbora
* /etc/init.d/rc1.d/K10dbora
* /etc/init.d/rc2.d/K10dbora
* /etc/init.d/rc3.d/S99dbora
* /etc/init.d/rc4.d/K10dbora
* /etc/init.d/rc5.d/S99dbora
* /etc/init.d/rc6.d/K10dbora

On Red Hat Advanced Server:

* /etc/rc.d/rc0.d/K10dbora
* /etc/rc.d/rc1.d/K10dbora
* /etc/rc.d/rc2.d/K10dbora
* /etc/rc.d/rc3.d/S99dbora
* /etc/rc.d/rc4.d/K10dbora
* /etc/rc.d/rc5.d/S99dbora
* /etc/rc.d/rc6.d/K10dbora

The symbolic links are not created in SLES8 and after with the 'chkconfig -add' command. To have the symbolic links created run the following in addition:

/sbin/chkconfig --set dbora 35

- Now the instance will startup automatically when Linux boots up.

Thursday, January 8, 2009

Install Linux driver for Ethernet - Marvell Yukon 88e8056 pci-e Gigabit Ethernet Controller

1. Install the Oracle Enterprise Linux 4.4 through the DVD’s (Start, 2, 3 & 4)

2. Once the installation is done go to Applications - > System Settings - > Network


3. Check whether the networking tab has some Ethernet found and active


4. If not then we are missing NIC driver for Linux for this hardware


5. Go to the following URL and download the driver,
http://www.marvell.com/drivers/driverDisplay.do?driverId=204
Driver Name: (Kernel v2.4.20 and Higher 2.4.x Kernels Linux Driver Install Package v10.61.3.3)

6. As we are not in the network, copy the driver in a USB and mount it in the Linux and install it by running the script,


bunzip2 -c install_A.B.C.D.tar.bz2 tar xfv –

# cd DriverInstall

#./install.sh

7. Once done reboot the server, the driver will make detect the Ethernet


8. Provide the IP through static assigning or through DHCP


9. It’ll take 15 minutes to start, once done Check the Applications - > System Settings - > Network - > Ethernet


10. The status will be active and now you are connected to the network

Friday, December 19, 2008

Increasing the swap space in Linux

Swap space can be increased in linux by using a swap file

1) Determine the size of the new swap file.


2) Multiply it with 1024 to determine the block size.

3) Login as a root. Execute the following commands

Create a swap file using the following command.

dd if=/dev/zero of=/swapfile bs=1024 count=value

where

swapfile = Name of the swap file

bs=Block size.

Count= Block count (Block count of 2GB swap file is (2048*1024))

4) Setup the swap file.

mkswap /swapfile

5) Enable the swap file.

swapon /swapfile

6) To enable it at the boot time, Add the below entry in the /etc/fstab

/swapfile swap swap 00

The next time the system boots, it will enable the swap file.

After adding the new swap file and enabling it, make sure it is enabled by viewing the output of the command

cat /proc/swaps (or) free -m

Friday, December 12, 2008

OEM grid control 10.2.0.1 installation issue

While performing a full install of Oracle Enterprise manager 10.2.0.1, the 'product specific prerequisite checks' page shows an error for the following pacakes even if they are installed.

compat-libstdc++-296-2.96-132.7.2
libstdc++devel-3.4.3-22.1
openmotif-21-2.1.30-11

One can manually check the prerequisite pacakages for OEM using metalink note 343364.1 and safely ignore the installer warnings and continue for a successful installation.