Create Bootable USB from Linux

Install Livecd-tools and spin-kickstarts using Yum
yum install livecd-tools spin-kickstarts

Make the partition bootable
/sbin/parted /dev/sdb
(parted) toggle N boot
(parted) quit

Run the command from shell
/usr/bin/livecd-iso-to-disk /path/to/live.iso /dev/sdb1

Resize /tmp in cpanel servers

service chkservd stop
service httpd stop
service mysql stop
service postgresql stop

lsof | grep /tmp

kill the process

umount /var/tmp

umount /tmp

vi /scripts/securetmp

replace “256000” with “512000”

rm -rf /usr/tmpDSK
/scripts/securetmp –auto

cd /tmp

ln -s /var/lib/mysql/mysql.sock

service postgresql start
service mysql start
service httpd start
service chkservd start

How to Boot second kernel if first fails

Reference :  http://www.linux-noob.com/forums/index.php?/topic/2928-grub-single-boot-and-kernel-panic-reboot/

If for example your grub.conf looks like the one i have below. This boots into the 2.6.20-1.2944 by default.

default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Fedora Core (2.6.20-1.2944.fc6)
        root (hd0,0)
        kernel /vmlinuz-2.6.20-1.2944.fc6 ro root=LABEL=/ acpi=off
        initrd /initrd-2.6.20-1.2944.fc6.img
title Fedora Core
        root (hd0,0)
        kernel /vmlinuz-2.6.20 ro root=LABEL=/ acpi=off
        initrd /initrd-2.6.20.img

If you want to have it so that 2.6.20 boots on next boot, run the following command from the console before rebooting.
echo “savedefault –default=1 –once” | grub –batch
then
reboot

Now, if you have a kernel that panics and need it to reboot if it panics. change your config and add the panic=# (# being seconds before auto reboot) to the kernel line. Example file below

default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Fedora Core (2.6.20-1.2944.fc6)
        root (hd0,0)
        kernel /vmlinuz-2.6.20-1.2944.fc6 ro root=LABEL=/ acpi=off panic=5
        initrd /initrd-2.6.20-1.2944.fc6.img
title Fedora Core (2.6.20)
        root (hd0,0)
        kernel /vmlinuz-2.6.20 ro root=LABEL=/ acpi=off panic=5
        initrd /initrd-2.6.20.img

so the order of operations on this are as follows.

1.) Add new kernel to grub.conf
2.) set default=# in grub.conf to the failsafe kernel (the one you want it to try if the other fails)
3.) run the following:
echo “savedefault –default=1 –once” | grub –batch
4.) reboot

Copied from :  http://www.linux-noob.com/forums/index.php?/topic/2928-grub-single-boot-and-kernel-panic-reboot/

Remote access to mysql database

Step 1 : vi  /etc/my.cnf
———————————————
pid-file        = /var/run/mysqld/mysqld.pid

socket          = /var/run/mysqld/mysqld.sock

port            = 3306

basedir         = /usr

datadir         = /var/lib/mysql

tmpdir          = /tmp

language        = /usr/share/mysql/English

bind-address    = mysql server ip

# skip-networking
———————————————

bind-address : IP address to bind to.

skip-networking : Don’t listen for TCP/IP connections at all. All interaction with mysqld must be made via Unix sockets. This option is highly recommended for systems where only local requests are allowed. Since you need to allow remote connection this line should removed from file or put it in comment state.

Step 2 : /etc/init.d/mysql restart

Step 3 : Grant access to remote IP address

mysql -u root -p mysqlGrant access to new database

Step 4 : If you want to add new database aaa for user bbb and remote IP xxx.xxx.xxx.xxx then type following commands at mysql prompt:

mysql> CREATE DATABASE aaa;
mysql> GRANT ALL ON aaa.* TO bbb@’xxx.xxx.xxx.xxx’ IDENTIFIED BY ‘PASSWORD’;

Step 5 : Grant access to existing database

mysql> update db set Host=’xxx.xxx.xxx.xxx’ where Db=’webdb’;
mysql> update user set Host=’xxx.xxx.xxx.xxx’ where user=’webadmin’;

mysql> exit

Step 6 : Test it From remote system

mysql -u webadmin –h 65.55.55.2 –p