theforeman / foreman_fog_proxmox

Foreman plugin to add Proxmox compute resource based on fog-proxmox gem
GNU General Public License v3.0
105 stars 30 forks source link

How to install this plugin on Centos7 #82

Closed csecsi closed 4 years ago

csecsi commented 5 years ago

I am confused about installing this plugin on Centos7 (like: fog-proxmox requires Ruby version >= 2.3). Could someone add a Centos install howto to the manual?

tristanrobert commented 5 years ago

Ruby 2.3 installation:

sudo yum install centos-release-scl
sudo yum install rh-ruby23
sudo scl enable rh-ruby23 bash

Or use rvm, rbenv, etc.

Foreman and its plugin installation form packages: https://www.theforeman.org/manuals/1.21/index.html#3.3InstallFromPackages

csecsi commented 5 years ago

THX for the help.

So this is what I did:

installing the necessary packages: sudo yum install centos-release-scl rh-ruby23 rh-ruby23-ruby-devel gcc zlib-devel -y

As /usr/share/foreman is owned by root I need as a quick and dirty solution: setfacl -R -m u:foreman:rxw /usr/share/foreman

sudo -u foreman scl enable rh-ruby23 bash gem install foreman_fog_proxmox

and after restart: Gem loading error: Unable to activate fog-1.42.1, because fog-core-2.1.2 conflicts with fog-core (~> 1.45) (RuntimeError)

What I am doing wrong?

Yamakasi commented 5 years ago

I have issues like this at the moment:


Building native extensions.  This could take a while...
ERROR:  Error installing foreman_fog_proxmox:
        ERROR: Failed to build gem native extension.

    current directory: /opt/rh/rh-ruby23/root/usr/local/share/gems/gems/nokogiri-1.10.3/ext/nokogiri
/opt/rh/rh-ruby23/root/usr/bin/ruby -r ./siteconf20190511-14749-10daj7j.rb extconf.rb
mkmf.rb can't find header files for ruby at /opt/rh/rh-ruby23/root/usr/share/include/ruby.h

extconf failed, exit code 1

Gem files will remain installed in /opt/rh/rh-ruby23/root/usr/local/share/gems/gems/nokogiri-1.10.3 for inspection.
Results logged to /opt/rh/rh-ruby23/root/usr/local/lib64/gems/ruby/nokogiri-1.10.3/gem_make.out
`
tristanrobert commented 5 years ago

@Yamakasi Please post a distinct issue and describe precisely what you did in order to reproduce it.

tristanrobert commented 5 years ago

@csecsi gem installation is not recommended by foreman team. Please read carefully the doc §2.3: https://theforeman.org/plugins/

Yamakasi commented 5 years ago

@tristanrobert exactly your commands posted above and after that a gem install...

I don't see the 0.8.0 version available in repo's that's why I tried Gem.

tristanrobert commented 5 years ago

@Yamakasi 0.8.0 packages PR to foreman-packaging have just been posted.

Yamakasi commented 5 years ago

@tristanrobert OK looking forward to it :)

brindapabari commented 5 years ago

THX for the help.

So this is what I did:

installing the necessary packages: sudo yum install centos-release-scl rh-ruby23 rh-ruby23-ruby-devel gcc zlib-devel -y

As /usr/share/foreman is owned by root I need as a quick and dirty solution: setfacl -R -m u:foreman:rxw /usr/share/foreman

sudo -u foreman scl enable rh-ruby23 bash gem install foreman_fog_proxmox

and after restart: Gem loading error: Unable to activate fog-1.42.1, because fog-core-2.1.2 conflicts with fog-core (~> 1.45) (RuntimeError)

What I am doing wrong?

@csecsi -- Were you able to install the plugin on CentOS7. I am doing the same steps and facing issues. Could you please list steps you performed for this plugin installation? Any pointers would be really helpfull

csecsi commented 5 years ago

Negative. :( I gave it up after a while.

hlawatschek commented 5 years ago

Which foreman version do you use? We're packaging our own versions of foreman-fog-proxmox and fog-proxmox for orcharhino. I could send you the rpm packages for CentOS7 that should work with foreman-1.21 or 1.22

brindapabari commented 5 years ago

@csecsi

Following are the steps I followed for installing foreman_fog_proxmox (0.8) plugin in CentOS (7) for the latest foreman version (1.22) and finally had a working version • $sudo install -y foreman foreman-compute foreman-sqlite3 foreman-asset • In /usr/share/foreman/bundler.d directory, create a Gemfile.local.rb file and add following content in it: gem 'foreman_fog_proxmox'

• System ruby version might be different from tfm-ruby version. Foreman uses tfm-ruby, therefore run the shell with following command in order to confirm that tfm version is being used. 
Use only foreman user (not root!) sudo -u foreman … If required give read write access to foreman user to the /usr/share/foreman directory

sudo -u foreman scl enable tfm bash
    ○ bash-4.2$ whoami
        foreman
    ○ bash-4.2$ set
        Check all the environment variables displayed
    ○ bash-4.2$ gem install foreman_fog_proxmox
    ○ bash-4.2$ cd  /usr/share/foreman/
    ○ Install the gem plugin:
    bash-4.2$ bundle install 
    ○ Not sure if Precompilation of plugin assets is required or not. It gave me errors but the plugin was already installed. Therefore I processed with testing the plugin functionalities of computing the proxmox resource

• Opening up Foreman website -> Compute Resources throws permission error 

• [root]$ setenforce 0

• After disabling the selinux Foreman website shows the installed plugin in  Administer ->About ->Plugins. Able to open the Compute Resources page.

• Upon saving the Create Resource page / clicking on Test Connection of Proxmox server, it gives the authentication error similar to this open issue: https://github.com/theforeman/foreman_fog_proxmox/issues/86

Resolution provided by pdzionek in issue #86 works for me: ○ Commenting out line 82 from the file: • $vi /usr/share/foreman/.gem/ruby/gems/fog-proxmox-0.8.0/lib/fog/proxmox.rb

Hope this helps!

tristanrobert commented 4 years ago

Needs a new PR in theforeman/foreman-packaging to include 0.8.1.

tristanrobert commented 4 years ago

It is fixed in foreman-packaging PR#4308 and PR#4309. If you want to speed up you can follow these PR and vote for it.