Need help to install apache in desired location

Hello team is there any way by which i can install apache in my desired location. If we use
package 'httpd' do
action :install

It will install apache inside /etc/httpd. But i want to install apache inside /myfolder directory. Help me to figure this

So, in this case, the resource you're using here will just tell Chef to install the OS-appropriate httpd package on that system from upstream, which means it installs it in the OS-specific directory defined by the package being installed (rather than something defined by Chef).

If you want to customize that installation, you'd have two options: build your own custom RPM for Apache and have Infra install that or include a number of additional resources that define the configuration parameters you want. The latter would include adjusting the install the location, updating any read/write paths that need to be adjusted in the software itself, etc.

If you can help us understand why you're wanting to change the install directory, we might be able to offer a better or easier-to-achieve solution.

1 Like

Building your own package as Benny suggests is one way to do it but then it makes keeping your apache updated with security fixes more complicated.

Using custom recipes to replicate /etc/httpd and /var/www in your custom directory is entirely possible. Make sure you duplicate the same linked directories in /etc/httpd so your custom location continues to get updated modules (i.e. modules -> ../../usr/lib64/httpd/modules). There are probably some linked files/directories in /var/www too.

1 Like