Thursday, May 8, 2014

How To Install PhpMyAdmin On CentOS 6

It's very easy, just follow the steps:

1. Download the epel repo :

cd /tmp
wget http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm

2. Install the epel repo :

cd /tmp
rpm -ivh epel-release-6-8.noarch.rpm

3. install phpmyadmin using yum :

yum install phpmyadmin

=======================================================

 Package               Arch         Version                 Repository     Size
=======================================================

Installing:
 phpMyAdmin            noarch       3.5.8.2-1.el6           epel          4.3 M


Installing for dependencies:
 libmcrypt             x86_64       2.5.8-9.el6             epel           96 k
 php-gd                x86_64       5.3.3-27.el6_5          updates       107 k
 php-mbstring          x86_64       5.3.3-27.el6_5          updates       455 k
 php-mcrypt            x86_64       5.3.3-3.el6             epel           19 k
 php-php-gettext       noarch       1.0.11-3.el6            epel           21 k
4. Config phpmyadmin, we change the Apache configuration so that phpMyAdmin allows connections not just from localhost (add or just replace):

vi /etc/httpd/conf.d/phpmyadmin.conf

<Directory /usr/share/phpMyAdmin/>
   <IfModule mod_authz_core.c>
     # Apache 2.4
     <RequireAny>
       Require ip 127.0.0.1
       Require ip ::1
       Require ip 192.168.0.6
     </RequireAny>
   </IfModule>
   <IfModule !mod_authz_core.c>
     # Apache 2.2
     Order Deny,Allow
     Deny from All
     Allow from 127.0.0.1
     Allow from ::1
     Allow from 192.168.0.6
   </IfModule>
</Directory>
 
5. Restart httpd service.

Now test from your browser!

Httpd : Enable public_html In User Home Directory with SELinux

asas<
1. First of all, enable mod_userdir module in /etc/httpd/conf/httpd.conf
 
IfModule mod_userdir.c>
    #
    # UserDir is disabled by default since it can confirm the presence
    # of a username on the system (depending on home directory
    # permissions).
    #
    # UserDir enabled
 
    #
    # To enable requests to /~user/ to serve the user's public_html
    # directory, remove the "UserDir disabled" line above, and uncomment
    # the following line instead:
    #
    UserDir public_html
 
</IfModule>
 
2. Now we create public_html under user home directory.

mkdir ~user1/public_html

3. To make it work with SELinux, we need to change SELinux context of the public_html.

chcon --reference /var/www/html ~user1/public_html

4. Also change the permission of the public_html from 700 to 711.

chmod 711 ~user1/public_html

5. Enable SElinux boolean for httpd_enable_homedirs

sesetbool -P httpd_enable_homedirs 1
 
6. * Enable SElinux module mypol.pp
 
semodule -i mypol.pp 
 
7. * Enable SELinux boolean for httpd_read_user_content
 
setsebool -P httpd_read_user_content 1
 
8. Restart httpd.  
 
9. Done! 

* is optional
 

BIND Error : DLV validation error

I just got the dns bind error when resolver cannot resolve any outside domain, but work for local domain. The symptoms :

1. Resolver error when try to resolve to outside domain. But it works for local domain.
2. Found the error from /var/log/messages :

May  8 18:14:40 server1 named[3782]:   validating @0x7fa0e467a780: write.coffee.dlv.isc.org NSEC: bad cache hit (dlv.isc.org/DNSKEY)
May  8 18:14:40 server1 named[3782]: error (broken trust chain) resolving 'safebrowsing-cache.google.com.dlv.isc.org/DLV/IN': 8.8.8.8#53
May  8 18:14:40 server1 named[3782]: error (broken trust chain) resolving 'safebrowsing-cache.google.com/AAAA/IN': 8.8.8.8#53


Obviously I know that this might related with my laptop date and time as my cmos battery already died (drained and not replaced yet!) So, the hardware clock (RTC) is not reliable. It will be always 2008 after boot up.

This will lead to dnssec error, and ntpdate not working properly. I mean DLV validation failed.

It can be found in /etc/named.conf, you can either enable or disable it. I believe this kind of problem (battery) rarely happen for a real server (not like my lovely laptop).

 dnssec-enable yes;
 dnssec-validation yes;


So my solutions was :

1. I choose not to disable dnssec.

2. Run the ntpdate, and after date and time is synced.
 
ntpdate 0.centos.pool.ntp.org 

3. Restart named service, and try to dig any domain back.
 
service named restart

4. If you want to rely on hardware clock (RTC), run this.
 
hwclock --systohc

Done! 

Some reference for the solution (many thanks):

http://www.topdog.za.net/2012/08/22/fix-bind-error--broken-trust-chain--resolving/

http://pewetheb.blogspot.co.uk/2013/11/named-error-broken-trust-chain.html

Tuesday, March 12, 2013

How to add local http yum repository?

Follow the steps below:

1. Mount your RedHat/CentOS installation dvd, automatically it will be mount under /media/.

2. Make a directory under /var/www/html/ called "repo".

mkdir /var/www/html/repo

3. Copy all dvd contents to /var/www/html/repo/

rsync -arv /media/CentOS_6.3_Final/ /var/www/html/repo

4. Install createrepo using rpm in /var/www/html/repo/Packages/

[root@master Packages]# rpm -ivh createrepo-0.9.8-5.el6.noarch.rpm
error: Failed dependencies:
        deltarpm is needed by createrepo-0.9.8-5.el6.noarch
        python-deltarpm is needed by createrepo-0.9.8-5.el6.noarch

[root@master Packages]# rpm -ivh deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm
Preparing...                ########################################### [100%]
   1:deltarpm               ########################################### [100%]

[root@master Packages]# rpm -ivh pyt
Display all 114 possibilities? (y or n)

[root@master Packages]# rpm -ivh python-deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm
Preparing...                ########################################### [100%]
   1:python-deltarpm        ########################################### [100%]

[root@master Packages]# rpm -ivh createrepo-0.9.8-5.el6.noarch.rpm Preparing...                ########################################### [100%]
   1:createrepo             ########################################### [100%]

 


4. Create a repository metadata file in /var/www/html/repo/

createrepo .

5. Add new yum repo in /var/yum.repos.d called "local-http.repo", and insert this entry:

[root@master ~]# cat /etc/yum.repos.d/local-http.repo
[local-http]
name=Local HTTP Repo For CentOS $releasever $basearch
baseurl=http://localhost/repo/
enabled=1
gpgcheck=0


6. Clear yum cache

yum clean all

7. List current yum repo

yum repolist

Thanks

Friday, September 28, 2012

RHEL 6 / CentOS 6: Install Adobe Flash Player For Firefox Browser

Here the steps :
  1.  First download the installer in .tar.gz format at http://get.adobe.com/flashplayer/ .
  2. Extract the file.
  3. Copy the flash library to firefox :
  4. # cp libflashplayer.so /usr/lib64/mozilla/plugins/# chmod 0755 /usr/lib64/mozilla/plugins/libflashplayer.so 
  5. Or just install directly : 
  6. install -v -m 0755 libflashplayer.so /usr/lib64/mozilla/plugins
  7. Restart the firefox
    For more, please go to http://www.cyberciti.biz/faq/redhat-linux-yum-install-flash-player-for-firefox/

Friday, April 20, 2012

SAN Storage : How To Remove LUN

I did this on SLES11, but i think it can be applied on other distro also.

1. Unmap the LUN from the SAN controller.
2. To list down the current mapped LUN : multipath -ll

360050768028082bde800000000000008 dm-2 IBM,2145
size=70G features='1 queue_if_no_path' hwhandler='0' wp=rw
|-+- policy='round-robin 0' prio=0 status=active
| |- 1:0:0:1 sdc 8:32 failed faulty running
| `- 2:0:0:1 sdg 8:96 failed faulty running
`-+- policy='round-robin 0' prio=0 status=enabled
|- 1:0:1:1 sde 8:64 failed faulty running
`- 2:0:1:1 sdi 8:128 failed faulty running

3. multipath -f (LUN Id)
regdb02:~ # multipath -f 360050768028082bde800000000000008

4. clean up the scsi device record :

regdb02:~ # echo "1" > /sys/class/scsi_device/1\:0\:0\:1/device/delete
regdb02:~ # echo "1" > /sys/class/scsi_device/2\:0\:0\:1/device/delete
regdb02:~ # echo "1" > /sys/class/scsi_device/1\:0\:1\:1/device/delete
regdb02:~ # echo "1" > /sys/class/scsi_device/2\:0\:1\:1/device/delete

5. list down back the mapped LUN :

regdb02:~ # multipath -ll
regdb02:~

* empty already

5. rescan the bus

regdb02:~ # cd /usr/bin/
regdb02:/usr/bin # ./rescan-scsi-bus.sh

Done

NTPD Error : Cannot update the dynamic configuration policy.

If you face this error during configuring ntpd server, here is the simple steps :

1. cat /etc/resolv.conf.netconfig
2. edit the /etc/resolv.conf and make it same with /etc/resolv.conf.netconfig
3. retry the ntpd configuration
4. change back /etc/resolv.conf to the old

We can trace the error when tailf /var/log/messages.

Thanks