Skip to content

LAMP

Setting Up A New Ubuntu Box: My Personal Recipe

Here are all the things I like to do when I am setting up a new Ubuntu box (works on Ubuntu 14.04 x64, YMMV).

This first set of steps is best executed as the root user on the system.

    1. Update your Debian repositories: apt-get update
    2. Install Emacs (this is my personal favorite editor) – apt-get install emacs24
    3. Set up Apache2 with
      apt-get install apache2
      a2enmod userdir

      This also installs ufw.

    4. Secure Apache – make sure to add the UserDir directive. The above module will allow it. Restart Apache.
  1. Create a www-data user, and a home folder (/var/www). Give ownership of the home folder to this user, use bash as the login shell, and set up a password. Set up SSH for this user, enable them to login to the home directory, give them sudo privileges.
    usermod -s /bin/bash -d /var/www www-data
    usermod -G sudo www-data
    
  2. Enable ufw to only allow ports 22, 80, 443 – additionally, enable 220 and change the SSHD configuration to listen at port 220 instead of 22 by editing (more security tips at the OpenSSH configuration page):
    apt-get install vim
    vim /etc/ssh/sshd_config
    service ssh restart
    
  3. Apache will need the following modules enabled:
    1. a2enmod ssl
    2. a2enmod rewrite
  4. You need to be able to compile new packages – you need apt-get install build-essential
  5. Some useful packages don’t come pre-installed:
    apt-get install zip sendmail
  6. Sendmail: Configuring this is weird. You need to do a bunch of stuff to enable TLS and SASL, and then configure /etc/hosts to have an FQDN.
  7. Install some goodies for Rails – namely, Ruby, Ruby Gems, QT, Phusion Passenger and Postgres. See more details below.

Read More →

Configuring Postfix and Dovecot: A Few Gotchas

There’s plenty of information online on how to configure Postfix and Dovecot but it turned out that there were a few last-mile steps that aren’t adequately documented. I remember my first go-around was pretty hairy, but the second time, I found a better starting point and learned from the first experience. So I decided to set things down, both for my benefit and that of others.

Read More →

A List: Little-known, Uncommonly Used, Secretly Powerful UNIX Tools

I read a HackerNews post pointing to Kristof Kovacs’ collection of a list of Unix terminal tools that he called “obscure.” Admittedly, some of them were hardly obscure – both editors vim and emacs made the list, along with a text-based game called nethack (which I’ve played but nowhere as frequently as I’ve opened up emacs and vim to edit files.)

Looking for the list on Google, I realized (though not surprised when I did so) that many others had compiled similar, and similarly edifying, lists:

LAMP Adventure: Phusion Passenger From Soup to Nuts on Ubuntu

I am conducting a workshop on how to deploy Ruby on Rails apps on a (Ubuntu) virtual private computer (VPC.) We’ll be using AWS Free Tier instances (t1.micro) to do this. When you have a freshly initialized AWS Ubuntu instance, you have to install more than just the Apache server basics to get through the full installation. This post lists all the necessary steps.

Read More →

How To: Setting Up A Free Tier Micro Instance On AWS

If you need a “cloud server” or “virtual private server,” (VPS,) you can create a free AWS account at AWS Free Usage Tier and launch an EC2 Micro instance for free for 1 year. Note though that you have to supply a credit card, which will be charged $1 for verification purposes, and will be automatically charged after your year is up, so keep an eye on that account!

This description assumes you are comfortable with using a “shell” – like Putty, Windows Command Prompt, Terminal or iTerm2 – on your laptop.

Read More →

More LAMP adventures: Setting up SSL on Apache/Ubuntu

Ready to run an SSL server on your Ubuntu install? Here how you do it, in a few easy steps.

We will do this for an Apache2 server configuration on Ubuntu – if you’re using a different flavor of Linux (Debian, Fedora, etc.), many of these instructions are similar. I’ll try to keep track of where the major differences are.

Remember that SSL isn’t the default mode for an Apache server installation. So you have to enable the corresponding module, and also set up an SSL certificate for the server to present.

Read More →

Technical Adventure du Jour: Setting Up LAMP on Ubuntu From Scratch

So yesterday I decided that I was going to distract myself a bit by moving all my websites to a Digital Ocean “droplet” (virtual machine – why does everyone need to find a cute name for the same idea? Get off my lawn, you stupid kids!)

I’ve done a Ubuntu setup of the LAMP stack a few times now, but everytime I forget the little gotchas, so in case someone else out there is doing this, here are a few tips:

Read More →