Categories

Wednesday 3 February 2016

How to create Xen Virtual Machine on a Cirtic Xen server

Below are the steps for creating a Xen virtual machine in Cirtic Xen server



1)List the available OS template list on the Xen server
----------------------------------------------------------
xe template-list

use the required the template uuid returned from the above command
Below is the command for creating virtual machine for Xen
--------------------------------------------------------------------------------

xe vm-install template="Ubuntu Trusty Tahr 14.04" new-name-label="vmname" sr-uuid=4bc0bfb7-14c9-72be-b8bb-d6e90f102376

sr-uuid is the uuid of the storage unit in the xen server
For getting the list of all storage on the xen server , use the command xe sr-list

2) Disable boot from VM hard disk
---------------------------------------------------------------
xe vbd-list vm-uuid=cc693c44-6dd5-aa1b-fd4e-5d69daf7d222  userdevice=0
xe vbd-param-set uuid=3a49a4bd-c43c-c9eb-3b83-8981571fcdfe bootable=false


3)To add the required ISO to the xen server
-------------------------------------------------------------------
copy the iso file to location /opt/xensource/packages/iso and then ran the below command.

Inorder to detect the newly added iso we had to scan the storage unit using the below command
xe sr-scan uuid=c31d41d1-9f76-7fbb-d6fc-d90eeab42292(sr uuid)

Now just use the command xe cd-list command to list the available ISO files in xen repository

4) Now add the ISO file to CDrom of the new VM and make it bootable
-----------------------------------------------------------------------

xe vm-cd-add vm="vmname" cd-name="ubuntu-14.04.3-server-amd64.iso" device=3
xe vbd-list vm-name-label="vmname" userdevice=3
xe vbd-param-set uuid=16240ae1-fde2-8d4e-fb40-92248b2c3f1c bootable=true


5) Get network interface list on host
-------------------------------------------------

xe network-list


create a new Virtual network for  the new VM
xe network-create name-label="vmname_network"
Above command will give the uuid of the new network interface
and add the newly created network to the VM

xe vif-create vm-uuid=<vm-uuid> network-uuid=<network-uuid> device=1 mac=random
example : xe vif-create vm-uuid=cc693c44-6dd5-aa1b-fd4e-5d69daf7d222 network-uuid=6f5daa27-2621-a1b5-de12-88721958ff73 device=1 mac=random
Now plug this newly created interface to the VM

xe vif-plug uuid=b96978ec-9425-850a-f47e-61d204609aee


Change memory settings. By default, XenServer create debian VM with 256M RAM, check it out
----------------------------------------------------------------------------------------
xe vm-list name-label="newVM" params=all |grep memory

xe vm-memory-limits-set dynamic-max=1GiB dynamic-min=1GiB static-max=1GiB static-min=1GiB name-label="newVM"



Change disk size. By default, XenServer create debian VM with 8 GB disk, check it out
------------------------------------------------------------------------------------------
xe vm-disk-list vm="newVM"
Change disk size, for example to 20 GB, if need
xe vdi-resize uuid=[VDI uuid] disk-size=20GiB


start the VM
-------------------------------------------------
xe vm-start vm=newVM

Also for connecting the VNC to the virtual machine. Always make a ssh tunnel with virtual machine vnc port number
Now connect to the VM using vncviewer

----------------------------------------------------
vncviewer -via root@[xenserver] localhost:[port]

or you can create a ssh tunnel from vnc port of the xen server to the local server

ssh -L 5901:localhost:5902 root@IPadress


http://www.vogella.com/tutorials/Gerrit/article.html

Saturday 8 August 2015

Enable gzip compression on a website in a Linux Server

Hi,

Below are the steps I have followed to enable gzip compression for a site.

1)First enable mod_deflate module for apache on the server

This can be done by using easy apache on the cpanel server. Check if it is enabled or not, by using the command

httpd -l |grep -i deflate


2)Then open the .htaccess configuration file in the website's document root and add the following code on it.


<IfModule mod_mime.c>
 AddType application/x-javascript .js
 AddType text/css .css
</IfModule>
<IfModule mod_deflate.c>
 AddOutputFilterByType DEFLATE text/css application/x-javascript text/x-component text/html text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon application/javascript
 <IfModule mod_setenvif.c>
  BrowserMatch ^Mozilla/4 gzip-only-text/html
  BrowserMatch ^Mozilla/4\.0[678] no-gzip
  BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
 </IfModule>
 <IfModule mod_headers.c>
  Header append Vary User-Agent env=!dont-vary
 </IfModule>
</IfModule>

3)Also we need to add the gzip compression settings in php.ini of the server


If you are using suphp, then Copy the php.ini to the document root of the wensite

Then add the compression configuration as below
 
output_handler = Off
zlib.output_compression = On
zlib.output_handler = ob_gzhandler
 
 
 
That's it. Now check if gzip is enabled or not using the site

http://checkgzipcompression.com



Saturday 21 March 2015

Steps to Route email through another server in Exim Cpanel

Hi All,

Below is the steps to route the email for all of the domains through another server. The MTA should need to authenticate on to the the relay server inorder to send emails.

On Cpanel Go to

Main > Service Configuration > Exim Configuration Editor, click on the Advanced Editor button, and enter the following in Section:AUTH:
begin authenticators

ServerName_login:
 driver = plaintext
 public_name = LOGIN
 client_send = : ServerNameUsername : ServerNamePassword

on the section client_send provide the mail account username and password to authent
 icate to the antoher server.

Then add the following route in the Section: ROUTERSTART configuration box as shown in the following image:
send_via_ServerName:
driver = manualroute
domains = ! +local_domains
transport = ServerName_smtp
hosts_randomize = true
route_list = * ServerName.com::25 randomize byname
host_find_failed = defer

no_more

Add the following transport to the Section: TRANSPORTSTART configuration box as shown in the following image:
ServerName_smtp:
driver = smtp
hosts_require_auth = *
tls_tempfail_tryclear = true
headers_add = X-AuthUser: ${if match {$authenticated_id}{.*@.*}\
{$authenticated_id} {${if match {$authenticated_id}{.+}\
{$authenticated_id@$primary_hostname}{$authenticated_id}}}}
That's it

Now you will be able to send emails in exim accounts through another server.

Thanks and Regards
Syamkumar.M

Sunday 8 March 2015

Ubuntu dependency issue while upgrading (linux-headers-generic (= 3.2.0.72.86) but 3.2.0.76.90 is to be installed)

Hi,

I faced an error while I ran the apt-get upgrade command on the Ubuntu 12.04 LTS server for fixing the Glibc vulnerability. The Exact error is


linux-header: depends on linux-headers-generic (= 3.2.0.72.86): but 3.2.0.76.90 is to be installed.


Below is the steps for fixing the issue. First check the header packages installed using the command

apt-get --get-selections |grep -i header


Then remove the below packages using the dpkg commands as below.


sudo dpkg -r linux-image-generic-pae
sudo dpkg -r linux-headers-generic-pae
sudo dpkg -r linux-generic-pae


Now run the below commands to upgrade


sudo apt-get -f install
sudo apt-get upgrade


This will installl the required packages and will replace the headers with new one and will resolve the dependency issues.



Thanks and Regards
Syamkumar.M

Tuesday 17 February 2015

sasl login authentication failed authentication failure postfix webmin

Hi,

I faced one of the strange issue in which postfix was unable to send email from the domain users. There was a php mailer script that is sending emails by providing the smtp details(username, password and hostname of smtp server) to the phpmailer configuration file. But unfortunately the authentication was not working and so emails are not going from the code. Below is the steps to fix the issue.

1)First Check the log /var/log/maillog. I found the error as


postfix/smtpd[13573]: warning: localhost[127.0.0.1]: SASL LOGIN authentication failed: authentication failure


2)The postfix is using the saslauth authentication method. Theconfiguration options for starting saslauth with postfix is configured on the file

/etc/sysconfig/saslauthd

Open the configuration file and in the option field there will be a variable "r" is given

OPTIONS="-r"
Remove that option and set it as OPTIONS=""
 
There is no need for r in that .Below is the description for r.
 
 
 -r      Combine the realm with the login (with an '@' sign in between).
             e.g.  login: "foo" realm: "bar" will get passed as login:
             "foo@bar".  Note that the realm will still be passed, which may
             lead to unexpected behavior. 






Thanks and Regards

Syamkumar.M


Sunday 16 November 2014

Steps to migrate Ubuntu Server to another Machine

Hi,

I have  a requirement in my organisation to replicate the  server environment running in  operating system ubuntu in kvm to another machine in vmware. The current machine contains applications like apache, trac, postgresql, svn etc. One solution for migration is to shutdown kvm machine. Then convert the kvm disk images of the machines to the vmware disks using vmware tools as mentioned in the post

http://syamkumar-linux.blogspot.in/2014/08/how-to-install-vmware-tools-and-convert.html

This process will take many hours to complete and the system will be down on that time. As it is a critical system, we cannot afford that much downtime. So I decided to use an alternative method. That is migration of ubuntu server to another one. Below are the steps for that.

1)First We need to find out the version of ubuntu running on the current machineu. This can be get using the command.

cat /etc/issue

Ubuntu 12.04.2 LTS \n \l

2)Then we need to create a machine in vmware with the same version of ubuntu as in the current machine and install the ubuntu on it.

3)Now on the source machine we need find out the list of packages installed on the source.

sudo dpkg --get-selections | sed "s/.*deinstall//" | sed "s/install$//g" > ~/pkglist


The above command will list all the installed packages on the source machine and will store it in the file pkglist

4)Now on the destination machine install the packages same as in the source machine. That can be done by copying the file pkglist to the destination machine using scp or rsync. The use the below command to install the packages .

sudo aptitude update && cat pkglist | xargs sudo aptitude install -y


Now we have same packages and services running on the destination machine as in the source machine.


5)Now we need to transfer the config file and data from the source machine to the destination machine using scp or rsync.

That is you need to rsync the apache directory, document roots, postgresql data directory, trac configuration file, and trac modules etc. Make sure that you need to shutdown the services before copying it.

Once it is done. All the services will run on the destination machine like in source machine. That is it will behave like the source machine.

If you have done this steps correctly your migration will be succesfull.


Thanks and Regards
Syamkumar.M

Friday 14 November 2014

Command to reset the cpanel account password

Hi,

We can  reset the account password for the cpanel account by using commands. We usually do it by login to WHM interface and then use the modify account section. But this can be done simply using command line.
This post is usefull for some one who doesn't have a cpanel license on the server.


Below is the commands to reset the cpanel account password

1)First we need to change an environment variable in the current shell we are using export command

export ALLOW_PASSWORD_CHANGE=1

2)Then use the command

/scripts/chpass  username password 

This will change the account password

3)But the ftp password won't sync with the new update. So you need to run the below command to update it

/scripts/ftpupdate

Cheers
Syamkumar.M


Ad