Thursday, January 5, 2012

Step-by-step installing an Oracle-ready CentOS 6.2 Server

This is how to for installing an Oracle-ready Linux box with CentOS 6.2, It covers the steps involved on the preparation of an Oracle-ready server for the further installation of Oracle Database Server/Oracle Fusion Middleware Suite on a multi-role server deployment.

Requirements

  •  An USB stick with more than 4 GB of free storage
  • A 64 bits server machine with plenty RAM and HDD storage
  • Connectivity with CentOS Internet repositories or LAN mirrors
  • A Linux client machine with an installed desktop environment: CentOS, Debian, Ubuntu, etc. + Gnome, KDE, etc.

Steps

  1. Download a CentOS-6.2-x86_64-bin-DVD1.iso  (4.1GB) from the DVD mirrors or alternative download a minimal (322M), netinstall (227M), LiveCD (698M) or LiveDVD (1.6G) version. This how to uses CentOS-6.2-x86_64-bin-DVD1.iso  (4.1GB).
  2. Store the downloaded ISO into de USB key via this guide. I prefer the alternatives section with livecd-iso-to-disk script. 
  3. Connect the USB stick to one of the USB ports on the server machine and boot. Ensure that USB boot is enabled on the setup.
  4. On the CentOS installation wizard select Server and customize.
  5. Choose a wise partition schema depending on your hardware, for example 6 GB RAM + 2 x 500GB HDD:
  6. /            ext4    60GB   
    /boot    ext4    130M
    /home    xfs        ~403GB
    /opt    xfs        ~240GB      
    /var    xfs        ~210GB
    swap    swap    12GB 
  7.  On the package selection step ensure that no desktop environment is selected and ensure that ssh is installed. Select any additional package you want.
  8. Choose a complex root password.
  9. Once the OS installation is completed, reboot, login as root and ensure that ssh is working via:
  10. $ ssh localhost
  11. By default, the eth0 network interface is disabled. Configure networking settings:
    1. Login as root
    2. Edit the archive /etc/sysconfig/network-scripts/ifcfg-eth0  and configure the network interface to look like:
    3. DEVICE="eth0"
      HWADDR="00:1C:C0:95:59:55"
      NM_CONTROLLED="yes"
      ONBOOT="yes"
      NETWORK=192.168.192.0
      NETMASK=255.255.255.0
      IPADDR=192.168.192.201
      GATEWAY=192.168.192.1
      DNS1=192.168.192.2
      DNS2=192.168.192.2
      PEERDNS="yes"
      
    4. Restart networking daemon and test for connectivity with ping or other tool.
  12. Add a sudoer user -for example bozz- to avoid the use of root
    1. Login as root
    2. Create a new user and add it to wheel group:
    3. $ adduser -G wheel bozz
    4. Reset the password for bozz user (NOTE: choose a password you won't forget):
    5. $ passwd bozz
    6. Edit /etc/sudoers and uncomment the line starting with %wheel, it shall look like:
    7. %wheel  ALL=(ALL)    ALL
    8. Logout, login again with  bozz user and test sudoer's privileges:
    9. $ sudo ls -hal
    NOTE: From now, I only use the bozz user instead of root. You can also (optionally) disable the root account from remote access for security reasons.
  13. Login as bozz user
  14. Configure CentOS repositories via LAN mirrors:
    1. Ensure you can connect to the LAN mirror, example: http://mirrors.home.dev/centos
    2. $ pushd /tmp
      $ wget http://mirrors.home.dev/centos
      $ popd
      
    3. Create a new repo file at /etc/yum.repos.d/CentOS-Mirror.repo
    4. $ sudo nano /etc/yum.repos.d/CentOS-Mirror.repo
    5. Append the following entries pointing to the mirror:
    6. [base]
      name=CentOS-$releasever - Base
      baseurl=http://mirrors.home.dev/centos/$releasever/os/$basearch/
      gpgcheck=0
       
      #released updates 
      [updates]
      name=CentOS-$releasever - Updates
      baseurl=http://mirrors.home.dev/centos/$releasever/updates/$basearch/
      gpgcheck=0
      
      #additional packages that may be useful
      [extras]
      name=CentOS-$releasever - Extras
      baseurl=http://mirrors.home.dev/centos/$releasever/extras/$basearch/
      gpgcheck=0
      
    7. Comment or delete existing repository archives
      • comment every line of /etc/yum.repos.d/CentOS-Base.repo with #
      • or just:
      • delete the repository file
      • $ sudo rm /etc/yum.repos.d/CentOS-Base.repo
    8. Update the system using the mirror:
    9. $ sudo yum update
  15. Install Java JRE 7u1 64 bit on the server [Not required for Oracle Database, required for Oracle Fusion Middleware Suite]:
    1. Goto http://www.oracle.com/technetwork/java/javase/downloads/index.html and download jre-7u1-linux-x64.rpm
    2. Copy jre-7u1-linux-x64.rpm to the server via scp or other. Via scp from the Linux client:
    3. $ scp jre-7u1-linux-x64.rpm bozz@SERVER:~/
    4. Login into server and run installer:
    5. $ sudo rpm -Uvh jre-7u1-linux-x64.rpm
    6. Make use of Java JRE absolute version (/usr/java/jre1.7.0_01) in the alternatives configuration for java and javaws:
    7. $  sudo alternatives --install /usr/bin/java java /usr/java/jre1.7.0_01/bin/java 20000
      $  sudo alternatives --install /usr/bin/javaws javaws /usr/java/jre1.7.0_01/bin/javaws 20000
      
    8. Ensure the correct java version:
    9. $ java -version
      java version "1.7.0_01"
      Java(TM) SE Runtime Environment (build 1.7.0_01-b08)
      Java HotSpot(TM) 64-Bit Server VM (build 21.1-b02, mixed mode)
    10. Ensure that the alternatives is properly configured:
    11. $ alternatives --config java
      There is 1 program that provides 'java'.
      
          Selection    Command
        -----------------------------------------------
        *+ 1           /usr/java/jre1.7.0_01/bin/java
      
        Enter to keep the current selection[+], or type selection number: 
       
      $ alternatives --config javaws
      
        There is 1 program that provides 'javaws'.
      
          Selection    Command
        -----------------------------------------------
        *+ 1           /usr/java/jre1.7.0_01/bin/javaws
      
      
    12. Configure JRE_HOME system-wide environment variable. Edit /etc/environment:
    13. $ nano /etc/environment
    14. Append the following content:
    15. export JRE_HOME=/usr/java/jre1.7.0_01
      
    16. Logout and login again and test if JRE_HOME environment variable is correct:
    17. $ echo $JRE_HOME
      /usr/java/jre1.7.0_01
      
      $ ls -1 $JRE_HOME
      bin
      COPYRIGHT
      lib
      LICENSE
      man
      plugin
      README
      release
      THIRDPARTYLICENSEREADME.txt
      Welcome.html
      
      
  16. Prepare the CentOS server for installing Oracle products without sacrifice performance with a graphical environment. Oracle Fusion Middleware products use an X11 graphical environment on installation wizards. So the  SSH X11 Forwarding should be installed and enabled.
    1. On the server, edit /etc/ssh/sshd_config:
    2. $ sudo nano  /etc/ssh/sshd_config
    3. Set the following values:
    4. X11Forwarding yes
      X11DisplayOffset 10
      X11UseLocalhost yes
      
    5. On the server, install the packages  xorg-x11-xauth and libXtst:
    6. $ sudo yum install xorg-x11-xauth libXtst
    7. On the client, install the fontconfig packages xorg-x11-fonts-base and liberation-fonts:

    8. for a CentOS client:
      $ sudo yum install xorg-x11-fonts-base liberation-fonts
      for Ubuntu client:
      $ sudo apt-get install xfonts-base ttf-liberation
    9. On the client, try to login to the remote server using "-Y" option:
    10. $ ssh -Y bozz@SERVER
    11. Remotely logged, try to run your X program, such as the xterm or other:
    12. $ sudo yum install xterm
      $ xterm
      And you shall see the X program pop up in your local desktop. You can also add the following into your $HOME/.ssh/config :
      ForwardAgent yes
      ForwardX11 yes
      ForwardX11Trusted yes
      
       

References

4 comments:

  1. Hello Eduardo,

    Thank for sharing this information, It is helps me too much.

    I want to notify that the URL:

    http://mirrors.home.dev/centos

    I guess now is:

    http://mirror.centos.org/centos

    ReplyDelete
    Replies
    1. Thx very much. By mirror.home.dev I mean any in home/business self-hosted mirror of the official CentOS repo.

      Delete
  2. Hi Eduardo,

    As a developer, I am wondering if I can just install Oracle database just on a standalone server without using a client machine. So I is it Ok to install some desktop element as well? Besides some system resource is going to be used for the GUI, is there any other problem with it?

    ReplyDelete
    Replies
    1. Of course. You can install the Oracle in standalone mode in your own development machine w/ Desktop environment. Besides resource consumption nothing else happens.

      Delete