Thursday, November 27, 2014

Step to create ClearOS bootable USB in windows 7

URL ClearOS: http://www.clearfoundation.com/Software/downloads.html
URL Syslinux: https://www.kernel.org/pub/linux/utils/boot/syslinux/

Make sure you pick the highest version you can find and download the zip version of it.
Linux, like PC’s uses Master Boot Records and therefore cannot just boot any disk. You need to make that disk bootable. This is why we need Syslinux.

1. Connect the USB disk to a Windows Vista or 7 PC.

2. Create a FAT32 partition on it of at least 5GB using Disk Management.



3. Open the ClearOS iso file with WinRAR (open, not extract).




4. Copy the images and isolinux folders to the USB drive.



5. Rename the “isolinux” folder to “syslinux“. AND Open the “syslinux” folder, find and rename “isolinux.cfg” to “syslinux.cfg“.



6. Copy the ClearOS iso file to the root of the USB partition.

7. Find your Syslinux zipfile and extract it to a subfolder on your desktop.




8. Open a command prompt with Administrative privilege and navigate to the “win32” folder inside the Syslinux folder.
 Note:  Take note of the USB drive letter and run. My side USB drive is "L:"
 Run this command: syslinux.exe -m -f -a -d /boot/syslinux l:



This will make the drive bootable for Linux. Obviously replace l: with your drive letter.
And that’s it. You now have a bootable USB drive for ClearOS.

9. After creating Bootable USB, Go to BIOS and change the boot priority to USB.

10. After booting ClearOS select the "HardDisk" option selecte the partition.

That's it......... 

CentOS 6 CD/DVD/ISO to USB Installation in Windows 7


I tried various Linux ISO to USB software like UNetbootinUniversal-USB-Installer etc... to create CentOS 6 bootable Pendrive. But all have some problems or limitations which force me to use ISO2USB software, which help me to meet my need.

Create a CentOS 6 bootable USB which will support customized installation (by using kickstart configuration file).

UNetbootin: Bootable USB of CentOS 6 created by UNetbootin is not even booting the system using USB and not support kickstart configuration file.

Universal-USB-Installer: It successfully boot the CentOS 6 from USB but failed to install by kickstart configuration file and Copying section.

Prepare CentOS 6 bootable from ISO file or CD/DVD :

URL for Windows : https://sourceforge.net/projects/iso2usb/files/latest/download

1. Plug the USB drive to Windows XP/Vista/7 machine.

2.  After downloading, Execute the ISO2USB software.


3. Browse CentOS 6 ISO (with custom installation) file by using the highlighted browse button.


4. Click on OK button but before clicking on OK button; just make sure that correct USB drive should be selected.


5. Click Exit button, when finished.


6. Safely remove USB drive from Windows XP/Vista/7 system.

  USB drive is now ready to install CentOS 6 (with custom configuration file) on your system.

Wednesday, November 26, 2014

PHP mail function not working on CentOS server with WHM, testing in browser.



I configured LAMP server in VPS server, I tried to run PHP mail function in web browser, but it was not working in the 1st attempt. Later, I solved the issue.

1. Login to WHM with username and password.


2. Go to Server Configuration => Tweake Setting.


3.  In side the Tweake Settings go to Mail option,  change the 'Prevent “nobody” from sending mail' to Off Default Mode.




4. Create the PHP mail function script in the Document root "test.php".

<?php
  $to = "Destination mail ID";
  $message = "Hello World";
  $subject = "User Activated";
  $headers = 'MIME-Version: 1.0' . "\r\n";
  $headers = 'Content-type: test/html; charset=iso-8859-1' . "\r\n";

  //Additional Header
  $headers = 'From: Easyship <info@easyshipping.com>' . "\r\n";
  
  //send email
  mail($to, $subject, $message, $header);
  
  //Email response
  dir ("Reach Here"); 
?>

5. Go to web browser and test the PHP mail function script in browser.
    URL:-    http://IP Address/~easy/easyshipping/test.php    or   DomainName/test.php
     

6. If there is no error, go to the mail box and check for php test mail.



That's it...






Wednesday, November 12, 2014

Installing Composer Globally on CentOS 6.4

Installing Composer Globally on CentOS 6.4


Composer is a tool for dependency management in PHP. It allows you to declare the dependent libraries your project needs and it will install them in your project for you.

Composer requires PHP 5.3.2+ to run. A few sensitive php settings and compile flags are also required, but the installer will warn you about any incompatibilities.

To install it globally on CentOS follow the steps below.
1. First, go to the /tmp directory. 

      [root@centos ~]# cd /tmp

2. Download the composer.phar file.

       [root@centos tmp]# curl -sS https://getcomposer.org/installer | php

3. You can run these commands to easily access composer from anywhere on your   system: Move it to /usr/local/bin/

       [root@centos tmp]#  mv composer.phar /usr/local/bin/composer

4. Then, just run composer in order to run Composer instead of
        [root@centos ~]#  php composer.phar

Reference URL :   https://getcomposer.org/doc/00-intro.md     


Saturday, February 1, 2014

LAMP Installation and Configuration form Source Code



About LAMP :

LAMP stack is a group of open source software used to get web servers up and running. The acronym stands for Linux, Apache, MySQL, and PHP (it can be either python or perl). LAMP represents a full featured stack containing the most popular web server known as Apache. The most popular database server MySQL and the most popular open-source web programming language known as PHP. In This Documentation I will show you how can we install the LAMP stack from the source code.

Step – 1 Basic Configuration Checking.
1. To check the System Architecture.

2. To Check the Network Information (IP).

3. To check the Hostname for the LAMP Server.

4. To stop the IPtables and Check the Rules.

5. To check  Selinux Enabled or Disabled.

Step – 2  LAMP Installations and Configuration.

Directory Structure of my Installation:

          /usr/local/src/                     =>      The Downloaded .tar file will be save here.
            /usr/local/lamp/                 =>      This where I compile install the source code.
            /usr/local/lamp/apache  =>       I will install Apache under this directory.
            /usr/local/lamp/mysql    =>       I will install MySQL under this directory.       
            /usr/local/lamp/php         =>       I will install PHP under this directory.

Check and Remove if already installed RPM’s.

Change the directory and download the source code from internet.

    [root@masterdns src]#  wget  http://in1.php.net/get/php-5.4.8.tar.gz/from/this/mirror
                    

Install Supported / Dependency packages. ( gcc, gcc-c++, make, cmake, ncurses, libxml2-delvel).

Compiling and Testing Apache-Server.

[root@masterdns src]# tar -xvf httpd-2.2.22.tar.gz
[root@masterdns src]# cd httpd-2.2.22
[root@masterdns httpd-2.2.22]# mkdir /usr/local/lamp
[root@masterdns httpd-2.2.22]# ./configure --prefix=/usr/local/lamp/apache --enable-so --enable-mods-shared="most"
[root@masterdns httpd-2.2.22]# make
[root@masterdns httpd-2.2.22]# make install

 Note: What is Configure Script , Make, Make install :

Configure: Configure script Checks some details about the machine on which the software is going to be installed. This script checks for lots of dependencies on your system. For the particular software to work properly, it may be requiring a lot of things to be existing on your machine already. If any of the major requirements are missing on your system, the configure script would exit and you cannot proceed with the installation, until you get those required things. if configure  fails we can not execute the make command.

 Make: Actual Compilation of the source code                 

 Make install: Install the compiled binaries to proper directories.

 --prefix : With prefix we specify the location where want to install the software (/usr/local/lamp/apache/).  Default location will be under (/usr/local/apache2) 

 --enable-so : This will enable DSO (Dynamic Shared Object ) capability so that we can add additional modules  to apache without recompiling  the entire apache.

 --enable-mods-shared="most" : List of modules we want to enable . Here I choose to enable most of the modules.

 Apache Directory structure.     


Starting and Testing Apache.     




    

       After installation, we need to configure the “ServerName” point to localhost in httpd.conf file.
            [root@masterdns apache]# vim conf/httpd.conf
                       ServerName masterdns.shyam.com:80
            [root@masterdns apache]# bin/apachectl start

                       httpd (pid 13198) already running
   
       Now open your Browser and type http://Yourip  or http://masterdns.shyam.com
       Note: The default index.html is locate inside the /usr/local/lamp/apache/htdocs/index.html

         






Compiling and Testing MySQL-Server.
    
       Before compiling the mysql we need to create a user called "mysql" so that we can run the mysql service  under his privilege.

   [root@masterdns src]# groupadd mysql
   [root@masterdns src]# useradd -g mysql mysql

        Extract the downloaded mysql source code and compile.

          [root@masterdns src]# tar -xvf mysql-5.5.28.tar.gz  
          [root@masterdns src]# cd mysql-5.5.28
          [root@masterdns mysql-5.5.28]# cmake --DCMAKE_INSTALL_PREFIX=/usr/local/lamp/mysql   --DMYSQL_DATADIR=/usr/local/lamp/mysql/data
          [root@masterdns mysql-5.5.28]# make
          [root@masterdns mysql-5.5.28]# make install

      Note: If you get any error while running the camke like any dependency error first you need to install the proper rpm  and before running the  cmake  again you should  remove CMakeCache.txt.

          [root@masterdns mysql-5.5.28]# rm  -rf  CMakeCache.txt

        If you installed mysql  rpm already using rpm then you should go through this steps.
          [root@masterdns mysql-5.5.28]# rm -rf /etc/my.cnf
          [root@masterdns mysql-5.5.28]# chkconfig --del mysqld

      Change the ownership for mysql directory.

            [root@masterdns src]# chown -R mysql:mysql /usr/local/lamp/mysql/

      Change to Mysql directory and see the directory content.

     
      Set the MySQL Base Directory and Database Directory using mysql script.


     Copy the MySQL configuration file to /etc/my.cnf

         [root@masterdns mysql]# cp /usr/local/lamp/mysql/support-files/my-medium.cnf  /etc/my.cnf

      To add the MySQL service script to /etc/init.d/ directory and enable prenatally.

         [root@masterdns mysql]# cp /usr/local/lamp/mysql/support-files/mysql.server /etc/init.d/mysqld
         [root@masterdns mysql]# chkconfig --add mysqld
         [root@masterdns mysql]# chkconfig --level 235 mysqld on
         [root@masterdns mysql]# chkconfig --list mysqld
mysqld            0:off    1:off    2:on    3:on    4:on    5:on    6:off
         [root@masterdns mysql]# service mysqld restart
Shutting down MySQL. SUCCESS!
Starting MySQL... SUCCESS!
         [root@masterdns mysql]# netstat -ntlp | grep mysql
tcp     0    0 0.0.0.0:3306     0.0.0.0:*   LISTEN    29421/mysqld        

      Now we need to install MySQL Client package, then only we can access MySQL Server.


      Now access MySQL Server using MySQL Client in terminal.

   
     Compiling and Testing PHP

      Compile the PHP source code with support with Apache and MySQL.

      [root@masterdns src]# tar -xvf php-5.4.8.tar.gz
      [root@masterdns src]# cd php-5.4.8
      [root@masterdns php-5.4.8]# ./configure --prefix=/usr/local/lamp/php --with-apxs2=/usr/local/lamp/apache/bin/apxs --with-mysql=/usr/local/lamp/mysql/
      [root@masterdns php-5.4.8]# make
      [root@masterdns php-5.4.8]# make install
      [root@masterdns php-5.4.8]# cp /usr/local/src/php-5.4.8/php.ini-production /usr/local/lamp/php/lib/php.ini

Checking php module is installed properly.

      [root@masterdns php-5.4.8]# /usr/local/lamp/apache/bin/apachectl -t -D DUMP_MODULES | grep php
              php5_module (shared)
              Syntax OK

       Tell apache to process file starting .php extension.

       Open up the file "/usr/local/lamp/apache/conf/httpd.conf "   then add  " AddHandler  application/x-httpd-php .php "  with in the  <IfModule mime_module> .......   </IfModule>

            [root@masterdns php-5.4.8]# vim /usr/local/lamp/apache/conf/httpd.conf
                        ........................
                        ........................
                        <IfModule mime_module>
                        ........................
                        AddType application/x-compress .Z  
                        AddType application/x-gzip .gz .tgz
                        AddHandler  application/x-httpd-php   .php    .html           
                        .........................               
                        .........................  
                        </IfModule>

       Check Everything works properly.

       Create an index.php under /usr/local/lamp/apache/htdocs/ with the following contents.

            [root@masterdns src]# vim /usr/local/lamp/apache/htdocs/phpinfo.php
                        <?php
                                    phpinfo();
                        ?>

       Now restart the all Services.

[root@masterdns src]# /usr/local/lamp/apache/bin/apachectl start
            httpd (pid 13198) already running
[root@masterdns src]# service mysqld restart
Shutting down MySQL.... SUCCESS!
Starting MySQL...... SUCCESS!

       Now open your Browser and type   http://Yourip/phpinfo.php  or http://masterdns.shyam.com/phpinfo.php
       You will get test page containing information about php, mysql, apache and all the libraries compiled with php.





                                                                        .………………………………………………….
                                                                        ….……………………………………………….
                                                                        …………………………………………………..

                                                                        …………………………………………………..

Making phpinfo.php as the default page.

Edit  the/usr/local/lamp/apache/conf/httpd.conf  as follows.
           
            <IfModule dir_module>
                        DirectoryIndex  index.html
            </IfModule> 

Change to…..

            <IfModule dir_module>
                        DirectoryIndex  phpinfo.php index.html
            </IfModule> 

Removing the Installed LAMP server.
You can simply uninstall the lamp server by removing the directories in which you have installed the source code but   before doing this you should properly stop the running services.

            [root@masterdns ~]# /usr/local/lamp/apache/bin/apachectl stop
            [root@masterdns ~]# service  mysqld stop
            [root@masterdns ~]# rm  -rf   /usr/local/lamp/apache
            [root@masterdns ~]# rm  -rf   /usr/local/lamp/mysql
            [root@masterdns ~]# rm  -rf   /usr/local/lamp/php