Apache Apache rewrite rules Rewrite to a folder and hide the folder name in url : RewriteCond %{SERVER_NAME} ^sitename.com [NC,OR] RewriteCond %{SERVER_NAME} www.sitename.com [NC] RewriteCond %{REQUEST_URI} !^anyfiletoexclude.php [NC] RewriteCond %{REQUEST_URI} !^/foldertoredirect/ [NC] RewriteCond (.*) /foldertoredirect/$1 force use www RewriteCond %{SERVER_NAME} ^website.com$ RewriteRule ^/(.*) http://www.
Cloud Computing Configure Vsftpd in amazon ec2 instance pasv_enable=YES pasv_min_port=12000 pasv_max_port=12100 port_enable=YES pasv_address=
Reset A2Billing admin password echo "update cc_ui_authen set pwd_encoded = '410fc6268dd3332226de95e42d9efa4046c5463769d7493b85e65cfa5c26362dc2455cc23c0bc5831deb008def4ab11a9eaa9b76ba3f377da134f39ec60dd758' where login='root'" | mysql -pPASSWORD DATABASE This will reset username and password to : root/changepassword
Cloud Computing Mounting Open stack Cloud Object Storage in Linux Prerequisites: libcurl and libcurl-devel fuse, fuse-devel, and fuse-libs libxml2 and libxml2-devel Download the cloudfuse : This version doesnot support mounting at container level : wget https://github.com/redbo/cloudfuse/tarball/master This supports mounting at container level: https://github.com/vfloz/cloudfuse/tarball/master tar -zxvf master cd ./configure make && make
Perl Issues and Solutions Display The Include paths for perl : perl -e 'print join("\n", @INC);' View Cpan Configuration: cpan>o conf Find perl module’s Path: perl -MList::Util -e'print $_ . " => " . $INC{$_} . "\n" for keys %INC'
IPtables Delete Rules in Iptables iptables -D (Chain Name) ( RuleNum) eg. iptables -D FORWARD 1 You can delete all rules from filter chain by typing : iptables -F or from nat table iptables -F -t nat
Apache Creating SSL Certificates Create a Self Signed Certificate : 1. Generate A Server Key : #openssl genrsa -des3 -out server.key 4096 2. Generate the Signing Request using the key above #openssl req -new -key server.key -out server.csr 3.Sign the certificate signing request. #openssl x509 -req -days 365 -in server.csr -signkey
Network Installing Vnc Server on Linux Machine without monitor Vnc Installation Without Monitor Packages Required : 1.vnc 2.vnc-server 3.Desktop Environment KDE or GNOME Configuring VNC : 1. Add users like normal users. 2. login to each users 3. create password by running vncpasswd 4. It creates .vnc folder 5. Edit /etc/sysconfig/vncservers, and add the following to
HA & Synchronization Using Rsync to Syncronise files between servers Rsync is a nice utility to synchronize files and folders between two servers securely and efficiently. It only copies the difference so making the process much faster and efficient. Ok, here i will show you how to setup rsync. 1. Download the rsync package. Click Here 2. Untar the package
Web Snipetts Combobox On change If you need to get a value for the selected item in a combo box you can use the following function : onchange=”alert(this.options[this.selectedIndex].text) if you need the value then just replace text with value . For example, if you want to redirect the page based on
Systems Administrator Force Install CPAN Module in Linux from CLI Force Install CPAN Module perl -MCPAN -e “CPAN::Shell->force(qw(install HTTP::Cookies));”
Systems Administrator Changing the password hashing algorithm to sha-512 change password hashing algorithm to sha-512 # authconfig –test | grep hashing # authconfig –passalgo=sha512 –update
IPtables Redirecting Ports in Iptables Redirect ports in iptables iptables -t nat -A PREROUTING -i eth0 -p tcp –dport $srcPortNumber -j REDIRECT –to-port $dstPortNumbe
Systems Administrator Installing Perl Modules Its convenient to install perl modules from command line. #perl -MCPAN -e shell cpan> install PACKAGE NAME eg. cpan> install HTML::Template
Network Adding Multiple IP Address to A NIC Card It is possible to bind more than one ip address on a single network interface card in linux. copy your existing network card configuration file as shown: #cd /etc/sysconfig/network-scripts #cp ifcfg-eth0 ifcfg-eth0:1 >>ifcfg-eth0 looks like this : # File: ifcfg-eth0 DEVICE=eth0 ONBOOT=yes BOOTPROTO=static IPADDR=192.168.
DNS How to retrieve named.ca file You can retrieve named.ca file by issuing the following command dig @a.root-servers.net . ns > named.ca or download from this location : ftp://ftp.internic.net/domain/named.root
Systems Administrator Grub reinstall in rescue mode You can re-install grub boot loader in rescue mode by issuing the following command : #grub-install /dev/sda1 or hda1 ( based on your boot partition) if it is scsi drive it would be sda and hda if it is ide drive. If you get something like this : ” Error /dev/hdx or
Vi & String Processing Save File as in VI Editor You can save file as another file in vi editor after you make changes to the current file, so that you can quit without saving and still retain the changes in another file. :w! newfile.txt or :w! /var/newfile.txt Thanks
Vi & String Processing Introduction to String Processing Introduction to string Processing Head/Tail Head and tail command are used to view the first and last few lines of a file respectively. By default these commands generate 10 number of lines. # head /etc/passwd (shows first 10 lines) # tail /etc/passwd (shows last 10 lines) One very handful
Systems Administrator Managing Partitions *Mounting filesystem #mount (fs-type> -o fs_type=vfat,ext2,ext3,iso9660 etc options=rw ro exec noexec dev nodev auto noauto suid nosuid user nouser or (owner, noowner) async sync the above options are default keywords additional options loop uid=,gid= remount, #mount /dev/hdax /personnel (only for temporary or
Systems Administrator Linux Filesystem Management Linux Filesystem management –>File system Ids ext2/ext3 –>83 linux swap ->82 RAID –>fd LVM –>83 above id no. are based on hex system #fdisk -l -> Disk partitioning tools .fdisk -> post-installaton disk partitioning tool (other disk partition tools sfdiks – can be used in scripts parted- advanced disk
Systems Administrator Linux Hardware and Kernel * Hardware Resources –>Kudzu – .It is hardware detection program that typically runs during boot time to detect any added or removed h/w. .It refers the file/etc/sysconfig/hwconf to deletct any added/removed h/w. #hwbrowser . Graphical tool that displays the list of detected h/w. #cd /usr/share/
Systems Administrator Controlling Services in Linux –> Controlling services service management tools: 1 .chkconfig .it is noninteractive tool that can be used in shell scripts. .xinetd-based services comes into immediate effect if actived/de-activated with this tool. .Stand-Alone service comes into effect only on next rebootif activated/de-activated using this tool. [to avoid reboot, use ‘service command’
Systems Administrator Linux Daemons Deamons (what is deamons) ——————————- .Background process are called deamons and sometimes called services) Types ——- Two types: 1. Stand-alone deamon .Location: /etc/rc.d/init.d/* .Keeps running all the time 2. Transient deamon (service) .Controled by super-deamon ‘xinetd’ .Location: /etc/xinetd.d/* .Also called xniedtd-based deamons (or services)
Systems Administrator Linux Init Initialization -init initialization #vi /etc/inittab format id:runlevel:action:process id –> it is 1-4 char. long identification char. runlvele–> It represents the runlevel for which the action has to be taken. If omitted, action will be taken for all the runlevels. Action–> Represents the action to be taken for the