

    FreeBSD   Linux


John Ferrell

$FreeBSD: doc/el_GR.ISO8859-7/articles/linux-users/article.sgml,v 1.4 2009/10/
08 21:01:16 keramida Exp $
   2008     FreeBSD
 FreeBSD       FreeBSD Foundation.
 Linux       Linus Torvalds 
 .
  Intel, Celeron, EtherExpress, i386, i486, Itanium, Pentium,  Xeon
        Intel Corporation
          .
    Red Hat,  RPM     
   Red Hat, Inc.       .
  UNIX      Open Group  
    .
          
           
 .           
      FreeBSD     
 ,      : [TM]  .
           Linux
 /        FreeBSD
-------------------------------------------------------------------------------

1 

        FreeBSD   Linux 
     Linux      
   FreeBSD.       FreeBSD,
          
.
         FreeBSD.   
  FreeBSD       
,      __FreeBSD 
  FreeBSD.
-------------------------------------------------------------------------------

2 :   Bash;

    Linux       Bash 
     FreeBSD.  ,  Bash 
      FreeBSD. ,  FreeBSD 
 tcsh(1)    .  Bash      
  ,    ___Ports 
FreeBSD.
   ,     
chsh(1)        .  
      root  .     
          FreeBSD,
   /usr/local/bin  /usr/bin.  
,         /usr/local/
bin  /usr/bin     .   ,  root
       ,    
   .    ,    
   root,  toor,      
    .     
   _toor.
-------------------------------------------------------------------------------

3   Ports:    FreeBSD

        UNIX (
  ,   ,   ), 
FreeBSD        :  
  ports.          ports, 
.
-------------------------------------------------------------------------------

3.1 

   - ,      
FreeBSD   .deb   Debian/Ubuntu    .rpm 
 Red Hat/Fedora.      
pkg_add(1).  ,      Apache 2.2:

  # pkg_add /tmp/apache-2.2.6_2.tbz

    -r   pkg_add(1)     
,     ,    :

  # pkg_add -r apache22
  Fetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-6.2-release/
  Latest/apache22.tbz... Done.
  Fetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-6.2-release/
  All/expat-2.0.0_1.tbz... Done.
  Fetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-6.2-release/
  All/perl-5.8.8_1.tbz... Done.
  [snip]

  To run apache www server from startup, add apache22_enable="YES"
  in your /etc/rc.conf. Extra options can be found in startup script.


     :      FreeBSD (6.2,
     6.3, 7.0, .       CD-ROM) 
      pkg_add -r         
      .        
        .    
       PACKAGESITE     
      .  ,   PACKAGESITE
       ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-6-
     stable/Latest/         
       6.X.
             FreeBSD 
      _______FreeBSD.

      ,   
 4.4    FreeBSD: ___Packages.
-------------------------------------------------------------------------------

3.2 Ports

        FreeBSD    
Ports.    Ports       
Makefiles    (patches)     ,
         FreeBSD  
  .    port,     
 ,        
patches,    ,      .
         
.
      Ports (     
   ports),   /usr/ports.    
    Ports      
FreeBSD.     ,       CD
     sysinstall(8)      
  FreeBSD    csup(1)   
portsnap(8).         
  Ports  _4.5.1  .
   port         
       .  
    Apache 2.2     Ports:

  # cd /usr/ports/www/apache22
  # make install clean

     ports     
    .  , 
  Apache 2.2   ports     
mod_ldap      WITH_LDAP  make(1):

  # cd /usr/ports/www/apache22
  # make WITH_LDAP="YES" install clean

   4.5    FreeBSD, __Ports
Collection,         Ports.
-------------------------------------------------------------------------------

3.3 Ports  ,    ;

      - ports,  
          
    .      :
 ( )

*    (      
   ).
*          .
*        .

Ports ( )

*     . (  
      ).   ports  
    ,     , 
      .
*        (patches)   .

    ,        . 
     ,     ports
  . ( ,      
,      ports     
     make package  
      .)
-------------------------------------------------------------------------------

4   :    run-levels;

 Linux     SysV,   FreeBSD  
   BSD.   init(8)  BSD,  
run-levels,    /etc/inittab.   ,   
  script ,  rc(8). To script /etc/rc    /etc/
defaults/rc.conf    /etc/rc.conf     
  .        
 script      /etc/rc.d/  /
usr/local/etc/rc.d/.  scripts      scripts 
   /etc/init.d/   Linux.
 _____________________________________________________________________________
|      scripts   ;      |
|scripts     /etc/rc.d/          |
|   . ( ,  cron(8), sshd(8), syslog  |
|(3),  .)  scripts     /usr/local/etc/rc.d/|
|        ,          |
|  Apache,  Squid, ...                                        |
|                 |
|;  FreeBSD      .     |
|,  ,    ,             |
|(userland,     ls(1), cat(1), cp(1) .),   |
|  ,  .      .  |
|      ,        |
|,       Apache,  X11,                 |
|Mozilla Firefox, .     ,    |
|   ___Ports  FreeBSD.     |
|  ,            |
|  /usr/local/.          |
|    /usr/local/bin/,          |
|____/usr/local/etc/,_..._________________________|

        
_enable="YES"   /etc/rc.conf (rc.conf(5)).  
   /etc/defaults/rc.conf      
.       /etc/rc.conf  
  . ,     ,
          
   .
      /etc/rc.conf    sshd
(8)   Apache 2.2.     Apache   
   SSL.

  # enable SSHD
  sshd_enable="YES"
  # enable Apache with SSL
  apache22_enable="YES"
  apache22_flags="-DSSL"

         /etc/rc.conf, 
        (   
   ):

  # /etc/rc.d/sshd start

        ,  
           forcestart:

  # /etc/rc.d/sshd forcestart

-------------------------------------------------------------------------------

5  


5.1  

      ethX    Linux  
   ,  FreeBSD    
       .   
   ifconfig(8)     Intel Pro 1000 (
 em0 and em1):

  % ifconfig
  em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
          options=b<RXCSUM,TXCSUM,VLAN_MTU>
          inet 10.10.10.100 netmask 0xffffff00 broadcast 10.10.10.255
          ether 00:50:56:a7:70:b2
          media: Ethernet autoselect (1000baseTX <full-duplex>)
          status: active
  em1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
          options=b<RXCSUM,TXCSUM,VLAN_MTU>
          inet 192.168.10.222 netmask 0xffffff00 broadcast 192.168.10.255
          ether 00:50:56:a7:03:2b
          media: Ethernet autoselect (1000baseTX <full-duplex>)
          status: active

-------------------------------------------------------------------------------

5.2   IP

     IP        
 ifconfig(8).        ,   
   ,        /etc/
rc.conf.         
   (hostname),   IP,    
 (defaultrouter):

  hostname="server1.example.com"
  ifconfig_em0="inet 10.10.10.100  netmask 255.255.255.0"
  defaultrouter="10.10.10.1"

          
   DHCP:

  hostname="server1.example.com"
  ifconfig_em0="DHCP"

-------------------------------------------------------------------------------

6 Firewall

 Linux   IPTABLES     firewall 
 .  FreeBSD   firewall   .  
,  FreeBSD   firewalls:

* IPFIREWALL
* IPFILTER
* PF

 IPFIREWALL  IPFW (      IPFW   ipfw(8))
  firewall         
 FreeBSD.  IPFW      dummynet(4)   
     (traffic shaping)   
   .
    IPFW      
 SSH:

  ipfw add allow tcp from any to me 22 in via $ext_if

 IPFILTER    firewall     Darren Reed.
      FreeBSD,      
,   NetBSD, OpenBSD, SunOS, HP/UX, 
Solaris.
     IPFILTER     
  SSH:

  pass in on $ext_if proto tcp from any to any port = 22

   firewall,  PF,    OpenBSD project. 
PF     IPFILTER,      PF
      IPFILTER.  PF     
altq(4)      QoS.
   PF       
SSH:

  pass in on $ext_if inet proto tcp from any to ($ext_if) port 22

-------------------------------------------------------------------------------

7   FreeBSD

        FreeBSD:  
 ,   (binary) ,    CD
.
         ,   
   .      
       FreeBSD     FreeBSD
    CVS (Concurrent Versioning System).  
        ,  
        . 
         ,
   __    FreeBSD.
  (binary) ,        yum 
apt-get      Linux.   freebsd-update(8) 
      .    
,     ,     cron(8).

     :     cron(8) 
      ,    
      freebsd-update cron   crontab(1)  
              
        .

       0 3 * * * root /usr/sbin/freebsd-update cron


   ,   CD ,  
.     CD     
  (upgrade).
-------------------------------------------------------------------------------

8 procfs:    

 Linux,      /proc/sys/net/ipv4/ip_forward  
      IP (IP forwarding).  FreeBSD
     sysctl(8)       
 ,   procfs(5)     
 . (    sysctl     
Linux).
    IP,       
         FreeBSD :

  % sysctl net.inet.ip.forwarding
  net.inet.ip.forwarding: 0

  -a           
:

  % sysctl -a
  kern.ostype: FreeBSD
  kern.osrelease: 6.2-RELEASE-p9
  kern.osrevision: 199506
  kern.version: FreeBSD 6.2-RELEASE-p9 #0: Thu Nov 29 04:07:33 UTC 2007
      root@i386-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC

  kern.maxvnodes: 17517
  kern.maxproc: 1988
  kern.maxfiles: 3976
  kern.argmax: 262144
  kern.securelevel: -1
  kern.hostname: server1
  kern.hostid: 0
  kern.clockrate: { hz = 1000, tick = 1000, profhz = 666, stathz = 133 }
  kern.posix1version: 200112
  ...


     :        sysctl  
      .

     procfs,    
  ,       truss(1) 
    ,    ___
Linux. (       Linux    
procfs,  linprocfs(5)).      procfs,  
      /etc/fstab:

  proc                /proc           procfs  rw,noauto       0       0


     :  noauto       /
     proc     .

   procfs    :

  # mount /proc

-------------------------------------------------------------------------------

9  


9.1  


  Linux (Red Hat/   FreeBSD 
Debian)
yum install package / apt- pkg_add -r package          
get install package                                   
rpm -ivh package / dpkg -  pkg_add -v package         
i package
rpm -qa / dpkg -l          pkg_info                   
                                                     

-------------------------------------------------------------------------------

9.2  


 Linux   FreeBSD 
lspci        pciconf                     PCI
lsmod        kldstat                      
modprobe     kldload / kldunload       /  
strace       truss                       

-------------------------------------------------------------------------------

10 

          
   FreeBSD.      ,
    __FreeBSD     
        .
-------------------------------------------------------------------------------
  ,   ,     ftp://ftp.FreeBSD.org/
                               pub/FreeBSD/doc/.
          FreeBSD,     
                   <questions@FreeBSD.org>.
             ,  e-mail 
                              <doc@FreeBSD.org>.
