122 lines
3.0 KiB
Plaintext
122 lines
3.0 KiB
Plaintext
# choose a name ($NEW_VM)
|
|
# choose a volume size ($SIZE)
|
|
virsh vol-create-as vg0 rootfs-$NEW_VM $SIZE --format logical
|
|
virsh define $NEW_VM
|
|
virsh edit $NEW_VM
|
|
# add hard disk as "vda" and set volume to boot on (vg0/rootfs-$NEW_VM)
|
|
# add cdrom as "hda" and set volume to the distro iso (use "virt" version)
|
|
# copy the mac address of the network card ($MAC)
|
|
# choose an ip ($IP)
|
|
~/libvirt/scripts/net-add_static_lease new_vm $MAC $IP
|
|
virsh start $NEW_VM
|
|
virsh domdisplay $NEW_VM
|
|
# check the port the vnc display is switched on ($PORT)
|
|
virsh domdisplay $NEW_VM | cut -d: -f3
|
|
# on the local machine, create a ssh tunnel:
|
|
ssh root@freepoteries.fr -L 5900:127.0.0.1:59$PORT
|
|
# out of the newly created ssh session (keep it open for log messages)
|
|
vncviewer 127.0.0.1:5900
|
|
# login into your newly booted os
|
|
# all the following instructions are done into the VM, by the VNC client
|
|
# (vncviewer)
|
|
|
|
# instructions for alpine linux :
|
|
# choose your keymap $KM (fr)
|
|
setup-keymap $KM
|
|
# choose your hostname
|
|
setup-hostname
|
|
# answer your system hostname (that will also be its subdomain)
|
|
# choose your timezone $TZ (Europe/Paris)
|
|
setup-timezone -z $TZ
|
|
# setup interfaces (answer "eth0" and "dhcp")
|
|
setup-interfaces
|
|
/etc/init.d/networking restart
|
|
# choose your ssh server (openssh)
|
|
setup-sshd
|
|
# choose your ntp server (chrony)
|
|
setup-ntp
|
|
# choose your repo (36 : alpine.42.fr)
|
|
setup-apkrepos
|
|
# setup the dns
|
|
setup-dns
|
|
# answer 1 : freepoteries.fr
|
|
# answer 2 : 192.168.42.11
|
|
# test by pinging freepoteries.fr and belugaspot.freepoteries.fr (always up),
|
|
# they should give "192.168.42.1" and "192.168.42.55"
|
|
# setup mail server
|
|
setup-mta
|
|
# answer: mail.freepoteries.fr
|
|
# install syslinux and e2fsprogs if not installed
|
|
apk add syslinux e2fsprogs xfsprogs
|
|
# create your disks
|
|
fdisk /dev/vda
|
|
# create a partition that takes the whole hard disk
|
|
# make it bootable "a"
|
|
# save your changes "w"
|
|
# format it to the right fs
|
|
mkfs.xfs /dev/vda1
|
|
# fix the mbr
|
|
dd bs=440 count=1 conv=notrunc if=/usr/share/syslinux/mbr.bin of=/dev/vda
|
|
# mount the partition
|
|
mount /dev/vda1 /mnt
|
|
mkdir /mnt/boot
|
|
# install the system on the created partition
|
|
setup-disk -m sys /mnt
|
|
mount -o bind /dev /mnt/dev
|
|
mount -o bind /proc /mnt/proc
|
|
chroot /mnt
|
|
# install the bootloader
|
|
extlinux -i /boot
|
|
update-extlinux
|
|
# change password (toor)
|
|
passwd
|
|
|
|
exit
|
|
poweroff
|
|
|
|
# in the first ssh session
|
|
virsh edit $NEW_VM
|
|
# set the boot dev to "hd" - ~/libvirt/scripts/switch_boot_device.sh $NEW_VM
|
|
virsh destroy $NEW_VM
|
|
virsh start $NEW_VM
|
|
|
|
# ssh
|
|
vim /etc/ssh/sshd_config
|
|
# set "PermitRootLogin yes"
|
|
rc-service sshd restart
|
|
mkdir ~/.ssh
|
|
|
|
# on the host:
|
|
scp ~/.ssh/authorized_keys new_host.freepoteries.fr:~/.ssh/
|
|
|
|
# on the vm
|
|
vim /etc/ssh/sshd_config
|
|
# set "PermitRootLogin without-password"
|
|
rc-service sshd restart
|
|
|
|
# on the host
|
|
eval $(ssh-agent)
|
|
ssh-add ~/.ssh/*
|
|
ssh root@new_host.freepoteries.fr (should not ask password)
|
|
|
|
# add zone on unbound
|
|
# add proxy on revproxy
|
|
|
|
# packages :
|
|
screen
|
|
vim
|
|
git
|
|
nginx
|
|
php7-fpm
|
|
ruby
|
|
python3
|
|
|
|
# var/www :
|
|
garradin
|
|
|
|
# etc/nginx/conf.d :
|
|
garradin.conf
|
|
|
|
# follow these instructions
|
|
https://wiki.alpinelinux.org/wiki/Nginx_with_PHP#PHP7_Installation
|