Enabling quotas for users
Fri, 03/23/2007 - 10:58 — sandipCheck to make sure the quota package is installed, else run:
# yum install quota
Edit "/etc/fstab" and add "usrquota,grpquota" to the / partition:
LABEL=/ / ext3 defaults,usrquota,grpquota&nbs p; 1 1
Then run:
# mount -o remount /
# quotacheck -avugm
# quotaon -avugm
To check quotas for all users:
# repquota -a
To edit quota for a particular user:
# edquota -u <user>
Alternately use setquota:
# setquota <softlimit> <hardlimit> 0 0 <user>
Creating LVM partitions.
Fri, 03/23/2007 - 10:34 — sandipAfter creating a new partition (/dev/hda5) with fdisk run the below commands:
# partprobe
# pvcreate /dev/hda5
# vgcreate vg0 /dev/hda5
# lvcreate -L 1G -n lv0 vg0
# mke2fs -j /dev/vg0/lv0
Extending LVM
Fri, 03/23/2007 - 09:19 — sandipExtend partition by 1Gb.
# lvresize -L +1G /dev/vg00/lvol0
# e2fsck -f /dev/vg00/lvol0
# resize2fs -pf /dev/vg00/lvol0
Notes:
-
resize2fs has replaced ext2online in FC6.
need to unmount volume prior to doing resize2fs.
Restoring corrupt rpm database
Fri, 03/23/2007 - 08:09 — sandipIf you have a corrupt rpm database, simply delete the db files and rebuild it again.
# rm -rf /var/lib/rpm/*db.*
# rpm --rebuilddb
New Hosting Server Checklist
Tue, 02/20/2007 - 11:20 — sandipBelow are some basic guidelines on setting up new hosting servers. This is only a point of reference to begin with and you should know what you are doing, else it is highly advisable to get an expert to work on setting up and securing the server:
Synopsis:
-
Scan server with tools such as netstat, nmap, nessus etc...
Disable services not required.
Remove packages not required.
Update all other packages.
Secure Incoming and Outgoing ports.
Move SSH to a different port and disable direct root login.
Enable Antidos and BruteForce Detection.
Scan for rootkits and setup daily reporting.
Secure tmp and tmpfs.
Secure binaries, paths and profiles.
Secure Apache and PHP, and cofigure to expose minimum info about the applications used.
Secure Ftp via TLS/SSL connection.
...
Host Networking on VirtualBox
Thu, 02/08/2007 - 10:32 — sandipThis is how I got host networking for VirtualBox and have it setup to use bridging on FedoraCore 6 host. This allows for two way traffic between the host and the guest. You will need bridge-utils and uml-utilities.
The first step is to configure the host with a bridge and a tap device. With this only the bridge will get an IP address and not the ethX nor the tapX device.
I am using dhcp to assign the IP addresses so the basic commands on the host are as below and can be put in the rc.local file for it to come up on boot:
# VirtualBox Bridging
# load the tun module
modprobe tun
# Create a tap device with permission for the user running vbox
tunctl -t tap0 -u {user}
chmod 666 /dev/net/tun
# Bring up ethX and tapX in promiscuous mode
ifconfig eth0 0.0.0.0 promisc
ifconfig tap0 0.0.0.0 promisc
# Create a new bridge and add the interfaces to the bridge.
brctl addbr br0
brctl addif br0 eth0
brctl addif br0 tap0
# Give the bridge a dhcp address.
dhclient br0
You should now be able to use host networking in VirtualBox, just change "attached to" to "host interface" and add the interface name of "tap0" in your networking settings for the guest.
Notes:
If you're using a firewall on your host, make sure to turn it off when testing network setup.
I have had success with using APF as firewall which seems compatible with bridging.
References:
Preparing and presenting video for the web...
Sat, 02/03/2007 - 20:13 — sandipRecently, I've had to convert a 15 minute infomercial for BetterDaysMinistries.org, a non-profit organization. I was provided with a dvd, that cycled the infomercial twice during playback. Besides, the phone number and address shown on the original infomercial was old and that information needed to be updated. Below are highlights of the whole conversion process.
Migrating sites between DirectAdmin servers
Fri, 02/02/2007 - 10:55 — sandipThese are some basic notes for reference just in case I need to do the migration thing again!!!
Steps taken on the old server
-
Created a new reseller account.
Created sites in the new reseller account as domain.com2 for the domains that needed to be migrated. DA won't let you add the same name twice, which is why I used a different one for the time being. Doing this will setup all the required files/paths needed to use the website.
Copied the files to the new domain.
# cp -pR /home/olduser/domains/domain.c om/* /home/newuser/domains/domain.c om2/
# chown -R newuser:newuser /home/newuser/domains/domain.c om2
# for x in `find /home/newuser/domains/*/public _html -type f -print0 | xargs --null grep -l /home/olduser`; do perl -pi.bak -e 's/\/home\/olduser/\/home \/newuser/g' $x ; done
# cd /etc/virtual
# mv domain.com domain.com.tmp
# mv domain.com2 domain.com
# mv domain.com.tmp domain.com2
Changed user for the imap files.
# find /home/newuser/imap -user olduser | xargs chown newuser:newuser
Renamed the new domains to domain.com from domain.com2.
Logged in as reseller and created a backup.
Created a script and dumped out single databases.
#!/bin/bash
# dbExport.sh
OLD_DB=(
db1
db2
db3
...
)
for ((i=0; i<${#OLD_DB[@]}; i++))
do
mysqldump --opt -u root --password={psswd} ${OLD_DB[$i]} > ./db/${OLD_DB[$i]}.db
done
# find /home/newuser/domains -perm 0777 -type d > 777.txt
Nepalese NGO Releases Localised Open CD
Fri, 01/26/2007 - 09:56 — sandipIn its on going efforts to bring the power of FOSS based technologies to the mountainous asian nation of Nepal, the Madan Puraskar Pustakalaya has released a localised version of the Open CD.
The Open CD is a project to create a collection of FOSS applications that run on the Windows platform, from Open Office to Firefox and beyond.
Localized Free and Open Source Software, Nepali Open CD 1.0
Madan Puraskar Pustakalaya (MPP) has released the Nepali OpenCD 1.0 in January 9, 2007. The Nepali OpenCD 1.0 is a compilation of free and open source software localized into Nepali and runnable in the Windows operating system and developed by Madan Puraskar Pustakalaya. After the release of two different versions of NepaLinux, a localized Linux Distribution in Nepali, the development of the Nepali OpenCD 1.0 is yet another attempt of Madan Puraskar Pustakalaya for promoting the usage of localized Free and Open Source Software in the region. With the existing old legacies of the Windows operating system deeply rooted in the masses, the localized OpenCD is believed to be a motivating factor for switching to the Free and Open Source Software. The translation and localization of the software has been supported by the International Development and Research Centre, Canada under the PAN Localization Project.
Contents of the Nepali OpenCD
The localized Nepali OpenCD consists of the following software:
1.OpenOffice.org Suite (Office applications like Writer,Calc,Impress,Base etc.);
2.SeaMonkey Browser and Mail client (Browser and mail client);
3.Gimp (Image Manipulation Software);
4.FileZilla - 3(FTP Client Program for uploading and downloading files);
5.VLC Media Player (Software for playing audio video files);
6.Nepali Unicode Keyboard driver (Input System for Nepali).
Pre-requisites for running the software included in the OpenCD after installation
In order to run the software included in the OpenCD after installation, the Nepali Unicode Keyboard driver, also included in the OpenCD has to be installed first in the computer.
Both the Open CD and its sister project Nepalinux can be found at nepalinux.org
Serving files from a folder outside the web root with mod_rewrite
Thu, 01/25/2007 - 15:29 — sandipI was serving static content within a drupal installation, which became a huge nightmare when doing upgrades. So, I decided, I should just create a symbolic link to a folder outside the installation and route the traffic via mod_rewrite rules.
I first created a folder called "/var/www/site_files" and then symlinked to it from "/var/www/html/site_files". This way, I just have to recreate one single symbolic link after doing the upgrades.
With the below rules, I was able to maintain the links to the existing pages.
## BEGIN: site_files ##
# Redirect to the homepage if site_files is being called
RewriteRule ^site_files/?$ http://%{HTTP_HOST}/ [L,R=301]
# Apped / at the end of url, if directory is being called without /
RewriteCond %{REQUEST_URI} !^/?$
RewriteCond %{DOCUMENT_ROOT}/site_files%{R EQUEST_URI} -d
RewriteRule ^(.+[^/])$ /$1/ [R=301,L]
# Get directory or file if exists in site_files directory
RewriteCond %{REQUEST_URI} !^/$
RewriteCond %{DOCUMENT_ROOT}/site_files%{R EQUEST_URI} -d [OR]
RewriteCond %{DOCUMENT_ROOT}/site_files%{R EQUEST_URI} -f
RewriteRule ^(.*)$ site_files/$1 [L]
## END: site_files ##