Kernel updates and grub settings in Ubuntu

ubuntu

Ubuntu tips for Linux kernel updates and grub settings:

I always try to install Ubuntu security or Linux kernel updates. But sometimes I get problems with graphics drivers and Linux kernels because my graphics driver is not compatible with latest Linux kernel. Then I have to boot with older Linux kernel version in Ubuntu. That’s why I wanted to write small tips.

  • Which Linux kernel version I have?

Open a terminal with Ctrl-Alt-T or from Unity menu
Type uname -sr press enter.  (-s name of the operating system, -r the operating system release level)

Linux 3.2.0-43-generic

  • List of  all installed Linux kernels in Terminal:

dpkg --list | grep linux-image

  • How can I see Ubuntu boot menu on startup?

Display your Grub is to press and hold the SHIFT button while booting.

  • Boot settings in grub: How can I boot with older Linux kernel?

Open grub in editor:

sudo gedit /etc/default/grub

#This is newest Linux kernel and default setting in Ubuntu
# deactivate
#GRUB_DEFAULT=0

# Set default for older Linux kernel (first entry is 0 in grub boot menu)
# 2 for Previous Linux versions 4 for me Linux 3.2.0-38-generic
# see your previous Linux versions in grub menu
GRUB_DEFAULT="2>4"

Save your changes and close editor.  Then type:

sudo update-grub

Without update-grub command your changes will not be applied! Reboot and you can see your selected Linux kernel with uname -sr command.

  • What happens if my GRUB_DEFAULT setting is wrong?

Don’t worry! Ubuntu will boot with the latest kernel.

Reference: www.askubuntu.com

How to update sun jdk 7 on Ubuntu 12.04

java logo

Oracle has released  JDK 7 Update 6 with JavaFX 2.2 Final for GNU/Linux, Mac OS X and MS Windows last week. I have already written how to install Sun JDK 6-7 on Ubuntu 12.04. I want to write how to update JDK 7 Update 6 manually.

Update JDK 7u6:

If you want to manually upgrade to a new version, first uninstall the JDK 7 and then reinstall. You can check your java version in console "java -version” or online here: Verify java version

Package manager: Those who have already installed an older version of Sun Java via the package manager, removes the same way.

  • First, close the web browser (because of java browser plugin).
  • Remove the Java version from the alternatives system:
sudo update-alternatives --remove "javac" "/usr/lib/jvm/jdk1.7.0_04/bin/javac"
sudo update-alternatives --remove "java" "/usr/lib/jvm/jdk1.7.0_04/bin/java"
sudo update-alternatives --remove "javaws" "/usr/lib/jvm/jdk1.7.0_04/bin/javaws"
  • Remove the browser plugin link:
sudo rm /usr/lib/mozilla/plugins/libnpjp2.so
  • Remove the jdk directory:
sudo rm -rf /usr/lib/jvm/jdk1.7.0_04

Netbeans note: If you uninstall old JDK, NetBeans 7.2 is not starting. Open the netbeans.conf file under etc directory and change the netbeans_jdkhome parameter to the new jdk path.

netbeans_jdkhome="/usr/lib/jvm/jdk1.7.0_06"

Happy coding.

PostgreSQL installation and settings on Ubuntu 12.04

postgresql

Updated for Ubuntu GNU/Linux 13.04 (Raring Ringtail).

  • Install latest PostgreSQL 9.1 in console:
sudo apt-get install postgresql libpq-dev
  • PostgreSQL has a super user is called postgres. Change user to the PostgreSQL user:
sudo su - postgres
  • Change password of postgres user:
psql -d postgres -U postgres
psql (9.1.3) Type "help" for help
postgres=# alter user postgres with password 'YOUR_NEW_PASSWORD';
ALTER ROLE
postgres=# \q
#logout postgres user
logout
  • Restart the PostgreSQL server:
sudo /etc/init.d/postgresql restart

pgAdmin III: PostgreSQL administration and management tools

  • If pgAdminIII is not installed, the installation is easy:
sudo apt-get install pgadmin3
  • Open pgAdminIII and add new localhost server. Go to menu File > Add Server as the following screenshot:

pgAdmin

Set up pgAdmin III server instrumentation:
When connecting to a PostgreSQL database using pgAdmin you may receive an error letting you know that the server instrumentation is not installed.

  • Install postgresql-contrib package:
sudo apt-get install postgresql-contrib
  • Install adminpack extension:
sudo -u postgres psql
postgres=# CREATE EXTENSION "adminpack";
postgres=# \q