Upgrading Oracle Linux from 6.2 to 6.3

Environment: Oracle Linux 6.2 64-bit, Oracle Linux 6.3 64-bit, Oracle VM VirtualBox 4.1.18

Oracle recently released version 6.3 of their Linux distribution, so I decided to upgrade my 6.2 installation on VirtualBox, which has Oracle 11gR2 and GlassFish running on it.

Some things you need to keep in mind:

– you need root access

– downloading and installing the rpm packages can take a long time

– you need to reboot your server after the upgrade

– for production servers, take a full system backup before starting the upgrade

First, let’s check the version of our current installation:

$ su -
Password:
$ cat /etc/oracle-release
Oracle Linux Server release 6.2
$ lsb_release -d
Description:	Oracle Linux Server release 6.2

Next, we need to retrieve the yum repository file. Rename the old one if it already exists.

$ cd /etc/yum.repos.d/
$ mv public-yum-ol6.repo public-yum-ol6.repo.old
$ wget http://public-yum.oracle.com/public-yum-ol6.repo

--2012-08-23 10:43:43--  http://public-yum.oracle.com/public-yum-ol6.repo
Resolving public-yum.oracle.com... 141.146.44.34
Connecting to public-yum.oracle.com|141.146.44.34|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1707 (1.7K) [text/plain]
Saving to: “public-yum-ol6.repo”

100%[===================================================================================>] 1,707       --.-K/s   in 0s

2012-08-23 10:43:48 (42.4 MB/s) - “public-yum-ol6.repo” saved [1707/1707]

Finally, start the upgrade with the command “yum upgrade”. This will generate a list of all rpm packages that will be updated or installed, and also show you how much free disk space you will need for the download. I needed about 420 MB. Press “y” to confirm the upgrade.

$ yum upgrade
...
Transaction Summary
=============================================================================================================================
Install      22 Package(s)
Upgrade     374 Package(s)
Remove        1 Package(s)

Total download size: 417 M
Is this ok [y/N]:
...
 vim-minimal.x86_64 2:7.2.411-1.8.el6                           wpa_supplicant.x86_64 1:0.7.3-3.el6
  xmlrpc-c.x86_64 0:1.16.24-1209.1840.el6                        xmlrpc-c-client.x86_64 0:1.16.24-1209.1840.el6
  xorg-x11-drv-ati.x86_64 0:6.14.2-9.el6                         xorg-x11-drv-ati-firmware.noarch 0:6.14.2-9.el6
  xorg-x11-drv-intel.x86_64 0:2.16.0-4.el6                       xorg-x11-drv-mga.x86_64 0:1.4.13-7.el6
  xorg-x11-drv-wacom.x86_64 0:0.13.0-6.el6                       xorg-x11-server-Xorg.x86_64 0:1.10.6-1.el6
  xorg-x11-server-common.x86_64 0:1.10.6-1.el6                   xulrunner.x86_64 0:10.0.6-1.0.1.el6_3
  yum.noarch 0:3.2.29-30.0.1.el6                                 yum-plugin-security.noarch 0:1.1.30-14.el6
  yum-rhn-plugin.noarch 0:0.9.1-40.0.1.el6                       yum-utils.noarch 0:1.1.30-14.el6

Complete!

When the upgrade completes successfully, reboot your server to activate the new kernel… and hope everything works fine :-)

Note: on VM VirtualBox, you will need to re-install the Guest Additions after the upgrade. Click on Devices -> Install Guest Additions… in the top menu to reinstall them. You will need to reboot your guest one more time to enable them.

Enjoy!
Matthias

Advertisements

Upgrading the Unbreakable Enterprise Kernel (UEK) on Oracle Linux 6.2

Environment: Oracle Linux 6.2 64-bit with kernel 2.6.32-300.11.1.el6uek.x86_64, Oracle VM VirtualBox 4.1.10.

Oracle just released the RPMs for Oracle Linux 6.3. You can get them here. This includes an update of their Unbreakable Enterprise Kernel (UEK). I will explain here how you can upgrade your kernel to the latest version.

To know which kernel you are currently running, you can use the command “uname -r”:

$ uname -r
2.6.32-300.11.1.el6uek.x86_64

We are now going to upgrade our kernel to the latest version by using yum. The first thing you need to do is to get the yum configuration file for your platform. Note: execute all commands with user root.

$ cd /etc/yum.repos.d/
$ wget http://public-yum.oracle.com/public-yum-ol6.repo

--2012-06-28 11:08:31--  http://public-yum.oracle.com/public-yum-ol6.repo
Resolving public-yum.oracle.com... 141.146.44.34
Connecting to public-yum.oracle.com|141.146.44.34|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1707 (1.7K) [text/plain]
Saving to: “public-yum-ol6.repo”

100%[===================================================================================>] 1,707       --.-K/s   in 0s

2012-06-28 11:08:36 (162 MB/s) - “public-yum-ol6.repo” saved [1707/1707]

Next, modify the public-yum-ol6.repo file and set enabled=1 in the section [ol6_UEK_latest]. This is how my file looks like now:

[ol6_latest]
name=Oracle Linux $releasever Latest ($basearch)
baseurl=http://public-yum.oracle.com/repo/OracleLinux/OL6/latest/$basearch/
gpgkey=http://public-yum.oracle.com/RPM-GPG-KEY-oracle-ol6
gpgcheck=1
enabled=0

[ol6_ga_base]
name=Oracle Linux $releasever GA installation media copy ($basearch)
baseurl=http://public-yum.oracle.com/repo/OracleLinux/OL6/0/base/$basearch/
gpgkey=http://public-yum.oracle.com/RPM-GPG-KEY-oracle-ol6
gpgcheck=1
enabled=0

[ol6_u1_base]
name=Oracle Linux $releasever Update 1 installation media copy ($basearch)
baseurl=http://public-yum.oracle.com/repo/OracleLinux/OL6/1/base/$basearch/
gpgkey=http://public-yum.oracle.com/RPM-GPG-KEY-oracle-ol6
gpgcheck=1
enabled=0

[ol6_u2_base]
name=Oracle Linux $releasever Update 2 installation media copy ($basearch)
baseurl=http://public-yum.oracle.com/repo/OracleLinux/OL6/2/base/$basearch/
gpgkey=http://public-yum.oracle.com/RPM-GPG-KEY-oracle-ol6
gpgcheck=1
enabled=0

[ol6_u3_base]
name=Oracle Linux $releasever Update 3 installation media copy ($basearch)
baseurl=http://public-yum.oracle.com/repo/OracleLinux/OL6/3/base/$basearch/
gpgkey=http://public-yum.oracle.com/RPM-GPG-KEY-oracle-ol6
gpgcheck=1
enabled=0

[ol6_UEK_latest]
name=Latest Unbreakable Enterprise Kernel for Oracle Linux $releasever ($basearch)
baseurl=http://public-yum.oracle.com/repo/OracleLinux/OL6/UEK/latest/$basearch/
gpgkey=http://public-yum.oracle.com/RPM-GPG-KEY-oracle-ol6
gpgcheck=1
enabled=1

[ol6_UEK_base]
name=Unbreakable Enterprise Kernel for Oracle Linux $releasever ($basearch)
baseurl=http://public-yum.oracle.com/repo/OracleLinux/OL6/UEK/base/$basearch/
gpgkey=http://public-yum.oracle.com/RPM-GPG-KEY-oracle-ol6
gpgcheck=1
enabled=0

To upgrade the kernel, run the command “yum upgrade kernel-uek”. This will ask for a confirmation first before downloading and installing the new kernel:

$ yum upgrade kernel-uek
Loaded plugins: refresh-packagekit, security
ol6_UEK_latest                                                                                        |  951 B     00:00
Setting up Upgrade Process
Resolving Dependencies
--> Running transaction check
---> Package kernel-uek.x86_64 0:2.6.39-200.24.1.el6uek will be installed
--> Processing Dependency: kernel-uek-firmware = 2.6.39-200.24.1.el6uek for package: kernel-uek-2.6.39-200.24.1.el6uek.x86_64
--> Running transaction check
---> Package kernel-uek-firmware.noarch 0:2.6.39-200.24.1.el6uek will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================
 Package                          Arch                Version                              Repository                   Size
=============================================================================================================================
Installing:
 kernel-uek                       x86_64              2.6.39-200.24.1.el6uek               ol6_UEK_latest               26 M
Installing for dependencies:
 kernel-uek-firmware              noarch              2.6.39-200.24.1.el6uek               ol6_UEK_latest              2.8 M

Transaction Summary
=============================================================================================================================
Install       2 Package(s)

Total download size: 28 M
Installed size: 103 M
Is this ok [y/N]:

Downloading Packages:
(1/2): kernel-uek-2.6.39-200.24.1.el6uek.x86_64.rpm                                                   |  26 MB     04:11
(2/2): kernel-uek-firmware-2.6.39-200.24.1.el6uek.noarch.rpm                                          | 2.8 MB     00:27
-----------------------------------------------------------------------------------------------------------------------------
Total                                                                                        104 kB/s |  28 MB     04:39
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : kernel-uek-firmware-2.6.39-200.24.1.el6uek.noarch                                                         1/2
  Installing : kernel-uek-2.6.39-200.24.1.el6uek.x86_64                                                                  2/2

Installed:
  kernel-uek.x86_64 0:2.6.39-200.24.1.el6uek
Dependency Installed:
  kernel-uek-firmware.noarch 0:2.6.39-200.24.1.el6uek
Complete!

After the upgrade, reboot your system. After the reboot run the command “uname -r” again. You will notice that the new kernel is used now:

$ uname -r
2.6.39-200.24.1.el6uek.x86_64

Note: if you are trying this on Oracle VM VirtualBox, upgrading the kernel will break the Guest Additions. To fix this, you need to download the “kernel-uek-devel-2.6.39-200.24.1.el6uek.x86_64” package first and then reinstall the Guest Additions.

 

Matthias

Increasing swap space on Oracle Linux

Environment: Oracle Linux 6.2 64-bit, Oracle VM VirtualBox 4.1

Whenever you increase the physical memory of a Linux server, you probably also need to increase the swap space. There are several ways you can do this. In most cases, the swap space is present as a separate swap partition, which can be a stand-alone partition or part of a logical volume inside of a volume group. The swap space can also be present as a swap file, or even a combination of swap partitions and swap files with priorities.

1) Investigating the system

You can use the commands swapon and free to display information about your currently configured swap space. You can also have a look at the system files /etc/fstab and /proc/swap.

Let’s have a look at my system:

$ swapon -s
Filename				Type		Size	Used	Priority
/dev/dm-1                               partition	3571704	59144	-1

$ cat /proc/swaps
Filename				Type		Size	Used	Priority
/dev/dm-1                               partition	3571704	59144	-1

$ cat /etc/fstab|grep swap
/dev/mapper/vg_ol6ora11g02-lv_swap swap                    swap    defaults        0 0

So, in my case, I have one swap partition of 3,5GB which is part of a logical volume (lv_swap) inside a logical volume group.

2) First option: adding a swap partition

To create a new swap area on a disk partition, you need the command mkswap. After the swap area is created, you have to activate it using the command swapon. Finally, to enable the swap area after a server reboot, you have to add it to the system file /etc/fstab.

In my example, I first added a 2GB virtual disk to my VirtualBox installation. This new disk was visible under Oracle Linux as disk device /dev/sdb. I used this disk device to create my new swap area on. Note: please make sure you use the correct disk device!

$ mkswap -c /dev/sdb
mkswap: /dev/sdb: warning: don't erase bootbits sectors
        on whole disk. Use -f to force.
Setting up swapspace version 1, size = 2097148 KiB
no label, UUID=8e6f61c3-1070-450f-b89a-3af8d646e985

$ swapon /dev/sdb
$ swapon -s

Filename				Type		Size	Used	Priority
/dev/dm-1                               partition	3571704	133296	-1
/dev/sdb                                partition	2097144	0	-2

$ cat /etc/fstab|grep /dev/sdb

/dev/sdb                swap                    swap    defaults        0 0

3) Second option: adding a swap file

When you have no free disk or disk partitions available, it’s also possible to increase your swap area by creating a swap file. First, you need to create an empty file with the required size using the dd command. Then you need to activate the swap file using mkswap and finally add it to the /etc/fstab file (same as with swap partitions).

Let’s check my example where I add a 2GB swap file under /root:

$ dd if=/dev/zero of=/root/swapfile count=1024 bs=2097152

1024+0 records in
1024+0 records out
2147483648 bytes (2.1 GB) copied, 245.797 s, 8.7 MB/s

$ mkswap -c /root/swapfile

mkswap: /root/swapfile: warning: don't erase bootbits sectors
        on whole disk. Use -f to force.
Setting up swapspace version 1, size = 2097148 KiB
no label, UUID=99076d49-9893-425f-b0b1-1f21c7e9f8be
$ swapon /root/swapfile
$ swapon -s

Filename				Type		Size	Used	Priority
/dev/dm-1                               partition	3571704	298532	-1
/root/swapfile                          file		2097144	0	-2

$ cat /etc/fstab|grep swapfile

/root/swapfile 		swap                    swap    defaults        0 0

4) Third option: increasing the size of a logical volume

If your swap area is on a logical volume, you can increase it by extending the logical volume using the command lvextend. However, things are a bit more complicated. First, if you don’t have any free extents available, you need to add a physical volume to the volume group where the logical volume is located in. Second, to increase the size of the swap area, you need to temporarily disable it first (swapoff) followed by the recreation of the swap area using mkswap.

In my example, I first add the device /dev/sdb to my volume group, next I increase the logical volume to 4.5GB using lvextend, and then I disable and recreate the swap area:

lvm> vgextend vg_ol6ora11g02 /dev/sdb
  No physical volume label read from /dev/sdb
WARNING: swap signature detected on /dev/sdb. Wipe it? [y/n] y
  Wiping swap signature on /dev/sdb.
  Writing physical volume data to disk "/dev/sdb"
  Physical volume "/dev/sdb" successfully created
  Volume group "vg_ol6ora11g02" successfully extended
lvm> vgs
  VG             #PV #LV #SN Attr   VSize  VFree
  vg_ol6ora11g02   2   2   0 wz--n- 21.50g 2.00g

$ swapoff /dev/mapper/vg_ol6ora11g02-lv_swap
$ lvextend -L 4.5G /dev/mapper/vg_ol6ora11g02-lv_swap
  Extending logical volume lv_swap to 4.50 GiB
  Logical volume lv_swap successfully resized

$ mkswap -c /dev/mapper/vg_ol6ora11g02-lv_swap
mkswap: /dev/mapper/vg_ol6ora11g02-lv_swap: warning: don't erase bootbits sectors
        on whole disk. Use -f to force.
Setting up swapspace version 1, size = 4718588 KiB
no label, UUID=04fa98f4-c72e-4bb6-94b4-57f9384f779f

$ swapon /dev/mapper/vg_ol6ora11g02-lv_swap
$ swapon -s
Filename				Type		Size	Used	Priority
/dev/dm-1                               partition	4718584	0	-1

HTH,

Matthias

Enable non-root user access to shared folders on Oracle VM VirtualBox

Environment: Windows 7 64-bit (host), Oracle Linux 6.2 64-bit (guest), Oracle VM VirtualBox 4.1.10 with Guest Additions.

I recently installed Oracle Linux 6.2 on VM VirtualBox under Windows 7, and I decided to add a shared folder to C:\Temp, so I could exchange files between my Windows 7 host and the Oracle Linux guest.

This worked fine for user “root”: I could easily access the Windows files from my Linux installation through the folder /media/sf_Temp. However, whenever I tried to access the files with a non-root user (in my example: user “oracle”), all I got was a “Permission denied” message:

[oracle@ol6ora11g02 ~]$ cd /media/sf_Temp/
-bash: cd: /media/sf_Temp/: Permission denied

The solution for this problem is to add the user that needs access to the shared folder to the user group “vboxsf”:

[root@ol6ora11g02 ~]# usermod -a -G vboxsf oracle

Note: don’t forget the “-a” (append) option, otherwise you might remove all other groups from the user!

After this, I switched back to the user “oracle”, and I could easily access my shared folder:

[root@ol6ora11g02 ~]# su – oracle
[oracle@ol6ora11g02 ~]$ cd /media/sf_Temp/
[oracle@ol6ora11g02 sf_Temp]$ ls -la
total 340315
drwxrwx— 1 root vboxsf 8192 Mar 13 16:43 .
drwxr-xr-x. 3 root root 4096 Apr 4 14:36 ..
drwxrwx— 1 root vboxsf 0 Feb 27 11:19 apex_4.1
-rwxrwx— 1 root vboxsf 121601974 Sep 8 2011 apex_4.1.zip

 

Matthias

Enabling print screen for VM VirtualBox windows on Windows 7

I was trying to document a VM VirtualBox installation with screenshots, but I noticed that I couldn’t make screen shots of active VM VirtualBox windows using ALT-Print Screen. This is on Windows 7 64-bit, version of VirtualBox is 4.1.10.

I first thought there was something wrong with my keyboard or Windows settings, but making print screens of other windows DID work. Then I found this: http://superuser.com/questions/66353/print-screen-doesnt-work-if-virtualbox-is-active-window.

So, to enable print screens of active VirtualBox windows, you need to uncheck “Auto Capture Keyboard” under File -> Preferences -> Input. After this all worked fine!

 

Matthias