These are notes, I had taken down while setting up ISPConfig Hosting Control Panel on LayeredTechs Grid. Most of the steps were referenced via howtoforge and ispconfig installation notes. There were some gotchas to look out for and has bee noted below:
sandip's blog
New Server CentOS 4.4 at LT Grid with ISPConfig Installed
Submitted by sandip on Tue, 01/23/2007 - 23:52Check for number of arguments in bash
Submitted by sandip on Wed, 01/17/2007 - 11:49# Check for proper number of command line args.
EXPECTED_ARGS=1
E_BADARGS=65
if [ $# -ne $EXPECTED_ARGS ]
then
echo "Usage: `basename $0` {arg}"
exit $E_BADARGS
fi
looping through an array with the for loop in bash
Submitted by sandip on Wed, 01/17/2007 - 11:40VALUES=(
value1
value2
value3
...
valueN
)
# Alternately:
#VALUES=("value1" "value2" "value3" "..." "valueN")
for ((i=0; i<${#VALUES[@]}; i++))
do
echo ${VALUES[$i]}
done
Flash Player 9 released for linux
Submitted by sandip on Wed, 01/17/2007 - 09:22Adobes' Flash Player 9 is now public ready and can be downloaded from macromedia.mplug.org.
Quick install on Fedora using yum repository:
-
Create the yum repo file as below:
# cat << EOF > /etc/yum.repos.d/macromedia.repo
[macromedia]
name=Macromedia for i386 Linux
baseurl=http://macromedia.rediris.es/rpm/
enabled=0
gpgcheck=1
gpgkey=http://macromedia.mplug.org/FEDORA-GPG-KEY
EOF
Install the flash-plugin via yum:
# yum --enablerepo=macromedia -y install flash-plugin
Search Engine Friendly Redirects
Submitted by sandip on Mon, 01/15/2007 - 01:06301 redirect is the most efficient and Search Engine friendly method for webpage redirection. If you have to change file names or move pages around, it's the safest option and preserves your search engine rankings. The code "301" is interpreted as "moved permanently".
With php:
<?
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://host.domain.tld" );
?>
With mod_rewrite:
RewriteEngine on
#Redirect Old domain to New domain
RewriteRule (.*) http://host.domain.tld/$1 [R=301,L]
# Redirect a particular domain
RewriteCond %{http_host} ^domain\.tld$ [NC]
RewriteRule ^(.*)$ http://host.newdomain.tld/$1 [R=301,L]
# Redirect a particular file
RewriteRule ^old_file.html$ http://host.domain.tld/new_file.html [R=301,L]
Block IP addresses from accessing your site via .htaccess
Submitted by sandip on Sun, 01/14/2007 - 00:47There are couple ways to block an IP, the one general way is to use htaccess deny feature.
SetEnvIf REMOTE_ADDR "^xxx.xxx.xxx.xxx$" badip
SetEnvIf REMOTE_ADDR "^xxx.xxx.xxx.xxx$" badip
<Limit GET POST>
order deny,allow
deny from env=badip
</Limit>
Extract individual files from an RPM
Submitted by sandip on Mon, 01/01/2007 - 17:39To extract an individual file from an rpm package without installing the rpm:
-
Use rpm2cpio or rpm -qpl to list files and full paths in the package:
$ rpm2cpio <package_name> | cpio -t
Use rpm2cpio to extract a file. Run this command from /tmp or elsewhere in order to avoid overwriting any current system files.
This creates the full path in the current directory and extracts the file specified.
$ rpm2cpio <package_name> | cpio -iv --make-directories <full-file-path>
To extract everything to the current directory:
$ rpm2cpio <package_name> | cpio -ivd
Load your PHP pages faster with GZip compression
Submitted by sandip on Sat, 12/23/2006 - 00:57If you have heavy pages with lots of images and text, you can greatly improve its' performance by dynamically compressing the page with php.
Put the below code in the header of each php page.
<? ob_start("ob_gzhandler"); ?>
It automatically gzips the page for browsers that support it.
This could also be set in the php.ini file instead, so all php pages are automatically compressed without having to add the above code in each and every php page.
In php.ini add the below code:
output_handler = ob_gzhandler
extracting initrd.img file on Fedora Core 6
Submitted by sandip on Sat, 11/25/2006 - 02:22initrd in Fedora Core 6 is a gzipped cpio archive which can be extracted using:
$ cd /tmp
$ gunzip < /boot/initrd.img |cpio -i --make-directories
Upgrading Fedora Core with Yum Remotely
Submitted by sandip on Fri, 11/24/2006 - 00:21I have recently upgraded Fedora Core 2 to Fedora Core 3 using Yum. The steps are outlined below:
-
Import the Fedora RPM-GPG-KEY if not done so already.
# rpm --import /usr/share/rhn/RPM-GPG-KEY-fedora
# wget http://download.fedoralegacy.org/fedora/3/os/i386/fedora-release-3-8.i386.rpm
# wget http://download.fedoralegacy.org/fedora/3/os/i386/yum-2.1.11-3.noarch.rpm
# rpm -Uvh --force fedora-release*.rpm yum*.rpm
# yum update kernel
# lilo -v -v
# lilo -R 2.6.12-1.1381_FC3
# yum remove kernel-2.4*
# yum upgrade
Reboot once the upgrade is successful.