Red Hat

How to Remove failed & faulty storage (SAN) devices from server.

Procedure to remove failed & faulty SAN devices from your Linux server.

  1. First un-mount the file system(s) that mounted the device(s).
  2. If device(s) is a member of an LVM volume group, first remove LV (lvremove), then VG (vgremove) & then PV (pvremove)
  3. Remove SAN device(s) IDs from multipath configuration file & reload multipath service.
  4. Now you can reclaim SAN devices from your server. This activity should be done on storage box.
  5. After reclamation, execute “multipath -ll” command to check the status of SAN devices. Now you will see the failed & faulty devices.
  6. Finally, remove each path showing failed & faulty device(s) from the server. To do this, use below command:
    # echo 1 > /sys/block/<device-name>/device/delete

    where <device-name> will be one among the failed & faulty devices.

 

Example:

After storage reclamation, when you execute “multipath -ll” command below will be the output.

# multipath -ll | grep failed
\_ 3:0:0:1  sdc  8:32   [failed][faulty]
\_ 4:0:0:1  sdn  8:208  [failed][faulty]
\_ 3:0:0:0  sdb  8:16   [failed][faulty]

Now you need to remove these failed & faulty paths using below command:

# echo 1 > /sys/block/sdc/device/delete
# echo 1 > /sys/block/sdn/device/delete
# echo 1 > /sys/block/sdb/device/delete
Red Hat

YUM [Errno -3] Error performing checksum error.

The YUM “[Errno -3] Error performing checksum” error is generated when you are trying to install some Linux RPMs using YUM command. This Error message is stating clearly that it cannot perform the checksum and cannot continue with the installation. The checksum error message is generated because YUM client is using an older version of YUM which do not support newer checksum used to create the repomd.xml metadata files.

The checksum type used in repomd.xml and for packages in the metadata can be sha256 or older sha1 or sha.  The  default is now  “sha256″ for all RHEL 6 or Centos 6 OS. In case your repository is created on a RHEL-6 system and you are using RHEL-5 as YUM client, this is where the problem will arise.  The  older yum version 3.0 doesn’t support the sha256 checksum and can only support sha.

You can fix this checksum issue by creating YUM repository using sha instead of the default sha256.

# createrepo -v -s sha <path to your repository>
# yum clean all
# yum list
Apache Web Server

Apache Webserver Installation & Configuration.

This post will help you to install & configure Apache webserver in RHEL / CentOS.

Below are my machine’s details:

# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 6.3 (Santiago)

# hostname 
Linux-Machine.test.com

# ifconfig eth0 | grep -w inet
          inet addr:10.64.248.20  Bcast:10.64.248.255  Mask:255.255.255.0

 

Edit hosts file and add your machine’s fully qualified name against IP address.

# vim /etc/hosts
10.64.248.20    Linux-Machine.test.com    Linux-Machine

Save this file & exit.

 

Configure YUM & Install Apache packages.

# yum install httpd
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
Updating certificate-based repositories.
Unable to read consumer identity
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package httpd.x86_64 0:2.2.15-15.el6_2.1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=====================================================================================================================================================
 Package                        Arch                            Version                                      Repository                         Size
=====================================================================================================================================================
Installing:
 httpd                          x86_64                          2.2.15-15.el6_2.1                            rhel-6.3                          812 k

Transaction Summary
=====================================================================================================================================================
Install       1 Package(s)

Total download size: 812 k
Installed size: 2.9 M
Is this ok [y/N]: y
Downloading Packages:

Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : httpd-2.2.15-15.el6_2.1.x86_64 [############################################################################################### ] 1/1
Installed products updated.
Verifying  : httpd-2.2.15-15.el6_2.1.x86_64                                                                                                    1/1
Installed:
 httpd.x86_64 0:2.2.15-15.el6_2.1
Complete!

 

Check the installed RPMs.

# rpm -qa httpd
httpd-2.2.15-15.el6_2.1.x86_64

Apache Configuration.

Apache Installation directory is “/etc/httpd”

# cd /etc/httpd/
# ls -l
total 8
drwxr-xr-x  2 root root 4096 Aug 20 15:01 conf
drwxr-xr-x. 2 root root 4096 Aug 19 14:49 conf.d
lrwxrwxrwx  1 root root   19 Aug 19 14:49 logs -> ../../var/log/httpd
lrwxrwxrwx  1 root root   29 Aug 19 14:49 modules -> ../../usr/lib64/httpd/modules
lrwxrwxrwx  1 root root   19 Aug 19 14:49 run -> ../../var/run/httpd

conf –> Includes apache main configuration file (httpd.conf).

conf.d –> Includes all configuration files of virtual hosts.

logs –> Apache web server (access + error) logs. Its a soft link to “/var/log/httpd”.

modules –> Soft link to apache modules directory. It includes all the installed apache modules.

 

Edit main configuration file & make below mentioned changes.

# cd conf
# vim httpd.conf
ServerAdmin root@Linux-Machine.test.com
<VirtualHost *:80>
    ServerAdmin root@Linux-Machine.test.com
    DocumentRoot /var/www/html/
    ServerName Linux-Machine.test.com
    ErrorLog logs/LinuxMachine-error_log
    CustomLog logs/LinuxMachine-access_log combined
</VirtualHost>

Save & close this file.

 

Create an index.html file at “/var/www/html” location.

# cd /var/www/html
# vim index.html
<html>
<body>
Hi!! This is my first Apache Webserver.
</body>
</html>

Save & Close this file.

 

Start & Check Apache service status.

# /etc/init.d/httpd start
Starting httpd:                                            [  OK  ]
# /etc/init.d/httpd status
httpd (pid  25694) is running...

Enable apache service on boot time

# chkconfig httpd on

Check Process status

# ps -ef | grep httpd
root     25694     1  0 14:36 ?        00:00:00 /usr/sbin/httpd
apache   25697 25694  0 14:36 ?        00:00:00 /usr/sbin/httpd
apache   25698 25694  0 14:36 ?        00:00:00 /usr/sbin/httpd
apache   25699 25694  0 14:36 ?        00:00:00 /usr/sbin/httpd
apache   25700 25694  0 14:36 ?        00:00:00 /usr/sbin/httpd
apache   25701 25694  0 14:36 ?        00:00:00 /usr/sbin/httpd
apache   25702 25694  0 14:36 ?        00:00:00 /usr/sbin/httpd
apache   25703 25694  0 14:36 ?        00:00:00 /usr/sbin/httpd
apache   25704 25694  0 14:36 ?        00:00:00 /usr/sbin/httpd
root     25710 25658  0 14:37 pts/1    00:00:00 grep httpd

Check port status (By default, apache listens on port 80)

# netstat -ntplu | grep httpd
tcp        0      0 :::80                       :::*                        LISTEN      25694/httpd

Check  Apache / web page status in web browser.

Open URL (http://10.64.248.20) in web browser (where IP address will be your machine’s IP).

First_Apache_WebServer

First_Apache_WebServer

 

 

Red Hat

How to block IE (Internet Explorer) in Squid Proxy Server

You need to add below mentioned ACL & http_access rule in squid main configuration file (/etc/squid/squid.conf) to block IE (Internet Explorer) usage through Squid Proxy Server.

Edit Squid Configuration File

# vim /etc/squid/squid.conf
### Block IE Usage ####
acl bad_browser browser IE Gecko$
http_access deny bad_browser all

Save & Close this file.

Restart Squid Proxy Service

# /etc/init.d/squid restart
Stopping squid: ................                           [  OK  ]
Starting squid: .                                          [  OK  ]

Now try accessing any web page using IE (make sure you have configured your proxy server IP & port in IE settings).

You will get below error.

Block IE in Squid Proxy Server.

Block IE in Squid Proxy Server.

Red Hat

Squid Proxy Server Installation on RHEL / CentOS 6.

Squid is a caching proxy for the Web supporting HTTP, HTTPS, FTP and more. It reduces bandwidth and improves response times by caching and reusing frequently-requested web pages. Squid has extensive access controls and makes a great server accelerator.

Install Squid on RHEL / CentOS

# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 6.3 (Santiago)

# yum install squid -y
Loaded plugins: product-id, security, subscription-manager
Updating certificate-based repositories.
Unable to read consumer identity
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package squid.x86_64 7:3.1.10-1.el6_2.4 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=====================================================================================================================================================
 Package                         Arch                             Version                                      Repository                       Size
=====================================================================================================================================================
Installing:
 squid                           x86_64                           7:3.1.10-1.el6_2.4                           local                           1.7 M

Transaction Summary
=====================================================================================================================================================
Install       1 Package(s)

Total download size: 1.7 M
Installed size: 5.8 M
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : 7:squid-3.1.10-1.el6_2.4.x86_64                                                                                                   1/1 
Installed products updated.
  Verifying  : 7:squid-3.1.10-1.el6_2.4.x86_64                                                                                                   1/1 

Installed:
  squid.x86_64 7:3.1.10-1.el6_2.4                                                                                                                    

Complete!

To Check Squid RPM

# rpm -qa squid
squid-3.1.10-1.el6_2.4.x86_64

Squid Main Configuration file

Squid main configuration file is located at /etc/squid/squid.conf. Edit this file, add ACLs (access control list) & http_access rules as per your requirement. At least allow your local networks 192.168.10.0/24 & 192.168.10.0/24 to access web through this squid proxy server.

# vim /etc/squid/squid.conf
acl our_networks src 192.168.10.0/24 192.168.20.0/24
http_access allow our_networks

Save & Close this file.

Start / Stop / Restart / Status : Squid Proxy Server

# /etc/init.d/squid status
squid is stopped

# /etc/init.d/squid start
Starting squid: .                                          [  OK  ]

# /etc/init.d/squid stop
Stopping squid: ................                           [  OK  ]

# /etc/init.d/squid start
Starting squid: .                                          [  OK  ]

# /etc/init.d/squid restart
Stopping squid: ................                           [  OK  ]
Starting squid: .                                          [  OK  ]

Verify Squid Proxy Server Status

Default port for squid proxy is 3128 (TCP).

# netstat -ntplu | grep -w 3128
tcp        0      0 :::3128                     :::*                        LISTEN      2990/(squid)

Enable Squid Server startup on boot.

# chkconfig squid on

# chkconfig squid --list
squid              0:off    1:off    2:on    3:on    4:on    5:on    6:off
KVM

Error polling connection ‘qemu:///system’: internal error Cannot find suitable emulator for x86_64

When you are trying to connect virt-manager, it gives below error message or pop up.

Error Message

“Error polling connection ‘qemu:///system’: internal error Cannot find suitable emulator for x86_64”
 

Error Screenshot

Virtualization_Error

Virtualization_Error

 

Solution

To fix this error, you need to enable Virtualization Technology in motherboard BIOS.

Apache Web Server

Apache Tomcat Connector (mod_jk) – Installation & Configuration.

Apache Tomcat Connector (mod_jk) – Installation & Configuration.

You can download Apache Tomcat Connector using this URL : http://tomcat.apache.org/connectors-doc/

We are using Tomcat Connectors 1.2.37    (tomcat-connectors-1.2.37-src.tar.gz).

# cd /opt/

# wget http://www.apache.org/dist/tomcat/tomcat-connectors/jk/tomcat-connectors-1.2.37-src.tar.gz

# tar -zxvf tomcat-connectors-1.2.37-src.tar.gz

# cd tomcat-connectors-1.2.37-src

# cd native/

# ./configure --with-apxs=/usr/local/apache2/bin/apxs

# make

# make install

# chmod 755 /usr/local/apache2/modules/mod_jk.so

Create mod_jk.conf file & set values as per your requirement.

# vi /usr/local/apache2/conf/extra/mod_jk.conf

LoadModule jk_module modules/mod_jk.so
JkWorkersFile conf/extra/workers.properties
JkShmFile     conf/extra/jk.shm
JkShmSize     64M
JkLogFile    /usr/local/apache2/logs/mod_jk_debug.log
JkLogLevel    info
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "

Save & close this file.

Create workers.properties file & set values as per your requirement.

# vi /usr/local/apache2/conf/extra/workers.properties

worker.list=Portal

######## Worker1 - Portal ########
worker.Portal.type=lb
worker.Portal.balance_workers=Portal1,Portal2
worker.Portal.sticky_session=1

#Tomcat Server - Load Balancer Member 1
worker.Portal1.port=8019
worker.Portal1.host=<x.x.x.x>
worker.Portal1.type=ajp13
worker.Portal1.connection_pool_timeout=600
worker.Portal1.socket_timeout=600
worker.Portal1.socket_keepalive=true
worker.Portal1.lbfactor=1

#Tomcat Server - Load Balancer Member 2
worker.Portal2.port=8019
worker.Portal2.host=<x.x.x.x>
worker.Portal2.type=ajp13
worker.Portal2.connection_pool_timeout=600
worker.Portal2.socket_timeout=600
worker.Portal2.socket_keepalive=true
worker.Portal2.lbfactor=1
##################################

Save & close this file.

Edit httpd.conf file & include mod_jk.conf file.

# vi /usr/local/apache2/conf/httpd.conf
Include conf/extra/mod_jk.conf

Save & close this file.

Set permissions on Apache base directory.

# chown -R apache.apache /usr/local/apache2/

Apache configtest & service restart.

# /usr/local/apache2/bin/httpd -t
Syntax OK
# /usr/local/apache2/bin/httpd -k stop

# /usr/local/apache2/bin/httpd -k start