Debian Minimal Install: The base for all operations


This blog is really just a place holder for many blogs to be written in the future. In some of the future “How-To” blogs I plan on writing, I’m going to need to ensure that we start with a perfectly clean install of Debian. So from here we’ll start from a completely fresh install of a Debian 6 (Squeeze) OS.

 

For this you’ll need the newest version of Virtual Box installed on your machine. You’ll also want to download the Small Debian ISO from Debian’s Download page.

 

Let’s start with getting your Debian server built and running. Start with getting a Virtual Machine up and running. We’ll start with the basics of provisioning a Virtual Machine in Virtual Box:
Name your Server

 

Alocate some RAM to it:

 

Create a Virtual Hard Drive:

 

I normally stay with Virtual Box VDI disk images:

 

Dynamic Allocation is sufficient:

 

Store it in your preferred location. I store mine on a separate Solid State Disk:

 

After Completing that, right click on your new virtual machine, and click on “Settings…”

 

Get rid of your floppy drive and make sure your RAM and CPU are setup properly:

 

Add the Debian ISO to the CD Rom Drive:

 

The easiest thing to do it Bridge the network adapter to a physical wired Ethernet port.

 

Go ahead and start your Virtual Machine, and when you get to the boot screen just press “Enter”:

 
Select your language:

 
Location:

 
Keyboard Layout:

 
Configure the Host-name of your new Debian Server:

 
Setup the Root password:

 
Setup your name and user account, password, etc…:

 
What Time zone are you in?

 
Just for the sake of simplicity, use the whole disk:

 
Use the Virtual disk you just made:

 
Again, for simplicity, all files in the same partition.

 
Finish partitioning:

 
I like using MIT’s mirror, but choose whatever one you want:

 
You shouldn’t have a proxy, but if you do, fill it out here:

 
I normally dont participate in anonymous surveys, but you can if you want:

 
ONLY INSTALL SSH SERVER AND STANDARD SYSTEM TOOLS! NOTHING MORE, NOTHING LESS!!!

 
Setup the GRUB boot loader:

 
Finish the install, hit enter and watch your new system boot up!

 
Watch until you get to the login prompt.

 
 
Go ahead and log into your machine with the ROOT user, and the password you setup earlier.
 
 

So Let’s get a static Address on this thing by editing this file: /etc/network/interfaces

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
#allow-hotplug eth0
#iface eth0 inet dhcp
auto eth0
iface eth0 inet static
          address 192.168.0.100
          netmask 255.255.255.0
          network 192.168.0.0
          broadcast 192.168.0.255
          gateway 192.168.0.1

 

And you can restart networking with this:

/etc/init.d/networking restart

 

You’ll probably want to sudo from this user, so if that’s the case:

apt-get install sudo

 

After that software installs, you can edit your sudoers file like this:

#nano /etc/sudoers

 

When Editing the sudoers file, if you break it, have fun! Just copy the line where root is and paste it right below, change the name root to your username. Like this:

# User privilege specification
root ALL=(ALL) ALL
steve ALL=(ALL) ALL

 

 

I like to spice up the environment a little bit. Personalize it, ya know?

So, what I do is edit the ~/.bashrc file and add in some code.

nano ~/.bashrc

 

Then you can add in some code that will make your life a bunch easier:
(if there is already code in your .bashrc file, just append this to the bottom of the file!)

#################################
#                               #
#       BashRC File created by  #
#           Steve Erdman        #
#                               #
#################################
#                               #
#       Edited on Dec 13 2012   #
#                               #
#################################

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"


#[Color Prompt]

force_color_prompt=yes

#[Variables]

RESET="\[\017\]"
NORMAL="\[\033[;m\]"
LGREEN="\[\033[1;32m\]"
LGREEN0="\[\033[0;32m\]"
LBLUE="\[\033[1;34m\]"
LCYAN="\[\033[1;36m\]"
LRED="\[\033[1;31m\]"
LPURPLE="\[\033[1;35m\]"
BLACK="\[\033[0;30m\]"
BLUE="\[\033[0;34m\]"
GREEN="\[\033[0;32m\]"
CYAN="\[\033[0;36m\]"
PURPLE="\[\033[0;35m\]"
BROWN="\[\033[0;33m\]"
LGRAY="\[\033[0;37m\]"
DGREY="\[\033[01;30m\]"
RED="\[\033[0;31m\]"
YELLOW="\[\033[01;33m\]"
WHITE="\[\033[01;37m\]"

#[Good Command]
SMILEY="${GREEN}:)${NORMAL}"

#[Bad Command]
FROWNY="${RED}:(${NORMAL}"

#[Command Judge]
SELECT="if [ \$? = 0 ]; then echo \"${SMILEY}\"; else echo \"${FROWNY}\"; fi"

#[Working PS1 output]
PS1="${RESET}${LCYAN}\u ${RED}@ ${LCYAN}\h ${YELLOW}~ \`${SELECT}\` ${YELLOW}ᛤ> ${GREEN} ${NORMAL} "


#[Aliases]

alias ll="ls -alh"
alias ..='cd ..'
alias ...='cd ../..'
alias dfah='df -ah'

 

 

Next we’ll get the SSH Server installed so we can get some remote access to this server from our Linux Desktop.

apt-get install ssh openssh-server openssh-client

 

When that’s done test out connecting from your local machine to this virtual host using:

ssh steve@192.168.0.100

Now we can setup SSH keys on this system so that you can easily log in from your main Linux Desktop machine.

 

So go to your home directory on your local machine (NOT THE SERVER!) and your navigate to your home folder. From here CD into your .ssh directory and we’ll create your SSH Certificates.

cd ~/.ssh/
ssh-keygen -t rsa
{save as default file, press enter}
{enter your own password and hit enter}
{confirm your password}

 

Once this is done we’ll setup your host with keys to stay authenticated

cat ~/.ssh/id_rsa.pub | ssh steve@192.168.0.100 "cat - >> ~/.ssh/authorized_keys"
ssh-agent
ssh-add

 

And now you can test your new ssh keys by doing this:

ssh steve@{server-IP-Address}

 

I know this Blog is kinda dumb, but you’d be surprised how much of the future Blogs will be based off of this point.

 

If I ever start a blog saying, “From a fresh Debian Install…” you’ll know you should start here! 🙂

 

 

 

Enjoy!

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)
Tagged , , , . Bookmark the permalink.

Comments are closed.