February 20, 2014

Automatic RHEL 6 Installation with Kickstart

Introduction

Today the requirement are higher to quicker responds to the market. For a computer operation that means, they must be quicker to bring up new machine. The Red Hat solution for this is to use kickstart to standardize and automate the installation of a new RHEL instances.

The simplest way to create a working kickstart file is to actually install a new system (the way you want) and then use the kickstart created by anaconda to install new machine with.

The more advanced way is to start from scratch and use the system-config-kickstart tool and create you kickstart file. But there are some shortcoming with this tool and that is it can not handle LVM.

The pragmatic way is to start from a anaconda generated kickstart file and then edit with system-config-kickstart and finally manually add the LVM partition.

Here I will show you the easy way and use the anaconda generated file.

Prerequisite

Lets get started and install a new RHEL instance the manually way. We will install this machine as a virtualized machine and as hypervisor we will use KVM.

The requirement for this machine are:

  • 8 GB Disk Space
  • Basic Storage Devices
  • Use All Space

We will select the last checkbox 'Review and modify...', so we can see what is actually done.

What we see above is that two primary partitions are created - vda1 and vda2.

  • vda1 will contain standard ext4 file system for boot. The size of 500 MB is good for boot partition and should rarely be changed.
  • vda2 will be formatted with LVM and will fill up the rest of the available disk. This is also good.

The next step is the logical volumes: lv_root and lv_swap.

Note the few partition that are here created. For a server installation you would probably create more partitions, e.g. a separate partition for /var/log directory for a production server and for desktop installation you would probably create a separate partition for /home. But here we will keep to the basic suggested partition layout.

The second thing that is noteworthy is the small swap space. The thumb rule for a minimal installation production server is:

  • < 2GB RAM, use 2 * RAM
  • >= 2GB RAM, use RAM + 2GB

But remember these are not hard rules and dependce how often you will restart you system. For a desktop installation you will get away with smaller swap space.

Finally we will select to install a minimal installation. When installation is finish we will end up with a anaconda generated kickstart file located in /root/anaconda-ks.cfg.

Kickstart file

To make this kickstart file automatic we need to do three things:

  1. Uncomment the LVM partitioning. I also renamed the volume group to vg_rhel6.
  2. Add zerombr, to answer yes to the prompt question that all existing partitions will be destroyed.
  3. And finally automatically restart the system after installation.
# Kickstart file automatically generated by anaconda.

#version=DEVEL
install
cdrom
lang en_US.UTF-8
keyboard sv-latin1
network --onboot yes --device eth0 --bootproto dhcp --noipv6
rootpw  --iscrypted $6$...$...
firewall --service=ssh
authconfig --enableshadow --passalgo=sha512
selinux --enforcing
timezone --utc Europe/Stockholm
bootloader --location=mbr --driveorder=vda --append="crashkernel=auto rhgb quiet"
# The following is the partition information you requested
# Note that any partitions you deleted are not expressed
# here so unless you clear all partitions first, this is
# not guaranteed to work
zerombr
clearpart --all --drives=vda --initlabel

part /boot --fstype=ext4 --size=500
part pv.253002 --grow --size=1
volgroup vg_rhel6 --pesize=4096 pv.253002
logvol / --fstype=ext4 --name=lv_root --vgname=vg_rhel6 --grow --size=1024 --maxsize=51200
logvol swap --name=lv_swap --vgname=vg_rhel6 --grow --size=819 --maxsize=819

reboot

%packages
@core
@server-policy
%end

Test

The last step is to test it. First we need to make it accessible during installation. The easiest way to do that, is to use either a FTP or HTTP server. There are also other ways, such as using a shared network disk, accessible via NFS or CIFS. But I would recommend using a known FTP server.

Now start a new RHEL installation. At the first menu, press TAB.

Then at the end enter 'ks=ftp://<server>/<path>' and press ENTER.

Reference

February 8, 2014

Configure OpenJDK Source Code From Eclipse on RHEL 6

Introduction

In most Linux distribution is the source code for OpenJDK already available via RPM or Debian Package, but not for RHEL 6. The reason is probably the RHEL 6 main aim is for server OS and not for client development. Anyhow here is the way to make the source code available in Eclipse.

Installation

First you need to download the source zip from http://download.java.net/openjdk/jdk7/.

Then move the zip to the java home directory and name it src.zip.

$ cp /home/magnus/Downloads/jdk7u-ea798405286d.zip /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.51.x86_64/src.zip

Finally restore SELinux security policy.

$ restorecon -RFv /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.51.x86_64/src.zip
$ restorecon reset /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.51.x86_64/src.zip context unconfined_u:object_r:lib_t:s0->system_u:object_r:lib_t:s0

Test

If everything works fine, you should now be able to browse the java source code from Eclipse.

Troubleshoot

If the source code is not directly found, you might need to adjust the java home search path.

If that did not help, you could also verify the path to the source zip.

Finally you might need to restart Eclipse (I did not). Happy coding!

February 4, 2014

Install Flashplayer on RHEL 6

Download

Download the plug-in for Linux 64-bit (tar.gz) from http://get.adobe.com/flashplayer/.

Install

Move the tar file to /tmp and extract it.

$ mv /home/magnus/Downloads/install_flash_player_11_linux.x86_64.tar.gz /tmp/

$ cd /tmp

$ tar xvfz install_flash_player_11_linux.x86_64.tar.gz

Before proceeding close you web browser. Then move the flash player module to Firefox plugin directory.

$ cp libflashplayer.so /usr/lib64/mozilla/plugins

$ chmod 0755 -v /usr/lib64/mozilla/plugins/libflashplayer.so
mode of `/usr/lib64/mozilla/plugins/libflashplayer.so' changed to 0755 (rwxr-xr-x)

Test

Start Firefox and test against any youtube video.