diff options
author | Sergio Carlavilla Delgado <carlavilla@FreeBSD.org> | 2021-03-20 17:58:59 +0000 |
---|---|---|
committer | Sergio Carlavilla Delgado <carlavilla@FreeBSD.org> | 2021-03-20 18:03:12 +0000 |
commit | e16d21085bebdaf6f91c49e14cff9cb960a13315 (patch) | |
tree | c3fbc73e9d6003a6113526c2f6bb1ff31df217ee /documentation/content/en/articles/linux-users | |
parent | 98b9c01a12515cbc9b1eb4bf86ddf89f5b2f1b0c (diff) |
Diffstat (limited to 'documentation/content/en/articles/linux-users')
-rw-r--r-- | documentation/content/en/articles/linux-users/_index.adoc | 87 |
1 files changed, 64 insertions, 23 deletions
diff --git a/documentation/content/en/articles/linux-users/_index.adoc b/documentation/content/en/articles/linux-users/_index.adoc index 7f298494a8..2198e6d09d 100644 --- a/documentation/content/en/articles/linux-users/_index.adoc +++ b/documentation/content/en/articles/linux-users/_index.adoc @@ -33,21 +33,30 @@ toc::[] This document highlights some of the technical differences between FreeBSD and Linux(R) so that intermediate to advanced Linux(R) users can quickly familiarize themselves with the basics of FreeBSD. -This document assumes that FreeBSD is already installed. Refer to the link:{handbook}#bsdinstall[Installing FreeBSD] chapter of the FreeBSD Handbook for help with the installation process. +This document assumes that FreeBSD is already installed. +Refer to the link:{handbook}#bsdinstall[Installing FreeBSD] chapter of the FreeBSD Handbook for help with the installation process. [[shells]] == Default Shell -Linux(R) users are often surprised to find that Bash is not the default shell in FreeBSD. In fact, Bash is not included in the default installation. Instead, FreeBSD uses man:tcsh[1] as the default root shell, and the Bourne shell-compatible man:sh[1] as the default user shell. man:sh[1] is very similar to Bash but with a much smaller feature-set. Generally shell scripts written for man:sh[1] will run in Bash, but the reverse is not always true. +Linux(R) users are often surprised to find that Bash is not the default shell in FreeBSD. +In fact, Bash is not included in the default installation. +Instead, FreeBSD uses man:tcsh[1] as the default root shell, and the Bourne shell-compatible man:sh[1] as the default user shell. +man:sh[1] is very similar to Bash but with a much smaller feature-set. +Generally shell scripts written for man:sh[1] will run in Bash, but the reverse is not always true. However, Bash and other shells are available for installation using the FreeBSD link:{handbook}#ports[Packages and Ports Collection]. -After installing another shell, use man:chsh[1] to change a user's default shell. It is recommended that the `root` user's default shell remain unchanged since shells which are not included in the base distribution are installed to [.filename]#/usr/local/bin#. In the event of a problem, the file system where [.filename]#/usr/local/bin# is located may not be mounted. In this case, `root` would not have access to its default shell, preventing `root` from logging in and fixing the problem. +After installing another shell, use man:chsh[1] to change a user's default shell. +It is recommended that the `root` user's default shell remain unchanged since shells which are not included in the base distribution are installed to [.filename]#/usr/local/bin#. +In the event of a problem, the file system where [.filename]#/usr/local/bin# is located may not be mounted. +In this case, `root` would not have access to its default shell, preventing `root` from logging in and fixing the problem. [[software]] == Packages and Ports: Adding Software in FreeBSD -FreeBSD provides two methods for installing applications: binary packages and compiled ports. Each method has its own benefits: +FreeBSD provides two methods for installing applications: binary packages and compiled ports. +Each method has its own benefits: .Binary Packages * Faster installation as compared to compiling large applications. @@ -58,14 +67,18 @@ FreeBSD provides two methods for installing applications: binary packages and co * Ability to customize installation options. * Custom patches can be applied. -If an application installation does not require any customization, installing the package is sufficient. Compile the port instead whenever an application requires customization of the default options. If needed, a custom package can be compiled from ports using `make package`. +If an application installation does not require any customization, installing the package is sufficient. +Compile the port instead whenever an application requires customization of the default options. +If needed, a custom package can be compiled from ports using `make package`. A complete list of all available ports and packages can be found https://www.freebsd.org/ports/[here]. [[packages]] === Packages -Packages are pre-compiled applications, the FreeBSD equivalents of [.filename]#.deb# files on Debian/Ubuntu based systems and [.filename]#.rpm# files on Red Hat/Fedora based systems. Packages are installed using `pkg`. For example, the following command installs Apache 2.4: +Packages are pre-compiled applications, the FreeBSD equivalents of [.filename]#.deb# files on Debian/Ubuntu based systems and [.filename]#.rpm# files on Red Hat/Fedora based systems. +Packages are installed using `pkg`. +For example, the following command installs Apache 2.4: [source,shell] .... @@ -77,9 +90,11 @@ For more information on packages refer to section 5.4 of the FreeBSD Handbook: l [[ports]] === Ports -The FreeBSD Ports Collection is a framework of [.filename]#Makefiles# and patches specifically customized for installing applications from source on FreeBSD. When installing a port, the system will fetch the source code, apply any required patches, compile the code, and install the application and any required dependencies. +The FreeBSD Ports Collection is a framework of [.filename]#Makefiles# and patches specifically customized for installing applications from source on FreeBSD. +When installing a port, the system will fetch the source code, apply any required patches, compile the code, and install the application and any required dependencies. -The Ports Collection, sometimes referred to as the ports tree, can be installed to [.filename]#/usr/ports# using man:portsnap[8]. Detailed instructions for installing the Ports Collection can be found in link:{handbook}#ports-using[section 5.5] of the FreeBSD Handbook. +The Ports Collection, sometimes referred to as the ports tree, can be installed to [.filename]#/usr/ports# using man:portsnap[8]. +Detailed instructions for installing the Ports Collection can be found in link:{handbook}#ports-using[section 5.5] of the FreeBSD Handbook. To compile a port, change to the port's directory and start the build process. The following example installs Apache 2.4 from the Ports Collection: @@ -89,7 +104,8 @@ To compile a port, change to the port's directory and start the build process. T # make install clean .... -A benefit of using ports to install software is the ability to customize the installation options. This example specifies that the mod_ldap module should also be installed: +A benefit of using ports to install software is the ability to customize the installation options. +This example specifies that the mod_ldap module should also be installed: [source,shell] .... @@ -102,13 +118,24 @@ Refer to link:{handbook}#ports-using[Using the Ports Collection] for more inform [[startup]] == System Startup -Many Linux(R) distributions use the SysV init system, whereas FreeBSD uses the traditional BSD-style man:init[8]. Under the BSD-style man:init[8], there are no run-levels and [.filename]#/etc/inittab# does not exist. Instead, startup is controlled by man:rc[8] scripts. At system boot, [.filename]#/etc/rc# reads [.filename]#/etc/rc.conf# and [.filename]#/etc/defaults/rc.conf# to determine which services are to be started. The specified services are then started by running the corresponding service initialization scripts located in [.filename]#/etc/rc.d/# and [.filename]#/usr/local/etc/rc.d/#. These scripts are similar to the scripts located in [.filename]#/etc/init.d/# on Linux(R) systems. +Many Linux(R) distributions use the SysV init system, whereas FreeBSD uses the traditional BSD-style man:init[8]. +Under the BSD-style man:init[8], there are no run-levels and [.filename]#/etc/inittab# does not exist. +Instead, startup is controlled by man:rc[8] scripts. +At system boot, [.filename]#/etc/rc# reads [.filename]#/etc/rc.conf# and [.filename]#/etc/defaults/rc.conf# to determine which services are to be started. +The specified services are then started by running the corresponding service initialization scripts located in [.filename]#/etc/rc.d/# and [.filename]#/usr/local/etc/rc.d/#. These scripts are similar to the scripts located in [.filename]#/etc/init.d/# on Linux(R) systems. -The scripts found in [.filename]#/etc/rc.d/# are for applications that are part of the "base" system, such as man:cron[8], man:sshd[8], and man:syslog[3]. The scripts in [.filename]#/usr/local/etc/rc.d/# are for user-installed applications such as Apache and Squid. +The scripts found in [.filename]#/etc/rc.d/# are for applications that are part of the "base" system, such as man:cron[8], man:sshd[8], and man:syslog[3]. +The scripts in [.filename]#/usr/local/etc/rc.d/# are for user-installed applications such as Apache and Squid. -Since FreeBSD is developed as a complete operating system, user-installed applications are not considered to be part of the "base" system. User-installed applications are generally installed using link:{handbook}#ports-using[Packages or Ports]. In order to keep them separate from the base system, user-installed applications are installed under [.filename]#/usr/local/#. Therefore, user-installed binaries reside in [.filename]#/usr/local/bin/#, configuration files are in [.filename]#/usr/local/etc/#, and so on. +Since FreeBSD is developed as a complete operating system, user-installed applications are not considered to be part of the "base" system. +User-installed applications are generally installed using link:{handbook}#ports-using[Packages or Ports]. +In order to keep them separate from the base system, user-installed applications are installed under [.filename]#/usr/local/#. +Therefore, user-installed binaries reside in [.filename]#/usr/local/bin/#, configuration files are in [.filename]#/usr/local/etc/#, and so on. -Services are enabled by adding an entry for the service in [.filename]#/etc/rc.conf# . The system defaults are found in [.filename]#/etc/defaults/rc.conf# and these default settings are overridden by settings in [.filename]#/etc/rc.conf#. Refer to man:rc.conf[5] for more information about the available entries. When installing additional applications, review the application's install message to determine how to enable any associated services. +Services are enabled by adding an entry for the service in [.filename]#/etc/rc.conf#. +The system defaults are found in [.filename]#/etc/defaults/rc.conf# and these default settings are overridden by settings in [.filename]#/etc/rc.conf#. +Refer to man:rc.conf[5] for more information about the available entries. +When installing additional applications, review the application's install message to determine how to enable any associated services. The following entries in [.filename]#/etc/rc.conf# enable man:sshd[8], enable Apache 2.4, and specify that Apache should be started with SSL. @@ -139,7 +166,8 @@ If a service has not been enabled, it can be started from the command line using [[network]] == Network Configuration -Instead of a generic _ethX_ identifier that Linux(R) uses to identify a network interface, FreeBSD uses the driver name followed by a number. The following output from man:ifconfig[8] shows two Intel(R) Pro 1000 network interfaces ([.filename]#em0# and [.filename]#em1#): +Instead of a generic _ethX_ identifier that Linux(R) uses to identify a network interface, FreeBSD uses the driver name followed by a number. +The following output from man:ifconfig[8] shows two Intel(R) Pro 1000 network interfaces ([.filename]#em0# and [.filename]#em1#): [source,shell] .... @@ -158,7 +186,9 @@ em1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500 status: active .... -An IP address can be assigned to an interface using man:ifconfig[8]. To remain persistent across reboots, the IP configuration must be included in [.filename]#/etc/rc.conf#. The following [.filename]#/etc/rc.conf# entries specify the hostname, IP address, and default gateway: +An IP address can be assigned to an interface using man:ifconfig[8]. +To remain persistent across reboots, the IP configuration must be included in [.filename]#/etc/rc.conf#. +The following [.filename]#/etc/rc.conf# entries specify the hostname, IP address, and default gateway: [.programlisting] .... @@ -178,13 +208,16 @@ ifconfig_em0="DHCP" [[firewall]] == Firewall -FreeBSD does not use Linux(R) IPTABLES for its firewall. Instead, FreeBSD offers a choice of three kernel level firewalls: +FreeBSD does not use Linux(R) IPTABLES for its firewall. +Instead, FreeBSD offers a choice of three kernel level firewalls: * link:{handbook}#firewalls-pf[PF] * link:{handbook}#firewalls-ipf[IPFILTER] * link:{handbook}#firewalls-ipfw[IPFW] -PF is developed by the OpenBSD project and ported to FreeBSD. PF was created as a replacement for IPFILTER and its syntax is similar to that of IPFILTER. PF can be paired with man:altq[4] to provide QoS features. +PF is developed by the OpenBSD project and ported to FreeBSD. +PF was created as a replacement for IPFILTER and its syntax is similar to that of IPFILTER. +PF can be paired with man:altq[4] to provide QoS features. This sample PF entry allows inbound SSH: @@ -193,7 +226,8 @@ This sample PF entry allows inbound SSH: pass in on $ext_if inet proto tcp from any to ($ext_if) port 22 .... -IPFILTER is the firewall application developed by Darren Reed. It is not specific to FreeBSD and has been ported to several operating systems including NetBSD, OpenBSD, SunOS, HP/UX, and Solaris. +IPFILTER is the firewall application developed by Darren Reed. +It is not specific to FreeBSD and has been ported to several operating systems including NetBSD, OpenBSD, SunOS, HP/UX, and Solaris. The IPFILTER syntax to allow inbound SSH is: @@ -202,7 +236,8 @@ The IPFILTER syntax to allow inbound SSH is: pass in on $ext_if proto tcp from any to any port = 22 .... -IPFW is the firewall developed and maintained by FreeBSD. It can be paired with man:dummynet[4] to provide traffic shaping capabilities and simulate different types of network connections. +IPFW is the firewall developed and maintained by FreeBSD. +It can be paired with man:dummynet[4] to provide traffic shaping capabilities and simulate different types of network connections. The IPFW syntax to allow inbound SSH would be: @@ -216,9 +251,13 @@ ipfw add allow tcp from any to me 22 in via $ext_if There are two methods for updating a FreeBSD system: from source or binary updates. -Updating from source is the most involved update method, but offers the greatest amount of flexibility. The process involves synchronizing a local copy of the FreeBSD source code with the FreeBSD Subversion servers. Once the local source code is up-to-date, a new version of the kernel and userland can be compiled. +Updating from source is the most involved update method, but offers the greatest amount of flexibility. +The process involves synchronizing a local copy of the FreeBSD source code with the FreeBSD Subversion servers. +Once the local source code is up-to-date, a new version of the kernel and userland can be compiled. -Binary updates are similar to using `yum` or `apt-get` to update a Linux(R) system. In FreeBSD, man:freebsd-update[8] can be used fetch new binary updates and install them. These updates can be scheduled using man:cron[8]. +Binary updates are similar to using `yum` or `apt-get` to update a Linux(R) system. +In FreeBSD, man:freebsd-update[8] can be used fetch new binary updates and install them. +These updates can be scheduled using man:cron[8]. [NOTE] ==== @@ -236,7 +275,8 @@ For more information on source and binary updates, refer to link:{handbook}#upda [[procfs]] == procfs: Gone But Not Forgotten -In some Linux(R) distributions, one could look at [.filename]#/proc/sys/net/ipv4/ip_forward# to determine if IP forwarding is enabled. In FreeBSD, man:sysctl[8] is instead used to view this and other system settings. +In some Linux(R) distributions, one could look at [.filename]#/proc/sys/net/ipv4/ip_forward# to determine if IP forwarding is enabled. +In FreeBSD, man:sysctl[8] is instead used to view this and other system settings. For example, use the following to determine if IP forwarding is enabled on a FreeBSD system: @@ -313,4 +353,5 @@ Some common command equivalents are as follows: [[conclusion]] == Conclusion -This document has provided an overview of FreeBSD. Refer to the link:{handbook}[FreeBSD Handbook] for more in-depth coverage of these topics as well as the many topics not covered by this document. +This document has provided an overview of FreeBSD. +Refer to the link:{handbook}[FreeBSD Handbook] for more in-depth coverage of these topics as well as the many topics not covered by this document. |