Skip to content

Instantly share code, notes, and snippets.

View mikeclarke's full-sized avatar

Mike Clarke mikeclarke

View GitHub Profile
@mikeclarke
mikeclarke / Add user
Created December 12, 2010 21:39
Initial user setup on a CentOS box
# Create a new user (CentOS will create /home/admin as well)
adduser admin
# Assign the user a new password
passwd admin
# Add the user to the "wheel" group
usermod -a -G wheel admin
# Edit the /etc/sudoer file (requires knowledge of vi)
visudo
@mikeclarke
mikeclarke / iptables
Created December 12, 2010 21:41
Initial iptables configuration
# Flush iptables rules (start with a clean slate where all traffic to all destinations is allowed)
iptables -F
# Allow loopback traffic
iptables -A INPUT -i lo -j ACCEPT
# Reject traffic destined to any port on IP address 127.0.0 through 127.0.0.7
# iptables -A INPUT -i ! lo -d 127.0.0.0/8 -j REJECT
# Allow all ESTABLISHED and RELATED connections to stay up
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
# Allow all external hosts to be reachable from the box
iptables -A OUTPUT -j ACCEPT
@mikeclarke
mikeclarke / package-install
Created December 12, 2010 21:42
Installing baseline packages
yum update
yum groupinstall 'Development Tools'
@mikeclarke
mikeclarke / postgres-install
Created December 12, 2010 21:44
Basic PostgreSQL install
# Install the postgres packages
yum install postgresql postgresql-server
# Configure postgresql to start automatically on boot
chkconfig postgresql on
# Stat posgresql
service postgresql start
# Switch to postgres user (required to make initial connection to postgresql with default configuration)
su - postgres
# Make initial connection to the database to test connectivity
psql -d template1 -U postgres
@mikeclarke
mikeclarke / Credit card grep
Created December 12, 2010 21:48
Locating credit card data in log files
find /var/log/application/* -name "*.log" -type f -mtime -1
-exec egrep -Hn \
'\b(?:4[0-9]{12}(?:[0-9]{3})?
|5[1-5][0-9]{14}
|6(?:011|5[0-9][0-9])[0-9]{12}
|3[47][0-9]{13}
|3(?:0[0-5]|[68][0-9])[0-9]{11}
|(?:2131|1800|35\d{3})\d{11})\b'
{} > ~/output.out \;
@mikeclarke
mikeclarke / Acuity
Created December 12, 2010 21:55
Installing and running Acuity
easy_install -U pip
pip install -U virtualenv
cd /install/directory/location/
virtualenv --no-site-packages acuity
cd acuity/
source bin/activate
pip install django
pip install twisted
# Running the application
cd /install/directory/location/acuity/
@mikeclarke
mikeclarke / Install django mingus
Created December 12, 2010 22:00
Installing django-mingus
mkdir /opt/env/
chown django:django /opt/envs
su - django
cd /opt/env
virtualenv --no-site-packages django-mingus
pip install -E django-mingus/ psycopg2
source django-mingus/bin/activate
cd djagno-mingus
git clone git://github.com/montylounge/django-mingus.git
cd django-mingus/mingus
@mikeclarke
mikeclarke / SCM tools
Created December 12, 2010 22:01
Installing git and mercurial
-- Install git
cd ~/src
wget http://kernel.org/pub/software/scm/git/git-1.6.6.tar.gz
tar xzvf git-1.6.6.tar.gz
cd git-1.6.6
./configure
make
make install
-- Install mercurial
@mikeclarke
mikeclarke / Compile psycopg2
Created December 12, 2010 22:03
Compile psycopg2 from source
wget http://initd.org/pub/software/psycopg/psycopg2-2.0.13.tar.gz
yum install postgresql-devel
tar xzvf psycopg2-2.0.13.tar.gz
cd psycopg2-2.0.13
python2.6 setup.py build
python2.6 setup.py install
cd ~/src
wget http://bit.ly/6E0DNN
chmod u+x setuptools-0.6c11-py2.6.egg
./setuptools-0.6c11-py2.6.egg --prefix=/usr/local
easy_install -U pip
pip install -U virtualenv