Install foreman on Ubuntu 14.04

I found some patchy information and I had a lot of failed installs before I could get it up and running on Ubuntu 14.04 – this is the guide I made while I was doing it and includes all the errors I was making:

How to install Foreman on Ubuntu 14.04

How to install Foreman on Ubuntu 14.04 – Follow this guide, the internet is full of lies and deceit!

Create a linux 14.04 virtual machine – DON’T create a user called foreman, call it user, sysadmin, anything like that but not foreman – if you create a user “foreman” then the foreman install will fail and it won’t tell you why. Call the hostname foreman, or something similar. Once the server is created and up and running, stick an address reservation in DHCP and add a static record to DNS (as it’s a linux box it won’t register on the AD DNS)

1 – Change the hostname and the FQDN to match the DNS record

# sudo -s(if you don't like toggling your root access, just sudo each of these commands)
# vi /etc/hosts

Once your host file opens make changes so it looks like this:

root@foreman:~# vi /etc/hosts
127.0.0.1  localhost
127.0.1.1 example.host.local foreman

to save and quit vi – ESC, :x, enter

IMPORTANT – don’t put any capital letters in any of the host names. Even though in DNS the host name is sometimes rendered as example.HOST.LOCAL. if you put it in the hosts file like that then the installation will fail, and it won’t tell you why.

Check the hostname of your host now

# hostname -f

hopefully it will echo back example.host.local
Reboot your host (not essential I don’t think, worth it though)

# reboot

2 – Add puppet repos, install the puppet agent and puppetmaster. Enable the puppetmaster and then restart it

# sudo -s (if you don't like toggling your root access, just sudo each of these commands)
# wget https://apt.puppetlabs.com/puppetlabs-release-trusty.deb
# dpkg -i puppetlabs-release-trusty.deb
# apt-get update
# apt-get install -y puppetmaster puppet
# sed -i s/START=no/START=yes/g /etc/default/puppetmaster
# service puppetmaster restart

3 – Add foreman repos. Install Apache2 and Foreman-installer, then install Foreman

# echo "deb http://deb.theforeman.org/ trusty stable" > /etc/apt/sources.list.d/foreman.list
# echo "deb http://deb.theforeman.org/ plugins stable" >> /etc/apt/sources.list.d/foreman.list
# wget -q http://deb.theforeman.org/pubkey.gpg -O- | apt-key add -
# apt-get update
# apt-get install -y apache2 foreman-installer
# foreman-installer --enable-foreman-proxy > ./foreman.log

Hopefully you will not have any errors
4 – If you have no errors, continue to configure the puppet agent on the puppetmaster server (inception much?)

# sed -i '/\/var\/log\/puppet/a \server=example.host.local' /etc/puppet/puppet.conf
# service puppet restart

5 – now you can check out your foreman install – the default install credentials etc can be found in the log you made on installation

# cat foreman.log
Success!
* Foreman is running at https://example.host.local
Initial credentials are admin / SOMEPASSWORD
* Foreman Proxy is running at https://example.host.local:8443
* Puppetmaster is running at port 8140
The full log is at /var/log/foreman-installer/foreman-installer.log

6 – Open your browser and go to https://example.host.local – login with the credentials provided by the install log file

Leave a Reply

Your email address will not be published. Required fields are marked *