Project

Profile

Help

Virtualization quickstart » History » Revision 10

Revision 9 (Ichimonji10, 07/27/2017 05:04 PM) → Revision 10/21 (Ichimonji10, 07/27/2017 05:07 PM)

# Virtualization quickstart 

 This quickstart guide has been tested on Fedora 25. 

 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. 

 ## Option 1: Using libvirt and Virtual Machine Manager 

 Install required packages: 

 ~~~ 
 # dnf install libvirt qemu-kvm kvm libguestfs-tools virt-install 
 ~~~ 

 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/). 

 Launch the "Virtual Machine Manager" application and click: 

 1\. File  -\> New Virtual Machine   
 2\. Local install media  -\> Browse to downloaded ISO   
 3\) Accept default settings 

 ### SETTING UP THE VM: 

 1\. Start the VM with the "play button"   
 2\. Choose to install fedora:   
 3\. set hostname: give it a name other than localhost.   
 4\. make it meaningful   
 5\. set root password (weak one is OK)   
 6\. if you make a user, make sure to give them sudo access 

 **NOTE**: If you make a user and forgot to give them sudo access, start the VM, open a terminal, and: 

 ~~~ 
 $ su 
 # gpasswd --add admin wheel 
 ~~~ 

 Then restart. 

 **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. 

 To see your host's hostname, execute `hostname`. To change your host's hostname, run: 

 ~~~ 
 # hostnamectl set-hostname <new-hostname> 
 ~~~ 

 ### SETTING UP ANSIBLE (on the VM): 

 For details on Ansible, see the [Ansible documentation](https://docs.ansible.com/). 

 Install Ansible: 

 ~~~ 
 # dnf install ansible git 
 ~~~ 

 Download the pulp_packaging repo: 

 ~~~ 
 $ git clone https://github.com/pulp/pulp_packaging.git 
 ~~~ 

 Now we need to make a `hosts` file for Ansible. Use the results of the `hostname` command in the place of 'localhost': 

 ~~~ 
 $ cd pulp_packaging/ci/ansible 
 $ echo "$(hostname)" > hosts 
 ~~~ 

 ### Choosing what version of pulp to install 

 To choose the version of pulp that you will install: 

   - edit `pulp_packaging/ci/ansible/roles/pulp/defaults/main.yaml`, or 
   - pass `-e pulp_version=2.14 -e pulp_build=nightly` in the ansible-playbook invocation, or 
   - 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` 

 Now you are ready to run the ansible playbook: 

 ~~~ 
 $ ansible-playbook -i hosts -e ansible_connection=local pulp_server.yaml 
 ~~~ 

 ## Option 2: Using Vagrant with either libvirt or docker 

 See [Pulp Developer Setup](http://docs.pulpproject.org/dev-guide/contributing/dev_setup.html)