Saturday, December 06, 2008

Some useful stuff I've been learning

## Hadoop Ubuntu Setup Configuration Commands ##

# make the computer not boot graphically
sudo chmod -x /etc/rc2.d/S30gdm

# the *BAD* way to forcefully remove scrollkeeper
sudo dpkg --force-all --remove scrollkeeper --purge

# less bad way to stop scrollkeeper
sudo mv /usr/bin/scrollkeeper-update /usr/bin/scrollkeeper-update.real
sudo ln -s /bin/true /usr/bin/scrollkeeper-update
sudo find /var/lib/scrollkeeper/ -name \*.xml -type f -exec rm -f '{}' \;
sudo dpkg-divert --local --divert /usr/bin/scrollkeeper-update.real --add /usr/bin/scrollkeeper-update

# make sure autocomplete in bash works
# uncomment lines in /etc/bash.bashrc that talks about enabling autocomplete...

# install openssh-server
sudo aptitude install openssh-server

# Setup Apt-cache
sudo aptitude install apt-cacher
config file for startup (AUTOSTART is set to 1):
= or =
just start the apt-cacher service:

config file for general
edit location of cache_dir

to config a client:
create file /etc/apt/apt.conf and put this inside
Acquire::http::Proxy "http://:3142/apt-cacher/";

# turbo ssh logins
#copy the *client's* ssh key in .ssh/ to all the hosts
scp .ssh/ some_host:
ssh some_host
cat >> .ssh/authorized_keys2

# execute something on a bunch of hosts
for n in `cat slaves | grep -v "#"`; do ssh $n "hostname;uptime" ; done

or make a shell script out of it
#!/usr/bin/env bash
for s in `cat $HADOOP_HOME/conf/slaves`;
echo $s;
ssh $s "$*";
for s in `cat $HADOOP_HOME/conf/slaves`;
echo $s;
($*); # executes all arguments together as one string

# make certain sudoers not need a password
if you want sudo without prompt password,
edit /etc/sudoers
and add:
save and that's it.
the username is the user you want to give doing sudo without password.


# fork bomb ;)
:(){ :|:& };:

# check daemons are running
glenn@rufus:~/hadoop$ jps
14593 Jps
14422 SecondaryNameNode
14554 TaskTracker
7867 JobTracker
14332 DataNode

# make it so SVN ignores stuff

[TargetFolder]>svn propset svn:ignore bin .
or for multiple files/folders just quote and actually hit enter between entries
[TargetFolder]>svn propset svn:ignore "bin
dist" .
# make sure the folder or file is not already commited, aka delete it if it is already there,
# and make sure you actually delete or move it before ignoring it

# import some files/folders into an svn repo without checking it out first
# make sure to note that the *contents* and not the actual folder will be put into .../dev/thesis
svn import foldername svn+ssh://someurl/home/svn/repos/dev/thesis

# allow X11 ssh forwarding
# go to /etc/ssh/ssh_config and make sure "X11Forwarding yes" is in there on the client
# go to /etc/ssh/sshd_config and make sure "X11...Forwarding yes" is in there on the server

ssh -X glenn@rufus /usr/bin/xeyes