使用 vagrant 的厨师食谱安装 PEAR 时出现问题

发布于 2024-11-07 08:52:19 字数 997 浏览 0 评论 0原文

我正在使用 Vagrant 在本地创建开发服务器。我正在编写自己的厨师食谱来安装我需要的一切,但我遇到了问题。

Pear 不会安装,因为我认为它正在尝试下载一个不稳定的版本。错误是:

No such file or directory - pear -d preferred_state=stable search PEAR

配方如下

# 
# Chef recipe for provisioning a LAMP
# development server.
#
require_recipe 'apt'
require_recipe 'apache2'
require_recipe 'apache2::mod_php5'
require_recipe 'php::module_gd'
require_recipe 'mysql::server'

php_pear "PEAR" do
    action :upgrade
end

php_pear "MDB2" do
    action :install
end

php_pear "MDB2#mysql" do
    action :install
end

# Grant access to this box...
ruby_block "Create database + execute grants" do
    block do

    require 'rubygems'
    Gem.clear_paths
    require 'mysql'

    m = Mysql.new('localhost', "root", node[:mysql][:server_root_password])
m.query("GRANT ALL ON *.* TO 'root'@'10.0.0.1' IDENTIFIED BY '#{node[:mysql][:server_root_password]}'")
m.query('FLUSH PRIVILEGES')

    end
end

如何让 PEAR 安装最新的稳定版本?

I am using Vagrant to create a development server locally. I am writing my own Chef recipe to install everything I need but I am running into problems.

Pear will not install as I think it is trying to pull down a version that is not stable. The error is:

No such file or directory - pear -d preferred_state=stable search PEAR

The recipe is as follows

# 
# Chef recipe for provisioning a LAMP
# development server.
#
require_recipe 'apt'
require_recipe 'apache2'
require_recipe 'apache2::mod_php5'
require_recipe 'php::module_gd'
require_recipe 'mysql::server'

php_pear "PEAR" do
    action :upgrade
end

php_pear "MDB2" do
    action :install
end

php_pear "MDB2#mysql" do
    action :install
end

# Grant access to this box...
ruby_block "Create database + execute grants" do
    block do

    require 'rubygems'
    Gem.clear_paths
    require 'mysql'

    m = Mysql.new('localhost', "root", node[:mysql][:server_root_password])
m.query("GRANT ALL ON *.* TO 'root'@'10.0.0.1' IDENTIFIED BY '#{node[:mysql][:server_root_password]}'")
m.query('FLUSH PRIVILEGES')

    end
end

How can I make PEAR install the last stable version?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

赠我空喜 2024-11-14 08:52:20

您正在使用 pear 来安装 pear 本身吗?这不奇怪吗?

该错误消息

No such file or directory 

表明您的配方尝试将完整命令用作一个可执行文件,而不是作为命令和参数。

pear -d preferred_state=stable search PEAR

You are using pear to install pear itself? Isn't that strange?

The error message

No such file or directory 

indicates that your recipe tries to use the full command as one executable, not as command and parameters.

pear -d preferred_state=stable search PEAR
提赋 2024-11-14 08:52:20

以下是我在 Ubuntu VM 中升级 PEAR 的操作:

package "php-pear" do
  action :install
end

有一个名为 php-pear 的 Ubuntu 软件包,因此此命令将安装最新版本

Here's what I'm doing to upgrade PEAR in my Ubuntu VM:

package "php-pear" do
  action :install
end

There's an Ubuntu package called php-pear, so this command will install the latest version

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文