Saturday, September 8, 2012

Notepad for Ubuntu

       Notepad for ubuntu !!! I think by notepad for Ubuntu, maximum Ubuntu users will think that I am talking about the default text editor i.e. gedit. But it's something different. It is something that is faster than gedit, uses lesser memory and is more similar to Microsoft's Windows' Notepad.

       I am talking about leafpad .

     Leafpad is not installed by default in Ubuntu. It is present in Software center under category Accessories. You can also install it using terminal via the command :

sudo apt-get install leafpad
Advantages :-
1) Very low on resources.
2) Extremely fast
3) Similar to notepad of windows hence people switching from Windows will find it familiar to use.
4) Sleek and simple
5) Clean Interface.

Disadvantages :-
1) No support for tabs.
2) Too simple.
3) No option to choose encoding

Monday, June 25, 2012

Installing Windows after Ubuntu while dual-booting

    If you ever want to install windows on your system and dual boot with your current ubuntu installation, you don't have to get rid of your current installation. You can do it without re-installing ubuntu all-over again. 

Note : You need to have a working internet connection for the same or you need to have following five files correspong to your system architecture ( amd64 or i386 ) to proceed.
a) grub2-common_1.99-12ubuntu5_<architecture>.deb
b) grub-gfxpayload-lists_0.5_<architecture>.deb
c) grub-pc-bin_1.99-12ubuntu5_<architecture>.deb
d) grub-common_1.99-12ubuntu5_<architecture>.deb
e) grub-pc_1.99-12ubuntu5_<architecture>.deb
     You can download these from :

If your system satisfy the above condition then just do as in the following steps :

1) Back-up whatever you want to preserve. ( for worst-case scenario )

2) Have a Ubuntu CD / DVD / bootable USB disk with you. You will need it later on.

3) Create a partition for your windows installation from your ubuntu installation ( if you don't have one ) . The partion need-not to be formated as NTFS for now as you can do the same while installing windows. Just make a unformatted partition or simply create a blank free space (partition ) . You can do it via Gparted partition editor. If you don't have it installed , you can have it by entering following command in the terminal :
                       sudo apt-get update && sudo apt-get install gparted

4) Install Windows on the new partition.Remember not to touch the partition(s) containing your ubuntu installation or swap area.

5) At this point of time you won't be able to see or use your current ubuntu installtion as the system will straight boot into the new Windows installation.

6) Boot from your Ubuntu CD / DVD / bootable USB disk .

7) Open the terminal and enter the following command :

 i) sudo mkdir /mnt/temp ( creates a temporary directory for mounting your ubuntu partition )
ii) sudo mount /dev/sda2 /mnt/temp ( here /dev/sda2 is the partition where your ubuntu installation lies )
iii) Also mount some miscellaneous file-systems for proper working of chroot command : 
        for i in /dev /dev/pts /proc /sys; do sudo mount -B $i /mnt/temp$i; done
iv) Now chroot into your ubuntu Installation :
                                  sudo chroot /mnt/temp
v) If the above commands run successfully, the terminal prompt should include "root" ( root@ubuntu:/# ), which indicates you are in the chroot environment.
vi) Confirm you have working net connection in the chroot environment ( for downloading the grub installation files if you have not already downloaded it ) :
                               ping archive.ubuntu.com
vii) Update your package list : This step is optional if you have already downloaded the grub files.
                                sudo apt-get update
viii) Purging the Grub Loader : Do not proceed to next command if you don't have a working internet connection or you do not have access to downloaded grub files . The next command will remove grub, grub-pc (Grub 2) and grub-common. If you are sure you have never had Grub legacy on the current installation you may omit "grub" from the next command.
                             apt-get purge grub grub-pc grub-common
Here is what you will have to do:
  • Press ENTER to continue.
  • Read the warning during the install about removing the bootloader. TAB to highlight "<Yes>" and press ENTER.
viii) Re-install the grub packages : 
                   Command :
                           apt-get install grub-common grub-pc
Here is what will happen:
  • You will be given the opportunity to add extra kernel options to the kernel line. If you don't know, you probably don't need them ; TAB to highlight "<OK>" and press ENTER.
  • Read the installation notes. TAB to "<OK>" to continue.
  • When presented with the device option, use the Up/Down keys to select the correct drive ( /dev/sdX ).
  • Make sure the installation drive [*] /dev/sdX has an asterisk next to it ( example: [*] /dev/sda ). 
  • If it doesn't, highlight it and press the SPACE bar to select it. Do not select a partition ( example: [ ] /dev/sda5 , etc). 
  • TAB to "<OK>" and press ENTER. When it has finishing the installation, you should have Grub 2 installed.
ix) Update the Grub Loader files
                     update-grub
x)- Exit the chroot environment
                       exit
If you have successfully exited chroot, the terminal prompt should return to the Ubuntu Live CD prompt ( ubuntu@ubuntu:~$ ).

8) Reboot your system and you will be presented a grub based boot-menu containing the choice of operating systems ( including Windows ) you want to boot.There it goes ....

Have a happy Ubuntu Experience...

Wednesday, June 13, 2012

Trouble-shooting oracle 11g installation on Ubuntu

In my one of the previous post ( http://meandmyubuntulinux.blogspot.com/2012/05/installing-oracle-11g-r2-express.html ) , I told you about steps for installation of Oracle 11g R2 express edition on Ubuntu. But I found out that many of you are facing problems in installing using the given steps. So, I came up with an idea of adding a trouble-shooter post which can enable you to have a hassle-free installation experience.
                Most of the time, if you followed the steps in previous post then you should be able to reach at least up to the configuration part ( Step # 6(ii) ). If you face any problem before this step then you must perform re-installation. For this do the following :
1) Enter the following command on terminal window :
sudo -s
/etc/init.d/oracle-xe stop
ps -ef | grep oracle | grep -v grep | awk '{print $2}' | xargs kill
dpkg --purge oracle-xe
rm -r /u01
rm /etc/default/oracle-xe
update-rc.d -f oracle-xe remove

2) Follow the steps given in the previous post to install the Oracle 11g XE again.

Now, once you have reached the configuration part. Do the following to avoid getting MEMORY TARGET error ( ORA-00845: MEMORY_TARGET not supported on this system ) :
sudo rm -rf /dev/shm
sudo mkdir /dev/shm
sudo mount -t tmpfs shmfs -o size=2048m /dev/shm

(here size will be the size of your RAM in MBs ).

The reason of doing all this is that on a Ubuntu system  /dev/shm is just a link to /run/shm but Oracle requires to have a seperate /dev/shm mount point.

Update: Few people have also reported ORA-01031: insufficient privileges error . To avoid this simply use "oracle" ( without quotes ) as your password for sys / system user while in configurations step.

3) Next you can proceed with the configuration and other consequent steps.

To make the change permanent do the following :

a) create a file named S01shm_load in /etc/rc2.d :

sudo vim /etc/rc2.d/S01shm_load

Now copy and paste following lines into the file :

#!/bin/sh
case "$1" in
start) mkdir /var/lock/subsys 2>/dev/null
       touch /var/lock/subsys/listener
       rm /dev/shm 2>/dev/null
       mkdir /dev/shm 2>/dev/null
       mount -t tmpfs shmfs -o size=2048m /dev/shm ;;
*) echo error
   exit 1 ;;
esac

b) Save the file and provide execute permissions :

         sudo chmod 755 /etc/rc2.d/S01shm_load

This will ensure that every-time you start your system, you get a working Oracle environment.

If you face any other problem while installing Oracle 11g R2 XE on Ubuntu, please feel free to ask as comments.

Reference:
1) Ubuntu man-page 

Friday, May 25, 2012

Things I did after Installing my Ubuntu 12.04


             Although Ubuntu comes loaded with lots of applications but its default looks and applications may not suit everyone. Same was mine case. When I installed it , it simply refused to play any mp3 songs or any video. Reason of this is that Ubuntu policy is to provide free and open-source softwares. It can't provide many of popular softwares owing to this reason. An another reason can be argued that Ubuntu has to keep its size limited to 700 MB to facilitate CD burning. Many will disagree with this point as now-a-days disc drives are becoming increasingly low in use as you can see with tablets or netbooks or smartbooks ( e.g. Macbook Air ). Even Ubuntu comes with option of creating a bootable USB since Ubuntu 8.04 ( I think...) .

        Coming back to things to do after installing Ubuntu.....the very first thing everyone should do is to update your system . Ahh.... you will say I just installed my new Ubuntu and now I have to again update it. But yes , its important as it delivers the latest packages to your system which may contain latest bug-fixes and even new features which could not be accommodated in the CD you used to install your Ubuntu. If you used net-install or upgraded your Ubuntu , then you may not need updating again. Just open a terminal ( keyboard short-cut : Ctrl + Alt + t ) and type in following command :

          Command :
                            sudo apt-get update && sudo apt-get upgrade;

            Now as your packages are up-to-date you can add more applications to your Ubuntu installation to suit your need. But before that first explore what Ubuntu comes pre-loaded with. A few applications that comes with Ubuntu 12.04 LTS ( Precise Pangolin ) are as follows :
  1. Mozilla Firefox : One of the very best web browser.
  2. Empathy : A chat client for use with Gmail , Yahoo , Facebook accounts.
  3. Gwibber : A Broadcast client to use for posting and viewing latest updates/posts on facebook and twitter.
  4. Mozilla Thunderbird : A mail client equivalent to Outlook Express of M$ Windows Xp.
  5. Libre-office : A full-featured office package containing Libreoffice Writer ( equivalent to M$ word ) , Libreoffice Calc ( equivalent to M$ excel ) , Libreoffice Impress ( equivalent to M$ power-point ) .
  6. Brasero : A Disc burning client to let you burn your audio/video/data CD or DVD.
  7. Deja-dup : A back-up and restore tool.
  8. Ubuntu One : A tool and service to backup your data online ( cloud ) . It provides you with 5 GB of free space. You can increase the space if need more at a nominal charge.
  9. Evince : A document viewer for your text and pdf files
  10. Rhythmbox : A music player-cum-organizer .
  11. Shotwell : A tool to view and edit pictures . You import and create libraries of you photos and even share them online.
  12. Totem : A gstreamer-based movie/video player.
  13. Games : Sudoku , Solitaire, gbrainy , Mines , Mahjongg
  14. Transmission : A bit-torrent client .
  15. Ubuntu Software Center : A Central point to download new software for Ubuntu ( both paid and free )
  16. Simple Scan : A utility to use with your scanner.


                Although , Ubuntu comes pre-loaded with lots of applications for your ease , many times its not sufficient. So, go and install few more to add to this brigade :
1) VLC : The most popular video/audio player that plays almost any format out of box. It is the VideoLAN project's media player. It plays MPEG, MPEG-2, MPEG-4, DivX, MOV, WMV, QuickTime, WebM, FLAC, MP3, Ogg/Vorbis files, DVDs, VCDs, podcasts, and multimedia streams from various network sources.
               VLC can also be used as a streaming server that duplicates the stream it reads and multicasts them through the network to other clients, or serves them through HTTP.
                VLC has support for on-the-fly transcoding of audio and video formats, either for broadcasting purposes or for movie format transformations. Support for most output methods is provided by this package, but features can be added by installing additional audio plugins (vlc-plugin-pulse, vlc-plugin-sdl) or video plugins (vlc-plugin-sdl).

               Command :
                              sudo apt-get install vlc

Screen-shot :

2) Gstreamer Multimedia codecs : For playing any video / audio file the default multimedia players of Ubuntu ( i.e. RhythmBox and totem ) requires a set of codecs / plugins and the same is provided by the Gstreamer multimedia codecs. 
              Ubuntu has got a very unique and extremely user-friendly way to install these codecs. You have to just open the Multimedia file in totem player and if it is not able to play the file, it will ask whether you want to search for a suitable codec/plugin . Just proceed with the instructions in subsequent steps and it will download all the necessary packages for you and you are ready to enjoy your movie/song.
3) Chromium : If you are not satisfied by performance of Firefox , go and get chromium from google . It is the Linux version of Google Chrome. Chromium serves as a base for Google Chrome, which is Chromium re-branded (name and logo) with very few additions such as usage tracking and an auto-updater system.

               Command :
                            sudo apt-get install chromium-browser

Screen-shot :

4) MyUnity : This program allows one to configure and tune Unity with a pleasant and comfortable graphical interface. Please note that MyUnity is a third-party application, not official part of the Unity project.

             Command :
                            sudo apt-get install myunity

Screen-shot :

5) Synaptic Package Manager : This was the main package managing tool for Ubuntu before they decided to create Ubuntu Software Center. It enables you to install, upgrade and remove software packages in a user friendly way. A very useful tool and low on resource consumption.

            Command :
                             sudo apt-get install synaptic

Screen-shot :

6) Avidemux : It is a better equivalent to M$ Windows Movie Maker. It is a free video editor designed for simple cutting, filtering and encoding tasks. It supports many file types, including AVI, DVD compatible MPEG files, MP4 and ASF, using a variety of codecs. Tasks can be automated using projects, job queue and powerful scripting capabilities.

           Command :
                           sudo apt-get install avidemux-qt

Screen-shot :

7) Skype : Skype is a little piece of software that lets you make free calls to anyone else on Skype, anywhere in the world. And even though the calls are free, they are really excellent quality. Main Advantages of skype are :
* Make free Skype-to-Skype calls to anyone else, anywhere in the world.
* Call phones and mobiles at pretty cheap rates per minute.
* Group chat with up to 100 people or conference call with up to nine others.
* Free to download.

         Command :
                         sudo apt-get install skype

Screen-shot :

8) Gparted : It is a advanced partition editor that allows you to create and manage your hard-disk partitions. This tool is included on Ubuntu Live Disc but doesn't feature in default Ubuntu Installation. It is an equivalent to M$ Windows disk management tool.

          Command :
                        sudo apt-get install gparted

Screen-shot :

9) GIMP : GIMP ( GNU Image Manipulation Program ) is an advanced picture editor and is Linux equivalent of Adobe Photoshop. You can use it to edit, enhance, and retouch photos and scans, create drawings, and make your own images. Lots of tools are available; you can sharpen and resize photos, and remove dust and red-eyes, for example.
              It has a large collection of professional-level editing tools and filters, similar to the ones you might find in PhotoShop. Numerous fine-control settings and features like layers, paths, masks, and scripting give you total control over your images.
              Many image file formats are supported, including JPEG, PhotoShop (.psd), and Paint Shop Pro (.psp) files. It can also be used to scan and print photos.

          Command :
                      sudo apt-get install gimp

Screen-shot :

            The list I wrote above is just a glimpse of Softwares and Applications that are available to install in Ubuntu. With so much of advanced and feature-rich but still free applications available, I think one should think twice before spending thousands of bucks on M$ (my-crow-soft ) products. Don't use them just because they got better looks if you can have much better performance from a total free solution.
Any one interested in learning basic linux/terminal  commands can access the following sister-site link :
http://tipsandinfoit.blogspot.com/2012/05/basic-unix-commands.html 

Have a nice Ubuntu Experience ….

Thursday, May 10, 2012

Installing Oracle 11g R2 Express Edition on Ubuntu 12.04 64-bit

              Recently I installed Oracle 11g R2 Express Edition on my ubuntu 12.04 ( Precise Pangolin). But for this, I have to google a lot and had to install two times to get a fully working environment. So, I thought it would be better if I share my experience with my fellow ubuntu'ers so that they don't have to face the troubles that I encountered. I have came up with following series of steps ( mostly derived from the link source I given at the end of this post ) for easy and hassle-free installation.
              But at first, I must inform you about the limitations of Oracle 11g R2 Express Edition (XE) which are as follows :

    • The Installer released by Oracle is only meant for 64-bit (x86_64) systems. If you wish to install the 32-bit version , see installing oracle xe on ubuntu 32-bit
    • It will consume, at most, processing resources equivalent to one CPU.
    • Only one installation of Oracle Database XE can be performed on a single computer.
    • The maximum amount of user data in an Oracle Database XE database cannot exceed 11 GB.
    • The maximum amount of RAM that Oracle XE uses cannot exceed 1 GB, even if more is available.
      Now the steps for Installation :

      1) Download the Oracle 11gR2 express edition installer from the link given below:


      ( You will need to create a free oracle web account if you don't already have it )

      2) Unzip it :
      unzip oracle-xe-11.2.0-1.0.x86_64.rpm.zip

      3) Install the following packages :
      sudo apt-get install alien libaio1 unixodbc vim

      4) Convert the red-hat ( rpm ) package to Ubuntu-package :
      sudo alien --scripts -d oracle-xe-11.2.0-1.0.x86_64.rpm

      (Note: this may take a while , till that time you can go for step 5 )

      5) Do the following pre-requisite things:
      a) Create a special chkconfig script :

      The Red Hat based installer of Oracle XE 11gR2 relies on /sbin/chkconfig, which is not used in Ubuntu. The chkconfig package available for the current version of Ubuntu produces errors and my not be safe to use. Below is a simple trick to get around the problem and install Oracle XE successfully: 
      sudo vim /sbin/chkconfig

      (copy and paste the following into the file )
      #!/bin/bash
      # Oracle 11gR2 XE installer chkconfig hack for Ubuntu
      file=/etc/init.d/oracle-xe
      if [[ ! `tail -n1 $file | grep INIT` ]]; then
      echo >> $file
      echo '### BEGIN INIT INFO' >> $file
      echo '# Provides: OracleXE' >> $file
      echo '# Required-Start: $remote_fs $syslog' >> $file
      echo '# Required-Stop: $remote_fs $syslog' >> $file
      echo '# Default-Start: 2 3 4 5' >> $file
      echo '# Default-Stop: 0 1 6' >> $file
      echo '# Short-Description: Oracle 11g Express Edition' >> $file
      echo '### END INIT INFO' >> $file
      fi
      update-rc.d oracle-xe defaults 80 01
      Save the above file and provide appropriate execute privilege :
             sudo chmod 755 /sbin/chkconfig

      b) Set the Kernel parameters :
      Oracle 11gR2 XE requires to set the following additional kernel parameters:
      sudo vim /etc/sysctl.d/60-oracle.conf 
      (Enter the following) 
      # Oracle 11g XE kernel parameters  
      fs.file-max=6815744  
      net.ipv4.ip_local_port_range=9000 65000  
      kernel.sem=250 32000 100 128 
      kernel.shmmax=536870912 
      (Save the file) 
      Note: kernel.shmmax = max possible value , e.g. size of physical RAM ( in bytes e.g. 512MB RAM == 512*1024*1024 == 536870912 bytes ) 
      Verify the change : 
      sudo cat /etc/sysctl.d/60-oracle.conf 
      Load new kernel parameters: 
      sudo service procps restart  
      Verify: sudo sysctl -q fs.file-max 
             -> fs.file-max = 6815744 
      c) Increase the system swap space : Analyze your current swap space by following command :
                 free -m 
      Minimum swap space requirement of Oracle 11gR2 XE is 2 GB . In case, your is lesser , you can increase it by following steps in my one of previous post .
      d) make some more required changes :
      i) sudo ln -s /usr/bin/awk /bin/awk 
      ii) mkdir /var/lock/subsys 
      iii) touch /var/lock/subsys/listener 


      6) Now you are ready to install Oracle 11gR2 XE. Go to the directory where you created the ubuntu package file in Step 4 and enter following commands in terminal :
      i) sudo dpkg --install oracle-xe_11.2.0-2_amd64.deb  
      Update : Before you proceed to next step , do have a look at this trouble-shooting post in order to avoid MEMORY TARGET or any other "shared memory" error.

      ii) sudo /etc/init.d/oracle-xe configure 
      Enter the following configuration information:
      • A valid HTTP port for the Oracle Application Express (the default is 8080)  
      • A valid port for the Oracle database listener (the default is 1521) 
      • A password for the SYS and SYSTEM administrative user accounts
      Update / Note:- Few people have also reported ORA-01031: insufficient privileges error while connecting to the database. To avoid this simply use "oracle" ( without quotes ) as your password in this step. 
      • Confirm password for SYS and SYSTEM administrative user accounts
      • Whether you want the database to start automatically when the computer starts (next reboot).
      7) Before you start using Oracle 11gR2 XE you have to set-up more things :
      a) Set-up the environmental variables :
      Add following lines to your .bashrc :
      export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe
      export ORACLE_SID=XE
      export NLS_LANG=`$ORACLE_HOME/bin/nls_lang.sh`
      export ORACLE_BASE=/u01/app/oracle
      export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
      export PATH=$ORACLE_HOME/bin:$PATH
       
      b) execute your .profile to load the changes:
           
                . ./.profile

      8) Start the Oracle 11gR2 XE :

      sudo service oracle-xe start

      The output should be similar to following :
      user@machine:~$ sudo service oracle-xe start
      Starting Oracle Net Listener.
      Starting Oracle Database 11g Express Edition instance.
      user@machine:~$
       
      8) Create your user :
      a) start sqlplus and login as sys :
      sqlplus sys as sysdba
      ( provide the password you gave while configuring the oracle in Step 6 (ii) ).
      This should come to following :

      SQL*Plus: Release 11.2.0.2.0 Production on Wed May 9 12:12:16 2012

      Copyright (c) 1982, 2011, Oracle. All rights reserved.

      Enter password:

      Connected to:
      Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production

      SQL>

      b) Enter following on the sql prompt : Replace username and password by your desired ones.
      SQL> create user username identified by password;

      User created.

      SQL> grant connect,resource to username;

      Grant succeeded. 
       

      9) Now as you have created the user , you can login to it :

      user@machine:~$ sqlplus

      SQL*Plus: Release 11.2.0.2.0 Production on Wed May 9 12:28:48 2012

      Copyright (c) 1982, 2011, Oracle. All rights reserved.

      Enter user-name: temp
      Enter password:

      Connected to:
      Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production

      SQL> select 2+2 from dual;

      2+2
      ----------
      4

      SQL>


      Reference Links :-
      1. Oracle 11g reference Documents