Thursday, December 22, 2011

Linux Setup

These are some commands and setting to run when setting up an Linux box
Install GNOME
Ubuntu 11.10 installs with Unity - I'm still not a fan

sudo
apt-get install gnome-shell
Restart the machine and then select from the available X configurations - I like GNOME Classic

SSH Alias
Edit .bashrc to create SSH aliases for fast access to other Linux instances
alias servername='ssh domain\\username@servername.domain.com'
The name of the alias can be anything you like - if there are a lot of servers, the name of the server will probably work the best

source .bashrc to reload changes without a reboot

Create RSA Key Pair

Start in home directory
mkdir .ssh
chmod 700 .ssh
ssh-keygen -t rsa

I usually leave the passphrase blank because I guard my private key

Make backups of the key pair

Other options
-C "username@domain.com" - This will set the email address assigned to the public key, by default it will use the username and server name where it is being created
-D 4096 This creates a 4096 bit key, 2048 is set by default and strong enough in most situations

Add SSH Public Key to Server
Access your home directory on the Server
mkdir .ssh
vi .ssh/authorized_keys
Copy/paste the public key
chmod 600 .ssh/authorized_keys


Friday, December 9, 2011

Ruby on RHEL/CentOS/Amazon Linux

By default, Amazon Linux AMI uses Ruby 1.8.6 - development prefers version 1.9.2

Remove preinstalled Ruby
sudo yum erase ruby ruby-libs ruby-mode ruby-rdoc ruby-irb ruby-ri ruby-docs

Install Development tools
sudo yum install openssl-devel zlib-devel gcc gcc-c++ make autoconf readline-devel curl-devel expat-devel gettext-devel

Download and Build Ruby 1.9.2
wget ftp://ftp.ruby-lang.org//pub/ruby/1.9/ruby-1.9.2-p290.tar.gz
tar xzvf ruby-1.9.2-p290.tar.gz
cd ruby-1.9.2-p290
./configure
make
make install
gem install bundler

Add additional packages
yum install freetds freetds-devel git nginix

Add web group and directory
sudo groupadd web
sudo usermod -a -G web nginx
sudo mkdir /var/www
sudo chgrp web /var/www
sudo chmod g+ws /var/www