How to install and configure Debian 7 wheezy

Posted by Md. Mahidul Hasan on 1:04 PM with 1 comment

How to install and configure Debian 7 wheezy

I know for a new beginner Linux installation is not easy.  Specially if you come from windows background. In Linux you need to understand some basic info regarding partitioning and Linux data structure for going forward. But don't worry everyone has started from zero. So, If you are a new bee in Linux, don't worry at all. Guys like us always here to help at your journey to the Linux world. :-D


Introduction:
In this document I have used the following settings as an example:
Real IP                                                                 : 123.123.123.123
Subnet mask                                                      : 255.255.255.224
Gateway                                                              : 123.123.123.121
Local IP                                                                : 192.168.0.1
Local Network                                                   : 192.168.0.0/24, 192.168.1.0/24
Domain name                                                    : mahidul.com


So lets get start with Debian wheezy Installation. First put the Debian wheezy disk to the DVD drive. Then when a massage come about press any key. Then type any key from the keyboard. Then follow the bellow foot steps-

Language                                                             : English
Country                                                                : Other > Asia > Bangladesh
Keymap to use                                                   : American English
IP address                                                           : 123.123.123.123
Netmask                                                              : 255.255.255.224
Gateway                                                              : 123.123.123.121
Name server address                                      : 8.8.8.8 8.8.4.4
Domain name                                                    : mahidul.com
Host name                                                          : mail
Root password                                                  : give_your_password
Root password validity                                   : give_your_password
Full name for new user                                  : Mr. User Name
User name to the account                              : username
Choose a password                                          : give_your_password
Scan another cd/ dvd                                      : no
Use network mirror                                        : no
Partitioning method                                       : Guided use entire disk. 
Select disk to partition                                   : SCSI1 (0,0,0) (sda)-11.2 GB Hard disk drive
Partitioing Scheme                                          : All file in one partition


Partition for linux OS Debian. Keep 250 MB for boot and blootable flag shuld be on. Then make a partition of the double the size of your RAM and assign it as SWAP partition. Rest of the space keep as root(/).
                   
Primary /boot    - 256mb                - Bootable Flag ON
Primary swap     - 2 X Ram            - Bootable Flag OFF
Primary /             - Rest of HDD     - Bootable Flag OFF

Finish partitioning and write changes to the disk: yes
Participate into popular uses survey        : no
Chose software to install                              : standard system
Workgroup / domain name                         : mahidul.com
Modify smb.conf to us wins                         : no
Install the GRUB boot loader to the master boot: yes
Install the GRUB2 boot loader to the master boot: no
Choose software to install                       : Do not select any software from here.



Finish the installation and reboot the server. Now let assign network ip address so that we get Internet connectivity.
 


First update source list:

root@mail:~# nano /etc/apt/sources.list
deb http://ftp.us.debian.org/debian wheezy main
deb http://security.debian.org/debian-security squeeze/updates main
deb http://security.debian.org/ squeeze/updates main contrib non-free
deb-src http://security.debian.org/ squeeze/updates main


Then setup ip address to the NIC card:

root@mail:~# nano /etc/network/interfaces
# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug eth0
auto eth0
iface eth0 inet static
        address 123.123.123.123
        netmask 255.255.255.224
        network 123.123.123.64
        broadcast 123.123.123.95
        gateway 123.123.123.65
        # dns-* options are implemented by the resolvconf package, if installed
        dns-nameservers 8.8.8.8 8.8.4.4
        dns-search mahidul.com

allow-hotplug eth1
auto eth1
iface eth1 inet static
        address 192.168.0.1
        netmask 255.255.255.0

#This configuration divided eth1 into 2 logical port to support 2 network using 1 port. Genarelly you dont need the bellow configuration.
#allow-hotplug eth1:0
#auto eth1:0
#iface eth1:0 inet static
#        address 192.168.1.254
#        netmask 255.255.255.0

Restart the network interface.
root@mail:~# /etc/init.d/networking restart

Update your DNS address. It may be your own dns or may be your isp dns.
root@mail:~# vim /etc/resolv.conf
dns-name servers 8.8.8.8 8.8.4.4


Set the host name for the machine:
root@mail:~# vim /etc/hosts
123.123.123.123 mail.mahidul.com mail

root@mail:~# vim /etc/hostname
mail


Now update the source list and upgrade your all software packages.
root@mail:~# apt-get update
root@mail:~# apt-get upgrade

root@mail:~# vim /etc/passwd
: %s/bin\ /sh/bin\ /false/g



Set the date:
root@mail:~# date                            
root@mail:~# date --set 12:33:00       
root@mail:~# date --set 04-05-2011
root@mail:~# hwclock --systohc

   
Enable data transfer between the NIC cards. I mean enable packet forwarding:
root@mail:~# vim /etc/sysctl.conf
# Uncomment the next line to enable packet forwarding for IPv4
net.ipv4.ip_forward=1


Install some very important softwares:
root@mail:~# apt-get install vim iftop telnet alpine traceroute lynx -y
root@mail:~# apt-get install rcconf
root@mail:~# rcconf
# then selects the iptables option from here to start automatically every time after restart.


Install some dependencies:

root@mail:~# apt-get install gcc g++ make


Install and configure ssh for remote login:

root@mail:~# apt-get install ssh
root@mail:~# vim /etc/ssh/sshd_config
Port 78
Permit_Root_Login: no
root@mail:~# /etc/init.d/ssh restart


That’s all for a start. :-D Pretty easy! Isn’t it!!!!