How to Restrict the Access to Specific Web sites Using Squid Proxy Server on CentOS 6.2

This howto covers the steps necessary to restrict the access to specific web sites using Squid Proxy cache server for CentOS 6.2. Before beginning this steps, please make sure you have properly configured the squid proxy server. If not, please follow this article to install squid proxy server on CentOS 6.2 (How to Install and Configure Squid Proxy Server on CentOS 6.2)

Squid has capability to read the containing lists of web sites or domains for use in ACLs. In this example, the setup always restricting access to ehowstuff.com network and Bad_Websites, but allow surfing during surfing_hours group’s only if the sites does not in Bad_Wesites (other that Bad_Websites). Follow this steps to implement restricting access to specific websites.

1. Open the squid.conf configuration file :

    [root@centos62 ~]# vi /etc/squid/squid.conf
    

2. Create web folder under /etc/squid. This is to store any anonymous files such as Bad_Websites.squid.

    [root@centos62 ~]# mkdir /etc/squid/web
    

3.Create Bad_Websites.squid and add the bad websites list.

    [root@centos62 ~]# vi /etc/squid/web/Bad_Websites.squid
    

Example Bad website list :

    #List in /etc/squid/web/Bad_Websites.squid
    www.porn.com
    www.badwebsites.com
    

4. Define surfing_hour group’s name, surfing time and restricted websites file list.

    #Add this at the bottom of the ACL Section
    #
    acl surfing_hours time M T W H F 08:00-17:00
    acl Bad_Websites  dstdomain "/etc/squid/web/Bad_Websites.squid"
    #
    

5. Always restricting access to ehowstuff.com network and Bad_Wesites, but allow surfing during surfing_hours group’s only if the sites does not in Bad_Websites (other that Bad_Websites).

    # Only allow cachemgr access from ehowstuff.com
    http_access allow ehowstuff.com surfing_hours !Bad_Websites
    http_access deny Bad_Websites
    http_access deny ehowstuff.com
    

6. Restart Squid proxy server to take effect :

    [root@centos62 ~]# service squid restart
    Stopping squid: ................                           [  OK  ]
    Starting squid: .                                          [  OK  ]
    

Full Configuration of the Squid Cache Proxy Configuration :

    #
    # Recommended minimum configuration:
    #
    acl manager proto cache_object
    acl localhost src 127.0.0.1/32 ::1
    acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 ::1
    
    # Example rule allowing access from your local networks.
    # Adapt to list your (internal) IP networks from where browsing
    # should be allowed
    acl localnet src 10.0.0.0/8	# RFC1918 possible internal network
    acl localnet src 172.16.0.0/12	# RFC1918 possible internal network
    acl localnet src 192.168.0.0/16	# RFC1918 possible internal network
    acl localnet src fc00::/7       # RFC 4193 local private network range
    acl localnet src fe80::/10      # RFC 4291 link-local (directly plugged) machines
    acl ehowstuff.com src 192.168.1.0/24    # Your internal network
    
    acl SSL_ports port 443
    acl Safe_ports port 80		# http
    acl Safe_ports port 21		# ftp
    acl Safe_ports port 443		# https
    acl Safe_ports port 70		# gopher
    acl Safe_ports port 210		# wais
    acl Safe_ports port 1025-65535	# unregistered ports
    acl Safe_ports port 280		# http-mgmt
    acl Safe_ports port 488		# gss-http
    acl Safe_ports port 591		# filemaker
    acl Safe_ports port 777		# multiling http
    acl CONNECT method CONNECT
    
    #Add this at the bottom of the ACL Section
    #
    acl surfing_hours time M T W H F 08:00-17:00
    acl Bad_Websites  dstdomain "/etc/squid/web/Bad_Websites.squid"
    
    #
    # Recommended minimum Access Permission configuration:
    #
    # Only allow cachemgr access from localhost
    http_access allow manager localhost
    http_access deny manager
    
    # Only allow cachemgr access from ehowstuff.com
    http_access allow ehowstuff.com surfing_hours !Bad_Websites
    http_access deny Bad_Websites
    http_access deny ehowstuff.com
    
    
    
    # Deny requests to certain unsafe ports
    http_access deny !Safe_ports
    
    # Deny CONNECT to other than secure SSL ports
    http_access deny CONNECT !SSL_ports
    
    # We strongly recommend the following be uncommented to protect innocent
    # web applications running on the proxy server who think the only
    # one who can access services on "localhost" is a local user
    #http_access deny to_localhost
    
    #
    # INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
    #
    
    # Example rule allowing access from your local networks.
    # Adapt localnet in the ACL section to list your (internal) IP networks
    # from where browsing should be allowed
    #http_access allow localnet
    http_access allow localhost
    
    # And finally deny all other access to this proxy
    http_access deny all
    
    # Squid normally listens to port 3128
    http_port 3128
    
    # We recommend you to use at least the following line.
    hierarchy_stoplist cgi-bin ?
    
    # Uncomment and adjust the following to add a disk cache directory.
    #cache_dir ufs /var/spool/squid 100 16 256
    
    # Leave coredumps in the first cache dir
    coredump_dir /var/spool/squid
    
    # Add any of your own refresh_pattern entries above these.
    refresh_pattern ^ftp:		1440	20%	10080
    refresh_pattern ^gopher:	1440	0%	1440
    refresh_pattern -i (/cgi-bin/|\?) 0	0%	0
    refresh_pattern .		0	20%	4320
    

How to Restrict Web Access By Time Using Squid Proxy Server on CentOS 6.2

This howto covers the steps necessary to control internet access by time using Squid Proxy cache server for CentOS 6.2. Before beginning this steps, please make sure you have properly configured the squid proxy server. If not, please follow this article to install squid proxy server on CentOS 6.2 (How to Install and Configure Squid Proxy Server on CentOS 6.2)

1. Open the squid.conf configuration file :

    [root@centos62 ~]# vi /etc/squid/squid.conf
    

2. In this example, the setup just allow surfing_hour’s access from the ehowstuff.com network, while always restricting access to ehowstuff.com network other than surfing hour.

    # Example rule allowing access from your local networks.
    # Adapt to list your (internal) IP networks from where browsing
    # should be allowed
    acl ehowstuff.com src 192.168.1.0/24    # Your ehowstuff.com internal network
    

3. Define surfing_hour group’s name and time.

    #Add this at the bottom of the ACL Section
    #
    acl surfing_hours time M T W H F 08:00-17:00
    #
    

4. Always restricting access to ehowstuff.com, but allow during surfing hours only.

    # Only allow cachemgr access from ehowstuff.com
    http_access allow ehowstuff.com surfing_hours
    http_access deny ehowstuff.com
    

5. Restart Squid proxy server to take effect :

    [root@centos62 ~]# service squid restart
    Stopping squid: ................                           [  OK  ]
    Starting squid: .                                          [  OK  ]
    

Full Configuration of the Squid Cache Proxy Configuration :

    #
    # Recommended minimum configuration:
    #
    acl manager proto cache_object
    acl localhost src 127.0.0.1/32 ::1
    acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 ::1
    
    # Example rule allowing access from your local networks.
    # Adapt to list your (internal) IP networks from where browsing
    # should be allowed
    acl localnet src 10.0.0.0/8	# RFC1918 possible internal network
    acl localnet src 172.16.0.0/12	# RFC1918 possible internal network
    acl localnet src 192.168.0.0/16	# RFC1918 possible internal network
    acl localnet src fc00::/7       # RFC 4193 local private network range
    acl localnet src fe80::/10      # RFC 4291 link-local (directly plugged) machines
    acl ehowstuff.com src 192.168.1.0/24    # Your ehowstuff.com internal network
    
    acl SSL_ports port 443
    acl Safe_ports port 80		# http
    acl Safe_ports port 21		# ftp
    acl Safe_ports port 443		# https
    acl Safe_ports port 70		# gopher
    acl Safe_ports port 210		# wais
    acl Safe_ports port 1025-65535	# unregistered ports
    acl Safe_ports port 280		# http-mgmt
    acl Safe_ports port 488		# gss-http
    acl Safe_ports port 591		# filemaker
    acl Safe_ports port 777		# multiling http
    acl CONNECT method CONNECT
    
    #Add this at the bottom of the ACL Section
    #
    acl surfing_hours time M T W H F 08:00-17:00
    #
    # Recommended minimum Access Permission configuration:
    #
    # Only allow cachemgr access from localhost
    http_access allow manager localhost
    http_access deny manager
    
    # Only allow cachemgr access from ehowstuff.com
    http_access allow ehowstuff.com surfing_hours
    http_access deny ehowstuff.com
    
    
    
    # Deny requests to certain unsafe ports
    http_access deny !Safe_ports
    
    # Deny CONNECT to other than secure SSL ports
    http_access deny CONNECT !SSL_ports
    
    # We strongly recommend the following be uncommented to protect innocent
    # web applications running on the proxy server who think the only
    # one who can access services on "localhost" is a local user
    #http_access deny to_localhost
    
    #
    # INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
    #
    
    # Example rule allowing access from your local networks.
    # Adapt localnet in the ACL section to list your (internal) IP networks
    # from where browsing should be allowed
    #http_access allow localnet
    http_access allow localhost
    http_access allow ehowstuff.com
    
    # And finally deny all other access to this proxy
    http_access deny all
    
    # Squid normally listens to port 3128
    http_port 3128
    
    # We recommend you to use at least the following line.
    hierarchy_stoplist cgi-bin ?
    
    # Uncomment and adjust the following to add a disk cache directory.
    #cache_dir ufs /var/spool/squid 100 16 256
    
    # Leave coredumps in the first cache dir
    coredump_dir /var/spool/squid
    
    # Add any of your own refresh_pattern entries above these.
    refresh_pattern ^ftp:		1440	20%	10080
    refresh_pattern ^gopher:	1440	0%	1440
    refresh_pattern -i (/cgi-bin/|\?) 0	0%	0
    refresh_pattern .		0	20%	4320
    

How to Check Hard Disk Size and Hard Disk Usage on CentOS 6.2

In this post, i will share the simple command to check the Hard Disk size and usage on CentOS 6.2. This command is a basic command for linux operating system.

To view and list of the usage of each partition in the server :

    [root@centos62 ~]# df -h
    Filesystem            Size  Used Avail Use% Mounted on
    /dev/mapper/vg_centos62-lv_root
                           13G  1.8G   10G  15% /
    tmpfs                 504M     0  504M   0% /dev/shm
    /dev/sda1             485M   48M  412M  11% /boot
    

df command will displays the total, used, and available free space on all currently mounted filesystems.

To list the size of a specific directory, run the following command :

    [root@centos62 ~]# du -sh /root
    2.6M    /root
    

du command reports disk usage. It will shows the disk space used by the files and directories in a directory. The -h option makes the output easier to read by user.

How to List Available Apache httpd Web Server Package and Info on CentOS 6.2

In this post, i will show on how to list available Apache httpd web server package that was install on your CentOS server. Beside that, i will show how to show the apache information using command line.

To list available Apache httpd web server package :

    [root@centos62 ~]# yum list *httpd*
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
     * base: centos.maulvi.net
     * extras: centos.maulvi.net
     * updates: centos.maulvi.net
    Installed Packages
    httpd.i686                             2.2.15-15.el6.centos                    @CentOS6.2-Repository
    httpd-tools.i686                       2.2.15-15.el6.centos                    @CentOS6.2-Repository
    Available Packages
    httpd-devel.i686                       2.2.15-15.el6.centos                    CentOS6.2-Repository
    httpd-manual.noarch                    2.2.15-15.el6.centos                    CentOS6.2-Repository
    

Use yum info httpd command to get more information about Apache httpd web server package :

    [root@centos62 ~]# yum info httpd
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
     * base: centos.maulvi.net
     * extras: centos.maulvi.net
     * updates: centos.maulvi.net
    Installed Packages
    Name        : httpd
    Arch        : i686
    Version     : 2.2.15
    Release     : 15.el6.centos
    Size        : 2.8 M
    Repo        : installed
    From repo   : CentOS6.2-Repository
    Summary     : Apache HTTP Server
    URL         : http://httpd.apache.org/
    License     : ASL 2.0
    Description : The Apache HTTP Server is a powerful, efficient, and extensible
                : web server.
    

How to Install and Configure Samba Server on CentOS 6.2

In this post, i will show you on how to install samba service on CentOS 6.2. This post assumed that you have configure local yum repository.

    [root@centos62 ~]# yum install samba
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
     * base: centos.maulvi.net
     * extras: centos.maulvi.net
     * updates: centos.maulvi.net
    Setting up Install Process
    Resolving Dependencies
    --> Running transaction check
    ---> Package samba.i686 0:3.5.10-114.el6 will be installed
    --> Processing Dependency: samba-winbind-clients = 3.5.10-114.el6 for package: samba-3.5.10-114.el6.i686
    --> Processing Dependency: samba-common = 3.5.10-114.el6 for package: samba-3.5.10-114.el6.i686
    --> Processing Dependency: libtdb.so.1 for package: samba-3.5.10-114.el6.i686
    --> Processing Dependency: libcups.so.2 for package: samba-3.5.10-114.el6.i686
    --> Processing Dependency: libwbclient.so.0 for package: samba-3.5.10-114.el6.i686
    --> Processing Dependency: libtalloc.so.2 for package: samba-3.5.10-114.el6.i686
    --> Running transaction check
    ---> Package cups-libs.i686 1:1.4.2-44.el6 will be installed
    --> Processing Dependency: libavahi-client.so.3 for package: 1:cups-libs-1.4.2-44.el6.i686
    --> Processing Dependency: libtiff.so.3 for package: 1:cups-libs-1.4.2-44.el6.i686
    --> Processing Dependency: libjpeg.so.62 for package: 1:cups-libs-1.4.2-44.el6.i686
    --> Processing Dependency: libavahi-common.so.3 for package: 1:cups-libs-1.4.2-44.el6.i686
    --> Processing Dependency: libpng12.so.0(PNG12_0) for package: 1:cups-libs-1.4.2-44.el6.i686
    --> Processing Dependency: libpng12.so.0 for package: 1:cups-libs-1.4.2-44.el6.i686
    ---> Package libtalloc.i686 0:2.0.1-1.1.el6 will be installed
    ---> Package libtdb.i686 0:1.2.1-3.el6 will be installed
    ---> Package samba-common.i686 0:3.5.10-114.el6 will be installed
    --> Processing Dependency: /usr/bin/pkg-config for package: samba-common-3.5.10-114.el6.i686
    ---> Package samba-winbind-clients.i686 0:3.5.10-114.el6 will be installed
    --> Running transaction check
    ---> Package avahi-libs.i686 0:0.6.25-11.el6 will be installed
    ---> Package libjpeg.i686 0:6b-46.el6 will be installed
    ---> Package libpng.i686 2:1.2.46-1.el6_1 will be installed
    ---> Package libtiff.i686 0:3.9.4-1.el6_0.3 will be installed
    ---> Package pkgconfig.i686 1:0.23-9.1.el6 will be installed
    --> Finished Dependency Resolution
    
    Dependencies Resolved
    
    ====================================================================================================
     Package                      Arch        Version                 Repository                   Size
    ====================================================================================================
    Installing:
     samba                        i686        3.5.10-114.el6          CentOS6.2-Repository        5.0 M
    Installing for dependencies:
     avahi-libs                   i686        0.6.25-11.el6           CentOS6.2-Repository         54 k
     cups-libs                    i686        1:1.4.2-44.el6          CentOS6.2-Repository        324 k
     libjpeg                      i686        6b-46.el6               CentOS6.2-Repository        133 k
     libpng                       i686        2:1.2.46-1.el6_1        CentOS6.2-Repository        184 k
     libtalloc                    i686        2.0.1-1.1.el6           CentOS6.2-Repository         18 k
     libtdb                       i686        1.2.1-3.el6             CentOS6.2-Repository         29 k
     libtiff                      i686        3.9.4-1.el6_0.3         CentOS6.2-Repository        338 k
     pkgconfig                    i686        1:0.23-9.1.el6          CentOS6.2-Repository         67 k
     samba-common                 i686        3.5.10-114.el6          CentOS6.2-Repository         13 M
     samba-winbind-clients        i686        3.5.10-114.el6          CentOS6.2-Repository        1.1 M
    
    Transaction Summary
    ====================================================================================================
    Install      11 Package(s)
    
    Total download size: 20 M
    Installed size: 70 M
    Is this ok [y/N]: y
    Downloading Packages:
    ----------------------------------------------------------------------------------------------------
    Total                                                                10 MB/s |  20 MB     00:02
    Running rpm_check_debug
    Running Transaction Test
    Transaction Test Succeeded
    Running Transaction
      Installing : libtalloc-2.0.1-1.1.el6.i686                                                    1/11
      Installing : libtdb-1.2.1-3.el6.i686                                                         2/11
      Installing : samba-winbind-clients-3.5.10-114.el6.i686                                       3/11
      Installing : libjpeg-6b-46.el6.i686                                                          4/11
      Installing : libtiff-3.9.4-1.el6_0.3.i686                                                    5/11
      Installing : 2:libpng-1.2.46-1.el6_1.i686                                                    6/11
      Installing : 1:pkgconfig-0.23-9.1.el6.i686                                                   7/11
      Installing : samba-common-3.5.10-114.el6.i686                                                8/11
      Installing : avahi-libs-0.6.25-11.el6.i686                                                   9/11
      Installing : 1:cups-libs-1.4.2-44.el6.i686                                                  10/11
      Installing : samba-3.5.10-114.el6.i686                                                      11/11
    
    Installed:
      samba.i686 0:3.5.10-114.el6
    
    Dependency Installed:
      avahi-libs.i686 0:0.6.25-11.el6              cups-libs.i686 1:1.4.2-44.el6
      libjpeg.i686 0:6b-46.el6                     libpng.i686 2:1.2.46-1.el6_1
      libtalloc.i686 0:2.0.1-1.1.el6               libtdb.i686 0:1.2.1-3.el6
      libtiff.i686 0:3.9.4-1.el6_0.3               pkgconfig.i686 1:0.23-9.1.el6
      samba-common.i686 0:3.5.10-114.el6           samba-winbind-clients.i686 0:3.5.10-114.el6
    
    Complete!
    

Set Samba auto after boot up :

    [root@centos62 ~]# chkconfig smb on
    

Start samba service :

    [root@centos62 ~]# service smb start
    Starting SMB services:                                     [  OK  ]
    

How to Fix VMware Tools Installation Error

Symptom 1 : Missing Compiler Program

    Setup is unable to find the "gcc" program on your machine. Please 
    make sure it is installed. Do you want to specify the location of this
    program by hand?
    
    Setup is unable to find the 'make' program on your machine. Please 
    make sure it is installed. Do you want to specify the location of this 
    program by hand? [yes]
    

Solutions :
Install the following development tool that related with Vmware-tools software.

    [root@centos62 ~]# yum install gcc make kernel-headers kernel-devel -y
    

Symptom 2 : Failed Locating and Installing the C Header Files

    What is the location of the directory of C header files that match your running kernel?
    

Solutions :
Try to update the server kernel and reboot.

    [root@centos62 ~]# yum update kernel-headers kernel-devel -y
    

Reboot Server.

    [root@centos62 ~]# reboot
    

How to Install and Configure Squid Proxy Server on CentOS 6.2

This howto will show you the steps to install and configure a Squid 3 Proxy Server on CentOS6.2. Squid service plays two main roles which mainly act as a caching proxy server between the user and the web. Second role, squid also regularly used as a content accelerator, or reverse proxy, intercepting requests to a server and using a cached version of the page to serve the request. Follow below steps to install and configure squid.

1. Install Squid proxy using yum command. This installation is performed using local yum repository as documented in this article. (How to Setup Local Yum Repository from CD-ROM/DVD-ROM image on CentOS 6.2)

    [root@centos62 ~]# yum install squid -y
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
     * base: centos.maulvi.net
     * extras: centos.maulvi.net
     * updates: centos.maulvi.net
    Setting up Install Process
    Resolving Dependencies
    --> Running transaction check
    ---> Package squid.i686 7:3.1.10-1.el6_2.1 will be installed
    --> Processing Dependency: perl(Getopt::Long) for package: 7:squid-3.1.10-1.el6_2.1.i686
    --> Processing Dependency: perl(integer) for package: 7:squid-3.1.10-1.el6_2.1.i686
    --> Processing Dependency: perl(Pod::Usage) for package: 7:squid-3.1.10-1.el6_2.1.i686
    --> Processing Dependency: perl(DBI) for package: 7:squid-3.1.10-1.el6_2.1.i686
    --> Processing Dependency: perl(Digest::MD5) for package: 7:squid-3.1.10-1.el6_2.1.i686
    --> Processing Dependency: perl(vars) for package: 7:squid-3.1.10-1.el6_2.1.i686
    --> Processing Dependency: libltdl.so.7 for package: 7:squid-3.1.10-1.el6_2.1.i686
    --> Processing Dependency: perl(strict) for package: 7:squid-3.1.10-1.el6_2.1.i686
    --> Processing Dependency: /usr/bin/perl for package: 7:squid-3.1.10-1.el6_2.1.i686
    --> Processing Dependency: perl(Getopt::Std) for package: 7:squid-3.1.10-1.el6_2.1.i686
    --> Processing Dependency: perl(Net::POP3) for package: 7:squid-3.1.10-1.el6_2.1.i686
    --> Running transaction check
    ---> Package libtool-ltdl.i686 0:2.2.6-15.5.el6 will be installed
    ---> Package perl.i686 4:5.10.1-119.el6_1.1 will be installed
    --> Processing Dependency: perl-libs = 4:5.10.1-119.el6_1.1 for package: 4:perl-5.10.1-119.el6_1.1.i686
    --> Processing Dependency: perl-libs for package: 4:perl-5.10.1-119.el6_1.1.i686
    --> Processing Dependency: perl(Pod::Simple) for package: 4:perl-5.10.1-119.el6_1.1.i686
    --> Processing Dependency: libperl.so for package: 4:perl-5.10.1-119.el6_1.1.i686
    --> Processing Dependency: perl(version) for package: 4:perl-5.10.1-119.el6_1.1.i686
    --> Processing Dependency: perl(Module::Pluggable) for package: 4:perl-5.10.1-119.el6_1.1.i686
    ---> Package perl-DBI.i686 0:1.609-4.el6 will be installed
    --> Running transaction check
    ---> Package perl-Module-Pluggable.i686 1:3.90-119.el6_1.1 will be installed
    ---> Package perl-Pod-Simple.i686 1:3.13-119.el6_1.1 will be installed
    --> Processing Dependency: perl(Pod::Escapes) >= 1.04 for package: 1:perl-Pod-Simple-3.13-119.el6_1.1.i686
    ---> Package perl-libs.i686 4:5.10.1-119.el6_1.1 will be installed
    ---> Package perl-version.i686 3:0.77-119.el6_1.1 will be installed
    --> Running transaction check
    ---> Package perl-Pod-Escapes.i686 1:1.04-119.el6_1.1 will be installed
    --> Finished Dependency Resolution
    
    Dependencies Resolved
    
    ====================================================================================================
     Package                     Arch       Version                    Repository                  Size
    ====================================================================================================
    Installing:
     squid                       i686       7:3.1.10-1.el6_2.1         updates                    1.7 M
    Installing for dependencies:
     libtool-ltdl                i686       2.2.6-15.5.el6             CentOS6.2-Repository        45 k
     perl                        i686       4:5.10.1-119.el6_1.1       CentOS6.2-Repository       9.7 M
     perl-DBI                    i686       1.609-4.el6                CentOS6.2-Repository       705 k
     perl-Module-Pluggable       i686       1:3.90-119.el6_1.1         CentOS6.2-Repository        37 k
     perl-Pod-Escapes            i686       1:1.04-119.el6_1.1         CentOS6.2-Repository        30 k
     perl-Pod-Simple             i686       1:3.13-119.el6_1.1         CentOS6.2-Repository       209 k
     perl-libs                   i686       4:5.10.1-119.el6_1.1       CentOS6.2-Repository       590 k
     perl-version                i686       3:0.77-119.el6_1.1         CentOS6.2-Repository        49 k
    
    Transaction Summary
    ====================================================================================================
    Install       9 Package(s)
    
    Total download size: 13 M
    Installed size: 38 M
    Downloading Packages:
    (1/9): squid-3.1.10-1.el6_2.1.i686.rpm                                       | 1.7 MB     00:14
    ----------------------------------------------------------------------------------------------------
    Total                                                               881 kB/s |  13 MB     00:15
    warning: rpmts_HdrFromFdno: Header V4 RSA/SHA1 Signature, key ID c105b9de: NOKEY
    Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
    Importing GPG key 0xC105B9DE:
     Userid : CentOS-6 Key (CentOS 6 Official Signing Key) 
     Package: centos-release-6-2.el6.centos.7.i686 (@anaconda-CentOS-201112130233.i386/6.2)
     From   : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
    Running rpm_check_debug
    Running Transaction Test
    Transaction Test Succeeded
    Running Transaction
      Installing : 1:perl-Pod-Escapes-1.04-119.el6_1.1.i686                                         1/9
      Installing : 3:perl-version-0.77-119.el6_1.1.i686                                             2/9
      Installing : 4:perl-libs-5.10.1-119.el6_1.1.i686                                              3/9
      Installing : 1:perl-Pod-Simple-3.13-119.el6_1.1.i686                                          4/9
      Installing : 1:perl-Module-Pluggable-3.90-119.el6_1.1.i686                                    5/9
      Installing : 4:perl-5.10.1-119.el6_1.1.i686                                                   6/9
      Installing : perl-DBI-1.609-4.el6.i686                                                        7/9
      Installing : libtool-ltdl-2.2.6-15.5.el6.i686                                                 8/9
      Installing : 7:squid-3.1.10-1.el6_2.1.i686                                                    9/9
    
    Installed:
      squid.i686 7:3.1.10-1.el6_2.1
    
    Dependency Installed:
      libtool-ltdl.i686 0:2.2.6-15.5.el6             perl.i686 4:5.10.1-119.el6_1.1
      perl-DBI.i686 0:1.609-4.el6                    perl-Module-Pluggable.i686 1:3.90-119.el6_1.1
      perl-Pod-Escapes.i686 1:1.04-119.el6_1.1       perl-Pod-Simple.i686 1:3.13-119.el6_1.1
      perl-libs.i686 4:5.10.1-119.el6_1.1            perl-version.i686 3:0.77-119.el6_1.1
    
    Complete!
    

2. Configure server hosts file :

    [root@centos62 ~]# vi /etc/hosts
    
    127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
    ::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
    
    192.168.1.44 centos62.ehowstuff.com
    

3. Configure main squid configuration file. Use vi to edit.

    [root@centos62 ~]# vi /etc/squid/squid.conf
    

4. Add your internal network name into the IP networks list where browsing should be allowed. In this example, your internal network name is ehowstuff.com.

    acl localnet src 10.0.0.0/8     # RFC1918 possible internal network
    acl localnet src 172.16.0.0/12  # RFC1918 possible internal network
    acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
    acl localnet src fc00::/7       # RFC 4193 local private network range
    acl localnet src fe80::/10      # RFC 4291 link-local (directly plugged) machines
    acl ehowstuff.com src 192.168.1.0/24    # Your internal network
    

5. Add ehowstuff.com network in the ACL section list IP networks where browsing should be allowed :

    #http_access allow localnet
    http_access allow localhost
    http_access allow ehowstuff.com
    

6. Make sure squid proxy port is uncomment. You can change the proxy port to any available port here. As an example, other available port is 8080.

    # Squid normally listens to port 3128
    http_port 3128
    

7. Configure auto start at boot for squid service :

    [root@centos62 ~]# chkconfig squid on
    

8. Start squid service :

    [root@centos62 ~]# service squid restart
    Stopping squid: ................                           [  OK  ]
    Starting squid: .                                          [  OK  ]
    

9. Client browser configuration should be as below :

squid

How to Install Vsftpd Ftp Server on RHEL 6

In this post, i will show you on how to install Vsftpd service on Red Hat Enterprise Linux 6 (RHEL 6).This post assumed that you have configure local yum repository.

How to Setup Local Yum Repository from CD-ROM/DVD-ROM image on RHEL 6

1. Install the Vsftpd service.

    [root@rhel6 ~]# yum install vsftpd
    Loaded plugins: rhnplugin
    This system is not registered with RHN.
    RHN support will be disabled.
    DVD-RHEL6-Repository                                                         | 3.7 kB     00:00 ...
    DVD-RHEL6-Repository/primary_db                                              | 2.3 MB     00:00 ...
    Setting up Install Process
    Resolving Dependencies
    --> Running transaction check
    ---> Package vsftpd.i686 0:2.2.2-6.el6 set to be updated
    --> Finished Dependency Resolution
    
    Dependencies Resolved
    
    ====================================================================================================
     Package            Arch             Version                 Repository                        Size
    ====================================================================================================
    Installing:
     vsftpd             i686             2.2.2-6.el6             DVD-RHEL6-Repository             155 k
    
    Transaction Summary
    ====================================================================================================
    Install       1 Package(s)
    Upgrade       0 Package(s)
    
    Total download size: 155 k
    Installed size: 343 k
    Is this ok [y/N]: y
    Downloading Packages:
    Running rpm_check_debug
    Running Transaction Test
    Transaction Test Succeeded
    Running Transaction
      Installing     : vsftpd-2.2.2-6.el6.i686                                                      1/1
    
    Installed:
      vsftpd.i686 0:2.2.2-6.el6
    
    Complete!
    

2. Start Vsftpd Service :

    [root@rhel6 ~]# service vsftpd start
    Starting vsftpd for vsftpd:                                [  OK  ]
    

3. Stop Vsftpd Service :

    [root@rhel6 ~]# service vsftpd stop
    Shutting down vsftpd:                                      [  OK  ]
    

4. Restart Vsftpd Service :

    [root@rhel6 ~]# service vsftpd restart
    Shutting down vsftpd:                                      [  OK  ]
    Starting vsftpd for vsftpd:                                [  OK  ]
    

5. Make Vsftpd Service auto start on boot up :

    [root@rhel6 ~]# chkconfig vsftpd on
    

How to remove “Red Hat Enterprise Linux Test Page”

Symptoms :
After i installed apache httpd on Red Hat Enterprise Linux (RHEL) server, i got the following message :
Red Hat Enterprise Linux Test Page

Solution :
Go to welcome.conf file :

    [root@rhel6 ~]# vi /etc/httpd/conf.d/welcome.conf
    

To disable the Welcome page, comment out all the lines below :

    # This configuration file enables the default "Welcome"
    # page if there is no default index page present for
    # the root URL.  To disable the Welcome page, comment
    # out all the lines below.
    #
    <LocationMatch "^/+$">
        Options -Indexes
        ErrorDocument 403 /error/noindex.html
    </LocationMatch>
    

Comment out all the lines as below :

    # This configuration file enables the default "Welcome"
    # page if there is no default index page present for
    # the root URL.  To disable the Welcome page, comment
    # out all the lines below.
    #
    #<LocationMatch "^/+$">
    #    Options -Indexes
    #    ErrorDocument 403 /error/noindex.html
    #</LocationMatch>
    

Reload the apache httpd service to take effect :

    [root@rhel6 ~]# service httpd reload
    Reloading httpd:
    

How to Disable the SELinux on RHEL 6

In Redhat Enterprise Linux 6 (RHEL 6) minimal server installation, SELinux is set to enable. To disable SELinux, without having to reboot, you can use the setenforce command as below:

    [root@rhel6 ~]# setenforce 0
    

To disabled the SELinux on your next reboot, please change “SELINUX=enforcing” to “SELINUX=disabled”.

    # This file controls the state of SELinux on the system.
    # SELINUX= can take one of these three values:
    #     enforcing - SELinux security policy is enforced.
    #     permissive - SELinux prints warnings instead of enforcing.
    #     disabled - No SELinux policy is loaded.
    SELINUX=enforcing
    # SELINUXTYPE= can take one of these two values:
    #     targeted - Targeted processes are protected,
    #     mls - Multi Level Security protection.
    SELINUXTYPE=targeted
    

Change to the following :

    # This file controls the state of SELinux on the system.
    # SELINUX= can take one of these three values:
    #     enforcing - SELinux security policy is enforced.
    #     permissive - SELinux prints warnings instead of enforcing.
    #     disabled - No SELinux policy is loaded.
    SELINUX=disabled
    # SELINUXTYPE= can take one of these two values:
    #     targeted - Targeted processes are protected,
    #     mls - Multi Level Security protection.
    SELINUXTYPE=targeted
    

How to Install Joomla 1.7 using cPanel

There are two methods to install Joomla 1.7 on your webhosting. First method is with the automatic installer from the webhosting’s application that’s already included in the control panel, also called cPanel. Second method is manually install from the web hosting server. In this post, i will show you on how to install the Joomla 1.7 using cPanel.

1. Make sure you have domain or subdomain configured as below :
Joomla 1.7

2. Click on the QuickInstall from the Software/Services column :
Joomla 1.7

3. Select Joomla 1.7 :
Joomla 1.7

4. Click Continue :
Joomla 1.7

5. Click Install Now! :
Joomla 1.7

6. Installation has been completed. Take note on the temporary password. Kindly reset your temporary password asap :
Joomla 1.7

7. You can log in to joomla administrator’s page using the following URL:
http://domain/administrator
CMS URL will be as below : http://domain.

In this example, my joomla subdomain is http://joomla1.7.ehowstuff.com

How to Install Extra Repository for Redhat Enterprise Linux 6 (RHEL6)

In this post, i will show you on how to setup Extra Yum Repository for Redhat Enterprise Linux 6 (RHEL6).

1. How to Setup Local Yum Repository from CD-ROM/DVD-ROM image on RHEL 6

2. Setup epel yum repository for RHEL 6.

    [root@rhel6 ~]# cd /tmp
    [root@rhel6 tmp]# wget http://download.fedora.redhat.com/pub/epel/6/i386/epel-release-6-5.noarch.rpm
    --2012-01-24 08:54:00--  http://download.fedora.redhat.com/pub/epel/6/i386/epel-release-6-5.noarch.rpm
    Resolving download.fedora.redhat.com... 209.132.181.26, 209.132.181.27, 209.132.181.23, ...
    Connecting to download.fedora.redhat.com|209.132.181.26|:80... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 14064 (14K) [application/x-rpm]
    Saving to: âepel-release-6-5.noarch.rpmâ
    
    100%[==========================================================>] 14,064      41.3K/s   in 0.3s
    
    2012-01-24 08:54:01 (41.3 KB/s) - âepel-release-6-5.noarch.rpmâ
    
    [root@rhel6 tmp]# rpm -Uvh epel-release-6-5.noarch.rpm
    warning: epel-release-6-5.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
    Preparing...                ########################################### [100%]
       1:epel-release           ########################################### [100%]
    
    [root@rhel6 tmp]# yum repolist
    Loaded plugins: rhnplugin
    This system is not registered with RHN.
    RHN support will be disabled.
    epel/metalink                                                                | 3.8 kB     00:00
    epel                                                                         | 4.3 kB     00:00
    epel/primary_db                                                              | 3.4 MB     00:38
    repo id                          repo name                                                    status
    RHEL6-Repository                 RHEL6 repository                                             13,395
    epel                             Extra Packages for Enterprise Linux 6 - i386                  5,625
    repolist: 19,020
    

3. Setup Atomic yum repository for RHEL 6.

    [root@rhel6 tmp]# wget http://www6.atomicorp.com/channels/atomic/redhat/6/i386/RPMS/atomic-release-1.0-13.el6.art.noarch.rpm
    --2012-01-24 19:42:14--  http://www6.atomicorp.com/channels/atomic/redhat/6/i386/RPMS/atomic-release-1.0-13.el6.art.noarch.rpm
    Resolving www6.atomicorp.com... 69.20.6.166
    Connecting to www6.atomicorp.com|69.20.6.166|:80... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 6332 (6.2K) [application/x-rpm]
    Saving to: âatomic-release-1.0-13.el6.art.noarch.rpmâ
    
    100%[==========================================================>] 6,332       20.7K/s   in 0.3s
    
    2012-01-24 19:42:15 (20.7 KB/s) - âatomic-release-1.0-13.el6.art.noarch.rpmâ
    
    [root@rhel6 tmp]# rpm -Uvh atomic-release-1.0-13.el6.art.noarch.rpm
    warning: atomic-release-1.0-13.el6.art.noarch.rpm: Header V3 DSA/SHA1 Signature, key ID 5ebd2744: NOKEY
    Preparing...                ########################################### [100%]
       1:atomic-release         ########################################### [100%]
    
    [root@rhel6 ~]# yum repolist
    Loaded plugins: rhnplugin
    This system is not registered with RHN.
    RHN support will be disabled.
    repo id               repo name                                                               status
    RHEL6-Repository      RHEL6 repository                                                        13,395
    atomic                CentOS / Red Hat Enterprise Linux 6Server - atomicrocketturtle.com         394
    epel                  Extra Packages for Enterprise Linux 6 - i386                             5,625
    repolist: 19,414