# equivalence between FreeBSD and Ubuntu



## Donald Baud (Jan 5, 2018)

I recently found myself forced to work with Ubuntu.
I would like to ask what are the equivalence for some common administration tasks.

What is the equivalent of:

`/etc/rc.conf` 
where do I add the SERVICE_ENABLE="YES" and other flags?
where do I store the ethernet config on Ubuntu?
I read about init.b, upstart and systemd, I'm looking for some simple non-outdated info.

`/usr/local/etc/`
Is Ubuntu storing configs in `/etc`? how do you distinguish between the original Ubuntu configs and the custom added software? how do you avoid messing up the /etc folder?

`ipfw add 10 allow ip from me to any 80`
What is the IPTABLE equivalent?  Is there a short and sweet cheatsheet?

`pkg install www/apache24`
I read about `apt-get` or `apt` but then I have to update a repository in /etc/apt/sources. how does that work?

`portsnap fetch update`
What is the equivalent of our precious ports-mgmt/portmaster?

`freebsd-update fetch install`
would that be `apt-get install dist-upgrade`?

`make buildworld && make buildkernel && make installkernel && make installworld`
how do you recompile world on Ubuntu?

`sysctl -a`
`/etc/sysctl.conf` and `/boot/loader.conf`
`kldstat` and `kldload`

`service apache24 start`

`/etc/resolv.conf`
I see that it is managed from another place, what's the best way to update the nameserver?

`ifconfig em0 inet 10.0.0.1/24`
I noticed that Ubuntu is deprecating ifconfig for "ip" or "ethtool" why is that?

`/bin/tcsh` vs `bash`
How does command-history work on bash? 
I just want to be able to start a command line and "arrow up" the history to find a previous command.
I tried ctrl-R and !! but this seem clumsy, is there something i'm missing?

Please don't add to my misery by starting a flame war on which system is better.
I am a fanatic FreeBSD user who is instructed to manage a Ubuntu server.
I understand that my question would be useful the other way around on this forum. 
I figure that any answer would also help Linux users migrate to FreeBSD.


----------



## rigoletto@ (Jan 5, 2018)

You should ask that in an Ubuntu forum, but:



> /etc/rc.conf
> where do I add the SERVICE_ENABLE="YES" and other flags?
> where do I store the ethernet config on Ubuntu?
> I read about init.b, upstart and systemd, I'm looking for some simple non-outdated info.



You need to learn SystemD, everything is managed using `systemctl` and similar tools.



> /usr/local/etc/
> Is Ubuntu storing configs in /etc? how do you distinguish between the original Ubuntu configs and the custom added software? how do you avoid messing up the /etc folder?



You don't, in Linux everything actually is third party. /usr/local is used for actual custom things you did, and stuff manually installed like .bin software.



> freebsd-update fetch install
> would that be apt-get install dist-upgrade?



IIRC yes.


Forget about automated building from sources, learn how to do it manually if you are interested. Ubuntu is a binary only distribution. 

Btw, the Linux kernel is *A LOT OF* more complicated to configure than the FreeBSD one.

If you need to learn Linux better get a Gentoo box to do it. Just the installation will enlight several things. 

Gentoo has a Handbook too.

EDIT:
Best source for Linux HELP and THIS.


----------



## aragats (Jan 5, 2018)

lebarondemerde said:


> You need to learn SystemD, everything is managed using  systemctl and similar tools.


Not really, you still can switch to OpenRC.


----------



## rigoletto@ (Jan 5, 2018)

aragats said:


> Not really, you still can switch to OpenRC.



True, but I guess OP is in a business env and he may not be allowed to do that.


----------



## ralphbsz (Jan 5, 2018)

I'll answer only a few:



Donald Baud said:


> `kldstat` and `kldload`


lsmod tells you what modules are loaded.
modprobe loads a module, and all dependencies.
insmod loads just the module, and doesn't care about dependencies.
rmmod removes modules.



> `service apache24 start`


That is the same, even when using systemd.  Although I don't know whether with systemd the service needs to be enabled before you can start it (that's the equivalent situation where on FreeBSD you would use "onestart").



> `/etc/resolv.conf`
> I see that it is managed from another place, what's the best way to update the nameserver?


The overwriting of /etc/resolv.conf, and where network configuration is stored on Linux, is a god-awful mess.  I used to run all my linux servers without any trace of DHCP, and then nothing would overwrite /etc/resolv.conf (nor /etc/sysconfig/network/scripts/... or something like that, which is where the IP addresses were stored).  With DHCP, the trick is to make sure the DHCP server advertises the correct DNS, then the updating of /etc/resolv.conf happens to work magically.  This one is very ugly.



> `/bin/tcsh` vs `bash`
> How does command-history work on bash?
> I just want to be able to start a command line and "arrow up" the history to find a previous command.


A: You can just use tcsh on Ubuntu also.  I don't know whether it's installed by default, if not apt-get it.
B: In bash, cursor key up (and left and right and down) should work just fine.  If it doesn't, the problem is probably some terminal settings.  Matter-of-fact, you can tell bash that you want its command line editor to be in emacs mode (or in vi mode, of you are so inclined), and it will honor most editor commands right there.

Did you get a support contract with Ubuntu?  If yes, can you just call your support organization (maybe Ubuntu itself), and bug them with questions?  Here's why: Their support staff needs to know the pain points for users (like network configuration on Linux is a god-awful mess), because that feedback needs to be given to developers to clean up that mess.


----------



## rigoletto@ (Jan 5, 2018)

> Although I don't know whether with systemd the service needs to be enabled before you can start it (that's the equivalent situation where on FreeBSD you would use "onestart").



IIRC, there are two necessary commands, and the order they are issued is not relevant:

`systemctl enable service`
`systemctl start service`

Also, another import command is:

`systemctl list-unit-files`

To display all available services, what systemd call _units_.


----------



## ralphbsz (Jan 5, 2018)

lebaronmerde is right: better to learn the new systemd-style commands; the old service-style commands still work, but they are "old", and I don't know how much longer they're going to be there.


----------



## poorandunlucky (Jan 5, 2018)

This is kinda off-topic, but I used to work on a system that was inspired by Apple's initd to replace FreeBSD's rc script infrastructure...

I just found it so archaic and ... rusty...  It was like this old clock mechanism made of solid iron, and I thought it should be skeletal aluminum...

I'm surprised it hasn't been worked on much since I gave-up on 8.2...


----------



## p3rj (Jan 5, 2018)

To my knowledge, you'd use `apt-get dist-upgrade` (without install, that's used to add new software, or to update specific packages) to upgrade to a new Ubuntu version (e. g., from 17.04 to 17.10). To just get the latest version of all software installed for the current version, use `apt-get upgrade` (this includes new kernel versions and user-land software). Before either, use `apt-get update` to update your local package index. In general, several repositories are used in parallel (I know this can work with `pkg` too, but is often discouraged). These repos are kept in sources.list. This can be edited manually, or using `apt-add-repository`, which can also be used to remove a repo.
If you really want to start building things from source, I think you need to look at the `dpkg` layer below apt. I don't think this is done commonly, though.


----------



## scottro (Jan 5, 2018)

I see on an ancient fluxbox page of mine, at http://srobb.net/fluxbox.html, I have a step by step of how to build from source on Debian. I don't know if it's still accurate, it's from the early 2000's.   If you feel like testing it, look for the section about the rootmenu patch in Debian, or just search for Debian on the page, it's the second mention.


----------



## SirDice (Jan 5, 2018)

It looks like you have enough pointers now. 

Rule #7: FreeBSD Forums Rules

Thread closed.


----------

