Guys,
I refer following commands :
Examples :
=========
gzip -d guiderj_content.sql.gz
tar -xvzf guiderj_content.sql.gz
tar -jxvf eaccelerator-0.9.5.3.tar.bz2
=========
try :)
This is dedicated to the linux users, system admins, open source enthusiastic, techs whoever is looking for solution, tricks & concept etc. Reader will apply concept or execute command at their own risk. Owner of these article is not responsible for any impact, damages or errors.
Thursday, September 16, 2010
How to repair mysql database or tables of the database?
Guys,
I usually use following command to repair all the tables of the databases of a user.
=========
[root@server /var/lib/mysql]#for i in `ll |grep bigchakr|awk '{print $9}' |cut -d/ -f1`; do for j in `mysql -e "use $i; show tables;"|grep -v -`; do mysql -e "use $i; repair table $j;"; done done;
=========
User : bigchakr, please replace this user. It'll repair all the tables of all the DB of that user.
You can use myisamchk command to repair the DB. Here is the comamnd :
========
[root@server /var/lib/mysql]# myisamchk -r /var/lib/mysql/bigchakr_content/*.MYI
========
Note : bigchakr_content is the name of the DB. You can use following command.
========
[root@server /var/lib/mysql]# for i in `ll |grep bigchakr|awk '{print $9}'`; do myisamchk -r $i/*.MYI ; done
========
I don't prefer myisamchk since sometime it doesn't give good results.
Try. :)
I usually use following command to repair all the tables of the databases of a user.
=========
[root@server /var/lib/mysql]#for i in `ll |grep bigchakr|awk '{print $9}' |cut -d/ -f1`; do for j in `mysql -e "use $i; show tables;"|grep -v -`; do mysql -e "use $i; repair table $j;"; done done;
=========
User : bigchakr, please replace this user. It'll repair all the tables of all the DB of that user.
You can use myisamchk command to repair the DB. Here is the comamnd :
========
[root@server /var/lib/mysql]# myisamchk -r /var/lib/mysql/bigchakr_content/*.MYI
========
Note : bigchakr_content is the name of the DB. You can use following command.
========
[root@server /var/lib/mysql]# for i in `ll |grep bigchakr|awk '{print $9}'`; do myisamchk -r $i/*.MYI ; done
========
I don't prefer myisamchk since sometime it doesn't give good results.
Try. :)
Saturday, September 11, 2010
FileList::init() failed: ls_dir_wrapper() failed: Unable to logon user + Logon failure: unknown user name or bad password
Guys,
I have referred the following steps to sort out the error :
steps to recreate the error : Login into plesk cp >> domain's cp >> browse file manager. Here is the error :
------
---------------------- Debug Info -------------------------------
0: FileManagerUIPointer.php:709
FileManagerUIPointer->accessItem(string 'GET', NULL null)
1: client.domain.hosting.file-manager.php:86
plesk__client__domain__hosting__file_manager->accessItem(string 'GET', NULL null)
2: UIPointer.php:601
UIPointer->access(string 'GET')
3: plesk.php:43
------
Solutions :
1. RDP >> Mycomputer >>right click >> properties >>manage >>user & group >>click on users>> find the user(domain name) >>right click and click on properties >> uncheck 'password disable option'.
2. Go to run>>cmd>> and execute following query to retrieve the password of the user's admin area of the domain. For my case I executed the following query :
Example :
------
C:\>"%plesk_bin%"\dbclient --direct-sql --sql="select su.login, a.password from
accounts a, sys_users su where a.id=su.account_id and su.login='dhelalqamar.com
'"
login password
dhelalqamar.com domain_passwd
------
Note : Replace only login name here
3. Execute following command to be recognized the password by the system :
net user login_name password
Example :
====
C:\>
net user dhelalqamar.com qwertyu
The command executed successfully
====
Now try to browse the file manager. Error will be vanished :)
That's it. try :)
I have referred the following steps to sort out the error :
steps to recreate the error : Login into plesk cp >> domain's cp >> browse file manager. Here is the error :
------
---------------------- Debug Info -------------------------------
0: FileManagerUIPointer.php:709
FileManagerUIPointer->accessItem(string 'GET', NULL null)
1: client.domain.hosting.file-manager.php:86
plesk__client__domain__hosting__file_manager->accessItem(string 'GET', NULL null)
2: UIPointer.php:601
UIPointer->access(string 'GET')
3: plesk.php:43
------
Solutions :
1. RDP >> Mycomputer >>right click >> properties >>manage >>user & group >>click on users>> find the user(domain name) >>right click and click on properties >> uncheck 'password disable option'.
2. Go to run>>cmd>> and execute following query to retrieve the password of the user's admin area of the domain. For my case I executed the following query :
Example :
------
C:\>"%plesk_bin%"\dbclient --direct-sql --sql="select su.login, a.password from
accounts a, sys_users su where a.id=su.account_id and su.login='dhelalqamar.com
'"
login password
dhelalqamar.com domain_passwd
------
Note : Replace only login name here
3. Execute following command to be recognized the password by the system :
net user login_name password
Example :
====
C:\>
net user dhelalqamar.com qwertyu
The command executed successfully
====
Now try to browse the file manager. Error will be vanished :)
That's it. try :)
Thursday, September 9, 2010
How to install htop on linux machine?
Guys,
I used one bash script to automatically install the htop binary. The binary will show details of the running processes when you execute it on the konsole. Here is the script.
======
#!/bin/bash
cd /usr/local/src/
wget http://citylan.dl.sourceforge.net/project/htop/htop/0.8.3/htop-0.8.3.tar.gz
tar xzvf htop-0.8.3.tar.gz
cd htop-0.8.3
./configure
make
make install
======
That's it. Try :)
I used one bash script to automatically install the htop binary. The binary will show details of the running processes when you execute it on the konsole. Here is the script.
======
#!/bin/bash
cd /usr/local/src/
wget http://citylan.dl.sourceforge.net/project/htop/htop/0.8.3/htop-0.8.3.tar.gz
tar xzvf htop-0.8.3.tar.gz
cd htop-0.8.3
./configure
make
make install
======
That's it. Try :)
Sunday, September 5, 2010
Directory lookup for the file "C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\HTMLPDF.mdf" failed with the operating system error 3
Guys,
I got this error when I was restoring one database on mssql 2005(win 2003). I have tried to override the DB but still got the error message. I have changed the path and then successfully restored it since error is giving the clue :)
Error :
======
System.Data.SqlClient.SqlError: Directory lookup for the file "C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\HTMLPDF.mdf" failed with the operating system error 3(The system cannot find the path specified.). (Microsoft.SqlServer.Express.Smo)
======
Exact path for my system(Try to find out the paths of those files/You can make new files[May be inside the plesk directory]) :
=====
C:\Program Files (x86)\Parallels\Plesk\Databases\MSSQL\MSSQL.1\MSSQL\Data\dbname.mdf
C:\Program Files (x86)\Parallels\Plesk\Databases\MSSQL\MSSQL.1\MSSQL\Data\dbname.LDF
=====
Note : You'll get it at the "option" of the windows tool. You can refer the following URL.
======
http://www.linglom.com/2008/01/12/how-to-backup-and-restore-database-on-microsoft-sql-server-2005/
======
Note : You can create/backup/restore the DB at the mssql 2005 management area.
Try :)
I got this error when I was restoring one database on mssql 2005(win 2003). I have tried to override the DB but still got the error message. I have changed the path and then successfully restored it since error is giving the clue :)
Error :
======
System.Data.SqlClient.SqlError: Directory lookup for the file "C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\HTMLPDF.mdf" failed with the operating system error 3(The system cannot find the path specified.). (Microsoft.SqlServer.Express.Smo)
======
Exact path for my system(Try to find out the paths of those files/You can make new files[May be inside the plesk directory]) :
=====
C:\Program Files (x86)\Parallels\Plesk\Databases\MSSQL\MSSQL.1\MSSQL\Data\dbname.mdf
C:\Program Files (x86)\Parallels\Plesk\Databases\MSSQL\MSSQL.1\MSSQL\Data\dbname.LDF
=====
Note : You'll get it at the "option" of the windows tool. You can refer the following URL.
======
http://www.linglom.com/2008/01/12/how-to-backup-and-restore-database-on-microsoft-sql-server-2005/
======
Note : You can create/backup/restore the DB at the mssql 2005 management area.
Try :)
Saturday, September 4, 2010
How to build kernel module + How to develop kernel module + How to create kernel module?
Guys,
I developed a small program called hello.c and called some kernel functions in it. Here are the steps those I followed :
========
1. yum install kernel-headers-$(uname -r)
2. vi hello.c and add the following codes :
-----
#include "linux/module.h"
#include "linux/kernel.h"
int init_module(void)
{
printk(KERN_INFO "init_module() called\n");
return 0;
}
void cleanup_module(void)
{
printk(KERN_INFO "cleanup_module() called\n");
}
-----
3. vi Makefile and add the following lines :
-----
obj-m += hello.o
all:
make -C /lib/modules/2.6.18-194.8.1.el5/build/ M=$(PWD) modules
clean:
make -C /lib/modules/2.6.18-194.8.1.el5/build/ M=$(PWD) clean
-----
Note : Replace the version here. -C option is used to use the Makefile which has inside the "build" directory.
4. make //To create object files like .o and .ko. PT: ./configure is not needed since basic function of ./configure is to check the existence of header files and to create the Makefile and setup rules in those files. Here we have manually created the file and put the rules.
5. List of created object files after executing "make" command :
-----
root@server [~/test]# ls
./ hello.c .hello.ko.cmd hello.mod.o hello.o Makefile Module.symvers
../ hello.ko hello.mod.c .hello.mod.o.cmd .hello.o.cmd Module.markers .tmp_versions/
root@server [~/test]#
Example(O/P) :-
root@server [~/test]#make
make -C /lib/modules/2.6.18-194.8.1.el5/build/ M=/root/test modules
make[1]: Entering directory `/usr/src/kernels/2.6.18-194.8.1.el5-i686'
CC [M] /root/test/hello.o
Building modules, stage 2.
MODPOST
CC /root/test/hello.mod.o
LD [M] /root/test/hello.ko
make[1]: Leaving directory `/usr/src/kernels/2.6.18-194.8.1.el5-i686'
-----
6. root@server [~/test]# modinfo hello.ko //To get the details of the module
filename: hello.ko
srcversion: 4F856ABA1F3290D5F81D961
depends:
vermagic: 2.6.18-194.8.1.el5 SMP mod_unload 686 REGPARM 4KSTACKS gcc-4.1
root@server [~/test]#
7. Load module : insmod hello.ko
example :
root@server [~/test]# insmod hello.ko
8. Check whether it has loaded or not : lsmod | grep hello
example :
root@server [~/test]# lsmod | grep hello
hello 5504 0
root@server [~/test]#
9. Remove the module : rmmod hello
Ex :
root@server [~/test]# rmmod hello
10. Check the log :
root@server [~/test]# tail -2 /var/log/messages
Sep 4 19:28:20 server kernel: init_module() called
Sep 4 19:28:28 server kernel: cleanup_module() called
root@server [~/test]#
========
That's it. Try :)
I developed a small program called hello.c and called some kernel functions in it. Here are the steps those I followed :
========
1. yum install kernel-headers-$(uname -r)
2. vi hello.c and add the following codes :
-----
#include "linux/module.h"
#include "linux/kernel.h"
int init_module(void)
{
printk(KERN_INFO "init_module() called\n");
return 0;
}
void cleanup_module(void)
{
printk(KERN_INFO "cleanup_module() called\n");
}
-----
3. vi Makefile and add the following lines :
-----
obj-m += hello.o
all:
make -C /lib/modules/2.6.18-194.8.1.el5/build/ M=$(PWD) modules
clean:
make -C /lib/modules/2.6.18-194.8.1.el5/build/ M=$(PWD) clean
-----
Note : Replace the version here. -C option is used to use the Makefile which has inside the "build" directory.
4. make //To create object files like .o and .ko. PT: ./configure is not needed since basic function of ./configure is to check the existence of header files and to create the Makefile and setup rules in those files. Here we have manually created the file and put the rules.
5. List of created object files after executing "make" command :
-----
root@server [~/test]# ls
./ hello.c .hello.ko.cmd hello.mod.o hello.o Makefile Module.symvers
../ hello.ko hello.mod.c .hello.mod.o.cmd .hello.o.cmd Module.markers .tmp_versions/
root@server [~/test]#
Example(O/P) :-
root@server [~/test]#make
make -C /lib/modules/2.6.18-194.8.1.el5/build/ M=/root/test modules
make[1]: Entering directory `/usr/src/kernels/2.6.18-194.8.1.el5-i686'
CC [M] /root/test/hello.o
Building modules, stage 2.
MODPOST
CC /root/test/hello.mod.o
LD [M] /root/test/hello.ko
make[1]: Leaving directory `/usr/src/kernels/2.6.18-194.8.1.el5-i686'
-----
6. root@server [~/test]# modinfo hello.ko //To get the details of the module
filename: hello.ko
srcversion: 4F856ABA1F3290D5F81D961
depends:
vermagic: 2.6.18-194.8.1.el5 SMP mod_unload 686 REGPARM 4KSTACKS gcc-4.1
root@server [~/test]#
7. Load module : insmod hello.ko
example :
root@server [~/test]# insmod hello.ko
8. Check whether it has loaded or not : lsmod | grep hello
example :
root@server [~/test]# lsmod | grep hello
hello 5504 0
root@server [~/test]#
9. Remove the module : rmmod hello
Ex :
root@server [~/test]# rmmod hello
10. Check the log :
root@server [~/test]# tail -2 /var/log/messages
Sep 4 19:28:20 server kernel: init_module() called
Sep 4 19:28:28 server kernel: cleanup_module() called
root@server [~/test]#
========
That's it. Try :)
Friday, September 3, 2010
How to upgrade kernel on linux?
Guys,
I referred the following steps :
============================
1. cd /usr/local/src
2. wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-x.y.z.tar.bz2 //replace the version that you want to install or check it at http://www.kernel.org/
3. tar -xjvf linux-2.6.35.4.tar.bz2 -C /usr/src
4. cd /usr/src/linux-2.6.35.4
5. make menuconfig //if gcc is not there just install it like : yum install gcc
Note : You can enable various option here. But make it sure that you have enabled kernel config option. Go to General option >> Kernel .config support(enter space) and exit. (save the changes). make oldconfig > Use when upgrading kernel, only asks if new options.
6. make
7. make modules
8. make modules_install
Note(Do the following) : # ln -s /usr/src/linux-2.6.35.4 /usr/src/linux
# ln -s /usr/src/linux-2.6.35.4 /usr/src/linux-2.6
9. make install
Note : It will install three files inside the /boot directory :
* System.map-2.6.35.4
* config-2.6.35.4
* vmlinuz-2.6.35.4 and vmlinuz will point here.
example(For my case):
----------
root@server [/usr/src/linux-2.6.35.4]# make install
sh /usr/src/linux-2.6.35.4/arch/x86/boot/install.sh 2.6.35.4
arch/x86/boot/bzImage \
System.map "/boot"
root@server [/usr/src/linux-2.6.35.4]#
root@server [/boot]# ll |grep 2.6.35.4
-rw------- 1 root root 2586318 Sep 3 18:00 initrd-2.6.35.4.img
lrwxrwxrwx 1 root root 25 Sep 3 18:00 System.map ->
/boot/System.map-2.6.35.4
-rw-r--r-- 1 root root 1360605 Sep 3 18:00 System.map-2.6.35.4
lrwxrwxrwx 1 root root 22 Sep 3 18:00 vmlinuz -> /boot/vmlinuz-2.6.35.4
-rw-r--r-- 1 root root 2653408 Sep 3 18:00 vmlinuz-2.6.35.4
root@server [/boot]
Make sure System.map and vmlinuz are pointing to latest kernel else point them like :
ln -s /boot/System.map-2.6.28 /boot/System.map
ln -s /boot/vmlinuz-2.6.35.4 /boot/vmlinuz
-----------
10. cd /boot
11. mkinitrd initrd.img-2.6.35.4 2.6.35.4 //You may not be needed this step. For me it has automatically created. This is creation of RAM driver.
Example for my case :
------------
root@server [/boot]# mkinitrd initrd-2.6.35.4.img 2.6.35.4
initrd-2.6.35.4.img already exists.
root@server [/boot]#
------------
12. vi /boot/grub/menu.lst or /etc/grub.conf : //For me the entries has automatically put in this file like :
------------
root@server [/usr/src/linux-2.6.35.4]# cat /etc/grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,0)
# kernel /vmlinuz-version ro root=/dev/hda3
# initrd /initrd-version.img
#boot=/dev/hda
default=1
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.35.4)
root (hd0,0)
kernel /vmlinuz-2.6.35.4 ro root=/dev/hda3
initrd /initrd-2.6.35.4.img
title CentOS (2.6.18-194.8.1.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-194.8.1.el5 ro root=/dev/hda3
initrd /initrd-2.6.18-194.8.1.el5.img
title CentOS (2.6.18-128.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-128.el5 ro root=/dev/hda3
initrd /initrd-2.6.18-128.el5.img
root@server [/usr/src/linux-2.6.35.4]#
------------
13. reboot //enter this command at the konsole.
14. Check the server whether it comes online and check uname -r //If it does not come please contact DC to load the server from old kernel and sort the problem.
==============================
That's it. Try :)
I referred the following steps :
============================
1. cd /usr/local/src
2. wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-x.y.z.tar.bz2 //replace the version that you want to install or check it at http://www.kernel.org/
3. tar -xjvf linux-2.6.35.4.tar.bz2 -C /usr/src
4. cd /usr/src/linux-2.6.35.4
5. make menuconfig //if gcc is not there just install it like : yum install gcc
Note : You can enable various option here. But make it sure that you have enabled kernel config option. Go to General option >> Kernel .config support(enter space) and exit. (save the changes). make oldconfig > Use when upgrading kernel, only asks if new options.
6. make
7. make modules
8. make modules_install
Note(Do the following) : # ln -s /usr/src/linux-2.6.35.4 /usr/src/linux
# ln -s /usr/src/linux-2.6.35.4 /usr/src/linux-2.6
9. make install
Note : It will install three files inside the /boot directory :
* System.map-2.6.35.4
* config-2.6.35.4
* vmlinuz-2.6.35.4 and vmlinuz will point here.
example(For my case):
----------
root@server [/usr/src/linux-2.6.35.4]# make install
sh /usr/src/linux-2.6.35.4/arch/x86/boot/install.sh 2.6.35.4
arch/x86/boot/bzImage \
System.map "/boot"
root@server [/usr/src/linux-2.6.35.4]#
root@server [/boot]# ll |grep 2.6.35.4
-rw------- 1 root root 2586318 Sep 3 18:00 initrd-2.6.35.4.img
lrwxrwxrwx 1 root root 25 Sep 3 18:00 System.map ->
/boot/System.map-2.6.35.4
-rw-r--r-- 1 root root 1360605 Sep 3 18:00 System.map-2.6.35.4
lrwxrwxrwx 1 root root 22 Sep 3 18:00 vmlinuz -> /boot/vmlinuz-2.6.35.4
-rw-r--r-- 1 root root 2653408 Sep 3 18:00 vmlinuz-2.6.35.4
root@server [/boot]
Make sure System.map and vmlinuz are pointing to latest kernel else point them like :
ln -s /boot/System.map-2.6.28 /boot/System.map
ln -s /boot/vmlinuz-2.6.35.4 /boot/vmlinuz
-----------
10. cd /boot
11. mkinitrd initrd.img-2.6.35.4 2.6.35.4 //You may not be needed this step. For me it has automatically created. This is creation of RAM driver.
Example for my case :
------------
root@server [/boot]# mkinitrd initrd-2.6.35.4.img 2.6.35.4
initrd-2.6.35.4.img already exists.
root@server [/boot]#
------------
12. vi /boot/grub/menu.lst or /etc/grub.conf : //For me the entries has automatically put in this file like :
------------
root@server [/usr/src/linux-2.6.35.4]# cat /etc/grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,0)
# kernel /vmlinuz-version ro root=/dev/hda3
# initrd /initrd-version.img
#boot=/dev/hda
default=1
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.35.4)
root (hd0,0)
kernel /vmlinuz-2.6.35.4 ro root=/dev/hda3
initrd /initrd-2.6.35.4.img
title CentOS (2.6.18-194.8.1.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-194.8.1.el5 ro root=/dev/hda3
initrd /initrd-2.6.18-194.8.1.el5.img
title CentOS (2.6.18-128.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-128.el5 ro root=/dev/hda3
initrd /initrd-2.6.18-128.el5.img
root@server [/usr/src/linux-2.6.35.4]#
------------
13. reboot //enter this command at the konsole.
14. Check the server whether it comes online and check uname -r //If it does not come please contact DC to load the server from old kernel and sort the problem.
==============================
That's it. Try :)
Subscribe to:
Posts (Atom)