Php pecl config error on centos

When installing php PECL On CentOS/RHEL (+cPanel) installations, if you get a “checking whether the C compiler works… configure: error: cannot run C compiled programs”, you may need to remount the /tmp and /var/tmp with exec permissions first:

$ mount -o remount,exec,suid /tmp
$ mount -o remount,exec,suid /var/tmp

Then:

$ pecl install {package}

And, don’t forget to remount them as noexec after.

 

 

locate: can not stat () `/var/lib/mlocate/mlocate.db’

Run updatedb first.  You can run it manually from the command line.

updatedb

It should have scheduled itself as a cron job when you installed slocate.  If you just installed slocate, it will not have run yet.  Otherwise, make sure you have a cron daemon running and that there is an updatedb task scheduled.  Also, make sure your computer is on when it it is scheduled

If this is a VM and does not run continuously especially never spent days on this will happen. Just in case check the cron job found here:

The cron job is found here:

/etc/cron.daily/mlocate.cron

Thats’ pretty much it.

Centos No-IP setup

Howto Install no-ip utility in CentOS to fix dynamic ip issues using a subdomain from no-ip.org.

First go to no-ip webpage http://www.no-ip.com

Register and confirm your email, then login your account and add a host. Download the linux client As user root execute:

cd;wget "https://www.no-ip.com/client/linux/noip-duc-linux.tar.gz"
tar -xvf noip-duc-linux.tar.gz
cd noip-2.1.9-1
make
make install

Create a configuration file:

noip2 -C

The script will ask you which ethernet port to use, then write your email account you use to register with no-ip, then the password, finaly choose the host you will be using.

Now lets create init file to wake up the deamon every time we start our box.

cd /etc/init.d
nano noip2d

Add the following in noip2d :

# chkconfig: 345 20 80
# description: Starts noip2 deamon to check for dynamic ip \
# and updates new ip to no-ip.org dns cache.
#######################################################
#! /bin/sh
# . /etc/rc.d/init.d/functions # uncomment/modify for your killproc
case "$1" in
start)
echo "Starting noip2."
/usr/local/bin/noip2
;;
stop)
echo -n "Shutting down noip2."
echo "."
for i in `noip2 -S 2>&1 | grep Process | awk '{print $2}' | tr -d ','`
do
noip2 -K $i
done

##killproc -TERM /usr/local/bin/noip2
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
esac
exit 0
#######################################################

Save and Exit, now lets work on the permits:

 chmod +x /etc/init.d/noip2d
 chmod 700 /usr/local/bin/noip2
 chown root:root /usr/local/bin/noip2
 chkconfig --levels 3 noip2d on
 noip2d start

Verify the deamon is running:

 ps aux | grep noip2

If everything goes as plan, you have no-ip service in your box and will be updating every time your ip changes.

Finaly try to see your machine in your browser. http://myhostname.no-ip.org

Thanks for reading.

Amazon EC2 Docs and locations

To work with command line on the Amazon Cloud you need to get hold of the following file which is the EC2-api-tools look for the latest version here :

I used the file found here.

When trying to setup the Amazon EC2 tools you would expect to have some script that asks you key questions and sets up the environment for you.

Well not quite so.

Starting Point is here : Setting Up the Amazon EC2 Command Line Tools

1)  Install the Java JDK (Java Development Kit) OR  RTE ( Run Time Engine ) found here. For cento select the rpm.

13:30:16-root@controller:~$ yum install jre-7u9-linux-i586.rpm

2)  Test the java installation

13:36:56-root@controller:~$ java -version
java version “1.7.0_09”
Java(TM) SE Runtime Environment (build 1.7.0_09-b05)
Java HotSpot(TM) Client VM (build 23.5-b02, mixed mode, sharing)

3)  Download and unpack the api tools

13:38:39-root@controller:/tmp$ wget “http://s3.amazonaws.com/ec2-downloads/ec2-api-tools.zip”

13:39:49-root@controller:/tmp$ unzip ec2-api-tools.zip

4)  Move it to the user home folder under a new folder e.g. ec2

13:39:52-root@controller:/$ mv /tmp/ec2-api-tools-1.6.4/ ~/ec2/

5) Create a softlink to the new version (used for rewiring later when new versions are installed)

13:39:53-root@controller:/$ ln -s ~/ec2/ec2-api-tools-1.6.4/ ~/ec2/api

Create a shell script with the following environment parameters to tell amazon where the stuff is and who you are:

I add this script to my /etc/profile.d/ec2 since only two users on this machine is me :).

 

 

#!/bin/bash
export JAVA_HOME=/usr
export EC2_HOME=/root/ec2/api
export PATH=$PATH:$EC2_HOME/bin  
export AWS_ACCESS_KEY=XXXXXXXXXXX
export AWS_SECRET_KEY=//XXXXXXXXXXXXXXXXX
export EC2_URL=https://ec2.eu-west-1.amazonaws.com

 

 

Other Documents :

 

 

Adding a XFS filesystem to CentOS 5

Howto use enterprise Linux ‘extras’ to mount a XFS filesystem on a CentOS v5.2 VM

Install RPM’s
Note: Due to this bug (3205), install binutils to overcome the error “xargs: nm: No such file or directory” while installing kmod-xfs-xen.

# yum install binutils
# yum install xfsprogs yum-kmod kmod-xfs-xen

# mkfs.xfs -f /dev/sda1

Check

A chunk of disk (2TB) has been allocated to a LVM partition for the VM, which is formatted with XFS. The device is mapped into the VM as /dev/xvdc1 (i.e. a whole device, c.f. partitioned device).

Before using the filesystem, perform a check:

# xfs_check /dev/xvdc1

Note: xfs_check requires a significant chunk of memory to run. With 2Gbyte of swap and 1Gbyte of RAM a check was unsuccessful.

Mount
Mount the disk by using it’s volume label. The label can be verified with the xfs_admin program:

# xfs_admin -l /dev/xvdc1
label = “purple-files”

Add the mount entry to ‘/etc/fstab’ so that the filesystem is automatically mounted at the next restart.

LABEL=purple-files /files xfs defaults 0 0
Mount the filesystem

# mount /files

NOTE: CENTOS 6.X

Centos 6.X (64bit) already supports XFS in kernel. You only need to
install xfsprogs package to mount xfs filesystems.

just yum install xfsprogs (it is included in centos 6.2 base)

Appendices

# yum install xfsprogs yum-kmod kmod-xfs-xen

Dependencies Resolved

=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
kmod-xfs-xen x86_64 0.4-2 extras 256 k
xfsprogs x86_64 2.9.4-1.el5.centos extras 1.3 M
yum-kmod noarch 1.1.10-9.el5.centos base 15 k

Transaction Summary
=============================================================================
Install 3 Package(s)
Update 0 Package(s)
Remove 0 Package(s)

Total download size: 1.6 M

Search entire filesystem for text in Linux

To search for text through the entire filesystem from the current path down in Linux use the following :

find / -type f -print0 | xargs -0  grep -l  "string to search" 2>/dev/null

Script to list all the MAC addresses on the system

Listing the mac addresses of nic cards excluding null or loopback MACs i.e. 00:00:00:00:00:00

grep -H . /sys/class/net/*/address | awk ‘{split($0,array,”address:”);print array[2]}’ | grep -v ’00:00:00:00:00:00′

 

 

 

Force fsck on next boot

Since live systems are near to impossible to fsck when running (unless you can pull one side of the mirror then clone it to the other (very messy).

Become Root

sudo su –

or

su –

As root create file in root folder a file named forcefsck

touch /forcefsck

Restart the system.

shutdown -r now