Ubuntu auto start ssh server

Having to setup an Ubuntu server recently, all the CentOS commands had to get thrown out the Window.
Before i could put the server into the rack i had to make sure sshd started if the server ever reset.
Below is the following command to add ssh to the default startup.

It actually updates the rc.d scripts so probably also adds shutdown scripts to the unneeded run levels

sudo update-rc.d ssh defaults

Resolving local networks with Xip.io

I recently stumbled upon a brilliant service. Developing locally always involves editing the /etc/hosts file to resolve a domain to your local host and then having to setup DNS servers to be able to check on my mobile or tablet.
Xip.io seems to have solved this issue by creating a custom DNS service that allows you to resolve a custom domain to an internal ip address so when any other device does a lookup it resolves correctly.

For example; your machine is on and you need to check it on your mobile. You don’t want to upload it to your sever, setup a host, setup the database and all that. If you set the host on your local machine as


when your mobile tries to do a DNS lookup the remote DNS server extracts the from the Domain name and returns that back as the IP.

You can use any precursor to the ip address;


Brilliant idea!

Bash Profile

I find myself working in iTerm a lot. Well to be honest i prefair a terminal over a Finder window any day.
So i find myself running the same commands over and over, {{ git status }} over and over to check if any files have changed.
Checking which branch i’m currently on.

I spent a lot of time altering my bash profile to enable colours by default, changing the prompt layout, setting up aliases etc.
I finally found a brilliant template online by Jacob Tomlinson at Terminal Piperita Theme

The prompt integrates into git, so if git is enabled in the current directory it will add the current branch to the prompt and tell me if there have been any changes made. It’ll give me the user my terminal is logged in as and the hostname of the machine along with the current folder all with some pretty colours that change if i am logged in as root too. Continue reading

PHP 5.6 CentOS 6

One of the bad things with the default repos on CentOS is that the PHP releases are really dated.
I recently needed a later version of PHP on one of my servers so did some digging to find the following webtatic repo for all the latest PHP and module releases.

rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm

That will install the yum repository for you so you can do the magical yum installs
The usual and basic modules for PHP 5.6 are as follows;

yum install php56w php56w-mysql php56w-xml
Continue reading

Crontab; Minutes Hours Day….

“Is it Minutes first or hours first….”

Im forever forgetting which way it goes, i think i have to google it every time i need to edit it.
Minute, Hour, Day of the month, Month, Day of the week, Command
For example if you want to run ntpdate once a day at 1am to update your time

0 1 * * * /usr/sbin/ntpdate uk.pool.ntp.org >/dev/null 2>&1

>/dev/null 2>&1 ???

>/dev/null 2>&1

Pipes all the output  to /dev/null including errors (stderr if i remember right) so you don’t end up with emails without the output of ntpdate.

If your unsure how to view/edit the crontab its really quite easy. Continue reading

CentOS 6 EPEL 64bit

One thing i always need to do when installing a new CentOS install is, google the EPEL repo and remember the command to install the RPM. I must have done this 100 times now. Heres a snippet to make things easier.

EDIT: The easier way would be to yum install epel-release

cd /tmp
# Download the 64bit epel for centos 6
wget http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
# Install the epel
rpm -ivh epel-release-6-8.noarch.rpm
# Remove the rpm
rm -f epel-release-6-8.noarch.rpm