Linux/Xen/DomU/Devuan/Devuan Jessie: Difference between revisions

From Guungle
Jump to navigation Jump to search
(Created page with "===Devuan Jessie=== Start this process on a existing Devuan system. You will need to have the Devuan patched version of debootstrap installed. Create a empty image file and...")
 
Line 100: Line 100:
timeout        2
timeout        2


title          Ubuntu 14.04
title          Devuan Jessie
root            (hd0,0)
root            (hd0,0)
kernel          /boot/vmlinuz-3.13.0-24-generic root=/dev/xvda1 ro console=hvc0
kernel          /boot/vmlinuz-3.16.0-4-amd64 root=/dev/xvda1 ro console=hvc0
initrd          /boot/initrd.img-3.13.0-24-generic
initrd          /boot/initrd.img-3.16.0-4-amd64


title          Ubuntu 14.04 (Single-User)
title          Devuan Jessie (Single-User)
root            (hd0,0)
root            (hd0,0)
kernel          /boot/vmlinuz-3.13.0-24-generic root=/dev/xvda1 ro single console=hvc0
kernel          /boot/vmlinuz-3.16.0-4-amd64 root=/dev/xvda1 ro single console=hvc0
initrd          /boot/initrd.img-3.13.0-24-generic
initrd          /boot/initrd.img-3.16.0-4-amd64
</syntaxhighlight>
</syntaxhighlight>


Line 121: Line 121:
# End /etc/fstab
# End /etc/fstab
</syntaxhighlight>
</syntaxhighlight>


====Firewall====
====Firewall====

Revision as of 13:24, 15 January 2017

Devuan Jessie

Start this process on a existing Devuan system. You will need to have the Devuan patched version of debootstrap installed.

Create a empty image file and format it with ext3.

dd if=/dev/zero of=devuan_jessie.img bs=1M count=1 seek=1024
mkfs.ext3 devuan_jessie.img

Create a directory to mount the image on. Using '/mnt/img' for this example.

mkdir /mnt/img
mount -oloop devuan_jessie.img /mnt/img

Start the debootstrap process.

debootstrap --variant=minbase jessie /mnt/img http://auto.mirror.devuan.org/merged/

Once that completes, copy your existing /etc/apt/sources.list to the new image so we can run updates.

cp /etc/apt/sources.list /mnt/img/etc/apt/

Here is a basic sources.list

deb http://auto.mirror.devuan.org/merged jessie main
deb http://auto.mirror.devuan.org/merged jessie-updates main
deb http://auto.mirror.devuan.org/merged jessie-security main

Mount the necessary system files so that we can enter the new root filesystem with chroot.

mount --bind /dev /mnt/img/dev
mount --bind /dev/pts /mnt/img/dev/pts
mount -t proc proc /mnt/img/proc
mount -t sysfs sys /mnt/img/sys
chroot /mnt/img

Run updates and install a language pack.

apt-get update
apt-get upgrade

Configure the system timezone.

dpkg-reconfigure tzdata

Install the kernel image, SSH server and the full version of vim

apt-get install linux-image-`dpkg --print-architecture`
apt-get install openssh-server
apt-get install vim

To use the Xen console 'xm console (domU)' you need to setup a tty on /dev/hvc0. Edit /etc/inittab and add this line.

co:2345:respawn:/sbin/getty 38400 hvc0


The default udev rules for Devuan ignore Xen generated MAC addresses so you won't get a '/etc/udev/rules.d/70-persistent-net.rules' This causes your network interfaces not to come up.

Edit '/lib/udev/rules.d/75-persistent-net-generator.rules' and comment these lines. Here's the changes in patch/diff format.

@@ -21,7 +21,7 @@ KERNEL!="eth*|ath*|wlan*[0-9]|msh*|ra*|s
                                        GOTO="persistent_net_generator_end"

 # ignore Xen virtual interfaces
-SUBSYSTEMS=="xen",                     GOTO="persistent_net_generator_end"
+#SUBSYSTEMS=="xen",                    GOTO="persistent_net_generator_end"

 # ignore UML virtual interfaces
 DRIVERS=="uml-netdev",                 GOTO="persistent_net_generator_end"
@@ -75,7 +75,7 @@ ENV{MATCHADDR}=="00:0c:29:*|00:50:56:*|0
 ENV{MATCHADDR}=="00:15:5d:*",          ENV{MATCHADDR}=""
 ENV{MATCHADDR}=="52:54:00:*|54:52:00:*", ENV{MATCHADDR}=""
 ENV{MATCHADDR}=="08:00:27:*",          ENV{MATCHADDR}=""
-ENV{MATCHADDR}=="00:16:3e:*",          ENV{MATCHADDR}=""
+#ENV{MATCHADDR}=="00:16:3e:*",         ENV{MATCHADDR}=""

 # ignore Windows Azure Hyper-V virtual interfaces
 ENV{MATCHADDR}=="00:03:ff:*", ENV{MATCHADDR}=""

Configure your '/etc/network/interfaces' for DHCP

# interfaces(5) file used by ifup(8) and ifdown(8)
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto eth0
iface eth0 inet dhcp

GRUB

Setup a basic grub config in "/boot/grub/menu.lst"

default         0
timeout         2

title           Devuan Jessie
root            (hd0,0)
kernel          /boot/vmlinuz-3.16.0-4-amd64 root=/dev/xvda1 ro console=hvc0
initrd          /boot/initrd.img-3.16.0-4-amd64

title           Devuan Jessie (Single-User)
root            (hd0,0)
kernel          /boot/vmlinuz-3.16.0-4-amd64 root=/dev/xvda1 ro single console=hvc0
initrd          /boot/initrd.img-3.16.0-4-amd64

Configure a basic fstab

# Begin /etc/fstab
# <file system> <mount-point>   <type>   <options>                      <dump> <pass>
/dev/sda1          /             ext3      defaults,errors=remount-ro    0     0
proc               /proc         proc      defaults                      0     0

# End /etc/fstab

Firewall

apt-get install iptables
apt-get install ufw

ufw allow OpenSSH
ufw enable

Final Cleanup

Set a hostname.

Remove /etc/udev/rules.d/70-persistent-net.rules so that network comes up clean when the image is booted for the first time.

Remove SSH host keys so that new ones get generated on first boot.

Set a root password

echo 'trusy' > /etc/hostname
rm /etc/udev/rules.d/70-persistent-net.rules
rm /etc/ssh/ssh_host_*
passwd root