• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login
Netgate Discussion Forum
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login

Add pfsense package with command line

Scheduled Pinned Locked Moved Problems Installing or Upgrading pfSense Software
10 Posts 3 Posters 41.3k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N
    new_in_pf
    last edited by Nov 19, 2013, 10:00 AM Nov 19, 2013, 9:58 AM

    Hi to all again

    How i can add a package to my pfsense only with command line in shell?!

    I download a package (.tbz file) and all of prerequirement and put them into '/usr/local/pkg/' directory,
    then first install all prerequirement's package successfully and then install main package successfully  too
    (pkg_add 'PackageName.tbz')
    but in the web of pfsense don't show any one these package and i can not use of these.

    Can any person help me that how add packages to my pfsense with command line?

    Excuse me for bad english!!

    1 Reply Last reply Reply Quote 0
    • R
      rjcrowder
      last edited by Nov 19, 2013, 9:50 PM

      This code will do it. Save as pkg-install.php and invoke as /usr/local/bin/php ./pkg-install.php "pkg name".

      /* $Id$ */
      /* ========================================================================== */
      /*
          pkg-install.php
      */
      
      require_once("/etc/inc/util.inc");
      require_once("/etc/inc/functions.inc");
      require_once("/etc/inc/pkg-utils.inc");
      require_once("/etc/inc/filter.inc");
      require_once("/etc/inc/shaper.inc");
      require_once("/etc/inc/globals.inc");
      
      function install_pkg($pkgid) {
      global $pkg_interface;
      
              $pkg_interface = "console";
      	print "Installing package " . $pkgid . "\n";
      	$status = install_package($pkgid);
      	if($status == -1) {
      		print "Installation of " . $pkgid . " FAILED!\n";
      	}
      	else {
      		print "Installation of: " . $pkgid . " completed.\n";
      		$status = get_after_install_info($pkgid);
      		if($status)
      			print "Installation completed." . "\n" . $pkgid . " setup instructions" . "\n" . $status . "\n";
      		else
      			print "Installation completed. Please check to make sure that the package is configured from the respective menu then start the package.\n";
      	}
      
      	filter_configure();
      }
      
      if ($argv[1]!="")
              install_pkg($argv[1]);
      
      ?>
      
      
      1 Reply Last reply Reply Quote 0
      • N
        new_in_pf
        last edited by Nov 21, 2013, 5:17 AM

        Thanks but i did not mean that you say! :-\

        I create this file  pkg-install.php but i don't know that where i put this.

        " and invoke as /usr/local/bin/php" : How i do it?

        Unfortunately i am new in pfsense and don't understand specialized expressions of you.  :'(

        1 Reply Last reply Reply Quote 0
        • R
          rjcrowder
          last edited by Nov 21, 2013, 1:53 PM

          I'm not sure I understand… you asked how to install a pfSense package from the command line.

          If you save the php code somewhere, you can run it from the command line... just do 'php yourfile.php "package_name"' where package name is the package you want to install.

          1 Reply Last reply Reply Quote 0
          • J
            jimp Rebel Alliance Developer Netgate
            last edited by Nov 21, 2013, 2:25 PM

            2.1 includes a script to do this already.

            https://doc.pfsense.org/index.php/2.1_New_Features_and_Changes#SH.2FPHP_Shell_Scripts

            Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

            Need help fast? Netgate Global Support!

            Do not Chat/PM for help!

            1 Reply Last reply Reply Quote 0
            • R
              rjcrowder
              last edited by Nov 21, 2013, 2:29 PM

              Nice! Thanks! Didn't know that was in 2.1.

              1 Reply Last reply Reply Quote 0
              • J
                jimp Rebel Alliance Developer Netgate
                last edited by Nov 21, 2013, 2:31 PM

                Though reviewing the OP's request he seems to be trying to install the files locally by hand and that isn't possible - the script works like the GUI it requires remote access to the package repository.

                Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

                Need help fast? Netgate Global Support!

                Do not Chat/PM for help!

                1 Reply Last reply Reply Quote 0
                • N
                  new_in_pf
                  last edited by Nov 24, 2013, 8:04 AM

                  @jimp:

                  Though reviewing the OP's request he seems to be trying to install the files locally by hand and that isn't possible - the script works like the GUI it requires remote access to the package repository.

                  Really don't can i install packages locally? Even with "pkg_add" command?

                  Actually i install a package and his requirement from my hard and package compeletly installed with command line but problem is that don't show this package on the web interface!!!

                  Can you help me about this?

                  1 Reply Last reply Reply Quote 0
                  • J
                    jimp Rebel Alliance Developer Netgate
                    last edited by Nov 24, 2013, 5:10 PM

                    That is correct, you can get the binary parts installed, but not the GUI parts. There is no current way to do that without manually moving a bunch of files and hand editing several things into the config.xml file.

                    It's something we want to accommodate in the future, but it is not currently possible.

                    Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

                    Need help fast? Netgate Global Support!

                    Do not Chat/PM for help!

                    1 Reply Last reply Reply Quote 0
                    • N
                      new_in_pf
                      last edited by Nov 26, 2013, 10:38 AM

                      thanks for your help jimp but i have a problem and that is this:

                      Some of files of packages is filter for me and these not in my access
                      so i can not install some package on pfsense.
                      How i install this packages?

                      Can i get packages from installed packages on another pfsense that it access is full?

                      1 Reply Last reply Reply Quote 0
                      10 out of 10
                      • First post
                        10/10
                        Last post
                      Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
                        This community forum collects and processes your personal information.
                        consent.not_received