Ask Your Question
0

how to install new package on ubuntu

asked 2015-02-10 05:55:44 -0600

akshay gravatar image

updated 2015-04-15 22:03:02 -0600

GregLarkin gravatar image
class shell_ubn {
        file {
        "/home/shellinabox/shellinabox_2.14-1_amd64.deb":
        ensure => present,
        mode => 0777,
        source => "puppet:///modules/shell_ubn/shellinabox_2.14-1_amd64.deb",
        notify => Package["Shellinabox"],
}
package {
        "Shellinabox":
        ensure => installed,
        source => "/home/shellinabox/shellinabox_2.14-1_amd64.deb",
        require => File["/home/shellinabox/shellinabox_2.14-1_amd64.deb"],
}
}

On agent side i gave an error:

Error: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install Shellinabox' returned 100: Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package Shellinabox
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2015-04-15 22:14:32 -0600

GregLarkin gravatar image

updated 2015-04-15 22:15:17 -0600

Try adding the following attribute to your original package resource, and let me know if that fixes the problem or not:

provider => 'dpkg',

That should be cleaner than the solution you eventually worked out, and it essentially does the same thing.

edit flag offensive delete link more

Comments

Yes greg. It worked out. But the main thing is, there is no need to write package resource section. Without package resource we can install the packages on agent side.

akshay gravatar imageakshay ( 2015-04-16 00:45:24 -0600 )edit

The package resource type is cleaner and less expensive than exec resources. If you're not going to use the resource types puppet provides for the explicit purpose of packages, perhaps you should review why you are using puppet as your configuration management tool.

rnelson0 gravatar imagernelson0 ( 2015-04-16 06:39:58 -0600 )edit

yes rnelson. But the problem is when we write package resource section for red hat agent machine then there is no need to write this. so, for any linux operating system there is no need to write to package resource section. Without this we can install the packages on agent machine.

akshay gravatar imageakshay ( 2015-04-16 07:10:51 -0600 )edit

You should use if/case/selector conditionals to differentiate between different OS and OS families. But the package resource works with all supported OSes. By having the package definition in your code, if the package is removed, puppet will reinstall it - or install a version specified in hiera.

rnelson0 gravatar imagernelson0 ( 2015-04-16 07:34:56 -0600 )edit

Still we are not using hiera. But I am using the package resource section and I am successfully install the packages on any OS and without using if/case selector conditionals.

akshay gravatar imageakshay ( 2015-04-16 07:39:01 -0600 )edit
-1

answered 2015-04-15 00:44:59 -0600

akshay gravatar image
class class_name {

file {
"package _name":
ensure => present,
source => "puppet:///modules/class_name/package_name",
}
package {
"package_name":
ensure => present,
require => file["/home/package_name"],
notify => Exec["dpkg --install"],
}
exec {
"dpkg --install":
command => "/usr/bin/dpkg --install package_name",
path => "/usr/bin/:/sbin:/usr/sbin",
refreshonly => true,
}

}

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2015-02-10 05:55:44 -0600

Seen: 1,267 times

Last updated: Apr 15 '15