Posts Tagged "linux"

Resources for Learning Git and GitHub

Resources for Learning Git and GitHub
http://chronicle.com/blogs/profhacker/resources-for-learning-git-and-github/48285

InnoDB is red hot, MyISAM not

Planet MySQL

via InnoDB is red hot, MyISAM not.

Everyone who started using MySQL before 5.5 started off with MyIsam. It was the default storage engine and you had to go out of your way to use anything else. It was a good looking database, rugged…

How to downgrade PHP to 5.2 on Ubuntu?

Here is a quick script to do this task:

Courtsey of Stijn Beauprez from here: http://thejibe.com/blog/10/5/php-5210-debs-ubuntu-104-lucid#comment-9

#! /bin/sh
php_packages=`dpkg -l | grep php | awk ‘{print $2}’`

sudo apt-get remove $php_packages

sed s/lucid/karmic/g /etc/apt/sources.list | sudo tee /etc/apt/sources.list.d/karmic.list

sudo mkdir -p /etc/apt/preferences.d/

for package in $php_packages;
do echo “Package: $package
Pin: release a=karmic
Pin-Priority: 991
” | sudo tee -a /etc/apt/preferences.d/php
done

sudo apt-get update

sudo apt-get install $php_packages

To undo the script and upgrade to php 5.3 you will need to delete the file (sudo rm /etc/apt/preferences.d/php), run sudo apt-get update, and then sudo apt-get dist-upgrade which will get the latest packages for your distribution, including the PHP packages. (Ben Holt)

How to restore / resurrect deleted files in subversion?

If you delete a file or folder from subversion. You can easily restore it using the svn copy command below:

#Example Command (all one line)

svn copy http://subversion.server.com/path/to/deleted/file.psd -r 115 http://subversion.server.com/path/to/deleted/file.psd -m “Commit Message”

Note: 115 is the revision number in subversion where the latest version of file exists.

How to auto start services on boot in Centos / Redhat?

To auto start services in Centos or Redhat OS, you can use builtin chkconfig utility. It is located in /sbin directory. If you are a regular user (non-root), then /sbin may not be in your path. Therefore, you may have to use the full path to access the chkconfig utility.

To auto start a new service:

  • Find out the name of service’s script from /etc/init.d/ directory e.g. mysqld or httpd
  • Add it to chkconfig
    sudo /sbin/chkconfig --add mysqld
  • Make sure it is in the chkconfig.
    sudo /sbin/chkconfig --list mysqld
  • Set it to autostart
    sudo /sbin/chkconfig mysqld on

To stop a service from auto starting on boot

  • sudo /sbin/chkconfig mysqld off

Moved this site on to a VPS from IntoVPS

Few days ago, I moved this website on to a VPS from IntoVPS. So far IntoVPS has been quite good. It took only few minutes to get access to my VPS after signing up on IntoVPS site.

I picked Ubuntu 9.10 Server Edition for the OS because it is much easier to build a server on Ubuntu than dealing with Centos/Redhat crap.

P.S. Suprisingly IntoVPS guys also run super handy IntoDNS.com service!

Open Port 80 for Apache in iptables on Centos or Red Hat

Run the following command while logged in as root or sudo:

#Open port 80
/sbin/iptables -I RH-Firewall-1-INPUT 3 -p tcp -m tcp –dport 80 –tcp-flags SYN,RST,ACK SYN -j ACCEPT

#Make the changes permanent
/sbin/iptables-save

One mod deflate filter to rule them all …

Add the following code to your .htaccess file to automatically have all of your text files compressed by mod-deflate on the fly.

Warning: Make sure you are running Apache 2.0 server with Mod Deflate enabled.

AddOutputFilterByType DEFLATE text/html text/plain text/xml application/x-javascript application/javascript text/javascript text/css application/xml

All in one line.