How To install Apache MySQL and PHP

The easy way to install a web server with apache MySQL and PHP is by a project called XAMPP
XAMPP is a project of apache friends how let you the easy way to install Apache distribution containing MySQL, PHP and Perl.

I was trying to create a new WordPress blog on one of my servers. and I found this project very helpful.
All you have to do is to download a tar file from from XAMPP website untar him and thats it.
I will show you how it goes:

Download the last version of XAMPP from here - http://www.apachefriends.org/en/xampp-linux.html#374
Run the command:
tar xvfz xampp-linux-1.7.3a.tar.gz -C /opt

That's all. XAMPP is now installed below the /opt/lampp directory.
All you need to do to start the XAMPP is:
# /opt/lampp/lampp start

You should now see something like this on your screen:Starting XAMPP 1.7.3a...
LAMPP: Starting Apache...
LAMPP: Starting MySQL...
LAMPP started.


Go to your server via you browser ~ http://localhost




for more information and tricks go to the main project website - http://www.apachefriends.org/
Read more >>

Apache Compile Wallpaper

A new Wallpaper I found
Discover Simple, Private Sharing at Drop.io
Read more >>

How To make SSH Tunnel

Hi,
In this post I'll discuss no how to make ssh tunnel
this how to will show you the basic, and I hope you will take the good from it to your needs.

the main configuration is:
edit /etc/ssh/ssh_config with your favorite editor
# vi /etc/ssh/ssh_config
and add flowing lines in the end

Host test
HostName localhost
User your_user_name
LocalForward 2022 SERVER1_IP:22
LocalForward 2080 SERVER2_IP:80
LocalForwars 2025 SERVER3_IP:25


save the file.
and run: # ssh test
now if you'll try to access to localhost on port 2080 you'll go to SERVER2 on port 80, you can test it from your browser - http://localhost:2080/ or try to ssh to locahost with port 2022
# ssh -p 2080 localhost

and you'll see you go to SERVER1.

You can run the ssh tunnel from one command line instead of edit the ssh_config.
# ssh -N -f User_Name@SERVER2_IP -L 2080/localhost/80
this script tell the server to forward all the traffic to port 2080 to SERVER2 on port 80

Or if you want to make REVERSE tunnel you can run the same command but with -R instead of -L
# ssh -N -f User_Name@SERVER2_IP -R 2022/localhost/22
(with this script you can access from the remote machine (SERVER2) via ssh to your machine with port 2022)
run # ssh -p 2022 localhost from SERVER2

I'm hoping this post will help you to understand the basic of ssh tunneling
Please comment
Read more >>

Ram Usage Per Application

Hi all,
I found a cool script that show you very nicely how many ram memory every application on your server used:

444.0 KiB +   0.0 KiB = 444.0 KiB       atd
536.0 KiB +   0.0 KiB = 536.0 KiB       portmap
620.0 KiB +   0.0 KiB = 620.0 KiB       ping
640.0 KiB +   0.0 KiB = 640.0 KiB       acpid
748.0 KiB +   0.0 KiB = 748.0 KiB       init
764.0 KiB +   0.0 KiB = 764.0 KiB       rpc.statd
788.0 KiB +   0.0 KiB = 788.0 KiB       dhcdbd
904.0 KiB +   0.0 KiB = 904.0 KiB       check_ping
956.0 KiB +   0.0 KiB = 956.0 KiB       xinetd
960.0 KiB +   0.0 KiB = 960.0 KiB       hald-addon-acpi
  1.0 MiB +   0.0 KiB =   1.0 MiB       cron
  1.0 MiB +   0.0 KiB =   1.0 MiB       dbus-daemon
  1.1 MiB +   0.0 KiB =   1.1 MiB       system-tools-ba
  1.1 MiB +   0.0 KiB =   1.1 MiB       hald-addon-inpu
  1.1 MiB +   0.0 KiB =   1.1 MiB       hald-runner
  1.2 MiB +   0.0 KiB =   1.2 MiB       kerneloops
  1.2 MiB +   0.0 KiB =   1.2 MiB       NetworkManagerD
  2.0 MiB +   0.0 KiB =   2.0 MiB       rsyslogd
  2.0 MiB +   0.0 KiB =   2.0 MiB       avahi-daemon (2)
  2.1 MiB +   0.0 KiB =   2.1 MiB       NetworkManager
  2.2 MiB +   0.0 KiB =   2.2 MiB       pickup
  2.2 MiB +   0.0 KiB =   2.2 MiB       master
  2.2 MiB +   0.0 KiB =   2.2 MiB       nagios (2)
  2.3 MiB +   0.0 KiB =   2.3 MiB       hald-addon-stor (2)
  2.3 MiB +   0.0 KiB =   2.3 MiB       cupsd
  2.3 MiB +   0.0 KiB =   2.3 MiB       udevd
  2.4 MiB +   0.0 KiB =   2.4 MiB       qmgr
  3.0 MiB +   0.0 KiB =   3.0 MiB       screen (2)
  3.0 MiB +   0.0 KiB =   3.0 MiB       hald
  3.4 MiB +   0.0 KiB =   3.4 MiB       getty (6)
  4.2 MiB +   0.0 KiB =   4.2 MiB       sshd (2)
  4.6 MiB +   0.0 KiB =   4.6 MiB       gdm (2)
  5.3 MiB +   0.0 KiB =   5.3 MiB       snmpd
  6.2 MiB +   0.0 KiB =   6.2 MiB       Xorg
  7.0 MiB +   0.0 KiB =   7.0 MiB       munin-node
  9.0 MiB +   0.0 KiB =   9.0 MiB       collect2.pl
 17.6 MiB +   0.0 KiB =  17.6 MiB       bash (5)
 25.6 MiB +   0.0 KiB =  25.6 MiB       gdmgreeter
120.5 MiB +   0.0 KiB = 120.5 MiB       apache2 (11)

 Private  +  Shared  =  RAM used        Program

download the script from HERE - ps-mem.pl
to run the script to need to type:
# python ./ps_mem.pl




Enjoy (-:

Please leave a comment if you like this post.
Read more >>

HowTo Install NRPE on Debian-Host

Hi,
Later in my last post - How To Install Nagios
I want to show you how to install NRPE plugin on your Debian-Hosts to monitoring from Nagios.

Install NRPE-Daemon and Nagios-Plugins on Debian-Linux Host.

1. Make sure you have a C compiler installed
# apt-get install make gcc g++

2. Install SSL for secure communication between Nagios-Server and Debian-Host
# apt-get install libssl-dev

3. Install SNMP (in case you like to query some SNMP via NRPE)
# apt-get install snmpd
# apt-get install snmp scli tkmib

4. Create Nagios user
# useradd -p nagios nagios

5. Install Nagios-Plugins
# cd /usr/src
# wget http://internode.dl.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.13.tar.gz
# tar -xzvf nagios-plugins-1.4.13.tar.gz
# cd nagios-plugins-1.4.13
# ./configure
# make
# make install

6. Fix permission for the Nagios director
# chown -R nagios:nagios /usr/local/nagios/

7. Install Xinetd
# apt-get install xinetd

8. Install and configure NRPE
# cd /usr/src
# wget http://waix.dl.sourceforge.net/sourceforge/nagios/nrpe-2.12.tar.gz
# tar -xzvf nrpe-2.12.tar.gz
# cd nrpe-2.12
# ./configure
# make all
# make install-plugin
# make install-daemon
# make install-daemon-config
# make install-xinetd

Edit /etc/xinetd.d/nrpe
# vi /etc/xinetd.d/nrpe
and add to only_from= your Nagios server IP
only_from = 127.0.0.1 192.168.1.101

Add the following entry for the NRPE daemon to the /etc/services file.
# echo "nrpe 5666/tcp #NRPE" >> /etc/services

Restart the NRPE service
# /etc/init.d/xinetd restart

Test if NRPE is listening:
# netstat -l | grep nrpe

The output out this command should show something like this:
tcp 0 0 *:nrpe *:* LISTEN

Next, check to make sure the NRPE daemon is functioning properly. To do this, run the check_nrpe plugin that was installed for testing purposes.
# /usr/local/nagios/libexec/check_nrpe -H localhost

If everything is fine you will see this output:
NRPE v2.12

9. Test the NRPE from the Nagios-Server
Now we want to test if we can query some information from the Debian-Host via NRPE from the Nagios-Server.
So switch into /usr/local/nagios/libexec on your Nagios Server and check if you have the check_nrpe plugin.
# ls - l check_ nrpe

In case you dont have the check_nrpe plugin you need to download and compile NRPE. (See Step 8)
run the next command:
# ./check_nrpe -H HostIPAddress -c check_users

You should get something like this back:
USERS OK - 1 users currently logged in |users=1;5;10;0

Great! Your Nagios server is able to communicate with the Debian-Host.
Read more >>

How To Install Nagios on Ubuntu

Nagios is a powerful monitoring system that enables organizations to identify and resolve IT infrastructure problems before they affect critical business processes.

Download, install and Configure Apache
first we have to install some necessary compliers and Apache to run Nagios.
run the next commands:
# sudo apt-get install build-essential
# sudo apt-get install libgd2-xpm-dev
# sudo apt-get install apache2
# sudo apt-get install php5-common php5 libapache2-mod-php5

Configure Apache to use PHP:

Run in a terminal:
# sudo vi /etc/apache2/apache2.conf
Paste the following into the file:
DirectoryIndex index.html index.php index.cgi

and restart the server with the command
# sudo /etc/init.d/apache2 restart

Download, install, and configure Nagios
Create a user to run the service and a group to run external commands:

# sudo useradd -m nagios
# sudo passwd nagios
# sudo groupadd nagcmd
# sudo usermod -a -G nagcmd nagios
# sudo usermod -a -G nagcmd www-data

Download the current version of Nagios and Nagios Plugins from - http://www.nagios.org/download/

Extract the Nagios tar:
# sudo tar -zxvf nagios-3.1.2.tar.gz
and change to the nagios-3.1.2 directory
# cd  nagios-3.1.2
Now install the Nagios use the flowing commands :
# sudo ./configure --with-command-group=nagcmd
# sudo make all
# sudo make install
# sudo make install-init
# sudo make install-config
# sudo make install-commandmode
# sudo make install-webconf

Add a user for the Nagios interface:
# sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

Extract and compile the Nagios-plugins:
# tar -zxvf nagios-plugins-1.4.14.tar.gz
# cd nagios-plugins-1.4.14
# sudo ./configure --with-nagios-user=nagios --with-nagios-group=nagios
# sudo make
# sudo make install

Create a link to start the service:
# sudo ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios

Verify the config:
# sudo /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Start Nagios:
# sudo /etc/init.d/nagios start

You should now be able to log into the Nagios web interface (http://localhost/nagios) using the nagiosadmin user and password.
Read more >>

How To, MySQL to CSV - Script

Hi
I wanted to share a new script that I was writing,
This script knows how to take SQL queries, convert them to csv files and send them by eMail.

the script is divided to 2 files:
the first one contain all the sql queries, and the second do all the amazing job.

The fist file called SQL.reports can be download from HERE, contain the sql queries, the syntax must be like the example:
ReportName your_report_name
sql your query

ReportName your_second_report_name
sql select * from tableA where [...]

The script file called MySQL_to_csv.sh can be download from HERE,
the only things you need to do for this to work is to fill the next parameters in the script:
DBhost="localhost"
DBname="your DB name"
DBuser="your DB user name"
DBpass="your DB password"
Mail_to='list of mail with space between them'
please do not touch the rest of the script.

After you have been download those 2 file, placed them in the same directory on your server lets say /opt/reports
and make sure you give them a permission
# chmod +x /opt/reports/*

now all left to do is to run the MySQL_to_csv.sh script
# /opt/reports/MySQL_to_csv.sh
and check you mailBox.
you can also add the script to corntab to run in your own scheduling

Enjoy.
And please comment (-;
Read more >>