Project

Profile

Help

Virtualization quickstart » History » Revision 17

Revision 16 (kdelee@redhat.com, 07/28/2017 07:19 PM) → Revision 17/21 (kdelee@redhat.com, 07/28/2017 07:20 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:   
 For Fedora, you can install ansible without enabling any extra repos. For RHEL7 you will have to set up epel. 

 *For RHEL 7 only* 

 ~~~ 
 $ wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm 
 # rpm -i epel-release-latest-7.noarch.rpm 
 ~~~ 

 ~~~ 
 # 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=beta` 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=beta` 

 Now you are ready to run the ansible playbook:   
 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. 

 ~~~ 
 $ ansible-playbook -i hosts \ 
    -e ansible_connection=local \ 
    pulp_server.yaml \ 
       -e ask_pass=True \ 
    -e ansible_user=root 
 ~~~ 

 For RHEL7 you will have to provide your RHN credentials as well, 

 ~~~ 
 $ ansible-playbook -i hosts -e \ 
    ansible_connection=local \ 
    pulp_server.yaml -e \ 
    rhn_password=${RHN_PASS} \ 
    -e rhn_pool${RHN_POOL} \ 
    -e rhn_username=${RHN_USER}    \ 
    -e ask_pass=True -e \ 
    ansible_user=root 
 ~~~ 

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

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