Monday, November 11, 2013

Kernel compile with Grsec module in CentOS 6

Linux kernel is the life force of all Linux family of operating systems including Ubuntu, CentOS, and Fedora.
For most part, you don’t need to compile the kernel, as it is installed by default when you install the OS. Also, when there is a critical update done to the kernel, you can use yum, or apt-get to update the kernel on your Linux system.
However you might encounter certain situation, where you may have to compile kernel from source. The following are few situation where you may have to compile Kernel on your Linux system.
To enable experimental features that are not part of the default kernel.
To enable support for a new hardware that is not currently supported by the default kernel.
To debug the kernel
Or, just to learn how kernel works, you might want to explore the kernel source code, and compile it on your own.

(1) Download the kernel source
wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.2.52.tar.bz2
tar xjf linux-3.2.52.tar.bz2
(2)Copy the config file from /boot
cp /boot/config-`uname -r` .config
(3) Download grsecurity patch
wget http://mirrors.muarf.org/grsecurity/stable/grsecurity-2.9.1-3.2.52-201311071633.patch.gz
gunzip grsecurity-2.9.1-3.2.52-201311071633.patch.gz
cd linux-3.2.52
(4) installed the patch
patch -p1
cd ../
mv linux-3.2.52 linux-3.2.52-grsec
cd linux-3.2.52-grsec
(5) Configured the new kernel with grsecurity 
make menuconfig
make bzImage && make modules
make modules_install && make install
(6) Verify the file /etc/grub.conf  for new kernel and boot proirity
(7) Disable selinux
cat /etc/selinux/config 
ip a
(7)Reboot the server two newly installed kernel
reboot
(8) Verify the kernel once the server is back online.
uname -r

Wednesday, October 9, 2013

MySQL Basics

The main configuration file of MySQL is my.cnf. The full path to the configuration file is /etc/my.cnf.
The main files of these database are normally located in /var/lib/mysql directory.

Basically one can see three types of files .frm, .myi, .myd.. But they are not same for all tables and db. They differ based on the engines you use and sometimes even differ with the os. There are lots of other factors that is in the backend behind the type of files you see. We will  see some basic differences.

.FRM  =>  It has the table structure of your table or table definition

.MYI  =>   It has the indexes of your table

.MYD =>   It contains your data

For ex: if your db name is school and tables called class and student. The Physical structure will have a directory called school and files class.frm, class.myi, class.myd, student.frm, student.myi, student.myd.

Engines Specific:
 
Lets consider table student belongs to innodb and table class has MyIsam
 
Innodb:
      Innodb has only .frm files and it has its own tablespace where it contains indexes and datas and its shared in databases. for ex: student.frm
 
MyISAM:
      MyIsam has all the three files. where .myi has your indexes, .myd has your table datas and .frm has its table definition. 
ex: class.frm, class.myi, class.myd
 
Need this:
 
   You can use these files when your db crash, or when you upgrade your db to another version and it can also be used while migrating and repairing your indexes without affecting data..
 
Bits and pieces
 
   This is for those who are not aware about engines. Apart from Innodb and MyIsam there are also some other engines in mysql such as Merge, Memory, Cluster etc..

Sunday, October 6, 2013

Backend commands to get Wordpress Details

Please select the appropriate database and enter the MySQL prompt. You can get the details of the database by checking the wp-config file.



select * from wp_options where `option_name` = 'siteurl';
select * from wp_options where `option_name` = 'home';
SELECT * FROM `wp_options` WHERE `option_name` = 'current_theme';
UPDATE `eugi12_wrdp1`.`wp_users` SET `user_pass` = MD5( '12345678' ) WHERE `wp_users`.`ID` =1;

Find the version of Wordpress : grep wp_version wp-includes/version.php

Tuesday, September 24, 2013

Restore Incremental backup from backend

To restore cPanel backup from incremental backup.

Step 1) Taring the backup folder
tar -czf /home/user.tar.gz /backup/cpbackup/daily/user

Step 2) Restoring the backup
/scripts/restorepkg user

Friday, September 20, 2013

Restore cPremote Backups

Restore Backups from Plugin Page

You may need to goo WHM -> Plugins -> cPanel Remote Backups -> Restore A backup , then select the cpanel accounts and backup option for restore.

Restore Backups from server shell

If you need to restore a cPanel account say CPUSER from the backups see , the example commands below,

Restore email folder of cpanel user CPUSER from the daily backups
/scripts/cpremoterestore --user=CPUSER --from=daily --type=mail

Restore Document root from weekly backup for CPUSER
/scripts/cpremoterestore --user=CPUSER --from=weekly --type=www

Restore the complete home folder of CPUSER from monthly backup
/scripts/cpremoterestore --user=CPUSER --from=monthly --type=homefolder

Restore a full account from daily backup
/scripts/cpremoterestore --user=CPUSER --from=daily --type=full

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Affiliate Network Reviews