Setup puppet and install apache package issues - apache

For test purposes I wanted to setup puppet and deploy apache on Ubuntu 16.4 puppet master using puppet without bothering with using nodes by using the following steps:
$ wget https://apt.puppetlabs.com/puppet5-release-xenial.deb
Install the package by running:
$ dpkg –i puppet5-release-xenial.deb
Update package list
$ apt-get update
Install puppet server
$ sudo apt-get install puppetserver
On our Puppet server, install the puppetlabs-apache module:
$ sudo puppet module install puppetlabs-apache
From within the manifests directory, an init.pp class needs to be created
/etc/puppet/modules/apache/manifests/init.pp
class apache2 {
package {'apache2':
ensure => 'present',
}
}
To try to install the apache package I used:
$ sudo puppet apply init.pp
I then got the following:
Notice: Compiled catalog for osboxes.home in environment production in 0.03 seconds
Notice: Finished catalog run in 0.04 seconds
And when I check if apache is installed, it is not.
Where am I going wrong?

If you have the Apache module in the correct module path, then the problem is you don't have any code to include the module.
To keep it simple, let's forget about the file structure on the Puppet master and so forth and just create a file apache.pp (save it in /tmp or anywhere you like) and give it this content:
class apache2 {
package {'apache2':
ensure => 'present',
}
}
include apache2
Now try:
$ sudo puppet apply apache.pp
You should see Puppet install the apache2 package.
However, by convention, and also for proper integration with the Puppet master, you need to now place this content in expected file locations.
The class apache (the code you already had) needs to be in a file ${modulepath}/apache2/manifests/init.pp.
This is to satisfy Puppet's autoloader. You can find out more about that here.
Meanwhile, the modulepath is documented here, and it can vary depending on the version of Puppet, and how you set everything up.
To find out your modulepath try:
$ sudo puppet config print modulepath
Now, if you have all the files in place, you should next be able to include that class in a different way, like this:
$ sudo puppet apply -e "include apache2"
Once you get that working, it's time to read about the roles and profiles pattern.

Related

How to Install apache httpd from source for jboss clustering

I am currently setting up a JBoss EAP 7 cluster in domain mode and the goal is for an apache webserver to be installed as a load balancer. However, I am unable to install the httpd service from yum repositories as this is a VM that was provisioned by a client. I need to install httpd from its source which I have downloaded. My problem is that I am not sure about the configuration options to enable for this purpose. Any help would be appreciated. From the official website, the instruction doesn't give details about what modules to be enabled and I'm not sure which of them are relevant for my own purpose.
Download Download the latest release from http://httpd.apache.org/download.cgi
Extract $ gzip -d httpd-NN.tar.gz
$ tar xvf httpd-NN.tar
$ cd httpd-NN
Configure $ ./configure --prefix=PREFIX
Compile $ make
Install $ make install
Customize $ vi PREFIX/conf/httpd.conf
Test $ PREFIX/bin/apachectl -k start
Above provided link will contain all module which provided with default Apache httpd. You can download the Apache httpd source folder and check module information in modules.In Apache source module/proxy folder contains module information regarding the proxy configuration. i.e mod_proxy module.
I was able to do my installation by following the guide here

apache2: ERROR: Module not properly enabled

I am getting this error:
ERROR: Module wsgi not properly enabled:
/etc/apache2/mods-enabled/wsgi.load is a real file, not touching it
I have this:
USER root
RUN apt-get install -y apache2
RUN a2enmod wsgi
does anyone know what this error would signify?
I can't figure out how to resolve it.
if I forgo the a2enmod wsgi line, then I get:
/usr/lib/apache2/modules/mod_wsgi.so: cannot open shared object file:
No such file or directory
The error means that the file or directory mod_wsgi.so doesn't exist on your server. You may follow the instructions below on how to enable this module.
SSH to your machine.
Once you'r logged in, please execute the following commands below:
$ sudo apt-get install libapache2-mod-wsgi
$ sudo a2enmod wsgi
Please execute the find command to locate the mod_wsgi.so module.
$ sudo find / -name *mod_wsgi.so
You should see this result.
/usr/lib/apache2/modules/mod_wsgi.so
Furthermore, to install apache2 please execute the command below:
$ sudo apt-get install apache2 -y
Hope this information works for you.

AWS EC2 standard AWS AMI with PHP 7.0 - install libsodium recipe

(edited for clarity - rolled in accepted answer)
Libsodium has been prepped for PHP 7. In doing this, the namespace was removed and a prefix of sodium_ for methods and SODIUM_ for constants was added. Also the version methods were removed.
This github page documents all the new functions and constants and the project provides backward compatibility with the \Sodium namespace: https://github.com/Firehed/sodium/blob/master/src/we_cant_have_nice_things.php
Recipe: install Libsodium on PHP 7 on and AWS AMI
# PHP 7.0 Libsodium install AWS AMI
yum install -y php7-pear re2c php70-devel
yum groupinstall -y "Development Tools"
pecl7 install libsodium
vi /etc/php-7.0.d/20-libsodium.ini
; Enable libsodium extension module
extension=sodium.so
service httpd restart
command line test to verify sodium is installed
php7 --info | grep sodium
test php function to verify calling pattern for password hash
<?php
$password = "hello";
$hash_str = sodium_crypto_pwhash_str(
$password,
\SODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE,
\SODIUM_CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE
);
var_dump($password, $hash_str);
Thanks to #GracefulRestart for the help.
I see a couple problems here, the first is that your test file appears to be non-functional.
Running your test code with libsodium working in PHP 7 returns the following error:
PHP Fatal error: Uncaught Error: Call to undefined function Sodium\\library_version_major()
If you want to check the version, it may be easier to search the data from the phpinfo() function:
<?php phpinfo(); ?>
# or from CLI
php7 --info |grep sodium
The other problem I notice is in your install steps, you install libsodium both from source and from PECL. The make install command by default places the libraries in /usr/local/lib, while pecl7 install libsodium will normally install libraries into the default PHP modules directory.
If you were attempting to install from source, your /etc/php-7.0.d/20-libsodium.ini file is incorrect as that is loading the libsodium libraries you installed from PECL (you can check which directory it is loading from by check the extension_dir ini setting from phpinfo()).
If you only need to install from PECL, you do not need all of the development packages or any manual compiling.
EDIT I modified your posted recipe to remove the extraneous steps of downloading the source and just do everything with PECL:
yum install -y php7-pear re2c php70-devel
yum groupinstall -y "Development Tools"
# PHP 7.0
pecl7 install libsodium
vi /etc/php-7.0.d/20-libsodium.ini
; Enable libsodium extension module
extension=sodium.so
service httpd restart
If the YUM repositories for your distribution offer the php7-libsodium package, that would be an even smaller recipe
Hope that helps
Here's my solution to this recipe.
wget -c https://download.libsodium.org/libsodium/releases/libsodium-1.0.18.tar.gz
tar -xvf libsodium-1.0.18.tar.gz
cd libsodium-1.0.18
./configure
make && make check
make install
sudo pecl7 install -f libsodium
pecl7 should install and modify the php.ini file to include the following in the php.ini
extension="sodium.so"
If you running PHP in Elastic Beanstalk, the following file ./ebextentions/script.config :
files:
"/opt/elasticbeanstalk/hooks/appdeploy/pre/001_libsodium.sh":
mode: "000755"
owner: root
group: root
content: |
#!/usr/bin/env bash
wget -c https://download.libsodium.org/libsodium/releases/libsodium-1.0.18.tar.gz && tar -xvf libsodium-1.0.18.tar.gz && cd libsodium-1.0.18 && ./configure && make && make check && sudo make install && sudo pecl7 install -f libsodium

Gitlist installation error

I just install gitlist to follow my git repos and I get that page when I launch localhost/gitlist:
get('date', 'timezone')) { date_default_timezone_set($config->get('date', 'timezone')); } $app = require 'boot.php'; $app->run();
I can't solve the problem. Can someone give me a hand about that?
I had the same issue. I was able to solve it this way:
1- Be sure you have php7 correctly installed and with the apache2 module properly enabled/configured. I use ubuntu, for me it was enough with:
sudo apt-get -y install php7.0 libapache2-mod-php7.0
2- Be sure your gitlist folder has the right permisions for the web user. I use apache2(.4):
sudo chown -R www-data:www-data <path-to-gitlist>
3- Also check in your gitlist config.ini file that you are pointing to the folder containing the git repos, not to the git repos:
repositories[]= '/home/user/repositories'
4- Restart the apache service:
systemctl restart apache2
I hope this helps.

Install module with puppet

Trying to install the module vcsrepo with puppet, but really unsure how it could be done. The commandline to install it is:
puppet module install puppetlabs-vcsrepo
Tried to install it this way, but that didn't work:
package { 'vcsrepo':
ensure => installed,
}
It'd be really helpful to see the error output of the first command as that IS the way one installs a Puppet module. If I had to guess, it probably errored out saying something like /home/yourusername/.puppet/ does not exist - by default, when ran by a regular user, puppet install will attempt to download the module into .puppet/modules in that user's home directory. Running sudo puppet module install module-name though by default would install the module system-wide into /etc/puppet/modules.