LINUX


Monday 3 June 2013

Zpanel – A Good Cpanel Alternative Open Source

For every paid software, always you can find an opensource alternative, sometimes the alternative is better and complete like (Gimp vs Photoshop) sometimes not. Today we will see a good alternative to Cpanel, the well known paid hosting / server panel, it is zpanel.
ZPanel is a free to download and use Web hosting control panel written to work effortlessly with Microsoft Windows and POSIX (Linux, UNIX and MacOSX) based servers or computers. This solution can turn a home or professional server into a fully fledged, easy to use and manage web hosting server.
Zpanel is easy to install and to configure. In this tutorial i installed Zpanel in CentOS 6.3.
1- Before to start we need to install some requered dependencies:
yum install ld-linux.so.2 curl
2- Download the  installation script from the  Zpnel   website (Last stable  release 10.0.0.2)
wget http://www.zvps.co.uk/sites/default/files/downloads/centos-6-3/package/installer-x86_64-install.sh.x.tar.gz 
3- Now  extract the script  and  run
tar -zxvf installer-x86_64-install.sh.x.tar.gz 
4- Make the script  executable
chmod +x  installer-x86_64-install.sh.x
5- Run the script:
./installer-x86_64-install.sh.x
Screenshot
  • Accept  the  Licence
  • Set up  the  time zone
To contine please agree to the GPL license (y/n/q)? y
Find your timezone from : http://php.net/manual/en/timezones.php e.g Europe/London
Enter Your Time Zone: Europe/Amsterdam
  • Insert the  Install  version and  the  Domainname , Ip address and    the  password you want  to make  for  your  root  Mysql access and GO!!!
Install fresh ZPanel server or enter an upgrade version number e.g 10-0-1 :install
Enter the FQDN of the server (example: zpanel.yourdomain.com): zpanel.unixmen.com
Enter the Public (external) IP of the server: 192.198.1.109
MySQL Password is currently blank, please change it now.

Password you will use for MySQL: ******
Re-enter the password you will use for MySQL: ******

ZPanel will now install, are you sure (y/n/q)?
6- Installation Complted  and  Zadmin password  had  been generated.
Screenshot-1
 The  Server   will  restart automatically.
Please  connect to http://IP and  login with  zadmin user and  the  password  generated
and is done

Howto: Install VirtualBox 4.2.10 on RHEL / CentOS 6.x / Linux

VirtualBox is an Open Source Cross Virtualization Software, By Installing VirtualBox You can Install Multiple Guest Operating Systems.
I am sharing this Howto to Install VirtualBox 4.2.10 on Linux ( RHEL  and CentOS 6.x ).
By Following Instructions You will able to Install and Run VirtualBox 4.2.10 on Linux.
Oracle VirtualBox
Oracle VirtualBox
Perform Following steps to Install VirtualBox on Linux | CentOs | RHEL 6.x
1. You need to be root to perform this Howto.
2.  Configure Repositories :-
# Download and Install EPEL Repository 
[root@linux-support-ahmedabad-tejas-barot ~]# wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
[root@linux-support-ahmedabad-tejas-barot ~]# rpm -Uvh epel-release-6-8.noarch.rpm
# Configure VirtualBox Repository
[root@linux-support-ahmedabad-tejas-barot ~]# cd /etc/yum.repos.d/ 
[root@linux-support-ahmedabad-tejas-barot yum.repos.d]# wget http://download.virtualbox.org/virtualbox/rpm/rhel/virtualbox.repo
[root@linux-support-ahmedabad-tejas-barot yum.repos.d]# cd
3. Installing Dependencies for VirtualBox
[root@linux-support-ahmedabad-tejas-barot ~]# yum install binutils  gcc kernel-headers kernel-devel make libgomp glibc-headers glibc-devel patch  dkms qt
4. Finally Lets Start Installing VirtualBox 4.2.10
[root@linux-support-ahmedabad-tejas-barot ~]# yum install VirtualBox-4.2
5. That’s I

Custom Init / Boot Script for teamviewerd service for TeamViewer 8 / Ubuntu / CentOS / RHEL

Main Purpose of this script is :- Running teamviewerd as daemon on Ubuntu and CentOS / RHEL for TeamViewer 8.
As We already know that, TeamViewer 8 is now released and Looking Very nice. I have used the same for few days and Working fine.
But In Ubuntu I have faced the issue is that every time I am getting the error is “TeamViewer Daemon is not Running. Please Start the teamviewerd and Restart teamviewer.”
So To get the rid of above error, I have written a script to start teamviewerd on boot and we don’t need to do that manually. I am sharing the same script and tested on Ubuntu and it is working fine from last 5 days. The same script will work for CentOS / RHEL too but In CentOS / RHEL It is not required to start teamviewerd  manually. Below is the screenshot for the same.

teamviewerd
Error TeamViewerd
Script which i am sharing here is Originally written by me and for All Linux User’s Blog Visitors, It is possible that Few people may download and may change the Author Information and share again, I also don’t mind it but Trusted Source for the script is here only.
Usage of the script :- /etc/init.d/tvscript {start|stop|restart|status}
BUGS :- Do not rename this script as teamviewer or teamviewerd else it won’t work as expected.
For Ubuntu :-
1. You need to be root or any user with root rights.
2. Download the Script from below link :-
root@linux-support-ahmedabad-tejas-barot:~# wget -c http://www.tejasbarot.com/Scripts/tvscript.sh
3. Now Copy that Script to /etc/init.d/ and assign permissions
root@linux-support-ahmedabad-tejas-barot:~# cp tvscript.sh /etc/init.d/tvscript
root@linux-support-ahmedabad-tejas-barot:~# chmod 0755 /etc/init.d/tvscript
4. Now Let’s Update it as a Custom Init Script ( Boot Script )
root@linux-support-ahmedabad-tejas-barot:~# update-rc.d tvscript defaults
5. That’s It. Now You can use this script by /etc/init.d/tvscript or By rebooting your system.
For CentOS / RHEL 6.x :-
1. You need to be root or any user with root rights.
2. Download the Script from below link :-
[root@linux-support-ahmedabad-tejas-barot ~#] wget -c http://www.tejasbarot.com/Scripts/tvscript.sh
3. Now Copy that Script to /etc/init.d/ and assign permissions
[root@linux-support-ahmedabad-tejas-barot ~#] cp tvscript.sh /etc/init.d/tvscript
[root@linux-support-ahmedabad-tejas-barot ~#] chmod 0755 /etc/init.d/tvscript
4. Now Let’s Update it as a Custom Init Script ( Boot Script )
[root@linux-support-ahmedabad-tejas-barot ~#] chkconfig –add tvscript

5. That’s It. Now You can use this script by /etc/init.d/tvscript or By rebooting your system.
Hope this helps you all.

Linux TOP command explained

I have gone through the Article and Found it very useful and very informative, So posting here with Original link Mentioned below.
You can check the Video at the End.
Thanks to the Original author for writing so Beautifully.
Top Command
v
Top command options:
Line1: Gives System present time, up time of the machine, number of users logged in, Load average on system at 1, 5, 15 min interval. Please ignore the values which I mention in the video, which mention load average as 5,10 and 15mins.
Line2: Gives total number of process on the machine, number of running process, number of sleeping process, number of stopped process, number of Zombie process.
Line3: Gives you CPU details
Line4 &  5: Gives RAM and SWAP details.
Line6: To execute top command shortcuts(See below for the list of top command shortcuts ).
From Line7: dynamically displayed top process results.
 top commands shortcuts:
Note: Press below shortcuts at the time of running top command.
l –To display or to hide load average line
t –To display or to hide task/cpu line
1 –To display or hide all other CPU’s
m –to display or to hide RAM and SWAP details
s –To change the time interval for updating top results(value is in sec’s)
R –To sort by PID number
u — Press u then username to get only that user process details
P –To sort by CPU utilization
M –To sort by RAM utilization
c –To display or hide command full path
r –To renice a process, press r then the PID no then the renice value to renice a process.
k –To kill a process, press k then PID number then enter to kill a process
w –To save the modified configuration permanently.
q –To quit the top command.
h –for getting help on top command
Watch the Video :-
Original Link :- http://www.linuxnix.com/2011/08/linux-top-command-explained-2.html

Configure Linux Warnquota for Fedora / Ubuntu / RHEL / CentOS

In Linux, Most of the People Implement User Quota and Group Quota on Linux and The Might want to send e-mail warnings to the User by e-mail.
It Becomes very Important when the Mail Server is Running and You have implemented Disk Quota / User Quota / Group Quota for Users, So Its the First Basic requirement that We have to inform Users on Their Quota Usage at the Limit which we have configured.
So I am writing this article for Those Who have implemented a Quota and Do not know How to configure quota warning by e-mail.
quota


1. quota / quota-warnquota package must be Installed.
To Confirm :-
On RHEL / CentOS :- [root@tejas-barot-linux-support ~]# rpm -qa | grep quota # Output should not be empty
On Ubuntu :- root@tejas-barot-linux-support:~# dpkg –list | grep quota # Output should not be empty
2. Partition / Device must be mounted with usrquota
On RHEL / CentOS / Ubuntu :- [root@tejas-barot-linux-support ~]#mount | grep quota # Output should not be empty
3. Quota Must be Enabled on Partition.
4. If Above command is giving you proper output then you are good to go for Further Configuration.

5. Now Open /etc/warnquota.conf and Modify Following values as per your requirement.
Enjoy Disk Quotas :) Enjoy WarnQuota :) Enjoy Linux :) Enjoy Open Source :)
   MAIL_CMD        = "/usr/sbin/sendmail -t"
   FROM            = "linuxsupport@tejasbarot.com"
   SUBJECT         = NOTE: Your mailbox has exceeded allocatted disk space limits
   CC_TO           = "ahmedabad@tejasbarot.com"
   SUPPORT         = "linuxblog@tejasbarot.com"
   PHONE           = "000 111-2222"
   MESSAGE         = Your mailbox has exceeded the allotted limit\
    on this server|Please delete any unnecessary email in your mailbox on:|
   SIGNATURE       = This message is automatically generated by the mail system.
Once you are done with Configuring this Parameters Save and Exit from File
Description of above Configurations :-
MAIL_CMD = Command which used to send an e-mail.
FROM = Which E-Mail ID it will display to Recipient.
SUBJECT = Subject line which you want to Mention for Warning e-mail.
CC_TO = On Which ID it will Send Carbon Copy of the Mail.
SUPPORT =  Email ID which you have to mentioned as Support or anybody else where it should inform too.
PHONE = Of-course It will be a Number which you want to display as your Contact Number.
MESSAGE = Detailed Message OR Instructions Which you want to Send to the User. In Short, Body of the Mail.
SIGNATURE = Text which you have to set as your Signature.
6. Once It is configured properly, then To Send E-mail to all those users who exceeded quota then Execute Following command :-
Execute Command To Send E-Mail to All Those Users / Groups who exceeded quota or Grace Limit :-
[root@tejas-barot-linux-support ~]# warnquota
Execute Command To Send E-Mail to Particular User who exceeded quota or Grace Limit :-
[root@tejas-barot-linux-support ~]# warnquota -u <user-name>

Execute Command To Send E-Mail to Particular Group who exceeded quota or Grace Limit :-
[root@tejas-barot-linux-support ~]# warnquota -g <user-name>
7. That’s IT. Warning for Quota is configured.

Virtualization With KVM On A CentOS 6.4 Server

This guide explains how you can install and use KVM for creating and running virtual machines on a CentOS 6.4 server. I will show how to create image-based virtual machines and also virtual machines that use a logical volume (LVM). KVM is short for Kernel-based Virtual Machine and makes use of hardware virtualization, i.e., you need a CPU that supports hardware virtualization, e.g. Intel VT or AMD-V.
I do not issue any guarantee that this will work for you!
Virtualization
Virtualization

1 Preliminary Note

I’m using a CentOS 6.4 server with the hostname server1.example.com and the IP address 192.168.0.100 here as my KVM host.
I had SELinux disabled on my CentOS 6.4 system. I didn’t test with SELinux on; it might work, but if not, you better switch off SELinux as well:
vi /etc/selinux/config
Set SELINUX=disabled…
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
#     targeted - Targeted processes are protected,
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted
… and reboot:
reboot
We also need a desktop system where we install virt-manager so that we can connect to the graphical console of the virtual machines that we install. I’m using a Fedora 17 desktop here.

2 Installing KVM

CentOS 6.4 KVM Host:
First check if your CPU supports hardware virtualization – if this is the case, the command
egrep ‘(vmx|svm)’ –color=always /proc/cpuinfo
should display something, e.g. like this:
[root@server1 ~]# egrep ’(vmx|svm)’ –color=always /proc/cpuinfo
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall
nx mmxext fxsr_opt rdtscp lm 3dnowext 3dnow pni cx16 lahf_lm cmp_legacy svm extapic cr8_legacy misalignsse
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall
nx mmxext fxsr_opt rdtscp lm 3dnowext 3dnow pni cx16 lahf_lm cmp_legacy svm extapic cr8_legacy misalignsse
[root@server1 ~]#
If nothing is displayed, then your processor doesn’t support hardware virtualization, and you must stop here.
Now we import the GPG keys for software packages:
rpm –import /etc/pki/rpm-gpg/RPM-GPG-KEY*
To install KVM and virtinst (a tool to create virtual machines), we run
yum install kvm libvirt python-virtinst qemu-kvm
Then start the libvirt daemon:
/etc/init.d/libvirtd start
To check if KVM has successfully been installed, run
virsh -c qemu:///system list
It should display something like this:
[root@server1 ~]# virsh -c qemu:///system list
Id Name                 State
———————————-
[root@server1 ~]#
If it displays an error instead, then something went wrong.
Next we need to set up a network bridge on our server so that our virtual machines can be accessed from other hosts as if they were physical systems in the network.
To do this, we install the package bridge-utils…
yum install bridge-utils
… and configure a bridge. Create the file /etc/sysconfig/network-scripts/ifcfg-br0 (please use the IPADDR, PREFIX, GATEWAY, DNS1 and DNS2 values from the /etc/sysconfig/network-scripts/ifcfg-eth0 file); make sure you use TYPE=Bridge, not TYPE=Ethernet:
vi /etc/sysconfig/network-scripts/ifcfg-br0
DEVICE="br0"
NM_CONTROLLED="yes"
ONBOOT=yes
TYPE=Bridge
BOOTPROTO=none
IPADDR=192.168.0.100
PREFIX=24
GATEWAY=192.168.0.1
DNS1=8.8.8.8
DNS2=8.8.4.4
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System br0"
Modify /etc/sysconfig/network-scripts/ifcfg-eth0 as follows (comment out BOOTPROTO, IPADDR, PREFIX, GATEWAY, DNS1, and DNS2 and add BRIDGE=br0):
vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
#BOOTPROTO=none
NM_CONTROLLED="yes"
ONBOOT=yes
TYPE="Ethernet"
UUID="73cb0b12-1f42-49b0-ad69-731e888276ff"
HWADDR=00:1E:90:F3:F0:02
#IPADDR=192.168.0.100
#PREFIX=24
#GATEWAY=192.168.0.1
#DNS1=8.8.8.8
#DNS2=8.8.4.4
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth0"
BRIDGE=br0
Restart the network…
/etc/init.d/network restart
… and run
ifconfig
It should now show the network bridge (br0):
[root@server1 ~]# ifconfig
br0       Link encap:Ethernet  HWaddr 00:1E:90:F3:F0:02
inet addr:192.168.0.100  Bcast:192.168.0.255  Mask:255.255.255.0
inet6 addr: fe80::21e:90ff:fef3:f002/64 Scope:Link
UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
RX packets:8 errors:0 dropped:0 overruns:0 frame:0
TX packets:27 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:460 (460.0 b)  TX bytes:2298 (2.2 KiB)
eth0      Link encap:Ethernet  HWaddr 00:1E:90:F3:F0:02
inet6 addr: fe80::21e:90ff:fef3:f002/64 Scope:Link
UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
RX packets:18455 errors:0 dropped:0 overruns:0 frame:0
TX packets:11861 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:26163057 (24.9 MiB)  TX bytes:1100370 (1.0 MiB)
Interrupt:25 Base address:0xe000
lo        Link encap:Local Loopback
inet addr:127.0.0.1  Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING  MTU:16436  Metric:1
RX packets:5 errors:0 dropped:0 overruns:0 frame:0
TX packets:5 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2456 (2.3 KiB)  TX bytes:2456 (2.3 KiB)
virbr0    Link encap:Ethernet  HWaddr 52:54:00:AC:AC:8F
inet addr:192.168.122.1  Bcast:192.168.122.255  Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)
[root@server1 ~]#

Changing LDAP User’s Password Web-Based / 389-ds / Redhat-ds / Fedora-DS / LDAP

This article will show you how to change password of LDAP Users.
In This Article, I have demonstrated that How to change your Password for those users which are in 389-ds or Redhat-ds.
This is very simple you just need to change few parameters and You will able to change password of Ldap users from 389-ds.
Note :- If you have not Customized LDAP Attributes or Access Rights for Changing Password then it will work, I have Successfully tested the same on RHEL / CentOS 5.x / CentOS 6.x / RHEL 6.x and 389-ds.
Perform Following steps for the same.
Step 1:- Make Sure your LDAP Configured and You have correct Suffix ( i.e dc=tejasbarot,dc=com )
Step 2 :- Make Sure php-ldap Package is installed.
[root@tejas-barot-linux-support-ahmedabad ~]# yum install php-ldap
Step 3 :- Download the Following PHP Script, Thanks to the Original Script I have Modified Suffix for Understanding Purpose.
[root@tejas-barot-linux-support-ahmedabad ~]# wget -c http://www.tejasbarot.com/Scripts/ldap_pass_change.phps
Steps 4:- Now Rename the Script from ldap_pass_change.phps to ldap_pass_change.php
Step 5 :- Now Modify the Suffix in .php file, Open PHP File and Modify 3rd Line which Contains $dn
Change $dn 
from 
$dn = "dc=tejasbarot,dc=com"
TO
$dn = "dc=your,dc=suffix"
Save and Exit from File
Step 6:- Put this Script to your WebRoot Directory (i.e. /var/www/html/ )
Step 7:- Make Sure That PHP Script is executable by your Webserver through URL (i.e. http://ldap.tejasbarot.com or http://localhost/ldap_pass_change.php or http://192.168.1.10/ldap_pass_change.php )
You will able to see Following Screen :-
LDAP Change Password
LDAP Change Password

Step 6:- Now Put Values Like Below Screen Shot :-

Fill the Text Boxes
Fill the Text Boxes

Step 7 :- Once Password get changed, You will get a Notifications like below :-

Successful Password Change
Successful Password Change

Thanks to Original Script :- http://www.warden.pl/docs/pass.phps

Send SMTP email from Command Line Linux / SSMTP / GMAIL

Dear All,
It is not possible that on every Single System there is mail server available.
There is no mail server configured on your System and You want to send e-mail using SMTP Authentication then you can send mail by ssmtp utility.
You can use the Same Method for RHEL / CentOS / Fedora / Ubuntu.
So In this Article, I will show you that How can can send e-mail using Gmail Authentication using SMTP.
SMTP Mail
SMTP Mail
In this Article, We will use utility called SSMTP.
SSMTP RPM / DEB / Package Must be installed to Use this utility.
To Perform this HowTo :-
Step 1. You have to be root to Install and Perform this Howto.
Step 2. Open the ssmtp.conf in /etc/ssmtp/ssmtp.conf and Add the Following lines as per your requirement.
[root@linux-support-tejas-barot-ahmedabad ~]# vim /etc/ssmtp/ssmtp.conf 
Add the Following Configurations to /etc/ssmtp/ssmtp.conf and SAVE and EXIT 
root=smtpauth@gmail.com
mailhub=smtp.gmail.com:587
AuthUser=smtpauth@gmail.com
AuthPass=P@ssw0rd
UseSTARTTLS=yes

Step 3. Now Let’s say Now You want to send a Particular message. Like :-
Subject will be “Check the Server Health” and Body will be your “Cannot Access Server“.
So For the same Create a File called /root/message.txt and Add Following content to file :-
[root@linux-support-tejas-barot-ahmedabad ~]# vim /root/message.txt 
Subject: Check the Server Health Cannot Access Server Step 4. Now to Send an e-mail Execute Following command :-
Syntax is ssmtp -vvvv recipientmail@domain.com < <message-file>
[root@linux-support-tejas-barot-ahmedabad ~]# ssmtp -vvvv recipient@domain.com < message.txt That’s IT
 

Install / Upgrade Firefox 17.x on RHEL / CentOS / 5.x / 32-Bit / 64-Bit / X86_64 / Linux

This how will show you the way to Installing / Upgrading  Firefox 17 on RHEL and CentOS 5.x Linux. In RHEL 5.x and CentOS 5.x there is very Old Firefox version is available, So It is possible that you will not able to use some of the Latest Web based Features from Faebook, Gmail, twitter and LinkedIn.
So To run the Latest Web Based Features, We have to make sure our Firefox version should be Latest and Updated, As of Now there is Firefox 17 is available for the CentOS / RHEL 6.x. We will be Installing / Upgrading the Firefox using YUM.

Firefox 17.x on  RHEL5
Firefox 17.x on RHEL5

Please perform following steps to Install Mozilla Firefox on RHEL / CentOS / 5.x :-
Step 1 :- You need to be Root to Install / Upgrade Firefox 17 on RHEL / CentOS / 5.x :-
Step 2 :- Make sure Internet is Direct or You should be able to use Yum for external Repositories from Command Line.
Step 3 :- Close All Firefox Sessions.
Step 4 :- Execute Following Command to Move Existing Repositories to Another Directory to Avoid Package Conflicts.
[root@linux-support-ahmedabad-tejas-barot ~]# mv /etc/yum.repos.d/*.repo /root
Step 5 :- Download and Configure the Repository for Firefox 17 :-
[root@linux-support-ahmedabad-tejas-barot ~]# wget -c http://www.tejasbarot.com/RPMs/Downloads/firefox_tejas_barot.repo
[root@linux-support-ahmedabad-tejas-barot ~]# mv firefox_tejas_barot.repo /etc/yum.repos.d/
Step 6 :- Execute Following Command to Start Installing / Upgrading Firefox 17 on RHEL / CentOS / 5.x 
[root@linux-support-ahmedabad-tejas-barot ~]# yum install -y firefox
Step 7 :- Once Above Process is successfully completed, You will able to use firefox.
Step 8 :- Remove the Firefox Repository and Restore you Previous Repositories.
[root@linux-support-ahmedabad-tejas-barot ~]# rm -rf /etc/yum.repost.d/firefox_tejas_barot.repo
[root@linux-support-ahmedabad-tejas-barot ~]# mv /root/*.repo /etc/yum.repos.d/
That’s IT.
Hope this will helps you all, If you face any issue regarding the same or its not working for your some how then please raise your questions / issues