MOS VM: Unterschied zwischen den Versionen
M68k (Diskussion | Beiträge) K (M68k verschob die Seite MOS Mini Hackathon/MOS VM nach MOS VM, ohne dabei eine Weiterleitung anzulegen: shadows MOS Mini Hackathon in categories) |
Pete (Diskussion | Beiträge) (→MOS/VM: doku aktualisiert) |
||
(8 dazwischenliegende Versionen von 3 Benutzern werden nicht angezeigt) | |||
Zeile 2: | Zeile 2: | ||
{{Projekt | {{Projekt | ||
|image=Mos_vm.png | |image=Mos_vm.png | ||
− | |involved=[[User:queltos]] | + | |involved=[[User:queltos| queltos]], [[User:Hetti| Hetti]] |
|startdate=21.01.2013 | |startdate=21.01.2013 | ||
− | |status= | + | |status=awesome |
− | |wtf=Build your own virtual machine for MOS development using Vagrant | + | |wtf=Build your own virtual machine for [https://metalab.at/wiki/Metalab_OS MOS] development using Vagrant |
|hidden=false | |hidden=false | ||
}} | }} | ||
− | Build your own virtual machine for MOS development using Vagrant. | + | Build your own virtual machine for [https://metalab.at/wiki/Metalab_OS MOS] development using Vagrant. |
Done with: | Done with: | ||
− | * | + | * Debian Bullseye (Debian 11) |
− | * Oracle VM VirtualBox Manager | + | * Oracle VM VirtualBox Manager 6 and further |
− | * Vagrant | + | * Vagrant 2.x.x |
− | + | '''Checkout MOS from github''' | |
− | ''' | + | * https://github.com/Metalab/mos.git |
<pre> | <pre> | ||
− | $ | + | $ https://github.com/Metalab/mos.git |
</pre> | </pre> | ||
− | ''' | + | '''cd into the project directory''' |
<pre> | <pre> | ||
$ cd mos | $ cd mos | ||
</pre> | </pre> | ||
− | ''' | + | '''Call vagrant to build and setup your VM''' |
− | |||
− | |||
− | |||
− | |||
− | |||
<pre> | <pre> | ||
$ vagrant up | $ vagrant up | ||
Zeile 40: | Zeile 35: | ||
<pre> | <pre> | ||
Bringing machine 'default' up with 'virtualbox' provider... | Bringing machine 'default' up with 'virtualbox' provider... | ||
− | + | ==> default: Importing base box 'debian/bullseye64'... | |
− | + | ==> default: Matching MAC address for NAT networking... | |
− | + | ==> default: Checking if box 'debian/bullseye64' version '11.20220912.1' is up to date... | |
− | + | ==> default: Setting the name of the VM: mos_metalab_default_1670797153813_2335 | |
− | + | ==> default: Clearing any previously set network interfaces... | |
− | + | ==> default: Preparing network interfaces based on configuration... | |
− | + | default: Adapter 1: nat | |
− | + | ==> default: Forwarding ports... | |
− | + | default: 8000 (guest) => 8000 (host) (adapter 1) | |
− | + | default: 22 (guest) => 2222 (host) (adapter 1) | |
− | + | ==> default: Booting VM... | |
− | + | ==> default: Waiting for machine to boot. This may take a few minutes... | |
− | + | default: SSH address: 127.0.0.1:2222 | |
− | + | default: SSH username: vagrant | |
− | + | default: SSH auth method: private key | |
− | + | default: | |
− | + | default: Vagrant insecure key detected. Vagrant will automatically replace | |
− | + | default: this with a newly generated keypair for better security. | |
− | + | default: | |
− | + | default: Inserting generated public key within guest... | |
− | + | default: Removing insecure key from the guest if it's present... | |
− | VirtualBox! In most cases this is fine, but in rare cases it can | + | default: Key inserted! Disconnecting and reconnecting using new SSH key... |
− | prevent things such as shared folders from working properly. If you see | + | ==> default: Machine booted and ready! |
− | shared folder errors, please make sure the guest additions within the | + | ==> default: Checking for guest additions in VM... |
− | virtual machine match the version of VirtualBox you have installed on | + | default: The guest additions on this VM do not match the installed version of |
− | your host and reload your VM. | + | default: VirtualBox! In most cases this is fine, but in rare cases it can |
+ | default: prevent things such as shared folders from working properly. If you see | ||
+ | default: shared folder errors, please make sure the guest additions within the | ||
+ | default: virtual machine match the version of VirtualBox you have installed on | ||
+ | default: your host and reload your VM. | ||
+ | default: | ||
+ | default: Guest Additions Version: 6.0.0 r127566 | ||
+ | default: VirtualBox Version: 7.0 | ||
+ | ==> default: Setting hostname... | ||
+ | ==> default: Mounting shared folders... | ||
+ | default: /vagrant => <YOUR LOCAL SHARED FOLDER PATH> | ||
+ | ==> default: Running provisioner: shell... | ||
+ | default: Running: /tmp/vagrant-shell20221211-25251-r8t8xa.sh | ||
− | + | ##### | |
− | + | <various packet update operations> | |
− | + | ##### | |
− | |||
− | |||
− | |||
− | |||
− | PLAY [all] ******************************************************************** | + | default: |
+ | default: PLAY [all] ********************************************************************* | ||
+ | default: | ||
+ | default: TASK [Gathering Facts] ********************************************************* | ||
+ | default: ok: [localhost] | ||
+ | default: | ||
+ | default: TASK [link /mos -> /vagrant] *************************************************** | ||
+ | default: changed: [localhost] | ||
+ | default: | ||
+ | default: TASK [Install packages] ******************************************************** | ||
+ | default: changed: [localhost] | ||
+ | default: | ||
+ | default: TASK [add locale de_DE.UTF-8] ************************************************** | ||
+ | default: changed: [localhost] | ||
+ | default: | ||
+ | default: TASK [Upgrade pip3] ************************************************************ | ||
+ | default: changed: [localhost] | ||
+ | default: | ||
+ | default: TASK [Install python modules] ************************************************** | ||
+ | default: changed: [localhost] => (item=/vagrant/requirements.txt) | ||
+ | default: changed: [localhost] => (item=/vagrant/requirements-dev.txt) | ||
+ | default: | ||
+ | default: TASK [check the existence of the secret_key.py file and create one if it does not exist] *** | ||
+ | default: ok: [localhost] | ||
+ | default: | ||
+ | default: TASK [generate random django secret] ******************************************* | ||
+ | default: skipping: [localhost] | ||
+ | default: | ||
+ | default: TASK [generate mos sqlite database] ******************************************** | ||
+ | default: ok: [localhost] | ||
+ | default: | ||
+ | default: TASK [django makemigrations] *************************************************** | ||
+ | default: ok: [localhost] | ||
+ | default: | ||
+ | default: TASK [django migrate] ********************************************************** | ||
+ | default: ok: [localhost] | ||
+ | default: | ||
+ | default: TASK [Create Admin User] ******************************************************* | ||
+ | default: skipping: [localhost] | ||
+ | default: | ||
+ | default: TASK [django loaddata] ********************************************************* | ||
+ | default: skipping: [localhost] | ||
+ | default: | ||
+ | default: TASK [Activate virtualenv on vagrant ssh] ************************************** | ||
+ | default: changed: [localhost] | ||
+ | default: | ||
+ | default: TASK [Change into mos dir on vagrant ssh] ************************************** | ||
+ | default: changed: [localhost] | ||
+ | default: | ||
+ | default: PLAY RECAP ********************************************************************* | ||
+ | default: localhost : ok=12 changed=7 unreachable=0 failed=0 skipped=3 rescued=0 ignored=0 | ||
− | + | </pre> | |
− | |||
− | + | After booting up you will be greeted with our Info Screen with the next steps. | |
− | + | <pre> | |
− | + | ==> default: Machine 'default' has a post `vagrant up` message. This is a message | |
− | + | ==> default: from the creator of the Vagrantfile, and not from Vagrant itself: | |
− | + | ==> default: | |
− | + | ==> default: ====================================================== | |
− | + | ==> default: | |
− | + | ==> default: | |
− | + | ==> default: ███╗ ███╗███████╗████████╗ █████╗ ██╗ █████╗ ██████╗ | |
− | + | ==> default: ████╗ ████║██╔════╝╚══██╔══╝██╔══██╗██║ ██╔══██╗██╔══██╗ | |
− | + | ==> default: ██╔████╔██║█████╗ ██║ ███████║██║ ███████║██████╔╝ | |
− | + | ==> default: ██║╚██╔╝██║██╔══╝ ██║ ██╔══██║██║ ██╔══██║██╔══██╗ | |
− | + | ==> default: ██║ ╚═╝ ██║███████╗ ██║ ██║ ██║███████╗██║ ██║██████╔╝ | |
− | + | ==> default: ╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝╚════╝ | |
− | + | ==> default: | |
− | + | ==> default: Vagrant VM Development Machine | |
− | + | ==> default: | |
− | + | ==> default: How to proceed further: | |
− | + | ==> default: | |
− | + | ==> default: enter the VM with: | |
+ | ==> default: $ vagrant ssh | ||
+ | ==> default: | ||
+ | ==> default: Execute the following commands inside the VM: | ||
+ | ==> default: | ||
+ | ==> default: 1) You have to set the 'admin' superuser password manually | ||
+ | ==> default: $ ./manage.py changepassword admin | ||
+ | ==> default: | ||
+ | ==> default: 2) Start the server bound on all interfaces instead of 127.0.0.1 only | ||
+ | ==> default: $ ./manage.py runserver 0.0.0.0:8000 | ||
+ | ==> default: | ||
+ | ==> default: Access the instance under http://localhost:8000 in your browser | ||
+ | ==> default: | ||
+ | ==> default: Modifications in the folder will be immediately available in the dev environment. | ||
+ | ==> default: | ||
+ | ==> default: | ||
</pre> | </pre> | ||
Zeile 108: | Zeile 175: | ||
You should see something like: | You should see something like: | ||
<pre> | <pre> | ||
− | Linux | + | Linux mos-dev-vm 5.10.0-18-amd64 #1 SMP Debian 5.10.140-1 (2022-09-02) x86_64 |
The programs included with the Debian GNU/Linux system are free software; | The programs included with the Debian GNU/Linux system are free software; | ||
Zeile 116: | Zeile 183: | ||
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent | Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent | ||
permitted by applicable law. | permitted by applicable law. | ||
− | Last login: | + | Last login: Sun Dec 11 22:22:15 2022 from 10.0.2.2 |
− | vagrant@ | + | (dev) vagrant@mos-dev-vm:/mos$ |
</pre> | </pre> | ||
− | '''Step 6: | + | '''Step 6: Set initial admin PW for your MOS (do this IN the ssh session you opened before as explained in step 5)''' |
+ | |||
+ | user "admin" is already created by the vagrant script. | ||
+ | |||
<pre> | <pre> | ||
− | vagrant@ | + | (dev) vagrant@mos-dev-vm:/mos$ ./manage.py changepassword admin |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
</pre> | </pre> | ||
+ | You will be asked twice for the new password | ||
+ | |||
This user can be used to login into the MOS through the web frontend | This user can be used to login into the MOS through the web frontend | ||
'''Step 7: Run the MOS inside your VM''' | '''Step 7: Run the MOS inside your VM''' | ||
<pre> | <pre> | ||
− | vagrant@ | + | (dev) vagrant@mos-dev-vm:/mos$ ./manage.py runserver 0.0.0.0:8000 |
</pre> | </pre> | ||
You should see something like: | You should see something like: | ||
<pre> | <pre> | ||
− | + | Watching for file changes with StatReloader | |
+ | Performing system checks... | ||
− | 0 | + | System check identified no issues (0 silenced). |
− | + | Dezember 11, 2022 - 23:22:39 | |
− | Django version | + | Django version 3.2.16, using settings 'mos.settings.devel' |
− | + | Starting development server at http://0.0.0.0:8000/ | |
Quit the server with CONTROL-C. | Quit the server with CONTROL-C. | ||
</pre> | </pre> | ||
Zeile 156: | Zeile 221: | ||
Hint: | Hint: | ||
− | After login into your VM will be in the directory from your host where you checked out the project. | + | After login into your VM you will be in the directory from your host where you checked out the project. |
You can edit files on your host and the changes will be visible inside your VM. | You can edit files on your host and the changes will be visible inside your VM. | ||
Zeile 162: | Zeile 227: | ||
<pre> | <pre> | ||
$ vagrant halt | $ vagrant halt | ||
+ | </pre> | ||
+ | |||
+ | or suspend it | ||
+ | |||
+ | <pre> | ||
+ | $ vagrant suspend | ||
</pre> | </pre> | ||
Zeile 171: | Zeile 242: | ||
<pre> | <pre> | ||
Bringing machine 'default' up with 'virtualbox' provider... | Bringing machine 'default' up with 'virtualbox' provider... | ||
− | + | ==> default: Checking if box 'debian/bullseye64' version '11.20220912.1' is up to date... | |
− | + | ==> default: Clearing any previously set forwarded ports... | |
− | + | ==> default: Clearing any previously set network interfaces... | |
− | + | ==> default: Preparing network interfaces based on configuration... | |
− | + | default: Adapter 1: nat | |
− | + | ==> default: Forwarding ports... | |
− | + | default: 8000 (guest) => 8000 (host) (adapter 1) | |
− | + | default: 22 (guest) => 2222 (host) (adapter 1) | |
− | + | ==> default: Booting VM... | |
− | + | ==> default: Waiting for machine to boot. This may take a few minutes... | |
− | VirtualBox! In most cases this is fine, but in rare cases it can | + | default: SSH address: 127.0.0.1:2222 |
− | prevent things such as shared folders from working properly. If you see | + | default: SSH username: vagrant |
− | shared folder errors, please make sure the guest additions within the | + | default: SSH auth method: private key |
− | virtual machine match the version of VirtualBox you have installed on | + | ==> default: Machine booted and ready! |
− | your host and reload your VM. | + | ==> default: Checking for guest additions in VM... |
− | + | default: The guest additions on this VM do not match the installed version of | |
− | Guest Additions Version: | + | default: VirtualBox! In most cases this is fine, but in rare cases it can |
− | VirtualBox Version: | + | default: prevent things such as shared folders from working properly. If you see |
− | + | default: shared folder errors, please make sure the guest additions within the | |
− | + | default: virtual machine match the version of VirtualBox you have installed on | |
− | + | default: your host and reload your VM. | |
+ | default: | ||
+ | default: Guest Additions Version: 6.0.0 r127566 | ||
+ | default: VirtualBox Version: 7.0 | ||
+ | ==> default: Setting hostname... | ||
+ | ==> default: Mounting shared folders... | ||
+ | default: /vagrant => <YOUR LOCAL SHARED FOLDER PATH> | ||
+ | ==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision` | ||
+ | ==> default: flag to force provisioning. Provisioners marked to run always will still run. | ||
</pre> | </pre> | ||
No worries, the last line is not an error :) | No worries, the last line is not an error :) |
Aktuelle Version vom 11. Dezember 2022, 22:52 Uhr
MOS/VM
MOS VM | |
Gestartet: | 21.01.2013 |
Involvierte: | queltos, Hetti |
Status: | awesome |
Beschreibung: | Build your own virtual machine for MOS development using Vagrant |
Shutdownprozedur: | |
Zuletzt aktualisiert: | 2022-12-11 |
Build your own virtual machine for MOS development using Vagrant.
Done with:
- Debian Bullseye (Debian 11)
- Oracle VM VirtualBox Manager 6 and further
- Vagrant 2.x.x
Checkout MOS from github
$ https://github.com/Metalab/mos.git
cd into the project directory
$ cd mos
Call vagrant to build and setup your VM
$ vagrant up
You should see something like
Bringing machine 'default' up with 'virtualbox' provider... ==> default: Importing base box 'debian/bullseye64'... ==> default: Matching MAC address for NAT networking... ==> default: Checking if box 'debian/bullseye64' version '11.20220912.1' is up to date... ==> default: Setting the name of the VM: mos_metalab_default_1670797153813_2335 ==> default: Clearing any previously set network interfaces... ==> default: Preparing network interfaces based on configuration... default: Adapter 1: nat ==> default: Forwarding ports... default: 8000 (guest) => 8000 (host) (adapter 1) default: 22 (guest) => 2222 (host) (adapter 1) ==> default: Booting VM... ==> default: Waiting for machine to boot. This may take a few minutes... default: SSH address: 127.0.0.1:2222 default: SSH username: vagrant default: SSH auth method: private key default: default: Vagrant insecure key detected. Vagrant will automatically replace default: this with a newly generated keypair for better security. default: default: Inserting generated public key within guest... default: Removing insecure key from the guest if it's present... default: Key inserted! Disconnecting and reconnecting using new SSH key... ==> default: Machine booted and ready! ==> default: Checking for guest additions in VM... default: The guest additions on this VM do not match the installed version of default: VirtualBox! In most cases this is fine, but in rare cases it can default: prevent things such as shared folders from working properly. If you see default: shared folder errors, please make sure the guest additions within the default: virtual machine match the version of VirtualBox you have installed on default: your host and reload your VM. default: default: Guest Additions Version: 6.0.0 r127566 default: VirtualBox Version: 7.0 ==> default: Setting hostname... ==> default: Mounting shared folders... default: /vagrant => <YOUR LOCAL SHARED FOLDER PATH> ==> default: Running provisioner: shell... default: Running: /tmp/vagrant-shell20221211-25251-r8t8xa.sh ##### <various packet update operations> ##### default: default: PLAY [all] ********************************************************************* default: default: TASK [Gathering Facts] ********************************************************* default: ok: [localhost] default: default: TASK [link /mos -> /vagrant] *************************************************** default: changed: [localhost] default: default: TASK [Install packages] ******************************************************** default: changed: [localhost] default: default: TASK [add locale de_DE.UTF-8] ************************************************** default: changed: [localhost] default: default: TASK [Upgrade pip3] ************************************************************ default: changed: [localhost] default: default: TASK [Install python modules] ************************************************** default: changed: [localhost] => (item=/vagrant/requirements.txt) default: changed: [localhost] => (item=/vagrant/requirements-dev.txt) default: default: TASK [check the existence of the secret_key.py file and create one if it does not exist] *** default: ok: [localhost] default: default: TASK [generate random django secret] ******************************************* default: skipping: [localhost] default: default: TASK [generate mos sqlite database] ******************************************** default: ok: [localhost] default: default: TASK [django makemigrations] *************************************************** default: ok: [localhost] default: default: TASK [django migrate] ********************************************************** default: ok: [localhost] default: default: TASK [Create Admin User] ******************************************************* default: skipping: [localhost] default: default: TASK [django loaddata] ********************************************************* default: skipping: [localhost] default: default: TASK [Activate virtualenv on vagrant ssh] ************************************** default: changed: [localhost] default: default: TASK [Change into mos dir on vagrant ssh] ************************************** default: changed: [localhost] default: default: PLAY RECAP ********************************************************************* default: localhost : ok=12 changed=7 unreachable=0 failed=0 skipped=3 rescued=0 ignored=0
After booting up you will be greeted with our Info Screen with the next steps.
==> default: Machine 'default' has a post `vagrant up` message. This is a message ==> default: from the creator of the Vagrantfile, and not from Vagrant itself: ==> default: ==> default: ====================================================== ==> default: ==> default: ==> default: ███╗ ███╗███████╗████████╗ █████╗ ██╗ █████╗ ██████╗ ==> default: ████╗ ████║██╔════╝╚══██╔══╝██╔══██╗██║ ██╔══██╗██╔══██╗ ==> default: ██╔████╔██║█████╗ ██║ ███████║██║ ███████║██████╔╝ ==> default: ██║╚██╔╝██║██╔══╝ ██║ ██╔══██║██║ ██╔══██║██╔══██╗ ==> default: ██║ ╚═╝ ██║███████╗ ██║ ██║ ██║███████╗██║ ██║██████╔╝ ==> default: ╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝╚════╝ ==> default: ==> default: Vagrant VM Development Machine ==> default: ==> default: How to proceed further: ==> default: ==> default: enter the VM with: ==> default: $ vagrant ssh ==> default: ==> default: Execute the following commands inside the VM: ==> default: ==> default: 1) You have to set the 'admin' superuser password manually ==> default: $ ./manage.py changepassword admin ==> default: ==> default: 2) Start the server bound on all interfaces instead of 127.0.0.1 only ==> default: $ ./manage.py runserver 0.0.0.0:8000 ==> default: ==> default: Access the instance under http://localhost:8000 in your browser ==> default: ==> default: Modifications in the folder will be immediately available in the dev environment. ==> default: ==> default:
Step 5: Login into your VM
$ vagrant ssh
You should see something like:
Linux mos-dev-vm 5.10.0-18-amd64 #1 SMP Debian 5.10.140-1 (2022-09-02) x86_64 The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. Last login: Sun Dec 11 22:22:15 2022 from 10.0.2.2 (dev) vagrant@mos-dev-vm:/mos$
Step 6: Set initial admin PW for your MOS (do this IN the ssh session you opened before as explained in step 5)
user "admin" is already created by the vagrant script.
(dev) vagrant@mos-dev-vm:/mos$ ./manage.py changepassword admin
You will be asked twice for the new password
This user can be used to login into the MOS through the web frontend
Step 7: Run the MOS inside your VM
(dev) vagrant@mos-dev-vm:/mos$ ./manage.py runserver 0.0.0.0:8000
You should see something like:
Watching for file changes with StatReloader Performing system checks... System check identified no issues (0 silenced). Dezember 11, 2022 - 23:22:39 Django version 3.2.16, using settings 'mos.settings.devel' Starting development server at http://0.0.0.0:8000/ Quit the server with CONTROL-C.
Step 8: Open a browser on your host machine and connect to http://localhost:8000/
Step 9: Login into MOS with a click on "Login" and provide the credentials used in step 6
Step 10: Profit!
Hint: After login into your VM you will be in the directory from your host where you checked out the project. You can edit files on your host and the changes will be visible inside your VM.
If you are done with hacking stop the VM from your host with
$ vagrant halt
or suspend it
$ vagrant suspend
To start it again just enter:
$ vagrant up
You will see something like:
Bringing machine 'default' up with 'virtualbox' provider... ==> default: Checking if box 'debian/bullseye64' version '11.20220912.1' is up to date... ==> default: Clearing any previously set forwarded ports... ==> default: Clearing any previously set network interfaces... ==> default: Preparing network interfaces based on configuration... default: Adapter 1: nat ==> default: Forwarding ports... default: 8000 (guest) => 8000 (host) (adapter 1) default: 22 (guest) => 2222 (host) (adapter 1) ==> default: Booting VM... ==> default: Waiting for machine to boot. This may take a few minutes... default: SSH address: 127.0.0.1:2222 default: SSH username: vagrant default: SSH auth method: private key ==> default: Machine booted and ready! ==> default: Checking for guest additions in VM... default: The guest additions on this VM do not match the installed version of default: VirtualBox! In most cases this is fine, but in rare cases it can default: prevent things such as shared folders from working properly. If you see default: shared folder errors, please make sure the guest additions within the default: virtual machine match the version of VirtualBox you have installed on default: your host and reload your VM. default: default: Guest Additions Version: 6.0.0 r127566 default: VirtualBox Version: 7.0 ==> default: Setting hostname... ==> default: Mounting shared folders... default: /vagrant => <YOUR LOCAL SHARED FOLDER PATH> ==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision` ==> default: flag to force provisioning. Provisioners marked to run always will still run.
No worries, the last line is not an error :)
btw, don't forget to login into it and start MOS again