Wednesday, November 26, 2008

Keyboard problem in VMware under Ubuntu 8.10

In VMWARE Server on my fresh install of Ubuntu 8.10,after powering on a Windows XP vm, I realized that I could not use the some keys properly. On hitting the left arrow key, start menu was being displayed and other arrow keys had similar issues. Also, using VMware player was completely impossible as ctrl-alt-del wasn’t working.

To fix this issue, you simply need to run the following command,

echo 'xkeymap.nokeycodeMap = true' > /etc/vmware/config

Thursday, November 13, 2008

Install Mysql Activity Report on Ubuntu

Install these two packages:

apt-get install librrd2-dev libmysqlclient15-dev

Download the Mysql Report Activity:

wget http://freshmeat.net/redir/mysqlard/...d-1.0.0.tar.gz

tar -xvzf mysqlard-1.0.0.tar.gz
cd mysqlard-1.0.0

./configure
make
make install

Edit /usr/local/share/mysqlard/mysqlar.php and change username and password for your Mysql Database.

Give access right to www-data user for vim /usr/local/share/mysqlard/ :

chown www-data.www-data /usr/local/share/mysqlard/mysqlar.php

Add the alias to apache config file ( I added a new conf file in /etc/apache2/conf.d/ ):

vim /etc/apache2/conf.d/mysqlard.conf

and add these lines to it:

Alias /mysqlard /usr/local/share/mysqlard

"Directory /usr/local/share/mysqlard"

php_flag register_globals off

Options Indexes FollowSymLinks

"IfModule mod_dir.c"

DirectoryIndex mysqlard.php
"/IfModule"

"/Directory"


(change "" with <>).

Create a user in MYSQL:

GRANT USAGE ON *.* TO mysqlar@localhost;

and then change the user in mysqlar.php.

Check too all paths in these files:

mysqlard.server

mysqlard.cnf
mysqlard_graph

Copy the following files in appropriate crontab folders:
mysqlar.daily
mysqlar.weekly
mysqlar.monthly

You need to add a cron job to generate the graphs. For example :
*/5 * * * * root hourly=1 daily=1 weekly=1 monthly=1\
/usr/bin/mysqlar_graph > /dev/null

Restart apache2 service:

/etc/init.d/apache2 restart

You can access Mysql Activity Report with following url:

http://localhost/mysqlard/mysqlar.php

Apache Server Status

The Status module allows a server administrator to find out how well their server is performing. A HTML page is presented that gives the current server statistics in an easily readable form. If required this page can be made to automatically refresh (given a compatible browser). Another page gives a simple machine-readable list of the current server state.

The details given are:

  • The number of worker serving requests
  • The number of idle worker
  • The status of each worker, the number of requests that worker has performed and the total number of bytes served by the worker (*)
  • A total number of accesses and byte count served (*)
  • The time the server was started/restarted and the time it has been running for
  • Averages giving the number of requests per second, the number of bytes served per second and the average number of bytes per request (*)
  • The current percentage CPU used by each worker and in total by Apache (*)
  • The current hosts and requests being processed (*)
The lines marked "(*)" are only available if ExtendedStatus is On.

To enable status reports only for browsers from the foo.com domain add this code to your /etc/apache2/apache2conf configuration file:

"Location /server-status"
SetHandler server-status
Order Deny,Allow
Deny from all
Allow from foo.com

"/Location"

(change " with <>)

You can now access server statistics by using a Web browser to access the page http://your.server.name/server-status

You can get the status page to update itself automatically if you have a browser that supports "refresh". Access the page http://your.server.name/server-status?refresh=N to refresh the page every N seconds.

A machine-readable version of the status file is available by accessing the page http://your.server.name/server-status?auto. This is useful when automatically run, see the Perl program in the /support directory of Apache, log_server_status.

Wednesday, November 12, 2008

Mount a remote folder in Ubuntu

SSHFS (Secure SHell FileSystem) is a file system for Linux capable of operating on files on a remote computer.

apt-get install sshfs

(Remote host must run the ssh daemon)

sshfs
remoteuser@remotehost:/path/to/remote_dir local_mountpoint

Thursday, November 6, 2008

Zoneminder in Ubuntu

In Ubuntu run:

apt-get install zoneminder

apt-get -f install

modprobe -r zc0301
modprobe -r gspca
modprobe gspca

add this line to /etc/modprobe.d/blacklist:
blacklist zc0301

Give access right to Video Devices:

chmod 777 /dev/video(x)

Thursday, October 23, 2008

Friday, October 17, 2008

Enable SSH in VMware ESX 3.x

ESXi 3.5 does ship with the ability to run SSH, but this is disabled by default (and is not supported). If you just need to access the console of ESXi, then you only need to perform steps 1 - 3.

1) At the console of the ESXi host, press ALT-F1 to access the console window.

2) Enter unsupported in the console and then press Enter. You will not see the text you type in.

3) If you typed in unsupported correctly, you will see the Tech Support Mode warning and a password prompt. Enter the password for the root login.

4) You should then see the prompt of ~ #.

Edit the file inetd.conf (enter the command vim /etc/inetd.conf).

5) Find the line that begins with #ssh and remove the #. Then save the file.

6) Once you've closed the vi editor, run the command /sbin/services.sh restart to restart the management services. You'll now be able to connect to the ESXi host with a SSH client.

Monday, September 22, 2008

Disable Beep in Ubuntu Hardy

Open the file /etc/modprobe.d/blacklist as root in a text editor:


vim /etc/modprobe.d/blacklist

Add this line to the end of the file:

blacklist pcspkr

The next time Ubuntu boots up pcspkr will be blocked from loading and you will no longer hear the beep. Peace and quiet at last!

But if you only need a temporary solution to disable the beep, just run this command (as root):

modprobe -r pcspkr

Thursday, September 18, 2008

Make Hostname permanent in Strato - Debian

Chnage this line in file /etc/hostname.sh:

[ -f /etc/hostname ] && HOSTNAME="$(cat /etc/hostname)"

to:

[ -f /etc/hostname ] && HOSTNAME="YOURHOSTNAME"

Friday, August 29, 2008

Enable HTTPS in Debian

install this package:

apt-get install libapache-mod-ssl

Enable ssl mode in Apache:

a2enmod ssl

add port 443 in /etc/apache2/ports.conf:

Listen 443

Make certificate (after run this command you must answer some questions):

make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/apache2/ssl/apache.pem

add these lines to
/etc/apache2/sites-available/YOURSERVER.COM.conf:

>VirtualHost *:443>

. . .
SSLEngine On
SSLCertificateFile /etc/apache2/ssl/apache.pem
. . .

>/VirtualHost>

restart Apache2.

To redirect HTTP to HTTPS add these lines to
/etc/apache2/sites-available/YOURSERVER.COM.conf under 443 options:

RewriteEngine on
RewriteCond %{SERVER_PORT} ^80$
RewriteRule ^(.*)$ https://%{SERVER_NAME}$1 [L,R]
RewriteLog "/var/log/apache2/rewrite.log"
RewriteLogLevel 2

and restart Apache2 again!

ftp user in a jail

Edit vsftpd configuration file - /etc/vsftpd/vsftpd.conf and

make sure following line exists (and uncommented):

chroot_local_user=YES

Save and close the file. Restart vsftpd.

Tuesday, August 19, 2008

Windows Vista - Clear cache for dead offline files

Add the FormatDatabase (DBWD) registry entry to the following registry subkey:
(First add Parameters under Csc, if doesn't exist)

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Csc\Parameters

Then, set the FormatDatabase registry entry to 1.
The restart your computer.