显然这是不可能的,但我无法相信我是唯一需要它的人。
我想指定要安装的php版本,因为我正在处理一个需要php 5.2的旧项目。
实际上我的VM基于Oneiric with php 5.3
你有解决办法吗?
答案 0 :(得分:48)
您可以指定版本:
package { 'php' :
ensure => '5.2' ,
}
但是,如果您的上游回购中没有该版本的PHP RPM / Deb / package,那么您将要么:
通过提供程序包的路径从文件系统安装:
package { 'php' :
ensure => '5.2' ,
source => '/some/path/to/php-5.2.rpm' ,
}
答案 1 :(得分:7)
这与我在gpet中使用自定义apt存储库的gpg密钥非常接近
# put downloaded pgp keys into modulename/files/pgp/
# this will copy them all into /tmp
file { '/tmp/pgp-keys':
ensure => directory,
recurse => true,
source => 'puppet:///modules/modulename/pgp',
}
# add any keys that you need
exec { 'apt-key add':
command => '/usr/bin/apt-key add /tmp/pgp-keys/number1.gpg.key &&/
/usr/bin/apt-key add /tmp/pgp-keys/number2.gpg.key',
subscribe => File['/tmp/pgp-keys'],
refreshonly => true,
}
# make sure you add your custom apt repository
file { 'cassandra.sources.list':
ensure => 'present',
path => '/etc/apt/sources.list.d/cassandra.sources.list',
source => 'puppet:///modules/modulename/cassandra.sources.list',
require => Exec['apt-key add'],
}
# update your package list
exec { 'apt-get update':
command => '/usr/bin/apt-get update',
require => File['cassandra.sources.list'],
}
# Install your specific package - I haven't actually used this yet,
# based on answer by opsmason
package { 'cassandra':
ensure => '1.2.0',
require => Exec['apt-get update'],
}