MOS VM: Unterschied zwischen den Versionen
Pl (Diskussion | Beiträge) →MOS/VM: remove checkout hint |
Pete (Diskussion | Beiträge) →MOS/VM: doku aktualisiert |
||
(5 dazwischenliegende Versionen desselben Benutzers 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=awesome | |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''' | '''Checkout MOS from github''' | ||
* https://github.com/Metalab/mos.git | |||
<pre> | <pre> | ||
$ | $ https://github.com/Metalab/mos.git | ||
</pre> | </pre> | ||
Zeile 35: | 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 103: | 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 111: | 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 157: | Zeile 227: | ||
<pre> | <pre> | ||
$ vagrant halt | $ vagrant halt | ||
</pre> | |||
or suspend it | |||
<pre> | |||
$ vagrant suspend | |||
</pre> | </pre> | ||
Zeile 166: | 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 :) |