Skip to content

Instantly share code, notes, and snippets.

@nesquena
Created August 3, 2010 22:30
Show Gist options
  • Save nesquena/507272 to your computer and use it in GitHub Desktop.
Save nesquena/507272 to your computer and use it in GitHub Desktop.
Uniform Server Setup

Enable universe repository:

# /etc/apt/sources.list

## main & restricted repositories
deb http://us.archive.ubuntu.com/ubuntu/ jaunty main restricted universe
deb-src http://us.archive.ubuntu.com/ubuntu/ jaunty main restricted universe

deb http://security.ubuntu.com/ubuntu jaunty-security main restricted universe
deb-src http://security.ubuntu.com/ubuntu jaunty-security main restricted universe

Install Base Packages

sudo apt-get update && sudo apt-get upgrade
sudo apt-get install build-essential nano aptitude -y
sudo apt-get install psmisc curl wget screen iotop htop libssl-dev libreadline5 libreadline-dev

Configure language:

sudo locale-gen en_US.UTF-8
sudo /usr/sbin/update-locale LANG=en_US.UTF-8

Configure timezone:

sudo dpkg-reconfigure tzdata
sudo apt-get install ntp
sudo ntpdate ntp.ubuntu.com # Update time
date

Configure hostname:

$ sudo hostname your-hostname.domain.com

# sudo vim /etc/hosts
127.0.0.1 your-hostname.domain.com

# sudo vim /etc/hostname

$ hostname

Secure SSH:

# sudo nano /etc/ssh/sshd_config
Set "PermitRootLogin no"
Set "Port 28" # < 1024
sudo service ssh restart

# Login with
ssh <your username>@future.<your domain>.com -p 28

Setup Fail2Ban

sudo aptitude install fail2ban
cd /etc/fail2ban
sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local

# sudo nano /etc/fail2ban/jail.local
[DEFAULT]
ignoreip = 127.0.0.1
bantime  = 3600
maxretry = 5
[SSH], [SSH-DDOS]
enabled = true
port = 28

sudo /etc/init.d/fail2ban restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment