Re: HOWTO articles for migrating from Linux to FreeBSD, especially for pkg?

From: Lars Engels <lars.engels_at_0x20.net>
Date: Fri, 18 Jul 2014 14:10:25 +0200
On Thu, Jul 17, 2014 at 01:00:03PM -0700, Adrian Chadd wrote:
> On 17 July 2014 12:57, Andreas Nilsson <andrnils_at_gmail.com> wrote:
> >
> >
> >
> > On Thu, Jul 17, 2014 at 9:28 PM, Adrian Chadd <adrian_at_freebsd.org> wrote:
> >>
> >> Hi!
> >>
> >> 3) The binary packages need to work out of the box
> >> 4) .. which means, when you do things like pkg install apache, it
> >> can't just be installed and not be enabled, because that's a bit of a
> >> problem;
> >
> > I disagree on this. For network services on linux ( apart from ssh ), I want
> > that started very seldom. But I do want the package installed so that when I
> > need it, it is there. Having it autostart as part of being installed is
> > breaking KISS and in some way unix philosophy: I asked for something to be
> > installed, not installed and autostarted.
> 
> That's cool. We can disagree on that. But the fact that you have to
> edit a file to enable things and hope you get the right start entry in
> /etc/rc.conf or /usr/local/etc/rc.conf, or wherever you put it is, is
> a pain.

No, Sir! No need to edit anything:

root_at_testjail: # pkg install apache24
Updating repository catalogue
The following 5 packages will be installed:

        Installing pcre: 8.33
        Installing gdbm: 1.10
        Installing db42: 4.2.52_5
        Installing apr: 1.4.8.1.5.3
        Installing apache24: 2.4.6_1

The installation will require 47 MB more space

5 MB to be downloaded

Proceed with installing packages [y/N]: y
gdbm-1.10.txz 100%   83KB  83.2KB/s  83.2KB/s   00:00
db42-4.2.52_5.txz 100% 1457KB   1.4MB/s   1.4MB/s   00:00
apr-1.4.8.1.5.3.txz 100%  390KB 389.5KB/s 389.5KB/s   00:00
apache24-2.4.6_1.txz 100% 3649KB   3.6MB/s   3.6MB/s   00:00
Checking integrity... done
[1/5] Installing pcre-8.33... done
[2/5] Installing gdbm-1.10... done
[3/5] Installing db42-4.2.52_5... done
[4/5] Installing apr-1.4.8.1.5.3... done
[5/5] Installing apache24-2.4.6_1...===> Creating users and/or groups.
Using existing group 'www'.
Using existing user 'www'.
/usr/local/share/examples/apache24/httpd.conf ->
/usr/local/etc/apache24/httpd.conf
 done
To run apache www server from startup, add apache24_enable="yes"
in your /etc/rc.conf. Extra options can be found in startup script.

Your hostname must be resolvable using at least 1 mechanism in
/etc/nsswitch.conf typically DNS or /etc/hosts or apache might
have issues starting depending on the modules you are using.

root_at_testjail: # sysrc apache24_enable=yes
apache24_enable:  -> yes

root_at_testjail: # service apache24 start
Performing sanity check on apache24 configuration:
AH00557: httpd: apr_sockaddr_info_get() failed for testjail
AH00558: httpd: Could not reliably determine the server's fully
qualified domain name, using 127.0.0.1. Set the 'ServerName' directive
globally to suppress this message
Syntax OK
Starting apache24.
AH00557: httpd: apr_sockaddr_info_get() failed for testjail
AH00558: httpd: Could not reliably determine the server's fully
qualified domain name, using 127.0.0.1. Set the 'ServerName' directive
globally to suppress this message
root_at_testjail: #


That's 3 commands to enter. Admittedly 2 more than on some OS that
blindly starts any service you install, but 2 steps more logical and
even a newbie can do this.

What could be done is that pkg looks for rc scripts in a package,
extracts the enable line and prints a message how to enable the script /
daemon permanently.

Like: 
- To start the script "apache24" once run "service apache24 onestart".
- To start the script "apache24" at boot time run "sysrc apache24_enable=yes"
- The script "apache24" has the following optional settings for /etc/rc.conf:
    apache24_profiles (str):     Set to "" by default.
                                 Define your profiles here.
    apache24limits_enable (bool):Set to "NO" by default.
                                Set it to yes to run `limits $limits_args`
                                just before apache starts.
    apache24_flags (str):        Set to "" by default.
                                Extra flags passed to start command.
    apache24limits_args (str):   Default to "-e -C daemon"
                                Arguments of pre-start limits run.
    apache24_http_accept_enable (bool): Set to "NO" by default.
                                Set to yes to check for accf_http kernel
                                module on start up and load if not loaded.
    apache24_fib (str):         Set an altered default network view for apache




Received on Fri Jul 18 2014 - 10:10:31 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:50 UTC