RSSAll Entries in the "System" Category

Health check script Linux

Bellow I will present script checking Load Average on a Linux server which will send report if it becomes to high.
It is using Linux command ‘uptime’ which is pulling out server’s uptime as well as its Load Average:

In my script bellow I am using not the last minute load average, but the last five minutes (the second) one.
If you are not aware you can interpret a load average of “1.63, 0.70, 7.89” on a single-CPU system as:

– during the last minute, the system was overloaded by 63% on average (1.63 runnable processes, so that 0.73 processes had to wait for a turn for a single CPU system on average).

– during the last 5 minutes, the CPU was idling 30% of the time on average.

– during the last 15 minutes, the system was overloaded 698% on average (7.89 runnable processes, so that 6.98 processes had to wait for a turn for a single CPU system on average).

I have chosen the five minute interval as sending mails every minute is too aggressive in case of a server load. Also it could be something too short and handled by the server without notification.

* Note that some settings may need tuning because of changed/different command output

Once the script is ready you can set it as Cron. job Mine is set to check every 5th minute:

Tags

Can not include OpenSSL headers files.

Today I had question about “..why since I have OpenSSL installed and working fine with other services, I receive such message(the bellow one) when I am trying to compile something..”

The answer is because the application you are trying to compile manually requires “openssl-devel.x” package installed. It includes files for development of applications which will use OpenSSL.
So according to your OS you should use either yum, apt-get or gpg to install it.
In my example I am trying to compile on CentOS 32 bit, so I will use yum like that:

So the next time when I try to compile my application, Openssl headers files will be there:

Tags

PHP relocation error

This will be quick tutorial about how to fix PHP relocation error like this one: php: symbol zlibVersion , version libmysqlclient_16 not defined in in file libmysqlclient.so.16 with link time reference. Instead php: relocation error: php: symbol zlibVersion the error could be php: relocation error: php: symbol crc32.

This is an example and the issue could happen with any shared library not only with libmysqlclient.so .

As per the error message the library version is not matching so we have to check the shared library dependencies. This can be done with tool called ‘ldd’ which prints the shared library dependencies. In this case we will check PHP for “libmysqlclient” so the command should be like this:

Or if for some reason the PHP binary is located elsewhere:

The output should be similar to this one:

Let’s check the file:

In my case this is a symbolic link to the library in the same folder:

Now let’s check if this file exist in another place.

My output is:

So there are two libraries, and now we have to check where is the missing symbol – for example zlibVersion. For that will use ‘nm’ command lists symbols from object files. Let’s try the current linked file:

The output is:

So it seams there are no symbols in this library.

With the other file:

The output is:

Which seams better.

Now I will just remote the current link:

And will create a new one with the library that contains the symbol:

This should resolve the case, and the php: symbol zlibVersion , version libmysqlclient_16 not defined in in file libmysqlclient.so.16 with link time reference error was solved.

Tags

How to disconnect (kick out) other SSH users

In this tutorial I will talk about how to disconnect SSH user from Linux remote server.

This is useful when you have stuck SSH connections or there are suspicious IPs connected to the server. If your case is the second one you may kick out the hacker from the server, but even disconnected he may have setup already backdoor or application that will return the connection to him. Anyway the first step will be to kill sshd processes serving other connection but yours.

First you will have to login to the Linux server via SSH – if you are not aware how just click on the link.

Once logged in list all current users on the server using ‘w’ command – simply type:

This will list all users on the Linux box like this:

List logged users Linux

As you can see there are several users currently logged in, and to discover which one is yours can be done comparing your IP address, what is currently doing as well as the time – for how long the users is on the server.If you are just logged in your time will be the current one on the server.

To list which user which TTY(pts) is using we have to use the Linux ‘ps’ command with extended output like this:

The output will show which “sshd” service running for which ‘pts‘ stands:

List sshd processesNow I want to kick off Linux user with pts / 4 marked on the image, and for that I will use Linux ‘kill’ command.

This will send kill signal to process 6702 which is the number for the “sshd” service with pts / 4 running on the server.
After you have executed this command try the ‘w’ command to see if the user is still logged in.

Tags

Install YUM on CentOS

Writing this tutorial was inspired by VPS (Virtual Private Server) running with CentOS Linux without installed YUM (Yellowdog Updater, Modified). Often I am wondering why that is? If the VPS is coming with Plesk control panel installation – it is obvious – Parralels do not include YUM in their packages, and all additional modules should be installed from the Plesk Updater in order to prevent system miss configuration.
What about if you just have VPS with Linux (in this example with CentOS) without automatic updater?
If you are new with Linux – just for your information – YUM is an automatic updater and package maintainer for rpm packages. It calculates dependencies automatically it makes it easier to maintain groups of machines without having to manually update each one using RPM.

Simply copy and paste these lines in your console. Take in mind you should have root or sudo privileges.

Note: Scroll down for YUM install on CentOS previous versions.

Install YUM on CentOS 5.7 64 bit.

Install YUM on CentOS 5.7 32 bit.

Install YUM on CentOS 5.6 64 bit.

Install YUM on CentOS 5.6 32 bit.

Install YUM on CentOS 5.5 64bit :

Install YUM on CentOS 5.5 32bit :

Install YUM on CentOS 5.4 64bit :

 

Here is another example of how to install it. This is a manual fetch of all the .rpm packages needed for YUM installation under CentOS 4:

 

This second method for YUM installation on Linux systems is including more work than the first one since you have to download all packages one by one, but if you have good repository for your Linux distribution it will simple to gather the needed RPM’s.

Certainly it is easier just to copy the first example and paste it in your console if you are with CentOS 5.4. This will automatically install it after few moments depending on your connection.

If you want to install YUM on different Linux distribution, or different CentOS version – to find what dependencies it needs just download ‘yum – X.X.X-X. centosX.noarch.rpm’ package and try to run:

 

The system will generate all the YUM dependencies and will list it for you. Then go trough the Linux repository and collect all the packages listed. Ones you are ready just use the second method (the example with CentOS 4) to fetch and install them.

Tags

Pcmcia module viaccess

Pcmcia module viaccess – three words that are used very often in the Internet. Certainly we are talking about digital television, and in this article we will give you directions about how to install a DVB pcmcia device on Linux.

We assume that you already have pcmcia module viaccess plugged in your laptop. By default pcmsi is running on Linux, also the distribution of your OS should be > 2.6 kernel.
If this is so, there is an option to have the needed modules already compiled.

You need to check the specification of your card and to have the drivers coming from the manufacturer. If there are not any provided you will have to use the common ones developed by the Linux geeks over the word.

Lets start because our ‘pcmcia module viaccess’ is waiting.

Tags

Base Linux network settings

Like any other operating system Linux needs adjustment after its installation. One of the largest facilities of the operating system is easily configured through simple text files. These files are located in the directory /etc. This folder contains many files and sub folders, such sub folder pool configuration files status. For example all the scripts, which run and stop processes, respectively the trigger and shut the computer located in sub folder rc.d. Sub folder X11 configuration files then combines the graphic server, etc. This lecture will introduce how you can tune your network settings after the installation of your Linux.

Files that set the network configuration of the operating system are many, but we will check only the important ones:

hosts – file describes the names of computers by connecting them with their IP addresses. Every computer can be taken, short name or nickname. File format is the following:

Check the MySQL version on your server.

This tutorial will show you how to check MySQL version on a Linux server.
The version check can be done in a very common for Unix machines way:

Tags

Check your PHP version.

This tutorial will show you how to verify PHP version on a server with Unix /Linux operating system. This will be helpful in case when you are installing an application and it requires a specific PHP version.
Login to the server were you want to check and then type:

 

 

Then you should see the listing with the PHP version similar to this one:

 

Check php version

 

There is another way to check PHP version whit FTP file upload of a simple PHP file with function which will display PHP info .

Tags

Display information about a Unix / Linux system

This tutorial will show you how to verify the system information on Unix / Linux machines. This will be useful when you are going to compile a code and need to know the kernel version.

To display type:the current release level of the operating system