Check dir size howto

It is useful to know how to check the size of a folder. All you need to do is to run next command:

# du -hs /dir/location/

For example:

[root@myserver /]# du -hs /mail/
837M    /mail/

In this case, the size is shown in MBs.

Small update…

Hi there… Its been a while since my last post and that seems like a tradition for my blogs… Few posts and then couple months of inactivity… Well, you know, I’m busy, I’m sick, tired etc.. At the end I would like to announce a couple articles about Sysbench, mod_fcgid and other “Nuclear science” utilities…

see ya …

How do I check what version of Centos/Fedora/RH my server is running?

You can run the command below at a command prompt to see what version of Centos/Fedora/RH your server is running.

[root@hydra:~]# cat /etc/redhat-release
CentOS release 5.2 (Final)

Fedora sample:

[root@s2 ~]# cat /etc/redhat-release
Fedora release 7 (Moonshine)

Upgrading to PHP 5.2.5 on RHEL and CentOS

As you probably know, the latest CentOS and RHEL distros are available only with PHP 5.1.6 and if you want to upgrade PHP, you need to install it manually (or to find someone to do it for you 🙂 ). The 5.2.5 release brings several security enhancements, more than 60 bug fixes, and improved performance for those of you that like arrays (and really, who doesn’t?). I wanted to install latest RoundCube webmail application and it won’t work if you don’t have PHP> 5.2. Also, latest Vivvo won’t work without 5.2.x

So, if you don’t want to build rpms or to go through ./configure, make, make install nightmare, you can enable Jason Litka yum repository to your RHEL or CentOS system. To do this please follow next few steps.

First you need to validate that the packages came from Jason Litka and you’ll do it with next command:

#rpm --import

After you added his public GPG key, you’ll need to adjust yum so he can search at his repo. To do this, please follow next steps:

#nano -w /etc/yum.repos.d/utterramblings.repo

Now copy next lines inside this file and save those changes.

name=Jason's Utter Ramblings Repo

Now you can upgrade your PHP installation with simple:

#yum update php

More information about this can be found HERE.

#php -v

should return

[root@ns1 ~]# php -v
PHP 5.2.6 (cli) (built: May  5 2008 10:32:59)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies
[root@ns1 ~]#

I forget to say that you should restart httpd after upgrade.

Basic MySQL operations I

In this post, I will present few basic commands for MySQL administration. You’ll see how to create a database, create user, assign a database for specific user, etc. First I suppose that you have root password set and that you know it… (in next posts I will present few steps to set this password or to recover it…)

Log in to mysql console:

[root@hydra mysql]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 248
Server version: 5.0.45 Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

Here you can see server version (in this case 5.0.45). With next command you can see all databases

mysql> show databases;
| Database           |
| information_schema |
| birds              |
| mysql              |
| private             |
| bdd1             |
| test               |
6 rows in set (0.05 sec)

If you want to create a new database, enter next command (remember that all SQL commands must be terminated with ; )

mysql> create database db1;
Query OK, 1 row affected (0.00 sec)

Now we need to assign a user to newly created database. Also, we need to grant him all privileges for this database but restrict access and operations on another databases (except test database)

mysql> CREATE USER 'db1'@'localhost' IDENTIFIED BY 'db1pass';
Query OK, 0 rows affected (0.02 sec)
mysql> GRANT ALL PRIVILEGES ON db1.* TO 'db1'@'localhost' IDENTIFIED BY 'db1pass';
Query OK, 0 rows affected (0.01 sec)
mysql> quit;

After this you can repeat step from the beginning and test new user account. In next posts I will present phpMyadmin

How to test BIND version running on DNS server?

BIND, or Berkley Internet Name Domain, is an Internet naming system used for DNS, which allows you to find the sites you are looking for. BIND contains entries for DNS names, so for example, if you type into your browser, the record tells your browser at what IP address to find the site. If you need to test BIND version running on DNS server, you can use next commands:


nslookup -q=txt -class=CHAOS version.bind


#dig -t txt -c chaos VERSION.BIND @

After this, you should get next answers


version.bind    text =
version.bind    nameserver = version.bind

The Linux users will have more details about server

[root@server ~]# dig -t txt -c chaos VERSION.BIND @
; <<>> DiG 9.3.4-P1 <<>> -t txt -c chaos VERSION.BIND @
; (1 server found)
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 44906
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 0
;VERSION.BIND.                  CH      TXT
VERSION.BIND.           0       CH      TXT     "9.3.4-P1"
VERSION.BIND.           0       CH      NS      VERSION.BIND.
;; Query time: 54 msec
;; WHEN: Mon Mar 23 20:09:57 2009
;; MSG SIZE  rcvd: 65

To hide your version of bind, add the following value to named.conf (now the commands shown above won’t return Bind version)

options {
version "[SECURED]";

Save named.conf and restarted named.

Remember the fact that Bind is the most popular Internet naming system but not the only one…