Project

Profile

Help

Virtualization quickstart » History » Sprint/Milestone 8

Ichimonji10, 07/27/2017 05:00 PM

1 1 kdelee@redhat.com
# Virtualization quickstart
2
3 8 Ichimonji10
This quickstart guide has been tested on Fedora 25.
4 2 kdelee@redhat.com
5 8 Ichimonji10
Within code blocks, a prefix of `$` indicates that a command should be executed as a regular user, and `#` indicates that a command should be performed as root.
6 1 kdelee@redhat.com
7 8 Ichimonji10
## Option 1: Using libvirt and Virtual Machine Manager
8
9
Install required packages:
10
11 1 kdelee@redhat.com
~~~
12 8 Ichimonji10
# dnf install libvirt qemu-kvm kvm libguestfs-tools virt-install
13 1 kdelee@redhat.com
~~~
14
15 8 Ichimonji10
Then, download an image for the OS you want to run in your VM. Fedora ISOs may be downloaded [from here](https://getfedora.org/en/workstation/download/).
16 1 kdelee@redhat.com
17 8 Ichimonji10
Launch the "Virtual Machine Manager" application and click:
18 1 kdelee@redhat.com
19 8 Ichimonji10
1\. File -\> New Virtual Machine  
20
2\. Local install media -\> Browse to downloaded ISO  
21
3\) Accept default settings
22 1 kdelee@redhat.com
23
### SETTING UP THE VM:
24
25 8 Ichimonji10
1\. Start the VM with the "play button"  
26
2\. Choose to install fedora:  
27
3\. set hostname: give it a name other than localhost.  
28
4\. make it meaningful  
29
5\. set root password (weak one is OK)  
30
6\. if you make a user, make sure to give them sudo access
31 5 kdelee@redhat.com
32 8 Ichimonji10
**NOTE**: If you make a user and forgot to give them sudo access, start the VM, open a terminal, and:
33 5 kdelee@redhat.com
34 1 kdelee@redhat.com
~~~
35 8 Ichimonji10
$ su
36
# gpasswd --add admin wheel
37 1 kdelee@redhat.com
~~~
38 7 Ichimonji10
39 1 kdelee@redhat.com
Then restart.
40
41 8 Ichimonji10
**WARNING**: `localhost` is a **bad** hostname. Each of your VMs should have a unique hostname. If you clone a VM, both hosts will have the same hostname. It is imperative that you change your a host's hostname before installing any pulp components, as Pulp uses its host's hostname, and Pulp can produce undefined behavior if its host's hostname is changed after the fact.
42 7 Ichimonji10
43 8 Ichimonji10
To see your host's hostname, execute `hostname`. To change your host's hostname, run:
44 5 kdelee@redhat.com
45 1 kdelee@redhat.com
~~~
46 8 Ichimonji10
# hostnamectl set-hostname <new-hostname>
47 1 kdelee@redhat.com
~~~
48
49
### SETTING UP ANSIBLE (on the VM):
50 7 Ichimonji10
51 8 Ichimonji10
Install Ansible:
52 1 kdelee@redhat.com
53
~~~
54 8 Ichimonji10
# dnf install ansible git
55 1 kdelee@redhat.com
~~~
56 7 Ichimonji10
57
Ansible info:  
58
For documentation see http://docs.ansible.com/
59 1 kdelee@redhat.com
60
Download the pulp_packaging repo:
61
62
~~~
63 6 elyezer
$ git clone https://github.com/pulp/pulp_packaging.git
64 7 Ichimonji10
~~~
65 6 elyezer
66 8 Ichimonji10
Now we need to make a `hosts` file for Ansible. Use the results of the `hostname` command in the place of 'localhost':
67 6 elyezer
68 1 kdelee@redhat.com
~~~
69 2 kdelee@redhat.com
$ cd pulp_packaging/ci/ansible
70
$ echo "$(hostname)" > hosts
71 1 kdelee@redhat.com
~~~
72 2 kdelee@redhat.com
73
### Choosing what version of pulp to install
74
75 8 Ichimonji10
To choose the version of pulp that you will install:
76 1 kdelee@redhat.com
77 8 Ichimonji10
  - edit `pulp_packaging/ci/ansible/roles/pulp/defaults/main.yaml`, or
78
  - pass `-e pulp_version=2.14 -e pulp_build=nightly` in the ansible-playbook invocation, or
79
  - in hosts file, specify pulp_version and pulp_build on the same line as hostname, i.e. `name_of_host pulp_version=2.14 pulp_build=nightly`
80 7 Ichimonji10
81
Now you are ready to run the ansible playbook:
82 4 kdelee@redhat.com
83
~~~
84 8 Ichimonji10
$ ansible-playbook -i hosts -e ansible_connection=local pulp_server.yaml
85 1 kdelee@redhat.com
~~~
86
87
## Option 2: Using Vagrant with either libvirt or docker
88
89
See [Pulp Developer Setup](http://docs.pulpproject.org/dev-guide/contributing/dev_setup.html)