Virtualization quickstart » History » Sprint/Milestone 21
kdelee@redhat.com, 08/08/2017 05:14 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 | 10 | Ichimonji10 | 1\. File → New Virtual Machine |
20 | 2\. Local install media → Browse to downloaded ISO |
||
21 | 8 | Ichimonji10 | 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 | 9 | Ichimonji10 | For details on Ansible, see the [Ansible documentation](https://docs.ansible.com/). |
52 | |||
53 | 13 | kdelee@redhat.com | Install Ansible: |
54 | For Fedora, you can install ansible without enabling any extra repos. For RHEL7 you will have to set up epel. |
||
55 | 1 | kdelee@redhat.com | |
56 | 13 | kdelee@redhat.com | *For RHEL 7 only* |
57 | |||
58 | 1 | kdelee@redhat.com | ~~~ |
59 | 13 | kdelee@redhat.com | $ wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm |
60 | # rpm -i epel-release-latest-7.noarch.rpm |
||
61 | ~~~ |
||
62 | |||
63 | ~~~ |
||
64 | 7 | Ichimonji10 | # dnf install ansible git |
65 | ~~~ |
||
66 | 1 | kdelee@redhat.com | |
67 | Download the pulp_packaging repo: |
||
68 | |||
69 | ~~~ |
||
70 | 6 | elyezer | $ git clone https://github.com/pulp/pulp_packaging.git |
71 | 7 | Ichimonji10 | ~~~ |
72 | 6 | elyezer | |
73 | 8 | Ichimonji10 | Now we need to make a `hosts` file for Ansible. Use the results of the `hostname` command in the place of 'localhost': |
74 | 6 | elyezer | |
75 | 1 | kdelee@redhat.com | ~~~ |
76 | 2 | kdelee@redhat.com | $ cd pulp_packaging/ci/ansible |
77 | $ echo "$(hostname)" > hosts |
||
78 | 1 | kdelee@redhat.com | ~~~ |
79 | 2 | kdelee@redhat.com | |
80 | ### Choosing what version of pulp to install |
||
81 | |||
82 | 1 | kdelee@redhat.com | To choose the version of pulp that you will install: |
83 | 8 | Ichimonji10 | |
84 | 12 | pthomas@redhat.com | - edit `pulp_packaging/ci/ansible/roles/pulp/defaults/main.yaml`, or |
85 | - pass `-e pulp_version=2.14 -e pulp_build=beta` in the `ansible-playbook` invocation, or |
||
86 | 7 | Ichimonji10 | - 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=beta` |
87 | |||
88 | 16 | kdelee@redhat.com | Now you are ready to run the ansible playbook: |
89 | The ansible user needs to be root, if you are allready root, or have passwordless sudo, you can go without the `ask_pass` and `ansible_user` variables. |
||
90 | 1 | kdelee@redhat.com | |
91 | ~~~ |
||
92 | 21 | kdelee@redhat.com | $ cd pulp_packaging/ci/ansible |
93 | 17 | kdelee@redhat.com | $ ansible-playbook -i hosts \ |
94 | -e ansible_connection=local \ |
||
95 | pulp_server.yaml \ |
||
96 | -e ask_pass=True \ |
||
97 | -e ansible_user=root |
||
98 | 13 | kdelee@redhat.com | ~~~ |
99 | 1 | kdelee@redhat.com | |
100 | 13 | kdelee@redhat.com | For RHEL7 you will have to provide your RHN credentials as well, |
101 | 1 | kdelee@redhat.com | |
102 | ~~~ |
||
103 | 21 | kdelee@redhat.com | $ cd pulp_packaging/ci/ansible |
104 | 19 | kdelee@redhat.com | $ ansible-playbook -i hosts \ |
105 | -e ansible_connection=local \ |
||
106 | pulp_server.yaml \ |
||
107 | -e rhn_password=${RHN_PASS} \ |
||
108 | 20 | kdelee@redhat.com | -e rhn_pool=${RHN_POOL} \ |
109 | 17 | kdelee@redhat.com | -e rhn_username=${RHN_USER} \ |
110 | 18 | kdelee@redhat.com | -e ask_pass=True \ |
111 | -e ansible_user=root |
||
112 | 15 | kdelee@redhat.com | ~~~ |
113 | 14 | kdelee@redhat.com | |
114 | 1 | kdelee@redhat.com | ## Option 2: Using Vagrant with either libvirt or docker |
115 | |||
116 | See [Pulp Developer Setup](http://docs.pulpproject.org/dev-guide/contributing/dev_setup.html) |