Wednesday, December 11, 2013

Mysql kill all process listed in process list

Use below steps in terminal to kill all running mysql process -

mysql> select concat('KILL ',id,';') from information_schema.processlist into outfile '/tmp/process.txt';
 

we can also filter process list here by user host etc. by applying them in where clause.

mysql> source /tmp/process.txt;

Monday, November 18, 2013

Generate CSR & Install ssl certfication on linux server

It's 2 Step Process -

Step 1 - Create CSR field and send & receiving your SSL cert from your authority of choice -

Start with below command in terminal - 

openssl req -nodes -newkey rsa:2048 -keyout domain.key -out domain.csr

Thursday, June 20, 2013

Linux command - How to create a zip file of whole directory

We can use below linux command to zip archive a directory -

zip -r finename.zip /path/to/folder

Tuesday, June 18, 2013

How to configure send mail on linux dedicated server

Step 1 - Install Sendmail

          yum install sendmail

It will install sendmail on server. If already installed pleas skip this step

Step 2 - Enable sendmail

     setsebool -P httpd_can_sendmail 1

Step 3 - Start Sendmail Service

          service sendmail start


Wednesday, April 3, 2013

Linux Command to unzip zip file


Use below command to extract all files into the /path_to_dir directory:

$ unzip /path_to_file/file.zip  -d /path_to_extract

For example if you want to extract /var/www/html/file.zip to /var/www/html/site/

$ unzip /var/www/html/file.zip  -d /var/www/html/site/

Make sure you have installed zip / unzip utility 

if not use below commands to install

$ yum install zip

$yum install unzip

Tuesday, March 19, 2013

Which Linux distribution we choose Centos or Fedora

There are many different versions of Linux, and unlike other commercial operating systems that are controlled, distributed and supported by only one company, the core of Linux is free to distribute and use. This creates a situation in which numerous companies, organizations and individuals have developed their own specific version of the Linux operating system. When these versions are made publically available for use, they are known as “distributions”.

Monday, March 11, 2013

Centos 6.3 Screen resolution - GUI not fit for default resolution and we not able to change it. No other option available in screen display settings



Centos screen resolution - GUI not fit for default resolution and no other option was in screen display settings.
Remove xorg.conf file having resolution setting. Follow below steps:
  1. Go to /etc/x11/ 
  2. Remove xorg.conf file
  3. Reboot System
When system starts and comes to gui. Now go to screen display settings. All other options for screen resolution will be visible now. We can set it now.
 

Saturday, March 2, 2013

Set selinux to allow Apache and Samba on the same folder



First off, you can view the context of something with ls using ls -Z
[root@servername www]# ls -dZ /var/www/html
drwxr-xr-x  root root system_u:object_r:httpd_sys_content_t /var/www/html
 
Second, there are two options for giving Samba and Apache access to the same directory.
The simple way is to just allow samba read/write access everywhere with:

PHP files not working after LAMP (linux, PHP, Mysql, Installation) Add entries in IPtable for port 80 and 443

After successfully installing PHP, Mysql, Apache if still you are not able to execute php files. You need to check firewall settings on server. Check entries in iptable and allow access to port 80 and 443

open /etc/sysconfig/iptables

Add below lines :
# Allow traffic on port 80 (HTTP traffic)
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
#Allow traffic on 443 (HTTPS traffic)
-A INPUT -p tcp -m tcp --dport 443 -j ACCEPT


 Save and restart apache.

Try to run now your php files in browser it will work.

How to configue screen resolution after centos/linux installation if no option to change resolution

Sometimes after Centos installation screen resolution creates issue as you will not be able to view full window and configuration options tabs will be hidden.

The simplest way to sortout this issue is delete xorg.conf file.

Follow belwo steps :
  1. Navigate /etc/XII/ directory
  2. Remove or rename xorg.conf configuration file
  3. Restart the system (Type init 6 in terminal)
After restart system will automatically open configuration screen for set screen resolution.. You can select according to your choice.

Monday, January 21, 2013

Run web pages or console to be served via common HTTP or HTTPS that runs on port 80 and port 443 with Skype

Many developer face problem when they run http apache in xampp,wamp and  skype conversation tool simultaniously. You can not run both at a time because skype also uses port 80 and 443 as alternatives for incomming connections.

In oeder to solve this issue and run  both web pages or console to be served via common HTTP or HTTPS that runs on port 80 and port 443 and Skype you need to change configuration setting for listning post in either webserver or skype.

Linux command for starting samba service

Samba is a suite of utilities that allows your Linux to share files and other resources, such as printers, with Windows.

In order to start/stop samba service on linux machine you need use following commands -

To start :    /etc/init.d/smb start

To Stop :   /etc/init.d/smb stop

To Restart : /etc/init.d/smb restart

MySQL Take backp or create dump file of all databases on server with mysqldump

Below command can be used for taking backup of all databases with mysqldump.
 # mysqldump -u root -p --all-databases > alldbs.sql

Saturday, January 19, 2013

Mysql InnoDB store all databases in one file

In mysql all InnoDB table/data info live within ibdata1. The only manifestation of any InnoDB table outside of ibdata1 is the .frm file of the InnoDB table. Copying all InnoDB data at once requires copying all of /var/lib/mysql.

Friday, January 18, 2013

Mysql Xampp - Import large database through command prompt

There is limit to import database from GUI (phpmyadmin) in xampp. For large databases you can import via. comman line. Below are the steps you need to follow:

Step 1: Open / Run command prompt

Windows : Start > Rum > Type "cmd" > click "ok"

Friday, January 11, 2013

Purposal Documents for new site


Many times we need to send a proposal documents to our client as a negotiation before starting any project.
Here is sample proposal document for a drupal site.
You can  copy and change it according to your project domain.

Drupal 7 Content Management Guide for your clients

Many of us work on different type of CMS for different type of clients. Our clients may have of different nature some can manage site contents without any guide or other asks us for a full guide for managing contents.

Here I am sharing format of Content management guide for Drupal 7 admin.

Download and change it according to your needs. I hope it will be very helpful..

Drupal7 Content Management Guide.docx
Don't forget to leave your comments to improve this guide.

MySQL convert column type from TEXT to VARCHAR()

You can convert column type from TEXT to VARCHAR() with below query.

ALTER TABLE tablename MODIFY columnname VARCHAR(X)

Trick to write faster complex queries in mysql with views

Views can be used to optimize complex queries. As we can store result of some set of calculations in view and can join our queries with view.

Here all complex calculations will be performed by view. That will make the query lightweight and faster.

To illustrate :

If you have a record with update track in child table and you want to get each time latest updated record. For large table query for getting latest updates of a record will take time.

So make this query faster we can create a view separately for getting latest updates. Then can join this view with main table. It will faster your query.


Dump single table with mysqldump command

You can easily take backup of single large table with musqldump command

mysqldump -u user -p database name tablename > '/target_path/filename.sql'

Once you enter it will ask for mysql user password, after entering password it will create dump file at specified location.

Extract sql.gz file on linux server with ssh command

Simple command to extract sql.gz file on linux server with ssh :

gzip -d example.sql.gz

It will extract file at the same location where the zip file is.