How To Remotely Install Debian Over A RH Based Distro - Page 2

Want to support HowtoForge? Become a subscriber!
 
Submitted by jakev383 (Contact Author) (Forums) on Fri, 2008-08-08 14:29. ::

4) Keep some old system files

Next we're going to reuse some files from the old RH based system.  Chances are good that the machine name and hostname will stay the same, as well as the name servers, so we are going to copy the config files for these from our RH based system into our new Debian system.

Copy resolv.conf into the new system to keep our old name server information:

cp /etc/resolv.conf $ASD/etc/

cp: overwrite `/mnt/asd/etc/resolv.conf'? y

Copy our hosts file to keep the same name mapping information:

cp /etc/hosts $ASD/etc/

Lastly, our hostname file:

cp /etc/hostname $ASD/etc/

If you're missing either of the last 2 files, don't worry.  You can create them in the $ASD/etc/ directory now.

 

5) Begin setting up new system

Now that the base system is downloaded and installed, we're going to enter a chroot environment so we can begin to set the new system up:

chroot $ASD /usr/bin/env -i HOME=/root TERM=$TERM PS1='\u:\w\$ ' PATH=/bin:/usr/bin:/sbin:/usr/sbin /bin/bash --login

First thing we need to do is tell the new system how to mount the filesystems when it boots up.  I use vim as my editor of choice, but feel free to use whatever editor you feel comfortable with.  We're going to make a simple fstab for the moment:

vim /etc/fstab

# filesystem mount fs-type options dump fsck-order

/dev/hda2 / auto defaults 0 1
proc /proc proc defaults 0 0

Now we need to get proc mounted:

mount -t proc proc /proc

Then we set the hostname (make sure this matches what you have configured in your hosts file):

hostname test.example.com

RH based distros will not have this next file.  Debian systems configure the network interfaces in a different manner than RH based distros, so we need to create this next file and populate it:

vim /etc/network/interfaces

# Used by ifup(8) and ifdown(8). See the interfaces(5) manpage or
# /usr/share/doc/ifupdown/examples for more information.

auto lo
iface lo inet loopback

auto eth0 # Automatically bring eth0 up on boot
iface eth0 inet static # Define a static IP for eth0
  address 192.168.100.110 # This machine's IP address
  netmask 255.255.255.0 # The netmask for the network that this machine is on
  network 192.168.100.0 # The network that this machine is on
  broadcast 192.168.100.255 # The broadcast address for the network this machine is on
  gateway 192.168.100.1 # The gateway this machine needs to communicate through
  dns-nameservers 192.168.100.1 192.168.100.2 # Define name servers here - redundant to /etc/resolv.conf

Change the IP addresses to match your environment.  If you do not know this information, you can always open another SSH session into the system and find out. Opening a new SSH session into the machine will bring you into the RH system, not the chroot'ed Debian system, so you may gather this information from the config files on the functioning RH machine. Once you are done setting this information, save the file.

Let's set a few system settings now.  First let's set a root password and create a user account:

dpkg-reconfigure passwd

I answered Yes to Shadow passwords, entered a root password, and created a normal user account (user1) so that I do not have to login as root via SSH.

Next we install and configure our locales:

apt-get install locales

dpkg-reconfigure locales

Now select what type of locale you need (I selected en_US ISO-8559-1). Make sure you do NOT select 'None' as the default locale for the system environment.

Lastly, we need to set our timezone:

tzconfig

I couldn't get netselect-apt to work on my test system, so I manually configured my /etc/apt/sources.list:

vim /etc/apt/sources.list

deb http://mirrors.kernel.org/debian/ etch main
deb-src http://mirrors.kernel.org/debian/ etch main

deb http://security.debian.org/ etch/updates main
deb-src http://security.debian.org/ etch/updates main

You can try running 'netselect-apt etch' from the command line and seeing if it works for you. If not, you'll need to manually set the file. Remember to run

apt-get update

afterwards!

Now we need to install SSH so we can login after we reboot into the new Debian system:

apt-get -y install ssh

Using apt-cache we will search for a kernel appropriate for this system:

apt-cache search kernel-image

Use the SMP if you have multiple processors.  I'm using the generic 686 kernel that most everyone will use:

apt-get -y install kernel-image-2.6-686

I chose Yes to the vmlinuz symbolic link.  Make sure to choose "No" to the abort message that pops up about the bootloader.

Next we need to install a package that will help load modules, such as the Ethernet driver:

apt-get -y install discover

discover

You'll want to compare this against an output of

lsmod

on the RH system to see if there are any differences in identifying hardware. If there are, you'll need to add a line to /etc/modutils/aliases to load the correct driver.  Afterwards you'll need to run

update-modules

We also need to create /etc/discover.conf to configure hardware detection settings:

vim /etc/discover.conf

# /etc/discover.conf: hardware detection settings
# Enable the PCI, USB, IDE, and SCSI bus scans:
enable pci,usb,ide,scsi

# Disable PCMCIA - We're not running a laptop!
disable pcmcia

# Scan for these devices at boot
boot bridge ethernet ide scsi usb

Let's run makedev just to be on the safe side:

cd /dev
./MAKEDEV generic

This can take a couple minutes. After it's done, log out of the chroot.

logout


Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.