Compile apc and ssh2 for PHP 5.2.xx in Linux (ssh2, apc)

APC for Php 5.2.xx:

  1. wget http://pecl.php.net/package/apc
  2. unzip the download file
  3. run phpize in the unzip folder
  4. ./configure –enable-apc –with-php-config=/usr/local/bin/php-config
  5. make && make install
  6. enable the apc.so in php.ini

SSH2 for Php 5.2.xx

  1. wget http://www.libssh2.org/download/libssh2-1.2.5.tar.gz
  2. wget http://pecl.php.net/get/ssh2
  3. unzip all downloaded files
  4. in libssh2 folder
  5. ./configure && make && make install
  6. in SSH2 folder
  7. phpize
  8. ./configure && make && make install
  9. enable the ssh2.so in php.ini
Share

Load balance in CentOS

1. Testing your system if the bonding driver is available

modprobe bonding miimon=100
ifconfig bond0 192.168.1.1 netmask 255.255.255.0
ifconfig eth0 down
ifconfig eth1 down
ifenslave bond0 eth0 eth1

2. Create the network configration file for next reboot

create /etc/sysconfig/network-scripts/ifcfg-bond0

DEVICE=bond0
BOOTPROTO=static
ONBOOT=yes
NETWORK=192.168.1.0
NETMASk=255.255.255.0
IPADDR=192.168.1.13
GATEWAY=192.168.1.1
USERCTL=no

edit /etc/sysconfig/network-scripts/ifcfg-eth0 and eth1

**** original config *****
MASTER=bond0
SLAVE=yes

load bonding driver to modprode

edit /etc/modprobe.conf add

****** original config ********
alias bond0 bonding
options bond0 miimon=100 mode=1

reboot system

Share

Can’t edit a file in Linux even the root

In some case, the Linux have some files will not allow user edit directly. It will append immutable permission to the file. The file will not allow every one to edit or delete, unless the attribute has been removed.

lsattr path_to_file

Will show the addition attribute for the file or folder.

chattr -i path_to_file

Will change the file to immutable permission.

Share

Cent OS 5 PPTPD Setup VPN + NAT

PPTP Server Installation in CentOS 5

This document is shown how to build a Linux Point to Point Tunneling Protocol (PPTP) server using Poptop. This allows roaming users to connect to their corporate network from anywhere on the Internet securely and inexpensively. It supports Windows 95/98/Me/NT/2000/XP PPTP clients and Linux PPTP clients. The requirements are:
  • CentOS 5
  • kernel-2.6.18-8.el5
  • ppp-2.4.4-1.el5

Kernel version 2.6.15 or above has MPPE built-in which is required for MSCHAPv2. CentOS 5 kernel version is 2.6.18 that means you do not need to install the MPPE module. CentOS 5 comes with ppp-2.4.4-1.el5 and it is MPPE support enabled.

1. Run the command below to test if your kernel supports MPPE and you should get a return an “ok”:

modprobe ppp-compress-18 && echo ok

2. Download the RPM file pptpd-1.3.4-1.rhel5.1.i386.rpm from:

http://poptop.sourceforge.net/yum/stable/packages/

3. Install the RPM by running this command:

rpm -ivh pptpd-1.3.4-1.rhel5.1.i386.rpm

4. Change the following file /etc/ppp/options.pptpd as below:

name pptpd
refuse-pap
refuse-chap
refuse-mschap
require-mschap-v2
require-mppe-128
proxyarp
lock
nobsdcomp
novj
novjccomp
nologfd

5. Change the following file /etc/pptpd.conf as below:

option /etc/ppp/options.pptpd
logwtmp
localip 192.168.2.2
remoteip 192.168.99.11-15

6. Add the following username (johndie) and password (passwrd) in /etc/ppp/chap-secrets as below:

# Secrets for authentication using CHAP
# client server secret IP addresses
johndoe pptpd passwrd *

7. Run the following command to enable the pptpd to start automatically in runlevel 3 and 5 as below:

chkconfig –level 35 pptpd on

8. Now, you can start the pptpd service as below:

service pptpd start

9. For pptpd to work, the packet forwarding must be enabled. Edit /etc/sysctl.conf and change the line to below:

net.ipv4.ip_forward = 1

10. To enable it immediately, run the following command below:

sysctl -p

11. To enable NAT routing, run the following command below:

iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -o eth0 -j MASQUERADE

Share