Mateen Ahmed

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Friday, 26 July 2013

Enable Timestamps in History Command

Posted on 01:35 by Unknown


When we run the 'history' command it only gives you command along with the line numbers. Sometimes it’s useful to have a time stamp attached to each command to build a clearer picture.To enable the timestamps in history command , set 'HISTTIMEFORMAT' environment variable.


# export HISTTIMEFORMAT="%d-%b-%Y %r "



To permanently set this variable , add below entry at the end of file/etc/profile


export HISTTIMEFORMAT="%d-%b-%Y %r "
Read More
Posted in | No comments

Friday, 14 June 2013

Most Common Apache Tuning Parameters :

Posted on 23:11 by Unknown
One of the biggest hardware issue affecting webserver performance is RAM. A webserver should never ever have to swap, as swapping increases the latency of each request beyond a point that users consider "fast enough". This causes users to hit stop and reload, further increasing the load.

We should, control the MaxClients setting so that web server does not spawn so many children it starts swapping. This procedure for doing this is simple: determine the size of your average Apache process, by looking at your process list via a tool such as top, and divide this into your total available memory, leaving some room for other processes.

1. Remove unused modules : Modules that are not required should be removed because unused module still consume memory and other resources.

2. Should Use mod_disk_cache NOT mod_mem_cache :  mod_mem_cache will not share its cache among different apache processes, which results in high memory usage with little performance gain since on an active server, mod_mem_cache will rarely serve the same page twice in the same apache process.

3. Setup appropriate Expires, Etag, and Cache-Control Headers : To utilize cache, we must tell it when a file expires, otherwise  client will not experience the caching benefits.

4.Utilize mod_gzip/mod_deflate : gzip the content before sending it off and then the client will ungzip upon receipt, this will minimize the size of file transfers, it generally will help all user experience.

5. Turn HostnameLookups Off : if HostnameLookups is ON , it will add latency to every request because it requires a DNS lookup to complete before the request is finished.

6. Avoid using hostname in configs : if you have HostnameLookups off, this will prevent you from having to wait for the DNS resolve of the hostnames in your configs, use IP addresses instead.

7. Use Persistent Connections : Set KeepAlive On and then set KeepAliveTimeout and KeepAliveRequests. KeepAliveTimeout is how long apache will wait for the next request, and KeepAliveRequests is the max number of requests for a client prior to resetting the connection. This will prevent the client from having to reconnect between each request.

8. Increase Write Buffer Size : increase your write buffer size for tcp/ip buffers. On linux systems increase /proc/sys/net/core/wmem_max and  /proc/sys/net/core/wmem_default. If your pages fit within this buffer, apache will complete a process in one call to the tcp/ip buffer.

9.  Increase Max Open Files : if you are handling high loads increase the number of allowed open files. On linux, increase /proc/sys/fs/file-max and run ulimit -H -n 4096.

10.  Disable Content Negotiation : Content negotiation causes a big reduction in performance.Disable content negotiation where it is not needed. If you do require content negotiation, use the type-map handler, rather than the MultiViews option:

Note: Content negotiation is a mechanism defined in the HTTP specification that makes it possible to serve different versions of a document  at the same URI.

Read More
Posted in | No comments

How to Assign the IP Address and Default gateway in Linux From Command Line

Posted on 23:00 by Unknown
if config command is used to assign the ip address to a lan card from the command or from the terminal.

Syntax :

 # ifconfig [-v] [-a] [-s]  [interface]

Options :
  • -a :    display all interfaces which are currently available, even if down
  • -s :    display a short list (like netstat -i)
  • -v :   be more verbose for some error conditions
interface : The name of the interface.  This is usually a driver name followed by a unit number, for example eth0 for  the  first Ethernet interface. If your kernel supports alias interfaces, you can specify them with eth0:0 for the first alias of eth0. One can use them to assign a second address. To delete an alias interface use ifconfig eth0:0 down.

Example :

Below command is used to assign ip

# ifconfig eth0 <ip-address>  netmask <yournetmask>  up

Below command is used to check the ip address of eth0 lan card.

# ifconfig  eth0

Command To check the Default Gateway

# route  -n

Commands To  add/change the gateway

# route  del  default gw                                    // delete the default gateway
# route add default gw  <gateway-ipaddress>      
* command to add default gateway
Read More
Posted in | No comments

Key Based / Password Less SSH Authentication on Linux Servers

Posted on 05:35 by Unknown
Password Less authentication to Linux servers makes the system admin's life easy. To Implement password less or Keys based authentication we have to generate Public and Private keys , Copy the Pubic keys to remote Linux servers either manually or by ssh-copy-id command .

In My scenario I have Ubuntu laptop and daily I have to login to lot of remote Linux servers , Follow the below steps to achieve password less / Keys based authentication :
 Step:1 Generate Public and Private keys , using below command 

#ssh-keygen -t rsa





Above command will save the keys under ~/.ssh  directory with the name id_rsa & id_rsa.pub. Leave the passpharse empty while executing above command.
Step:2 Copy the public key to remote linux servers

#ssh-copy-id -i /root/.ssh/id_rsa.pub root@192.168.1.99



ssh-copy-id command will automatically copy the contents of id_rsa.pub file to ~/.ssh/authorized_keys file of remote linux server

Note :  if we don't want to use ssh-copy-id command , then manually Append contents of  file “id_rsa.pub” to
"~/.ssh/authorized_keys" remote linux server  and  change the permissions of "~/.ssh/authorized_keys" to  755.

Example:3  Now access the remote linux server and it will not ask for the password.


Read More
Posted in | No comments
Newer Posts Older Posts Home
Subscribe to: Posts (Atom)

Popular Posts

  • Linux Kernel /etc/sysctl.conf
    /etc/sysctl.conf can be a powerful way of changing kernel settings at run-time. If you have sysctl.conf support compiled into your kernel, y...
  • Domain name formulation
    The right-most label conveys the top-level domain; for example, the domain name  www.example.com  belongs to the top-level domain com. The h...
  • How To Add a non-login User in Linux so that he/she doesn't have shell.
    useradd & usermod commands are used to add and modify the users in linux. When invoked without the -D option, the useradd command creat...
  • To Increase Networking Performance Network Stack (Buffers Size)
    By default the Linux network stack is not configured for high speed large file transfer across WAN links. This is done to save memory resour...
  • SVN Server on RHEL6
    Subversion (SVN) is a version control system initiated in 2000 by CollabNet Inc. It is used to maintain current and historical versions of f...
  • Types of NameServer
                                                            There are four primary nameserver configuration:    Master Server:  The primary mast...
  • Apache Security with SELinux
    Security with Apache is an important topic, of which SELinux is a part. The reason for discussing SELInux at this point is so that you have ...
  • How do I hide the Apache version number under Linux server?
    You can easily hide Apche (httpd) version number and other information. There are two config directives that controls Apache version. The S...
  • Configuring ssh Server
                                                          SSH SERVER CONFIGURATIONS ssh command is a client remote login program to connect remo...
  • TOP - Process Activity Command
    The top program provides a dynamic real-time view of a running system i.e. actual process activity. By default, it displays the most CPU-int...

Blog Archive

  • ▼  2013 (19)
    • ▼  July (1)
      • Enable Timestamps in History Command
    • ►  June (6)
      • Most Common Apache Tuning Parameters :
      • How to Assign the IP Address and Default gateway i...
      • Key Based / Password Less SSH Authentication on Li...
    • ►  May (1)
    • ►  April (11)
  • ►  2012 (12)
    • ►  December (11)
    • ►  November (1)
Powered by Blogger.

About Me

Unknown
View my complete profile