Freitag, 2. April 2010

Install Debian on a ASUS Eee Box (EB1012)

The ASUS Eee Box is the ideal small home Server it needs less power and have a lot of features
  • Atom N330 1.60GHz
  • 2GB RAM
  • 250GB HDD
  • NVIDIA ION
  • WLAN b/g/n
  • GB-LAN
  • HDMI
  • VGA
  • eSATA
  • 5x USB2.0
  • Cardreader
  • Windows 7 Home Premium

1.) Prepear System
You should first connect the keyboard, mouse and a monitor and start the System normal and wait until it performs all of the needed setup of Windows 7.

When the System is ready, run all updates, install a antivirus programm and then download and install DriveImage XML (Free Version) from http://www.runtime.org/driveimage-xml.htm .

With DriveImage XML you can make a Backup of your C: Partion, please choose the D: Parition as Destination for the Backup file.

You can compress the finished Backup with 7zip or other Packers to get a smaller file.
After this copy the file to a USB Stick and burn it to a DVD or save it on a Backupplace of you choice.

Because the ASUS Eee Box comes with no optical CD/DVD/Bluray Drive you can connect a USB CD/DVD/Bluray Drive or you need to use a USB Stick for the Installation.

2.) Get Debian and Install Debian
After this you need to download Debian (stable Version) for the USB CD/DVD/Bluray Drive or for the USB Stick.

I have use the DVD Version of Debian which you can download under the following location:
http://cdimage.debian.org/debian-cd/5.0.4/i386/iso-dvd/

You only need to use the first DVD file debian-504-i386-DVD-1.iso.

For the USB Stick there a lot of Guides in the Internet even to prepare the USB Stick on Windows.

When you plan to use the ASUS Eee Box as DSL Router you need to use a additional USB Network Card, you need a USB Network Card for USB 2.0 because the USB 1.x versions are to low and will provide you only a max. 400 kb transfare rate (worse DSL 6000).

When you install the System, plugin all needed USB Device which you want to use on the System this includes the USB Network Card.

You can install the System as usally or with the standart features.
When the System is installed and the Debian is booting then you can go to the next step.

3.) Adjust the APT Sources
To get the lasted software and security updates we will add the APT Sources and choose the fasted one. You need to run the following commands:
...
apt-get install netselect-apt
cd /etc/apt
netselect-apt -n
apt-get update && apt-get upgrade
...

4.) Get the needed Informations for the right Kernel for the ASUS Eee Box
Normaly the current Kernel of the Debian Installation of to low for the Asus Eee Box and so we need to compile your own Kernel.

So we execute the following command:
...
# uname -a
Linux xxx 2.6.26-2-686 #1 SMP Tue Mar 9 17:35:51 UTC 2010 i686 GNU/Linux
...

2.6.26-2.686 is our current Kernel version, when your version is below 2.6.32.x or you want the best kernel for the ASUS Eee Box then you need to install your own kernel.

Check for needed Modules, run the following commands and copy the output of the "lspci -n" to the clipboard :
...
apt-get install pciutils
lspci -n
...

Past the results into the webpage http://kmuto.jp/debian/hcl/ to get a overview of the needed drivers.

You should get the following Informations:
PCI IDFunktioniert?HerstellerGerätTreiberkernel
10de0a82
nVidia CorporationMCP79 Host Bridge

10de0a88
nVidia CorporationMCP79 Memory Controller

10de0aad
nVidia CorporationMCP79 LPC Bridge

10de0aa4
nVidia CorporationMCP79 Memory Controller

10de0aa2YesnVidia CorporationMCP79 SMBusi2c-nforce2v2.6.30-
10de0a89
nVidia CorporationMCP79 Memory Controller

10de0aa3
nVidia CorporationMCP79 Co-processor

10de0aa5
nVidia CorporationMCP79 OHCI USB 1.1 Controller

10de0aa6
nVidia CorporationMCP79 EHCI USB 2.0 Controller

10de0aa7
nVidia CorporationMCP79 OHCI USB 1.1 Controller

10de0aa9
nVidia CorporationMCP79 EHCI USB 2.0 Controller

10de0ac0YesnVidia CorporationMCP79 High Definition Audiosnd-hda-intelv2.6.24-
10de0aab
nVidia CorporationMCP79 PCI Bridge

10de0ab8YesnVidia CorporationMCP79 AHCI Controllerahciv2.6.24-
10de0aa0
nVidia CorporationMCP79 PCI Express Bridge

10de0ac6
nVidia CorporationMCP79 PCI Express Bridge

10de0ac7
nVidia CorporationMCP79 PCI Express Bridge

10de087d
nVidia CorporationION VGA

10ec8168YesRealtek Semiconductor Co., Ltd.RTL8111/8168B PCI Express Gigabit Ethernet controllerr8169v2.6.25-
168c002bYesAtheros Communications Inc.AR9285 Wireless Network Adapter (PCI-Express)ath9kv2.6.29

Here you see that we need the following driver in the kernel to use all the features of the ASUS Eee Box:
  • i2c-nforce2 - SMBus
  • snd-hda-intel - Soundcard
  • ahci - Serial ATA Controller
  • r8169 - Gigabit Ethernet Controller
  • ath9k - For the Wireless Network Adapter
5.) Download and unpack the Kernel for the ASUS Eee Box

I choose the Kernel 2.6.33.2 for this, but you can use the current stable version from http://kernel.org/ as well.

To download the Kernel 2.6.33.2 we execute the following commands:
...
cd /usr/src/
wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.33.2.tar.bz2
apt-get install bzip2
tar xfvj linux-2.6.33.2.tar.bz2
...

6.) Copy the current Kernel config as basis for the new one

To save some work, we use the current Kernel config as basis for the new one, this can be done with the following commands:
...
apt-get install build-essential libncurses5-dev libncurses5
cp /boot/config-$(uname -r) /usr/src/linux-2.6.33.2/.config
cd /usr/src/linux-2.6.33.2/
make oldconfig
...

It will asked some question, but simple press Return to all of this question.
But when you want to answer all of this you can also answer most of them.

After this we will run the command "make menuconfig" to enter the kernel config menu and adjust the needed parts.

In the menu go to "Load an Alternate Configuration File" and click "ok".
After this we adjust the following Parts:
...
Processor type and features - Processor family - Intel Atom - MATOM [=y]
Processor type and features - Maximum number of CPUs - NR_CPUS [=4]
Device Drivers - Network device support - Ethernet (1000 Mbit) - Realtek 8169 gigabit ethernet support - R8169 [=y]
Device Drivers - Network device support - Wireless LAN - Atheros Wireless Cards - ATH_COMMON [=m]
Device Drivers - Network device support - Wireless LAN - Atheros Wireless Cards - Atheros 802.11n wireless cards support - ATH9K [=m]
Device Drivers - Serial ATA and Parallel ATA drivers - AHCI SATA support - SATA_AHCI [=m]
Device Drivers - I2C support - I2C Hardware Bus support - Nvidia nForce2, nForce3 and nForce4 - I2C_NFORCE2 [=m]
Device Drivers - Connector - unified userspace <-> kernelspace linker - CONNECTOR [=y]
Device Drivers - SCSI device support - SCSI device support - SCSI [=y]
Device Drivers - SCSI device support - SCSI low-level drivers - iSCSI Initiator over TCP/IP - ISCSI_TCP [=y]
Kernel hacking - Kernel debugging - DEBUG_KERNEL [=n]
Cryptographic API - CRC32c CRC algorithm - CRYPTO_CRC32C [=y]
...

This are the needed driver for the Asus Eee Box after this save the new configuration.

7.) Compile the kernel

To compile the kernel run the following commands:
...
make -j4
make -j4 modules
make -j4 modules_install
make install
update-initramfs -c -k 2.6.33.2
ln -s /usr/src/linux-2.6.33.2 /usr/src/linux
...

The "-j4" switch is that "make" will use all 4 CPU cores instead of one.
But it will take about 1 hour until the "make" command is finished, so take a break. ;)

8.) Edit grub menu.lst
Edit the file "/boot/grub/menu.lst" and copy the existing entry and adjust the entry so that it fit to your new kernel for e.g:

...
## ## End Default Options ##

title Debian GNU/Linux, kernel 2.6.33.2
root (hd0,0)
kernel /vmlinuz-2.6.33.2 root=/dev/mapper/System-Aron--Root ro quiet
initrd /initrd.img-2.6.33.2
...

Reboot the System and when all is working fine be happy. ;)

9.) Setup ASUS Eee Box as Access Point for WLAN

Unforently the current packet of hostapd is not compatible with the ASUS Eee Box and so we need to compile our own version.

So we need to download the lasted version from http://w1.fi/hostapd/ with the following commands:
...
cd /usr/src/
wget http://w1.fi/releases/hostapd-0.7.1.tar.gz
tar xfvz hostapd-0.7.1.tar.gz
cd /usr/src/hostapd-0.7.1/hostapd
cp defconfig .config
...

The Version 0.6.10 has a BUG and so we use the Version 0.7. 1 instead !
Then edit the .config file and remove the # before "CONFIG_DRIVER_NL80211=y".
After this you need to run the following commands:
...
apt-get install libnl-dev libcurl4-openssl-dev hostapd wireless-tools
make -j4
make install
mv /usr/local/bin/hostapd /usr/sbin/hostapd
...

We install the Debian hostapd packet first to get a default init.d script and a configuration file.

After this we edit the file "/etc/default/hostapd" and set remove the # before ...RUN_DAEMON="yes"...

Then you need to adjust the Configuration file /etc/hostapd/hostapd.conf with some parameters:
...
interface=wlan0
driver=nl80211
ssid=
hw_mode=g
channel=
auth_algs=3
ignore_broadcast_ssid=
wpa=2
wpa_passphrase=
...

Adjust the Network Config file for the Interface "wlan0" and add the following entry:
...
# Wlan Interface
auto wlan0
iface wlan0 inet static
address 192.168.0.10
netmask 255.255.255.0
...


Then you can try to start the Access Point with the following Command:
...
iwconfig
ifconfig wlan0 up
iwlist wlan0 scan
hostapd -dd /etc/hostapd/hostapd.conf
...

It will display you all Error Messages or error which are needs to be fixed before the Access Point can be running.
With "iwlist wlan0 scan" you scan for current WLANs, so don't worry if it doesn't return any result.
When you can see your wlan and all ist working correct, restart the System to check if the automatic configuration is working complet.

10.) Some Security advise before you connect the Box to the Internet

- Set up a firewall with iptables
- Change the standard port of ssh to a Port above 4096 (/etc/ssh/sshd_config)
- Install harden tools for e.g: "apt-get install harden-servers"
- Remove unneeded Tools and Services

11.) iSCSI Support for the Box
When you need iSCSI for the Box you need to compile this package as well from the source.

To do this you can use the following steps:
...
apt-get install subversion
cd /usr/src/
svn co https://iscsitarget.svn.sourceforge.net/svnroot/iscsitarget iscsitarget
cd iscsitarget/trunk/
...

Edit Makefile and remove the # before ...export KSRC := /usr/src/linux... and then run the follwing commands:

...
make -j4

make-install
mv /lib/modules/extra /lib/modules/2.6.33.2/
depmod
modprobe iscsi_trgt
...

Then you can configure the iSCSI Configuration and it should worked without any problems with your new kernel.

Keine Kommentare:

Kommentar veröffentlichen