Monday, December 15, 2008

Duall boot Vista and Fedora 10, installed from hard drive

I wanted to install Fedora 10 on my wife's Dell notebook from a downloaded dvd iso image, without burning it on a disk. I found that it could be possible with UNetbootin, but the problem was that Vista came installed on NTFS, which is not readable by anaconda installer. The solution was to create a temporary FAT32 partition.
This is how it worked:

In Vista use Disk Manager to create space on your HDD (right click on Computer and select Manage). Shrink the last partition by at least 10G and in the created space make a new 4G FAT32 partition and give it a drive letter. Your linux distro will be installed in the remaining space.

Download the Fedora 10 dvd iso and save it to the new partition.
Download and run UNetbootin. Choose to install from ISO image and select the image. Choose to install to hard drive. UNetbootin will then create c:\images folder and also extract packages from the iso image, which is pointless, but just let it do what it's doing.

Move the c:\images folder to the new partition. The partition should now contain your distro ISO image and the images folder.
After reboot, you should see a new boot menu. Select UNetbootin and when asked from which partition to install, select the last one. Then select to install in free space.

When the installation was finished, linux booted fine, but Vista complained about a missing boot loader. The problem was that grub was pointing to the first partition, but Vista was installed on the second (or even third - this is confusing me :), courtesy of Dell. The fix was to edit grub.conf and find the second occurance of rootnoverify and change 1 to 2 on that line:

vim /boot/grub/grub.conf

change

title Windows Vista
rootnoverify (hd0,1)

to

title Windows Vista
rootnoverify (hd0,2)

(the title will differ, could be "other" if you haven't changed it during installation)

When in Vista, run UNetbootin again and let it uninstall itself. The UNetbootin boot menu and all folders it created on the Vista drive will be gone.

I haven't yet come to deleting the termporary 4G Fat32 partition, but I guess the partition number in groub.conf for the linux partitions would have to be decreased by one when the partition is deleted or linux wouldn't boot.


Accessing the Vista NTFS partition from linux


http://fedorasolved.org/post-install-solutions/ntfs-read-write
http://www.ntfs-3g.org/index.html#usage

yum -y install ntfs-3g
mkdir -p /mnt/c
mount -t ntfs-3g /dev/sda2 /mnt/c

to make it permanent add an entry to fstab file.

echo '/dev/sda2 /mnt/c ntfs-3g defaults 0 0' >> /etc/fstab

(sda2 might be sda1, depending on where Vista lives)

Allowing root gui login
http://www.cyberciti.biz/faq/fedora-10-root-login/

sed -i '/root/ s/^/#/' /etc/pam.d/gdm
sed -i '/root/ s/^/#/' /etc/pam.d/gdm-password
sed -i '/root/ s/^/#/' /etc/pam.d/gdm-fingerprint

Friday, November 28, 2008

Vimperator for Opera

http://my.opera.com/Blazeix/blog/2008/07/04/vimperator-for-opera

mkdir -p ~/.opera/keyboard
cd ~/.opera/keyboard
wget http://files.myopera.com/Blazeix/blog/vimperopera.ini

Copied from the above page:
  • Open up your preferences window and navigate to Advanced->Shortcuts->Keyboard Setup and choose 'vimperopera'. Press O.K.
  • (Optional) To get a more authentic Vim[perator] experience, you may want to hide all of your toolbars except for the tab bar and address bar. Do this from the Tools->Appearance->Toolbars tab, and press Shift+m to toggle the menu bar on/off. I put my address bar at the bottom of the window, and kept the tab bar at the top. I hid all the other toolbars.
  • While in opera, download Standard Slim Skin.

Thursday, November 13, 2008

Vim - my config on CentOS

set vim as a default editor
echo "export EDITOR=/usr/bin/vim" >> /etc/profile
disable flow control in a terminal (unblock ctrl+s, ctrl+q for use in vim)
echo "stty -ixoff -ixon" >> ~/.bashrc

config:
echo '
set mouse=a
set number
set ts=2
set shiftwidth=2
set expandtab
set softtabstop=2
set smartindent
map <c-q> :mksession! ~/.vim/.session <cr>
map <c-s> :source ~/.vim/.session <cr>
nmap <F2> :update <cr>
imap <F2> <C-O>:update <cr>
' >> /etc/vimrc

Without the key mappings above, vim would be too painful for me to use for programming.
Ctrl+q ... save vim's state e.g. what files are opened, cursor position, ...
Ctrl+s ... restore saved state
F2 ... save current file - works in insert mode too

X11 clipboard
http://lug.wsu.edu/node/1239
yum install vim-X11
echo "alias vim='/usr/bin/vimx'" >> ~/.bashrc
. ~/.bashrc

rails support
http://www.vim.org/scripts/script.php?script_id=1567

Before running, check for latest version and replace 9499 below.
mkdir ~/.vim
cd ~/.vim
wget http://www.vim.org/scripts/download_script.php?src_id=9499
unzip rails.zip
rm rails.zip

enable rails docs
:helptags ~/.vim/doc
then run
:help rails

haml+sass syntax highlighting
http://www.vim.org/scripts/script.php?script_id=1773
http://www.vim.org/scripts/script.php?script_id=1979
Again, check for latest versions and modify 8461 and 7447 below.
mkdir ~/.vim/syntax
cd ~/.vim/syntax
wget http://www.vim.org/scripts/download_script.php?src_id=8461
wget http://www.vim.org/scripts/download_script.php?src_id=7447
echo '
au! BufRead,BufNewFile *.haml setfiletype haml
au! BufRead,BufNewFile *.sass setfiletype sass
' >> ~/.vim/filetype.vim

problem with haml.vim - carriage returns errors
http://railshacks.blogspot.com/2008/05/railsvim-breaks-in-hardy-heron.html
vim ~/.vim/syntax/haml.vim
and save with
:w ++ff=unix

Swap Escape and Caps Lock keys (to love vim more)
http://www.ibiblio.org/pub/Linux/docs/HOWTO/Keyboard-and-Console-HOWTO
echo '
remove Lock = Caps_Lock
keysym Escape = Caps_Lock
keysym Caps_Lock = Escape
add Lock = Caps_Lock
'> ~/.Xmodmap

File ~/.Xmodmap is processed by /etc/X11/xinit/xinitrc-common when X starts.
To take effect immediately, do
'xmodmap ~/.Xmodmap'

Same on Windoze
http://www.emacswiki.org/emacs/MovingTheCtrlKey#toc11
save the next 3 lines in a file, e.g. swapEscCL.reg and execute
REGEDIT4
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,03,00,00,00,01,00,3a,00,3a,00,01,00,00,00,00,00

tips
:%s/^/ / ... indent all lines
:.,.+3s/^/ / ... indent 4 lines from cusor down
<c-v>2><esc> ... indent 2x on a selected range

references
vim as development environment

to do
fix problem with javascript highlighting
now have to do
:set
syntax=javascript
perhaps filetype is not correctly set for js

CentOS 5 root bash prompt

http://www.pantz.org/software/shell/enhancingshellprompt.html

Default root prompt doesn't show host and current folder, because root doesn't have ~/.bashrc file, that loads /etc/bashrc. To fix it, simply copy .bashrc from other user's home dir or, if you don't need to include /etc/bashrc, create the .bashrc file with
echo 'PS1="[\u@\h \W]\\$ "' > /root/.bashrc
which can also go to %post in kickstart.

To load the change without relogin, run
. ~/.bashrc
(don't miss the dot at the beginning)

Blogger setup

Blogger content width in the classic template
I found the default width too narrow. Made it wider in Settings, Layout, Edit HTML with the following replacements:

width: 660px; => width: 1000px
width: 410px; => width: 780;
max-width:700px; => max-width:1000px;

Google Analytics
Once editing the template, why not to add Google Analytic code.
Not using Google Analytic yet? Sign up here.
Why?
"It's easy -- and free!"

Sitemap
Sign up for
Google Webmaster Tools and add your blogspot url as a new site. Then go to Sitemaps, Add Sitemap, select Add General Web Sitemap and type atom.xml in step 3 (ignore steps 1 and 2).

Good place to check is Google Webmaster Central and one more about blog feeds and yet nother one about using custom domain.

Wednesday, November 12, 2008

CentOS 5.2 - my desktop configuration

Normally I use Fedora for desktop, but this time I tried something a bit different

Started with kickstart that I previously put together to install headless server and then I installed gnome and the rest.

Gnome
yum groupinstall 'X Window System' 'GNOME Desktop Environment'
# if get error:" 0002483: nautilus-sendto requires a non-existent libgaim.so.0" do
http://bugs.centos.org/view.php?id=2483
wget http://mirror.centos.org/centos/5/os/i386/CentOS/nautilus-sendto-0.7-5.fc6.i386.rpm
rpm -Uvh --nodeps nautilus-sendto-0.7-5.fc6.i386.rpm


Display
It was a nightmare
to set up the correct resolution. First I was trying to find correct setting for my monitor on internet and manually edit xorg.conf, but had no luck. Then I was just fiddling with System/Preferences/Screen Resolution and System/Administration/System and the follwing commands till I got it right, but can't say what made it work.

system-config-display --reconfig
Xorg -configure
xinit

The resulting config looks like this:

cat /etc/X11/xorg.conf
# Xorg configuration created by system-config-display

Section "ServerLayout"
Identifier "single head configuration"
Screen 0 "Screen0" 0 0
InputDevice "Keyboard0" "CoreKeyboard"
EndSection

Section "InputDevice"
Identifier "Keyboard0"
Driver "kbd"
Option "XkbModel" "pc105"
Option "XkbLayout" "us"
EndSection

Section "Monitor"
Identifier "Monitor0"
ModelName "LCD Panel 1680x1050"
HorizSync 31.5 - 65.5
VertRefresh 56.0 - 65.0
Option "dpms"
EndSection

Section "Device"
Identifier "Videocard0"
Driver "nv"
EndSection

Section "Screen"
Identifier "Screen0"
Device "Videocard0"
Monitor "Monitor0"
DefaultDepth 24
SubSection "Display"
Viewport 0 0
Depth 24
EndSubSection
EndSection

Now, when looking at the first line of the file above, it seems that
system-config-display --reconfig
made it work.


USB Mouse & Keyboard
This was another issue that gave me hard time, but this time it was of my own making. I forgot that I purposely disabled USB support in kickstart with this line:
bootloader --location=mbr --append="nousb enforcing=0"

Worked that out from startup log:

dmesg | grep usb
#got message: "usbcore: USB support disabled"

vim /boot/grub/grub.conf
# and remove nousb to get USB working

PgAdmin
Install DAG repo from
http://dag.wieers.com/rpm/FAQ.php#B
then
yum install pgadmin3

Firefox Flash plugin
download yum repo rpm from adobe.com and then run
yum install flash-plugin

Firefox Java plugin
http://it.megocollector.com/?p=832
cd /usr/lib/mozilla/plugins
ls -s /usr/java/jre1.6.0_10/plugin/i386/ns7/libjavaplugin_oji.so ibjavaplugin_oji.so
# java location might differ, see what's in /usr/java folder

gnome-do and deskbar-applet
They look fancy, but in the end, alt+F2 might be good enough for me.

gnome-do : activate with Win+space
http://rpm.pbone.net/index.php3/stat/4/idpl/9221111/com/gnome-do-0.4.2.0-1.el5.kb.i386.rpm.html

deskbar applet : activate with alt+F3
http://rpm.pbone.net/index.php3/stat/4/idpl/4838900/com/deskbar-applet-2.17.2-3.el5.rf.i386.rpm.html

Finally, xterm's gray background makes me sad.
echo 'XTerm*background: white' >> /etc/X11/Xresources