vagrant to use yum instead of apt-get for centos boxes - yum

and have found it useful. I was following the documentation along, but instead of using the lucid32 box, I wanted to use a centos 6 box and try out chef provisioning, but once the vm loaded up, it seems to be using apt-get rather than yum to download chef. How can I make vagrant use yum instead?

What provisioner are you using? I had the same question using Chef, and resolved it by replacing the apt-get cookbook with yum, then updating the recipe include.
If you're using Chef, you can download the yum cookbook from opscode-cookbooks/yum and drop it in your cookbooks folder (e.g. ./vagrant_guide/cookbooks/yum/), then simply replace the apt-get recipe call with yum.
If you're following the Getting Started Guide, your project might look something like this:
./vagrant_guide/Vagrantfile
Vagrant::Config.run do |config|
config.vm.box = "centos"
config.vm.provision :chef_solo do |chef|
chef.add_recipe "vagrant_main"
# You could optionally just call chef.add_recipe "yum"
# here instead of doing it in the vagrant_main recipe
end
end
./vagrant_guide/cookbooks/vagrant_main/recipes/default.rb
require_recipe "yum"

Related

Chef:Install Apache at custom path/location

I want to install apache using chef. But when I use:
package 'httpd' do
action :install
end
It will install apache inside /etc/httpd but I want to install apache in another directory (for example: /abc).
The Chef package resource uses the underlying system's package manager such as yum, apt.
You haven't mentioned the distribution you are running on. However, using package 'httpd' on YUM based distribution will trigger yum install httpd
So, first find how you can change/set the install path using the underlying OS command. E.g. for YUM:
yum --installroot=<path> install <package>
In a Chef package resource:
package 'httpd' do
options '--installroot=/abc'
action :install
end
I have created a custom package and then installed in to desired loaction it helped me a lot Thank you very much everyone

How can I install php7.3-ldap on DDEV?

I'm trying to install the LDAP extension in my DDEV web container on macOS 10.15.4 with Docker 19.03.8. But the install step seems to be hanging endlessly. (Like half an hour before I quit it.)
First, I initiated DDEV.
ddev config --project-type drupal8 --docroot www/web
Then I added the post start hooks below.
name: foobar
type: drupal8
docroot: www/web
php_version: "7.3"
webserver_type: nginx-fpm
router_http_port: "80"
router_https_port: "443"
xdebug_enabled: false
additional_hostnames: []
additional_fqdns: []
provider: default
use_dns_when_possible: true
hooks:
post-start:
- exec: "sudo apt-get update"
- exec: "sudo apt-get install -y php7.3-ldap"
And run ddev start. But then it hangs at the install step.
=== Running task: Exec command 'sudo apt-get install -y php7.3-ldap' in container/service 'web', output below
debconf: delaying package configuration, since apt-utils is not installed
Is this how LDAP is supposed to be added? Or could that be a bug?
Side note: When I sudo apt-get install -y php-ldap it actually works, but this installs me the PHP 7.4 lib. I need to PHP 7.3 lib.
Edit 2020-08-02: In ddev v1.15+, php7.3-ldap is already installed, so this question is moot. But ldap was previously a good example of using webimage_extra_packages as described below.
In ddev v1.14+, just add webimage_extra_packages: [php7.3-ldap] to your .ddev/config.yaml. Adding php7.3-yaml is actually the example given for this in the docs on webimage_extra_packages.

how install pdo-mysql in centos7

I install laravel 5 and then install packages neede.
I install php-pdo and some other but now i cant install pdo-mysql and laravel return error.
PDOException in PDOConnection.php line 47: could not find driver
I am use Centos 7 and PHP 5-6-29.
Check which package is installed (which provider) and provides the stack, then use the same namespace.
Webtatic uses php56w-*
IUS uses php56u-*
remi-safe (SCL packages) use php56-php-*
remi-php56 simply use php-*
other providers can use something else
As you need pdo_mysql driver, simply
yum install <namespace>-pdo_mysql
(using the ext name, yum will find the correct package name which provides this ext).
Also check you don't have any "exclude" lines in the yum configuration (such as the ones provided in altered cpanel distributions)
Try using this
yum install php-mysql
systemctl restart httpd
You can search package like
yum search php
Pick the ones you need and install them like this:
yum -y install php-mysqlnd php-pdo
In the next step I will install some common PHP modules that are required by CMS Systems like Wordpress, Joomla, and Drupal:
yum -y install php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-soap curl curl-devel
https://webtatic.com/packages/php56/
I believe the driver is php56w-mysql so yum install php56w-mysql should do the job.

Why can you install the same package by different names with Yum

On Centos 6 I can do
# yum install webserver
or
# yum install httpd
And both commands will install httpd (apache)
I am building an RPM and I don't know which one I should use or why they are different.
Do packages have a 'generic' name that you can address them by? For instance if you had lighttpd installed it could provide the webserver package?
An RPM provides many things. Be they native library references, perl modules, etc. All are calculated while the RPM is built.
But you can also provide things yourself in a spec file (the file used to build an RPM), as in:
Provides: blablabla
So, it means the httpd package has:
Provides: webserver
in its spec file.
You can query what an installed package provides with:
rpm -q --provides pkgnamehere
But you can also ask what package provides something:
rpm -q --whatprovides theprovidedname
Finally, you can ask yum about provides:
yum whatprovides webserver
yum whatprovides grep
yum whatprovides /usr/bin/find
# etc etc

Amazon web services and ubuntu 10.04 ec2 instance

I have created ubuntu 10.04 ec2 image and now I need to install tomcat apache and jdk6 on my instance but whenever I use the command sudo apt-get install sun-java6-jdk or sudo apt-get install tomcat6 admin or sudo apt-get install ec2-api-tools
Package ec2-api-tools is not available, but is referred to by another package.
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package ec2-api-tools is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or is only available from another source
E: Package ec2-api-tools has no installation candidate
Another option is to add their official repository to apt - this will provide you up to date AWS tools:
sudo apt-add-repository ppa:awstools-dev/awstools
sudo apt-get update
sudo apt-get install ec2-api-tools -y
This is extremely useful for farther releases and and for up to date official bug fixes etc. just by running the usual
sudo apt-get update
sudo apt-get upgrade -y
Ubuntu doesn't have the Sun JDKs available by default so in /etc/apt/sources.list uncomment:
deb http://archive.canonical.com/ubuntu maverick partner
deb-src http://archive.canonical.com/ubuntu maverick partner
and then:
sudo apt-get update
sudo apt-get install sun-java6-jdk
ec2-api-tools requires the multiverse lines in sources.list to be uncommented first (remember to apt-get update also).
I am a bit confused, if you just want to install Java and Tomcat, why are you also trying to install the ec2 tools?
In any case, I also want to mention the free BitNami Cloud Tools installer (disclaimer: I am one of the developers). It includes the JDK and all EC2-related tools. We keep it fairly up-to-date and can run as a regular user.