buy tb-500

Archive for the ‘Linux’ Category

How to switch to a different PHP version?

Saturday, May 28th, 2011

How to switch to a different PHP version?

SiteGround has implemented a unique server setup that allows each customer to choose which version of PHP to use for his / her account. What is more, the customer can even use different PHP versions for different directories in one and the same hosting account.

The PHP versions currently supported are: PHP 4.4 PHP 5.0,  PHP 5.1, PHP 5.2, PHP 5.3 and a special additionally secured version of PHP 5.2 with Suhosin patch.

It is really easy to change PHP versions for your website with a web hosting account with SiteGround. All you need to do is follow those step:

1. Log in to cPanel for your account.
2. Go to Advanced section -> PHP Version Change
3. Navigate to the directory you would like to change the PHP version for (note that the change will apply to sub-directories for it as well)
4. Click on the directory name.
5. Select the desired PHP version and click Save.

That is all.

You can find detailed instructions how to manually change the PHP version for your account below:

Go to cPanel, File Manager and choose “Web Root (public_html/www)”. There create a new file (or edit the existing one) called .htaccess and add the following line:
To switch to PHP 4.4:

AddHandler application/x-httpd-php4 .php .php4 .php3

To switch to PHP 5.0:

AddHandler application/x-httpd-php5 .php .php5 .php4 .php3

To switch to PHP 5.1:

AddHandler application/x-httpd-php51 .php .php5 .php4 .php3

To switch to PHP 5.2:

AddHandler application/x-httpd-php52 .php .php5 .php4 .php3

To switch to PHP 5.3:

AddHandler application/x-httpd-php53 .php .php5 .php4 .php3

To switch to the secure PHP 5.2 with Suhosin patch:

AddHandler application/x-httpd-php52s .php .php5 .php4 .php3

This setting will apply recursively to all of the subdirectories. In case you’d like to have a different version of PHP in a subdirectory, create a new .htaccess file in it with the directive for the desired PHP version in it.

Rebuild php.ini in cpanel server (linux)

Saturday, May 28th, 2011

You can rebuilt php.ini by running the below command

/scripts/phpini

References

http://forum.ahosting.net/how-rebuild-php-ini-cpanel-server-656.html

Openvpn

Saturday, May 28th, 2011

OpenVPN Termination on OpenWrt

This page contains an overview on how to configure an OpenVPN client on a Linksys WRT54GS running OpenWrt.

Introductory Information

To secure the wireless network link between the WRT client and the remote access point, I chose to setup a VPN tunnel, and route all traffic from the network behind the WRT through this VPN tunnel.

OpenVPN was chosen, due to the availability of packages for OpenWrt and numerous other platforms, the security it provides, and the flexibilty and ease of configuration.

I chose to configure my linux router at the remote end as the OpenVPN server, with the OpenVPN client being the WRT.

Note that I’m using pre-shared keys, rather than SSL/TLS, as it simplifies the configuration.

As the subnet behind the WRT is houwels.sgnet.wafreenet, and it is connecting to the SGNet router, I prefix all OpenVPN configuration files with the name of the subnet, namely houwels.

Network Addressing
The following network addresses are used below:

10.60.68.16/29 client subnet behind WRT
10.60.68.17 LAN interface of WRT
10.60.68.18-22 client PCs behind WRT
10.60.68.232/30 client link between SGNet and WRT
10.60.68.233 virtual interface on SGNet router
10.60.68.234 WLAN interface of WRT
10.60.68.236/30 VPN link between SGNet and WRT
10.60.68.237 VPN end-point on SGNet router
10.60.68.238 VPN end-point on WRT

Substitute your own network addresses when implementing your own configuration.

Install & Configure OpenVPN Server
Install OpenVPN Server
I’m using an OpenVPN 2.0.5 server on a RedHat 9 linux box. Refer to the OpenVPN documentation for information on installing OpenVPN on RedHat and other linux distributions.

Create Static Key
On the linux router, create a pre-shared static key for the VPN link:

  openvpn --genkey --secret /etc/openvpn/houwels_static.key

Create Configuration File
The OpenVPN configuration file (/etc/openvpn/houwels_openvpn.conf) on the SGNet linux router is similar to this:

  # Use a dynamic tun device.
  dev tun0

  # 10.60.68.237 is our local VPN endpoint (SGNet).
  # 10.60.68.238 is our remote VPN endpoint (WRT).
  ifconfig 10.60.68.237 10.60.68.238

  # up script will establish routes once the VPN is alive.
  up ./houwels.up

  # pre-shared static key
  secret houwels_static.key

  # OpenVPN uses UDP port 1194 by default.
  # Each OpenVPN tunnel must use a different port number.
  port 1194

  # Downgrade UID and GID to "nobody" after initialization for extra security.
  user nobody
  group nobody

  # use LZO compression.
  comp-lzo

  # More reliable detection when a system loses its connection.  
  ping 15
  ping-restart 45
  ping-timer-rem
  persist-tun
  persist-key

  # Silence  the output of replay warnings, which are a common false
  # alarm on WiFi networks.  This option preserves the  security  of
  # the replay protection code without the verbosity associated with
  # warnings about duplicate packets.
  mute-replay-warnings

  # Verbosity level.
  # 0 = quiet, 1 = mostly quiet, 3 = medium output, 9 = verbose 
  verb 3

Create Routing Script
OpenVPN can run a script when the VPN link is established. This is useful, as it allows you to add a route through the VPN tunnel.

On the SGNet router, I use the following script (/etc/openvpn/houwels.up) to add a route to the subnet behind the WRT (10.60.68.16/29):

  #!/bin/bash

  # add route to houwels network via VPN end-point of WRT
  route add -net 10.60.68.16 netmask 255.255.255.248 gw $5

Note that the houwels.up script must be executable:

chmod 755 /etc/openvpn/houwels.up

Start OpenVPN
Once configured, start OpenVPN. On my RedHat linux router, it’s simply a matter of running

  /etc/init.d/openvpn start

and OpenVPN will parse each .conf file it finds in /etc/openvpn/, and start an OpenVPN daemon for each.

Install Components on OpenWrt
Install IPK Packages
Firstly, install the OpenVPN package and dependancies.

ipkg install openvpn

and ipkg will automatically install all required dependancies, including kmod-tun, liblzo, libopenssl, and of course the openvpn package.

The liblzo package provides libraries to support lzo compression for OpenVPN, the libssl package provides libraries for SSL encryption used by OpenVPN, and the kmod-tun package provides the TUN/TAP device driver kernel module required by OpenVPN.

Create Configuration Files
Firstly, create a directory for all OpenVPN configuration files on the WRT:

  mkdir /etc/openvpn

Copy the previously created shared static key (houwels_static.key) from the linux router into /etc/openvpn on the WRT.

Create the configuration file for the OpenVPN link, /etc/openvpn/houwels_openvpn.conf:

  # Use a dynamic tun device.
  dev tun

  # OpenVPN server is the SGNet router.
  remote 10.60.68.233

  # 10.60.68.238 is our local VPN endpoint (WRT).
  # 10.60.68.237 is our remote VPN endpoint (SGNet).
  ifconfig 10.60.68.238 10.60.68.237

  # up script will establish routes once the VPN is alive.
  up /etc/openvpn/houwels.up

  # pre-shared static key
  secret /etc/openvpn/houwels_static.key

  # OpenVPN uses UDP port 1194 by default.
  # Each OpenVPN tunnel must use a different port number.
  port 1194  

  # Downgrade UID and GID to "nobody" after initialization for extra security.
  user nobody

  # use LZO compression.
  comp-lzo

  # More reliable detection when a system loses its connection.
  ping 15
  ping-restart 45
  ping-timer-rem
  persist-tun
  persist-key

  # Verbosity level.
  # 0 = quiet, 1 = mostly quiet, 3 = medium output, 9 = verbose
  verb 3

Create a script /etc/openvpn/houwels.up to establish a default route through the VPN once it is active:

  #!/bin/ash

  # add default route through VPN tunnel
  route add -net 0.0.0.0 netmask 0.0.0.0 gw $5

Once again, the houwels.up script must be executable:

chmod 755 /etc/openvpn/houwels.up

Using OpenVPN on OpenWrt
Start OpenVPN
Before OpenVPN can be started, the tun device driver needs to be loaded:

  insmod tun

Note that this module will be automatically loaded by OpenWrt during a reboot, as installation of the OpenVPN ipkg has alreadycreated /etc/modules.d/20-tun.

Now manually start OpenVPN using:

  openvpn --daemon --config /etc/openvpn/houwels_openvpn.conf

Test the VPN by trying to ping the remote end-point of the VPN tunnel.
If it’s not working, increase the verbosity level in the configuration file, restart OpenVPN, and monitor the syslog to see why it might be failing to connect (use logread on OpenWrt, and monitor /var/log/messages on the linux router).

Configure OpenVPN to Auto-Start
To get OpenVPN to start each time the WRT is rebooted, create /etc/init.d/S65openvpn with the following contents:

  #!/bin/sh

  # start the VPN
  openvpn --daemon --config /etc/openvpn/houwels_openvpn.conf --ifconfig-nowarn

and make the script executable:

  chmod 755 /etc/init.d/S65openvpn

Completing Configuration
Firewall Script
Note that you’ll need to modify the firewall script on the WRT to allow for the VPN tunnel.
I modified the firewall to only allow traffic through the VPN tunnel, and block all other non-VPN-ed traffic.

Performance Testing
Network Architecture
This WRT is connecting to an 802.11b Minitar MNWAPB access point, and hence is restricted to 802.11b 11Mbps speeds.

The throughput was measured by using wget to retrieve a 3MB file over the wireless link.

Initial tests were performed during setup, when the WRT was physically located close to the Minitar access point, so the WRT was associated to the Minitar with a link rate of 11Mbps. The tests were repeated once the WRT was installed at the client site, with similar results.

Throughput Without VPN
Throughput over the wireless link between the WRT and the Minitar was tested at approximately 600 kbytes/sec (ie, typical for an 802.11b wireless link).

Throughput With VPN
Once the VPN tunnel was established, and all traffic routed through it, the tests were repeated. Throughput dropped to approximately 300 kbytes/sec.

The major cause of this slow-down is the CPU in the WRT, as it needs to encrypt and decrypt all the traffic that is passing through the VPN tunnel. This can be observed by monitoring the CPU usage on the WRT while transferring large amounts of traffic through the VPN tunnel – the OpenVPN process consumes 99% of the CPU during this time.

The slow-down caused by the VPN tunnel is acceptable in the situation I’m using the WRT. If this isn’t the case, the throughput of the VPN tunnel can be increased by moving the VPN termination from the WRT onto a faster device (ie, a linux router) behind the WRT.

References

http://martybugs.net/wireless/openwrt/openvpn.cgi

Install APC php cacher in linux server

Wednesday, May 25th, 2011

You need to install ELS first then install APC using below command

els –apc

That is all,

how to install ELS? you will find the guide in the current blig, just serarch about it

If you need further assist,, feel free to send email

Thank you.

Install Els in linux server

Wednesday, May 25th, 2011

To install ELS, simply run the following command as root:
wget --output-document=installer.sh http://servermonkeys.com/projects/els/installer.sh; chmod +x installer.sh; sh installer.sh

References

http://www.servermonkeys.com/els.php

Thant is all

Install Fantastico in WHM (cpanel server)

Wednesday, May 25th, 2011

You don’t need to download any files in order to install Fantastico!

Just SSH to your server and enter following commands (you may also copy/paste):

cd /usr/local/cpanel/whostmgr/docroot/cgi
wget -N http://files.betaservant.com/files/free/fantastico_whm_admin.tgz
tar -xzpf fantastico_whm_admin.tgz
rm -rf fantastico_whm_admin.tgz

NOW GO TO YOUR WHM -> Add-Ons (Plugins on v11.x or higher) -> Fantastico De Luxe WHM Admin (scroll down the left menu).

Follow the on screen instructions.

If you get a Source Guardian error when you go to Fantastico for the first time, just run this command:

chmod -R 0755 /usr/local/cpanel/3rdparty/etc/ixed

fter the installation is complete, click on “Settings” and go through the settings. While some settings are not important, some other (marked below with an *) are essential for a proper functioning of Fantastico installations.
Language: Select the language for the admin backend AND default language for users without a language selected.
Email notifications: Enter an email address in order to receive notifications when users perform installations using Fantastico.
Master files settings (*): If you are not an advanced user who modifies the master files, leave this to “Remove”. Change this only if you know what you are doing
PHPsuexec (*): VERY ESSENTIAL!!! Changing this value will not install or de-install phpsuexec for you. It will only tell Fantastico that you have phpsuexec installed or not installed on your server. Change to “installed” if you perform installations which produce an “Internal Server Error”. Notice: Changes will not apply to existing installations! You have to re-install in order to have working installations.
Path to netPBM: Enter the full path to the netPBM binaries in order to enable Gallery installations. As long as this field has no value, your users will not be able to install Gallery.
Select Fantastico licensing and files server: If the Fantastico pages take long to load switch to the server that works best for you. Fantastico will auto-switch if connections time out.
Update preference: Select latest version (sometimes experimental) or stable version (best working).

If your users don’t see a Fantastico link in their CPanel: Go to WHM and edit the “default” Features List. Activate Fantastico.

References

http://www.crucialp.com/resources/tutorials/dedicated-server/how-to-install-installing-fantastico-cpanel-whm.php

Fantastico is not installed at the default location /usr/local/cpanel/3rdparty/fantastico. Either move the Fantastico directory from it’s current location to /usr/local/cpanel/3rdparty/fantastico OR enable ioncube loaders in WHM -> Tweak settings.

Tuesday, May 17th, 2011

Solution is

just SSH to the server and restart cpanel services by run the below command

service cpanel restart

Then the issue will be fix.

Than kyou.

Migration from Cpanel server to Cpanel server using command (Linux)

Sunday, May 15th, 2011

if you want to do migration from Linux Cpanel Server to other  Linux Cpanel  server Manually,

1- SSH to the source server

then run below command to package the account

/scripts/pkgacc domain username

after done the packge then run the below command

scp -P portN packgeName root@DIP:/home

then will ask you about the password for the destination server, enter the password and the transfer will be start

after done the transfer, then refer to 2

2- SSH to the destination server, open the home directory by run this command

cd /home

then you will find the package name that you transferred it from the source server, after that refer to 3

3- extract the packge by run this command

/scripts/restoreacc  domain username

That is all, done, then now you need to go Cpanel for the destination server and u will find the domain is migrated already with all the emails and every thing , database

4- change the DNS pointing from registrar to the new server

Notes

portN = SSH port number for the destination server, most of the time will be 22 or 55000
Package name = cpmove_domain username.tar.gz
DIP= destination ip adreess, for the destination server

install rar in linux server

Wednesday, May 11th, 2011

if you want to enable rar in your linux server, then refer to below

Download this package:

http://download.gna.org/unrar/unrar-0.0.1.tar.gz

Go to the direcotry where you downloaded it and type these commands (as root):

tar -xvzf unrar-0.0.1.tar.gz
cd unrar-0.0.1
./configure
make
make install

After these steps logout from root and try again to extract your rar file.

references

http://www.unixresources.net/linux/lf/15/archive/00/00/18/06/180675.html

How to create FTP account in Cpanel

Wednesday, May 11th, 2011

Please refer to below URL will teach you how to create FTP

http://www.siteground.com/tutorials/ftp/ftp_account.htm

Thank you.