From 166667c873ad02f12a98d5a3ef2ca5c3a5d98516 Mon Sep 17 00:00:00 2001 From: Pasha Date: Wed, 7 Jun 2023 18:17:16 +0000 Subject: add more doc and virtual machine also supported. --- README | 16 ++++++------ next_steps | 72 ++++++++++++++++++++++++++++++++++-------------------- openstack_setup.sh | 2 +- 3 files changed, 56 insertions(+), 34 deletions(-) diff --git a/README b/README index 900b476..2a9e473 100644 --- a/README +++ b/README @@ -14,12 +14,12 @@ along with this program. If not, see . -Debian OpenStack Installer for home lab ---------------------------------------- +Debian OpenStack Installer for home lab setup +--------------------------------------------- -1. Install Debian 12 (Bookworm) on a physical machine. +Install Debian 12 (Bookworm) on a physical/virtual machine. -We will use same network interface for host and virtual machines. +1. setup static IP /etc/network/interfaces ------------------------------- @@ -32,6 +32,10 @@ iface eno1 inet static gateway 192.168.0.1 dns-nameservers 192.168.0.1 -------------------------------- +We will use same ethernet connection for host and virtual machines. + +# systemctl restart networking + external router @@ -53,12 +57,10 @@ EXTERNAL_BRIDGE_INTERFACE="eno1" check output from another shell # tail -f output.txt -restart and start exploring openstack on Debian. - +restart 3. Check "next_steps" for networking and launching your first instance. - 4. You can access dashboard: https://192.168.0.155/horizon/ diff --git a/next_steps b/next_steps index 0715390..9813ed2 100644 --- a/next_steps +++ b/next_steps @@ -1,47 +1,45 @@ +Initial configurations +---------------------- Authenticate $ . debian_openstack_installer/admin-openrc - -verify all network agents are ready +verify network agents are ready $ openstack network agent list -Create provider network: - -define network +Create network and subnet: +------------------------- $ openstack network create --share --external \ --provider-physical-network provider \ --provider-network-type flat provider - -define subnet $ openstack subnet create --network provider \ --allocation-pool start=192.168.0.20,end=192.168.0.90 \ --dns-nameserver 192.168.0.1 --gateway 192.168.0.1 \ --subnet-range 192.168.0.0/24 provider - enable icmp and ssh ports $ openstack security group rule create --proto icmp default $ openstack security group rule create --proto tcp --dst-port 22 default +OpenStack keypair +----------------- Generate a key pair: $ ssh-keygen -q -N "" - -cd to your home directory $ openstack keypair create --public-key ~/.ssh/id_rsa.pub mykey - -verify $ openstack keypair list create cpu flavor +----------------- $ openstack flavor create --id 0 --vcpus 2 --ram 1024 --disk 10 m1.nano +Debian OpenStack image +---------------------- download debian openstack image https://cdimage.debian.org/cdimage/openstack/ @@ -60,7 +58,9 @@ $ openstack image create \ debian-10-openstack-amd64 -check network +create an instance +------------------ +get network ID $ openstack network list +--------------------------------------+----------+--------------------------------------+ | ID | Name | Subnets | @@ -68,14 +68,21 @@ $ openstack network list | da5f9aa8-1bac-4aab-9931-0ce4d835783a | provider | eeeb4a46-8bb0-442b-b81c-20103c2d7f80 | +--------------------------------------+----------+--------------------------------------+ -copy ID as net-id while creating server +copy ID as net-id -$ openstack server create --flavor m1.nano --image debian-10-openstack-amd64 \ +$ openstack server create --flavor m1.nano \ + --image debian-10-openstack-amd64 \ --nic net-id=da5f9aa8-1bac-4aab-9931-0ce4d835783a \ --security-group default \ - --key-name mykey debianinstance + --key-name mykey \ + debianinstance +verify +$ openstack server list + +error duplicate SecurityGroups or server list failed +---------------------------------------------------- If you get error like "More than one SecurityGroup exists with the name 'default'." $ openstack security group list @@ -94,28 +101,41 @@ delete the other one $ openstack security group delete ID you may also specify security group id instead of name -$ openstack server create --flavor m1.nano --image debian-10-openstack-amd64 \ +$ openstack server create --flavor m1.nano \ + --image debian-10-openstack-amd64 \ --nic net-id=b2d69a6e-3a77-4d55-94fd-308558088a3d \ --security-group cd54c8c9-d754-434a-9f5c-807c3288fced \ - --key-name mykey debianinstance + --key-name mykey + debianinstance You may need to delete other default security group. -note: openstack server list may fail if multiple default profiles are present. -verify -$ openstack server list +note: openstack server list may fail if multiple default profiles are present. -when virtual server is ready you may ssh +login to the virtual server +--------------------------- $ ssh debian@IP -You may install apache2 for testing in vm. +note: If you ssh before server is ready it might ask for password instead of using your ssh key. Wait until the server add your key after initial boot. + +You may install apache2/nginx for testing in vm. -You need to enable port 80 for security group to allow accessing from other hosts. -example: +enable port 80 to allow access from other hosts. $ openstack security group rule create --proto tcp --dst-port 80 default (better create a new security group instead of enabling port 80 for default profile) -dashboard: https://192.168.0.155/horizon/ +Dashboard login +--------------- +You may access dashboard: +https://192.168.0.155/horizon/ + +login: openstack +pass: openstack +Domain: default + +login: admin +pass: ADMIN_PASS +Domain: default diff --git a/openstack_setup.sh b/openstack_setup.sh index 9339672..4c7666b 100644 --- a/openstack_setup.sh +++ b/openstack_setup.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright (C) 2022 Pasha +# Copyright (C) 2023 Pasha # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by -- cgit v1.2.1