VMware Player unrecoverable error: (vmx)

When I opened my VMware today, following error was displayed:

VMware Player unrecoverable error: (vmx)

Exception 0xc0000006 (disk error while paging) has occurred.

A log file is available in "C:UsersacerDocumentsVirtual MachinesRed Hat Enterprise Linux 6 64-bitvmware.log".

You can request support.

To collect data to submit to VMware technical support, run "vm-support".

We will respond on the basis of your support entitlement.

[dfads params=’groups=-1′]

Solution: Remove the following two files from the VMware installed directory. You can check the installed directory from Player -> Manage -> Virtual Machine Settings -> Options

  1. Red Hat Enterprise Linux 6 64-bit-93cd0331.vmem
  2. Red Hat Enterprise Linux 6 64-bit-93cd0331.vmss

[Source: http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1002347]

How to take backup and restore openvz (Proxmox Virtual Environment)?

Well, I am not that sound in playing with the tools of openvz but through the assistance of professionals, I came to learn how to take backup of openvz and restore it in another proxmox virtual environment. In order to understand this tutorial, you must have a little knowledge of Linux and its basic commands. The following steps more or less clearifies the process:

[dfads params=’groups=-1′]

 

  1. Login to your proxmox via root.
  2. Check whether there is sufficient space to take backup. Use the command below to check the available space on the system:

    moon:~# df -h

    Filesystem Size Used Avail Use% Mounted on

    /dev/mapper/pve-root 95G 15G 76G 16% /

    tmpfs 16G 0 16G 0% /lib/init/rw

    udev 10M 632K 9.4M 7% /dev

    tmpfs 16G 0 16G 0% /dev/shm

    /dev/mapper/pve-data 723G 272G 452G 38% /var/lib/vz

    /dev/sda1 504M 44M 435M 10% /boot

  3. In order to list out the virtual machines type the following command:

    moon:~# vzlist

    CTID NPROC STATUS IP_ADDR HOSTNAME

    101 67 running 10.10.10.110 hindi-website.example.com

    103 206 running 10.10.10.251 maincopy.example.com

    201 92 running 10.10.10.106 engsecondary.example.com

    240 64 running 10.10.10.108 wsdb-backup.example.com

    242 78 running 10.10.10.107 hi-secondary.example.com

    410 109 running 10.10.10.104 rc.example.com

  4. Note down the CTID for which you are taking the backup. CTID is an identifier which uniquily represents the respective virtual machine.
  5. Follow the command below to take the backup of the virtual machine:

    moon:~# sudo vzdump –dumpdir /var/lib/vz/dump/ 103 –suspend –compress

The above command takes a complete backup of the virtual machine whose CTID is 103 at the location /var/lib/vz/dump/. The backup process will take approximately an hour to complete. In order to confirm the successfull backup change the directory to /var/lib/vz/dump/ and execute the command ls or dir. Two files are generated prefixed by vzdump-openvz-*.

  1. Copy the backup to another proxmox using the following command:

    moon:~# scp vzdump-openvz-103-2014_06_24-17_22_53.tgz root@10.10.10.44:/var/lib/vz/dump/

  2. In order to restore, first of all login to your proxmox via GUI.
  3. Delete the virtual machine if there is insufficient space or make some space to restore the backup.
  4. Now, Login to your proxmox using ssh or putty. Change your directory to /var/lib/vz/dump/ (location of the backup) . Execute the following command:

    earth:~# vzrestore vzdump-openvz-103-2014_06_24-17_22_53.tgz 103

The above command will restore the backup creating a complete new virtual machine. It takes approximately an hour to complete the process.

  1. Login to your proxmox via GUI. A new virtual machine will be visible. Before starting the machine modify the IP Address in order to prevent the IP conflict.
  2. If the macnine contains MySQL binded with the IP then modify the IP from the file /etc/mysql/my.conf

[dfads params=’groups=-1′]

Starting web server: apache2(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80

download

$service apache2 restart
[....] Starting web server: apache2(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
failed!

In order to solve the above issue, type following on your console

fuser -k -n tcp 80

[dfads params=’groups=-1′]

Disk /dev/sdb doesn’t contain a valid partition table in Linux

drive-not-formatted

[dfads params=’groups=-1′]

1. Run fdisk /dev/sdb

2. Create a new partition table with ‘o’

3. Create a new partition with ‘n’

4. Let it use the default values by hitting ENTER when it asks for numbers, to take the entire available disk in this partition

5. Write the new partition table with ‘w’, which should dump you back to the prompt.

6. Finally, you should have a /dev/sdb1 to format using the following command:

  sudo mkfs.vfat -n ‘Ubuntu’ -I /dev/sdb1

[dfads params=’groups=-1′]

Load Testing on Web Servers using Apache Benchmark

ab

After working on many websites, I found one of my site getting too many traffic bringing down the site. I contacted the technical support who fixed the problem. I had never tested load on any of my site. So, I started studying load testing on web servers. This helped me to understand how many users can be handled by my website so that it can run smoothly.

I found a very light and strong linux tool called Apache Benchmark Tool that can test load on Web Servers. This can benchmark Apache, IIS and other web server with apache benchmarking tool called ab. There are also other open source tools that helps to test load on web servers.

[dfads params=’groups=-1′]

I executed following command on my linux terminal:

[code]

ab -c 1000 -n 1000 -t 60 -k http://ignou.ac.in

[/code]

Option -c : This option says there are 1000 concurrent users logged in on the Web Server.

Option -n : This option sends 1000 requests to the Web Server.

Option -t : This option says users will be logged in for 60 seconds.

Option -k : For Keep Alive On

I logged in to the web server and executed the following command to test the actual load.

[code]

top

[/code]

This command helped to track down the load average, CPU and Memory Utilization of the web server.

[dfads params=’groups=-1′]

How to redirect http requests to https on Debian Linux with Apache Web Server?

securing-apache5-590x277

[dfads params=’groups=-1′]

Do the following to redirect http requests to https running on Debian Linux with Apache Web Server.

File : /etc/apache2/ports.conf

[code]
NameVirtualHost *:80
Listen 80
[/code]

File : /etc/apache2/sites-availabe/default

[code]
<VirtualHost *:80>
ServerName www.example.com
Redirect / https://www.example.com/
</VirtualHost>

<VirtualHost *:443>
ServerName www.example.com
# … SSL configuration goes here
</VirtualHost>
[/code]

Restart Apache Webserver

[code]
/etc/init.d/apache2 restart
[/code]

[dfads params=’groups=-1′]

Installing and Configuring Commercial SSL on Debian Linux

SSL-Certificate-Secrity-H01CB360EBAB420000000000000004713

[dfads params=’groups=-1′]

Note: Please note that commercial SSL certificates require a unique IP address for SSL-enabled sites.

a. Enable SSL for Apache and make a directory named “ssl” inside “/etc/apache2/”

[code]
a2enmod ssl
mkdir /etc/apache2/ssl
[/code]

b. Create a Certificate Signing Request

[code]
cd /etc/apache2/ssl
openssl req -new -days 365 -nodes -keyout www.mydomain.com.key -out www.mydomain.com.csr
[/code]

The above command will create a certificate signing request (CSR) for the site which you’d like to use with SSL. Leave the challenge password blank.
Execute the following command to protect the key:

[code]
chmod 400 /etc/apache2/ssl/www.mydomain.com.key
[/code]

Files for your domain will be created in /etc/apache2/ssl. You may now submit the file ending in .csr to a commercial SSL provider for signing. You will receive a signed file after the CA signs the request. Save this file as /etc/apache2/ssl/www.mydomain.com.crt.
Execute the following command to protect the signed certificate:

[code]
chmod 400 /etc/apache2/ssl/www.mydomain.com.crt
[/code]

[dfads params=’groups=-1′]

c. Get the CA Root Certificate
You’ll need to get the root certificate for the CA that you paid to sign your certificate. You may obtain the root certs for various providers from these sites:
Verisign
Thawte
Globalsign
Comodo
For example, if we downloaded a root cert for Verisign, we would save it to /etc/apache2/ssl/verisign.cer.
d. Configure Apache to use the Signed SSL Certificate.
We’ll add an entry to /etc/apache2/ports.conf for the IP address you’ll be using to host your SSL-enabled site.
File excerpt:/etc/apache2/ports.conf

[code]
NameVirtualHost 12.34.56.78:443
Listen 443
[/code]

Replace the above IP address with your dedicated IP Address. Next, we edit the VirtualHost Configuration file i.e. /etc/apache2/sites-available/default in our case.

[code]
<Virtualhost 10.10.10.109:443>
SSLEngine On SSLCertificateFile /etc/apache2/ssl/www.mydomain.com.crt
SSLCertificateKeyFile /etc/apache2/ssl/www.mydomain.com.key
SSLCACertificateFile /etc/apache2/ssl/verisign.cer

ServerAdmin info@mydomain.com
ServerName www.mydomain.com
DocumentRoot /var/www/
ErrorLog /var/log/apache2/error.log
CustomLog /var/log/apache2/access.log combined
</Vritaulhost>
[/code]

NOTE: You can edit your existing Virtualhost Configuration file (Virtualhost *:80) by adding the above attributes within the Virtualhost tag.

e. Restart Apache:

[code]
/etc/init.d/apache2 restart
[/code]

f. Congratulations, you’ve installed a commercial SSL certificate! You can visit your site with SSL enabled. i.e. https://mydomain.com OR https://localhost/your_website/

[Source: https://library.linode.com/web-servers/apache/ssl-guides/debian-5-lenny]

[dfads params=’groups=-1′]

Solution to Url Encoded Slashes (%2F) Problem in Apache

[dfads params=’groups=-1′]

I was working on Drupal 6. I had to troubleshoot a site that has a problem in its link. The ugly URL looks like this: http://rcportblair.ignou.ac.in/admin/build/employee/search/result/none/0/none/%252F1

The last argument in the link i.e. %252F is a forward slash automatically added by the Drupal engine which was creating problem while generating result. There are many ways to handle these urls. One way is listed below:

<VirtualHost *:80>
    AllowEncodedSlashes On
</VirtualHost>

This directive may be set in server config file (e.g. httpd.conf OR /etc/apache2/sites-available/default) and may appear inside <VirtualHost> containers to affect certain websites. Using it in .htaccess files is not allowed.

[dfads params=’groups=-1′]

Clean URLs in CodeIgniter and Drupal for Debian based Dedicated Servers

[dfads params=’groups=-1′]

Initially, when my projects were in CodeIgniter I struggled to find out the solutions for Clean URLs. Now, I am working on Drupal CMS and the process for activating Clean URLs are similar as in CodeIgniter.

drupal&CodeIgniter

1. The first step is to add the following code in your .htaccess file.

<IfModule mod_rewrite.c>
RewriteEngine on

# Rewrite URLs of the form 'x' to the form 'index.php?q=x'.

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ project_dir/index.php?q=$1 [L,QSA]
</IfModule>

2. Next, for Debian Linux OS edit /etc/apache2/sites-available/default file and add the following script.

<Directory "/var/www/project_dir/">
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ project_dir/index.php?q=$1 [L,QSA]
</Directory>

3. If you are using CodeIgniter, the above two steps are done but for Drupal sites, visit the following link from your Drupal CMS Admin: http://your_site/admin/settings/clean-urls. Select the Enabled radio button & click on save.

Congratulations, You have activated Clean URLs for your websites.

[dfads params=’groups=-1′]

Restrict SSH Access by IP Address on Linux

[dfads params=’groups=-1′]

Here is how to restrict SSH access to certain IP addresses on and off your home LAN.

Edit the /etc/hosts.allow file to include these lines, assuming your home LAN is on the 192.168.4.x nonrouting IP block, and your work address is on the routing 1.1.1.x
IP block: Remember to add the period on the end of each incomplete IP number.
If you have another complete IP address or range, add a space and that range on the end.

# allow ssh login from home LAN and work LAN
sshd,sshdfwd-X11: 192.168.4. 1.1.1.x.

Edit your /etc/hosts.deny file to include this line:
sshd,sshdfwd-X11:ALL
These lines refuse SSH connections from anyone not in the IP address blocks listed.

Log out and then try logging back in to test your configuration. Good luck!

[dfads params=’groups=-1′]