Linux: Enable and Disable services during Startup

Do you ever wonder that how to setup CentOS (RedHat) Linux server startup service and how the services running?

With CentOS, you may use the command named chkconfig to configure your startup services.

First of all, you need to understand what is Linux runlevels, for more information, you may refer to the URL below,

In this example, let say we could like to set the runlevel at 2, 3, and 5 with httpd (Apache).

To enable the services in startup,

# chkconfig httpd --add
# chkconfig httpd on --level 235

To check which runlevel you have set,

# chkconfig --list httpd

To disable the startup,

# chkconfig httpd off

Understand Linux-based RAM and it’s cache

Linux Operating System that powered by Linux kernel have an advanced disk cache algorithm that used to store frequently access data from Hard disk.

This is to explain why some Linux server’s RAM still getting high memory usage even you upgrade your RAM.

To find out how much memory using by the Linux-based server, you may use the linux command “free” to track it. To get the detailed/actual memory usage, you may run the following command from your Linux box.

free -m

You should get some result as below,

             total       used       free     shared    buffers     cached
Mem:         15905       2879      13026          0        384        900
-/+ buffers/cache:       1593      14311
Swap:         3999          0       3999

With the result above, you may see that the used memory is 2879MB and free memory is 13026MB. However, the cached memory is 1593MB while the actual free memory will be 14311MB.

Howto: Change timezone in Linux

If you get your web hosting services from foreign country and you might want to change the server time zone to your location in Linux server, use the following script.

To set your time zone to LA, US time zone, use the following command,

rm -f /etc/localtime
ln -sf /usr/share/zoneinfo/America/Los_Angeles /etc/localtime


PHP Compilation Error

It is not my first time to install PHP to the Linux server, but I am always not remember the error and which packages should install to get away the error.

So I am sharing some error code with the packages needed as below.

Error: Configure: error: xml2-config not found. Please check your libxml2 installation.

yum install libxml2-devel

Error: Checking for pkg-config… /usr/bin/pkg-config configure: error: Cannot find OpenSSL’s

yum install openssl-devel

Error: Configure: error: Cannot find MySQL header files under /usr.
Note that the MySQL client library is not bundled anymore!

yum install mysql-devel

Error: Checking for unixODBC support… configure: error: ODBC header file ‘/usr/include/sqlext.h’ not found!

yum install unixODBC-devel

Error: Configure: error: Cannot find pspell

yum install pspell-devel

Useful Linux Monitoring Tools

If you still remember Mick Genie ever post on how to monitor RAM/Memory on Linux earlier from, you should have an idea on the basic command to monitor Linux server.

Today I would like to share some useful monitoring tools from Linux box. With Linux monitoring tools, it uses to analysis and debugging the Linux box.

1. Top Process
– Top process is the most used by the Linux user as it come with many useful information such as it’s server load, memory, iostat, etc.

With top command, it do comes with some hotkey.
t – Displays summary information off and on.
m –    Displays memory information off and on.
A –    Sorts the display by top consumers of various system resources. Useful for quick identification of performance-hungry tasks on a system.
f –    Enters an interactive configuration screen for top. Helpful for setting up top for a specific task.
o –    Enables you to interactively select the ordering within top.
r –    Issues renice command.
k –    Issues kill command.
z –    Turn on or off color/mono Continue reading Useful Linux Monitoring Tools

cPanel: How to monitor crond services using chkservd

When you are using cPanel cron services, you might found out the cPanel services down without any clue.

With this article, Mick Genie will guide you how to check your crond services by using cPanel chkservd services.

cPanel offer chkservd services to automatically monitor daemon services from the Linux server.

To done this, follow the step as below.
1. Open the file /etc/chkserv.d/crond, pico /etc/chkserv.d/crond
2. Add the command as below to the file.
service[crond]=x,x,x,/etc/init.d/crond restart,crond,root
3. Open the file /etc/chkserv.d/chkservd.conf, pico /etc/chkserv.d/chkservd.conf
4. Add command below to last line of the above file.
5. Restart chkservd services, /scripts/restartsrv chkservd

Ten Linux Command that you should know

If you are the Linux server administrator, you should know some major command from Linux.

Today, Mick Genie will show you some command that normally used by the Administrator.

1. wget – Retrieving a Software Package.
– wget is the most command use command to retrieve or get a software package or download tool from Linux Command, you can easily get the package downloaded through wget command.

Eg. wget

2. top – Monitoring Server Processes.
– With a top command, you could easily understand the server processes and it’s performance as it collected almost all of the information from the server processes.

3. tail – Reviewing Log File.
– When you checking the server log, you might want to get the real-time log information instead of open all of the file as sometimes it is large enough to and waste your memory and time to open the file. Using tail command could allow you check real-time log information.

Eg. tail -f /var/log/messages

Continue reading Ten Linux Command that you should know

Understand and read core.xxxx files

With Apache Linux box, sometimes you might get lots of file named core.xxxx where xxxx is some number. You might wonder what is these file.

Normally core.xxxx file was generated from Linux box and holds the current state of a process working memory when a process is crashed. To read the file, run the command as below from your shell.

strings core.1234

From the strings reading, each line represent different state of a process.