FreeBSD Operating System

Post-installation configuration

Разбить на страницы
Показывать лекцию целиком

In the last chapter we looked at the installation of the basic system, up to the point where it could be rebooted. It's barely possible that this could be enough. Almost certainly, though, you'll need to perform a number of further configuration steps before the system is useful. In this chapter we roughly follow the final configuration menu, but there are a few exceptions. The most important things to do are:

  • Install additional software.
  • Create accounts for normal users.
  • Set up networking support.
  • Configure the system to start all the services you need.
  • Configure the X Window System and desktop.
  • In this chapter, we’ll concentrate on getting the system up and running as quickly as possible. Later on in the book we'll go into more detail about these topics.

    At the end of the previous chapter, we had a menu asking whether we wanted to visit the "last options" menu. If you answer YES, you get the configuration menu shown in Figure 6-1 . If you have rebooted the machine, log in as root and start sysinstall. Then select Configure, which gets you into the same menu.

    (рис 6.1) Configuration menu

    As the markers under the word Networking indicate, this menu is larger than the window in which it is displayed. We'll look at some of the additional entries below. Only some of these entries are of interest in a normal install; we'll ignore the rest.

    There may be some reasons to deviate from the sequence in this chapter. For example, if your CD-ROM is mounted on a different system, you may need to set up networking before installing additional software.

    Installing additional software

    The first item of interest is Packages. These are some of the ports in the Ports Collection, which we'll look at in more detail in Chapter 9 .

    The Ports Collection contains a large quantity of software that you may want to install. In fact, there's so much that just making up your mind what to install can be a complicated process: there are over 8,000 ports in the collection. Which ones are worth using? I recommend the following list:

  • acroread is the Acrobat reader, a utility for reading and printing PDF files. We look at it briefly on page 276.
  • bash is the shell recommended in this book. We'll look at it in more detail on page 113. Other popular shells are tcsh and csh, both in the base system.
  • cdrecord is a utility to burn SCSI CD-Rs. We'll discuss it in chapter Chapter 13, Writing CD-Rs. You don't need it if you have an IDE CD-R drive.
  • Emacs is the GNU Emacs editor recommended in this book. We'll look at it on page 139. Other popular editors are vi (in the base system) and vim (in the Ports Collection).
  • fetchmail is a program for fetching mail from POP mailboxes. We look at it on page 504.
  • fvwm2 is a window manager that you may prefer to a full-blown desktop. We look at it on page 118.
  • galeon is a web browser. We’ll look at it briefly on page 418.
  • ghostscript is a PostScript interpreter. It can be used to display PostScript on an X display, or to print it out on a non-PostScript printer. We'll look at it on page 273.
  • gpg is an encryption program.
  • gv is a utility that works with ghostscript to display PostScript on an X display. It allows magnification and paging, both of which ghostscript does not do easily. We'll look at it on page 273.
  • ispell is a spell check program.
  • kde is the desktop environment recommended in this book. We'll look at it in more detail in Chapter 7, The tools of the trade.
  • mkisofs is a program to create CD-R images. We look at it in chapter Chapter 13 , Writing CD-Rs
  • mutt is the mail user agent (MUA, or mail reader) recommended in Chapter 26 , Electronic mail: clients.
  • Postfix is the mail transfer agent (MTA) recommended in chapter Chapter 27, Electronic mail: servers.
  • xtset is a utility to set the title of an xterm window. It is used by the .bashrc file installed with the instant-workstation package.
  • xv is a program to display images, in particular jpeg and gif.
  • Why do l recommend these particular ports? Simple: because I like them, and I use most of them myself. That doesn't mean they're the only choice, though. Others prefer the for more details.

    Instant workstation

    The ports mentioned in the previous section are included in the misc/instant-workstation port, which installs typical software and configurations for a workstation and allows you to be productive right away. At a later point you may find that you prefer other software, in which case you can install it.

    It's possible that the CD set you get will not include instant-workstation. That's not such a problem. Due to space restrictions, some CD distributions include instant-workstation-lite instead. If that's not there either, just install the individual ports from this list. You can also do this if you don't like the list of ports.

    Changing the default shell for root

    After installation, you may want to change the default shell for existing users to bash. If you have installed instant-workstation, you should copy the file /usr/lo-cal/share/dot.bashrc to root's home directory and call it .bashrc and .bash_profile. First, start

    presto# cp /usr/local/share/dot.bashrc .bashrc
    presto# ln .bashrc .bash_profile
    presto# bash
    === root@presto (/dev/ttyp2) ~ 1 -gt; chsh
    

    The last command starts an editor with the following content:

    #Changing user database information for root.
    Login: root
    Password:
    Uid [#]: 0
    Gid [# or name]: 0
    Change [month day year]:
    Expire [month day year]:
    Class:
    Home directory: /root
    Shell: /bin/csh
    Full Name: Charlie 
    Office Location:
    Office Phone:
    Home Phone:
    Other information:
    

    Change the Shell line to:

    Shell: /usr/local/bin/bash
    

    Note that the bash shell is in the directory /usr/local/bin; this is because it is not part of the base system. The standard shells are in the directory /bin.

    Adding users

    A freshly installed FreeBSD system has a number of users, nearly all for system components. The only login user is root, and you shouldn't log in as root. Instead you should add at least one account for yourself. If you're transferring a master.passwd file from another system, you don't need to do anything now. Otherwise select this item and then the menu item User, and fill out the resulting menu like this:

    (рис 6.2) Adding a user

    You should not need to enter the fields UID and Home directory: sysinstall does this for you. It's important to ensure that you are in group wheel so that you can use the su command to become root, and you need to be in group operator to use the shutdown command.

    Don't bother to add more users at this stage; you can do it later. We’ll look at user management in Chapter 8 , on page 112.

    Setting the root password

    Next, select Root Password. We’ll talk about passwords more on page 144. Select this item to set the password in the normal manner.

    Time zone

    Next, select the entry time zone. The first entry asks you if the machine CMOS clock (i.e. the hardware clock) is set to UTC (sometimes incorrectly called GMT, which is a British time zone). If you plan to run only FreeBSD or other UNIX-like operating systems on this machine, you should set the clock to UTC. If you intend to run other software that doesn't understand time zones, such as many Microsoft systems, you have to set the time to local time, which can cause problems with daylight savings time.

    (рис 6.3) Time zone select menu: USA

    The next menu asks you to select a "region," which roughly corresponds with a continent. Assuming you are living in Austin, TX in the United States of America, you would select America -- North and South and then (after scrolling down) United States of America. The next menu then looks like this: Select Central Time and select Yes when the system asks you whether the abbreviation CST sounds reasonable.

    This particular step is relatively cumbersome. You may find it easier to look in the directory /usr/share/zoneinfo after installation. There you find:

    # cd /usr/share/zoneinfo/
    # ls
    Africa       Australia   Etc       MET       WET
    America      CET         Europe    MST       posixrules
    Antarctica   CST6CDT     Factory   MST7MDT   zone tab
    Arctic       EET         GMT       PST8EDT
    Asia         EST         HST       Pacific 
    Atlantic     EST5EDT     Indian    SystemV
    

    If you want to set the time zone to, say, Singapore, you could enter:

    # cd Asia/
    # ls
    Aden       Chungking  Jerusalem     Novosibirsk  Tehran
    Almaty     Colombo    Kabul         Omsk         Thimbu
    Amman      Dacca      Kamchatka     Phnom_Penh   Tokyo
    Anadyr     Damascus   Karachi       Pyongyang    Ujung_Pandang
    Aqtau      Dili       Kashgar       Qatar        Ulaanbaatar
    Aqtobe     Dubai      Katmandu      Rangoon      Ulan -Bator
    Ashkhabad  Dushanbe   Krasnoyarsk   Riyadh       Urumqi
    Baghdad    Gaza       Kuala_Lumpur  Saigon       Vientiane
    Bahrain    Harbin     Kuching       Samarkand    Vladivostok
    Baku       Hong_Kong  Kuwait        Seoul        Yakutsk
    Bangkok    Hovd       Macao         Shanghai     Yekaterinburg
    Beirut     Irkutsk    Magadan       Singapore    Yerevan
    Bishkek    Istanbul   Manila        Taipei
    Brunei     Jakarta    Muscat        Tashkent
    Calcutta   Jayapura   Nicosia       Tbilisi
    # cp Singapore /etc/localtime
    

    Note that the files in /usr/share/zoneinfo/Asia (and the other directories) represent specific towns, and these may not correspond with the town in which you are located. Choose one in the same country and time zone.

    You can do this at any time on a running system.

    Network services

    (рис 6.4) Network services menu

    The next step is to configure your networking equipment. Figure 6-4 shows the Network Services Menu. There are a number of ways to get to this menu:

  • If you're running the recommended Custom installation, you'll get it automatically after the end of the installation.
  • If you're running the Standard and Express installations, you don't get it at all: after setting up your network interfaces, sysinstall presents you with individual items from the Network Services Menu instead.
  • If you're setting up after rebooting, or if you missed it during installation, select Configure from the main menu and then Networking.
  • The first step should always be to set up the network interfaces, so this is where you find yourself if you are performing a Standard or Express installation.

    Setting up network interface

    Figure 6-5 shows the network setup menu. On a standard 80x25 display it requires scrolling to see the entire menu. If you installed via FTP or NFS, you will already have set up your network interfaces, and sysinstall won't ask the questions again. The only real network board on this list is xl0, the Ethernet board. The others are standard hardware that can also be used as network interfaces. Don't try to set up PPP here; there's more to PPP configuration than sysinstall can handle. We'll look at PPP configuration in Chapter 20 .

    (рис 6.5) Network setup menu

    In our case, we choose the Ethernet board. The next menu asks us to set the internet parameters. Figure 6-6 shows the network configuration menu after filling in the values. Specify the fully qualified local host name; when you tab to the Domain: field, the domain is filled in automatically. The names and addresses correspond to the example network that we look at in Chapter 16, on page 294. We have chosen to call this machine presto, and the domain is example.org. In other words, the full name of the machine is presto.example.org. It's IP address is 223.147.37.2. In his configuration, all access to the outside world goes via gw.example.org, which has the IP address 223.147.37.5. The name server is located on the same host, presto.example.org. The name server isn't running when this information is needed, so we specify all addresses in numeric form.

    What happens if you don't have a domain name? If you're connecting to the global Internet, you should go out and get one—see page 318. But in the meantime, don't fake it. Just leave the fields empty. If you're not connecting to the Internet, of course, it doesn't make much difference what name you choose.

    (рис 6.6) Network configuration menu

    As is usual for a class C network, the net mask is 255.255.255.0. You don't need to fill in this information—if you leave this field without filling it in, sysinstall inserts it for you. Normally, as in this case, you wouldn't need any additional options to ifconfig.

    Other network options

    It's up to you to decide what other network options you would like to use. None of the following are essential, and none need to be done right now, but you may possibly find some of the following interesting:

  • inetd allows connections to your system from outside. We'll look at it in more detail on page 448. Although it's very useful, it's also a security risk if it's configured incorrectly. If you don't want to accept any connections from outside, you can disable inetd and significantly reduce possible security exposures.
  • NFS client. If you want to mount NFS file systems located on other machines, select this box. An X appears in the box, but nothing further happens. See Chapters 24 and 25 for further details of NFS.
  • NFS server. If you want to allow other systems to mount file systems located on this machine, select this box. You get a prompt asking you to create the file /etc/exports, which describes the conditions under which other systems can mount the file systems on this machine. You must enter the editor, but there is no need to change anything at this point. We'll look at /etc/exports in more detail on page 463.
  • ntpdate and ntpd are programs that automatically set the system time from time servers located on the Internet. See page 156 for more details. If you wish, you can select the server at this point.
  • rwhod broadcasts information about the status of the systems on the network. You can use the ruptime program to find the uptime of all systems running rwhod, and rwho to find who is running on these systems. On a normal-sized display, you need to scroll the menu down to find this option.
  • You don't need to select sshd: it's already selected for you. See page 453 for further details of ssh and sshd.
  • You don't need to specify any of the remaining configuration options during configuration. See the online handbook for further details.

    Startup preferences

    The next step of interest is the Startup submenu, which allows you to choose settings that take effect whenever you start the machine. See Chapter 29 for details of the startup files.

    (рис 6.7) Startup configuration menu The most important ones are:
  • Select APM if you're running a laptop. It enables you to power the system down in suspend to RAM or suspend to disk mode, preserving the currently running system, and to resume execution at a later date.
  • If you have USB peripherals, select usbd to enable the usbd daemon, which recognizes when USB devices are added or removed.
  • named starts a name daemon. Use this if you're connecting to the Internet at all, even if you don't have a DNS configuration: the default configuration is a caching name server, which makes name resolution faster. Just select the box; you don't need to do anything else. We'll look at named in Chapter 21 .
  • Select lpd, the line printer daemon, if you have a printer connected to the machine. We'll look at lpd in Chapter 15 .
  • Select Linux if you intend to run Linux binaries. This is almost certainly the case, and by default the box is already ticked for you.
  • Select SVR4 and SCO if you intend to run UNIX System V.4 (SVR4) or SCO OpenDesktop or OpenServer (SCO) binaries respectively.
  • Configuring the mouse

    FreeBSD detects PS/2 mice at boot time only, so the mouse must be plugged in when you boot. If not, you will not be able to use it. To configure, select Mouse from the configuration menu. The menu in Figure 6-8 appears.

    (рис 6.8) Mouse menu

    With a modern PS/2 mouse, you don't need to do any configuration at all. You just enable the mouse daemon or moused. Select the menu item Enable: you have the chance to move the mouse and note that the cursor follows. The keys don't work in this menu: select Yes and exit the menu. That's all you need to do.

    If you're running a serial mouse, choose the item Select mouse port and set it to correspond with the port you have; if you have an unusual protocol, you may also need to set it with the Type menu. For even more exotic connections, read the man page for moused and set the appropriate parameters.

    Configuring X

    You should have installed X along with the rest of the system—see page 75. If you haven't, install the package x11/XFree86. In this section, we'll look at what you need to do to get X up and running.

    X configuration has changed a lot in the course of time, and it's still changing. The current method of configuring X uses a program called x/86c/g, which is still under development, and it shows a few strangeness’s. Quite possibly the version you get will not behave identically with the following description. The differences should be relatively clear, however.

    (рис 6.9) xf86cfg main menu

    The configuration is stored in a file called XF86Config, thhough the directory has changed several times in the last few years. It used to be in /etc/X11/XF86Config or

    /etc/XF86Config, but the current preferred place is /usr/X11R6/lib/X11/XF86Config.The server looks for the configuration file in multiple places, so if you're upgrading from an earlier version, make sure you remove any old configuration files. We'll look at the contents of the file in detail in Chapter 28 . In this section, we'll just look at how to generate a usable configuration.

    From the configuration menu, select XFree86 and then xf86cfg. There is a brief delay while xf86cfg creates an initial configuration file, then you see the main menu of Figure 6-9. This application runs without knowing what the hardware is, so the rendering is pretty basic. The window on the left shows the layout of the hardware, and the window on the right is available in case your mouse isn't working. Select the individual components with the mouse or the numeric keypad. For example, to configure the mouse, select the image at top left:

    (рис 6.10) xf86cfg mouse menu

    In all likelihood that won't be necessary. The configuration file that xf86cfg has already created may be sufficient, so you could just exit and save the file. You'll probably want to change some things, though. In the following, we'll go through the more likely changes you may want to make.

    Configuring the keyboard

    You can select a number of options for the keyboard, including alternative key layouts. You probably won't need to change anything here.

    (рис 6.11) xf86cfg keyboard menu

    Describing the monitor

    Probably the most important thing you need to change are the definitions for the monitor and the display card. Some modern monitors and most AGP display cards supply the information, but older devices do not. In this example we'll configure a Hitachi CM813U monitor, which does not identify itself to x/86cfg. Select the monitor image at the top right of the window, then Configure Monitor(s). You see:

    (рис 6.12)

    xf86cfg doesn't know anything about the monitor, so it assumes that it can only display standard VGA resolutions at 640x480. The important parameters to change are the horizontal and vertical frequencies. You can select one of the listed possibilities, but unless you don't know your's monitor specifications, you should set exactly the frequencies it can do. In this case, the monitor supports horizontal frequencies from 31 kHz to 115 kHz and vertical frequencies from 50 Hz to 160 Hz, so that's what we enter. At the same time, we change the identifier to indicate the name of the monitor:

    (рис 6.13) xf86cfg monitor menu

    Select OK to return to the previous menu.

    Configuring the display card

    xf86cfg recognizes most modern display cards, including probably all AGP cards, so you probably don't need to do anything additional to configure the display card. If you find that the resultant configuration file doesn't know about your card, you'll have to select the card symbol at the top of the screen. Even if the card has been recognized, you get this display:

    (рис 6.14)

    The only indication you have that xf86cfg has recognized the card (here a Matrox G200) is that it has selected mga for the driver name. If you need to change it, scroll down the list until you find the card:

    (рис 6.15) xf86cfg card select menu

    Selecting display resolution

    The display resolution is defined by Mode Lines, which we'll look at in detail on page 513. The names relate to the resolution they offer. By default, xf86cfg only gives you 640x480, so you'll certainly want to add more. First, select the field at the top left of the screen:

    (рис 6.16) xf86cfg configuration selection

    From this menu, select Configure ModeLine. You see:

    (рис 6.17) xf86cfg mode line menu

    If you pass the cursor over the image of the screen, you'll see this warning:

    (рис 6.18) xf86cfg mode line warning

    Take it seriously. We’ll look at this issue again in Chapter 28 on page 510. For an initial setup, you shouldn't use this interface. Instead, select Add standard VESA mode at the top. We get another menu:

    (рис 6.19) xf86cfg VESA mode lines

    Select the resolutions you want with the highest frequency that your hardware can handle. In this case, you might select 1024x768 @ 85 Hz, because it's still well within the range of the monitor. Answer yes to the question of whether you want to add it. You can select as many resolutions as you want, but the ModeLine window does not show them.

    You can also use the ModeLine window to tune the display, but it's easier with another program, xvidtune.We'll look at those details in Chapter 28 .

    Finally, select Quit at the bottom right of the display. You get this window:

    (рис 6.20) xf86cfg quit

    When you answer Yes, you get a similar question asking whether you want to save the keyboard definition. Once you've done that, you're finished.

    Desktop configuration

    Next, select Desktop from the Configuration menu. You get this menu:

    (рис 6.21) Desktop select menu

    Which one do you install? You have the choice. If you know what you want, use it. There are many more window managers than shown here, so if you don't see what you're looking for, check the category x11-wm in the Ports Collection. The select menu gives you the most popular ones: Gnome, Afterstep, Enlightenment, KDE, Window maker and fwm2. In this book, we'll consider the KDE desktop and the fvwm2 window manager. KDE is comfortable, but it requires a lot of resources. Gnome is similar in size to KDE. By contrast, fvwm2 is much faster, but it requires a fair amount of configuration. We'll look at KDE and fvwm2 in Chapter 7 .

    Additional X configuration

    At this point, we're nearly done. A few things remain to be done:

  • Decide how you want to start X. You can do it explicitly with the startx command, or you can log in directly to X with the xdm display manager. If you choose start x, you don't need to do any additional configuration.
  • For each user who runs X, create an X configuration file.
  • Configuring xdm

    To enable xdm, edit the file /etc/t/ys. By default it contains the following lines:

    ttyv8  "/usr/X11R6/bin/xdm  -nodaemon"  xterm  off secure
    

    Using an editor, change the text off to on:

    ttyv8  "/usr/X11R6/bin/xdm  -nodaemon"  xterm  on secure
    

    If you do this from a running system, send a HUP signal to init to cause it to re-read the configuration file and start xdm:

    # kill -1 1
    

    This causes an xdm screen to appear on /dev/ttyv8. You can switch to it with Alt-F9.

    User X configuration

    If you're starting X manually with startx, create a file .xinitrc in your home directory. This file contains commands that are executed when X starts. Select the line that corresponds to your window manager or desktop from the following list, and put it in .xinitrc:

     
    Startkde    for kde
    exec gnome-session   for Gnome
    fvwm2        for fvwm2
    

    If you're using xdm, you put the same content in the file .xsession in your home directory.

    Rebooting the new system

    When you get this for, you should have a functional system. If you're still installing from CD-ROM, you reboot by exiting sysinstall. If you have already rebooted, you exit sysinstall and reboot with:

    # shutdown -r now
    

    Don't just press the reset button or turn the power off. That can cause data loss. We'll look at this issue in more detail on page 541.

    Страницы:

    In the last chapter we looked at the installation of the basic system, up to the point where it could be rebooted. It's barely possible that this could be enough. Almost certainly, though, you'll need to perform a number of further configuration steps before the system is useful. In this chapter we roughly follow the final configuration menu, but there are a few exceptions. The most important things to do are:

  • Install additional software.
  • Create accounts for normal users.
  • Set up networking support.
  • Configure the system to start all the services you need.
  • Configure the X Window System and desktop.
  • In this chapter, we’ll concentrate on getting the system up and running as quickly as possible. Later on in the book we'll go into more detail about these topics.

    At the end of the previous chapter, we had a menu asking whether we wanted to visit the "last options" menu. If you answer YES, you get the configuration menu shown in Figure 6-1 . If you have rebooted the machine, log in as root and start sysinstall. Then select Configure, which gets you into the same menu.

    (рис 6.1) Configuration menu

    As the markers under the word Networking indicate, this menu is larger than the window in which it is displayed. We'll look at some of the additional entries below. Only some of these entries are of interest in a normal install; we'll ignore the rest.

    There may be some reasons to deviate from the sequence in this chapter. For example, if your CD-ROM is mounted on a different system, you may need to set up networking before installing additional software.

    Installing additional software

    The first item of interest is Packages. These are some of the ports in the Ports Collection, which we'll look at in more detail in Chapter 9 .

    The Ports Collection contains a large quantity of software that you may want to install. In fact, there's so much that just making up your mind what to install can be a complicated process: there are over 8,000 ports in the collection. Which ones are worth using? I recommend the following list:

  • acroread is the Acrobat reader, a utility for reading and printing PDF files. We look at it briefly on page 276.
  • bash is the shell recommended in this book. We'll look at it in more detail on page 113. Other popular shells are tcsh and csh, both in the base system.
  • cdrecord is a utility to burn SCSI CD-Rs. We'll discuss it in chapter Chapter 13, Writing CD-Rs. You don't need it if you have an IDE CD-R drive.
  • Emacs is the GNU Emacs editor recommended in this book. We'll look at it on page 139. Other popular editors are vi (in the base system) and vim (in the Ports Collection).
  • fetchmail is a program for fetching mail from POP mailboxes. We look at it on page 504.
  • fvwm2 is a window manager that you may prefer to a full-blown desktop. We look at it on page 118.
  • galeon is a web browser. We’ll look at it briefly on page 418.
  • ghostscript is a PostScript interpreter. It can be used to display PostScript on an X display, or to print it out on a non-PostScript printer. We'll look at it on page 273.
  • gpg is an encryption program.
  • gv is a utility that works with ghostscript to display PostScript on an X display. It allows magnification and paging, both of which ghostscript does not do easily. We'll look at it on page 273.
  • ispell is a spell check program.
  • kde is the desktop environment recommended in this book. We'll look at it in more detail in Chapter 7, The tools of the trade.
  • mkisofs is a program to create CD-R images. We look at it in chapter Chapter 13 , Writing CD-Rs
  • mutt is the mail user agent (MUA, or mail reader) recommended in Chapter 26 , Electronic mail: clients.
  • Postfix is the mail transfer agent (MTA) recommended in chapter Chapter 27, Electronic mail: servers.
  • xtset is a utility to set the title of an xterm window. It is used by the .bashrc file installed with the instant-workstation package.
  • xv is a program to display images, in particular jpeg and gif.
  • Why do l recommend these particular ports? Simple: because I like them, and I use most of them myself. That doesn't mean they're the only choice, though. Others prefer the for more details.

    Instant workstation

    The ports mentioned in the previous section are included in the misc/instant-workstation port, which installs typical software and configurations for a workstation and allows you to be productive right away. At a later point you may find that you prefer other software, in which case you can install it.

    It's possible that the CD set you get will not include instant-workstation. That's not such a problem. Due to space restrictions, some CD distributions include instant-workstation-lite instead. If that's not there either, just install the individual ports from this list. You can also do this if you don't like the list of ports.

    Changing the default shell for root

    After installation, you may want to change the default shell for existing users to bash. If you have installed instant-workstation, you should copy the file /usr/lo-cal/share/dot.bashrc to root's home directory and call it .bashrc and .bash_profile. First, start

    presto# cp /usr/local/share/dot.bashrc .bashrc
    presto# ln .bashrc .bash_profile
    presto# bash
    === root@presto (/dev/ttyp2) ~ 1 -gt; chsh
    

    The last command starts an editor with the following content:

    #Changing user database information for root.
    Login: root
    Password:
    Uid [#]: 0
    Gid [# or name]: 0
    Change [month day year]:
    Expire [month day year]:
    Class:
    Home directory: /root
    Shell: /bin/csh
    Full Name: Charlie 
    Office Location:
    Office Phone:
    Home Phone:
    Other information:
    

    Change the Shell line to:

    Shell: /usr/local/bin/bash
    

    Note that the bash shell is in the directory /usr/local/bin; this is because it is not part of the base system. The standard shells are in the directory /bin.

    Adding users

    A freshly installed FreeBSD system has a number of users, nearly all for system components. The only login user is root, and you shouldn't log in as root. Instead you should add at least one account for yourself. If you're transferring a master.passwd file from another system, you don't need to do anything now. Otherwise select this item and then the menu item User, and fill out the resulting menu like this:

    (рис 6.2) Adding a user

    You should not need to enter the fields UID and Home directory: sysinstall does this for you. It's important to ensure that you are in group wheel so that you can use the su command to become root, and you need to be in group operator to use the shutdown command.

    Don't bother to add more users at this stage; you can do it later. We’ll look at user management in Chapter 8 , on page 112.

    Setting the root password

    Next, select Root Password. We’ll talk about passwords more on page 144. Select this item to set the password in the normal manner.

    Time zone

    Next, select the entry time zone. The first entry asks you if the machine CMOS clock (i.e. the hardware clock) is set to UTC (sometimes incorrectly called GMT, which is a British time zone). If you plan to run only FreeBSD or other UNIX-like operating systems on this machine, you should set the clock to UTC. If you intend to run other software that doesn't understand time zones, such as many Microsoft systems, you have to set the time to local time, which can cause problems with daylight savings time.

    (рис 6.3) Time zone select menu: USA

    The next menu asks you to select a "region," which roughly corresponds with a continent. Assuming you are living in Austin, TX in the United States of America, you would select America -- North and South and then (after scrolling down) United States of America. The next menu then looks like this: Select Central Time and select Yes when the system asks you whether the abbreviation CST sounds reasonable.

    This particular step is relatively cumbersome. You may find it easier to look in the directory /usr/share/zoneinfo after installation. There you find:

    # cd /usr/share/zoneinfo/
    # ls
    Africa       Australia   Etc       MET       WET
    America      CET         Europe    MST       posixrules
    Antarctica   CST6CDT     Factory   MST7MDT   zone tab
    Arctic       EET         GMT       PST8EDT
    Asia         EST         HST       Pacific 
    Atlantic     EST5EDT     Indian    SystemV
    

    If you want to set the time zone to, say, Singapore, you could enter:

    # cd Asia/
    # ls
    Aden       Chungking  Jerusalem     Novosibirsk  Tehran
    Almaty     Colombo    Kabul         Omsk         Thimbu
    Amman      Dacca      Kamchatka     Phnom_Penh   Tokyo
    Anadyr     Damascus   Karachi       Pyongyang    Ujung_Pandang
    Aqtau      Dili       Kashgar       Qatar        Ulaanbaatar
    Aqtobe     Dubai      Katmandu      Rangoon      Ulan -Bator
    Ashkhabad  Dushanbe   Krasnoyarsk   Riyadh       Urumqi
    Baghdad    Gaza       Kuala_Lumpur  Saigon       Vientiane
    Bahrain    Harbin     Kuching       Samarkand    Vladivostok
    Baku       Hong_Kong  Kuwait        Seoul        Yakutsk
    Bangkok    Hovd       Macao         Shanghai     Yekaterinburg
    Beirut     Irkutsk    Magadan       Singapore    Yerevan
    Bishkek    Istanbul   Manila        Taipei
    Brunei     Jakarta    Muscat        Tashkent
    Calcutta   Jayapura   Nicosia       Tbilisi
    # cp Singapore /etc/localtime
    

    Note that the files in /usr/share/zoneinfo/Asia (and the other directories) represent specific towns, and these may not correspond with the town in which you are located. Choose one in the same country and time zone.

    You can do this at any time on a running system.

    Network services

    (рис 6.4) Network services menu

    The next step is to configure your networking equipment. Figure 6-4 shows the Network Services Menu. There are a number of ways to get to this menu:

  • If you're running the recommended Custom installation, you'll get it automatically after the end of the installation.
  • If you're running the Standard and Express installations, you don't get it at all: after setting up your network interfaces, sysinstall presents you with individual items from the Network Services Menu instead.
  • If you're setting up after rebooting, or if you missed it during installation, select Configure from the main menu and then Networking.
  • The first step should always be to set up the network interfaces, so this is where you find yourself if you are performing a Standard or Express installation.

    Setting up network interface

    Figure 6-5 shows the network setup menu. On a standard 80x25 display it requires scrolling to see the entire menu. If you installed via FTP or NFS, you will already have set up your network interfaces, and sysinstall won't ask the questions again. The only real network board on this list is xl0, the Ethernet board. The others are standard hardware that can also be used as network interfaces. Don't try to set up PPP here; there's more to PPP configuration than sysinstall can handle. We'll look at PPP configuration in Chapter 20 .

    (рис 6.5) Network setup menu

    In our case, we choose the Ethernet board. The next menu asks us to set the internet parameters. Figure 6-6 shows the network configuration menu after filling in the values. Specify the fully qualified local host name; when you tab to the Domain: field, the domain is filled in automatically. The names and addresses correspond to the example network that we look at in Chapter 16, on page 294. We have chosen to call this machine presto, and the domain is example.org. In other words, the full name of the machine is presto.example.org. It's IP address is 223.147.37.2. In his configuration, all access to the outside world goes via gw.example.org, which has the IP address 223.147.37.5. The name server is located on the same host, presto.example.org. The name server isn't running when this information is needed, so we specify all addresses in numeric form.

    What happens if you don't have a domain name? If you're connecting to the global Internet, you should go out and get one—see page 318. But in the meantime, don't fake it. Just leave the fields empty. If you're not connecting to the Internet, of course, it doesn't make much difference what name you choose.

    (рис 6.6) Network configuration menu

    As is usual for a class C network, the net mask is 255.255.255.0. You don't need to fill in this information—if you leave this field without filling it in, sysinstall inserts it for you. Normally, as in this case, you wouldn't need any additional options to ifconfig.

    Other network options

    It's up to you to decide what other network options you would like to use. None of the following are essential, and none need to be done right now, but you may possibly find some of the following interesting:

  • inetd allows connections to your system from outside. We'll look at it in more detail on page 448. Although it's very useful, it's also a security risk if it's configured incorrectly. If you don't want to accept any connections from outside, you can disable inetd and significantly reduce possible security exposures.
  • NFS client. If you want to mount NFS file systems located on other machines, select this box. An X appears in the box, but nothing further happens. See Chapters 24 and 25 for further details of NFS.
  • NFS server. If you want to allow other systems to mount file systems located on this machine, select this box. You get a prompt asking you to create the file /etc/exports, which describes the conditions under which other systems can mount the file systems on this machine. You must enter the editor, but there is no need to change anything at this point. We'll look at /etc/exports in more detail on page 463.
  • ntpdate and ntpd are programs that automatically set the system time from time servers located on the Internet. See page 156 for more details. If you wish, you can select the server at this point.
  • rwhod broadcasts information about the status of the systems on the network. You can use the ruptime program to find the uptime of all systems running rwhod, and rwho to find who is running on these systems. On a normal-sized display, you need to scroll the menu down to find this option.
  • You don't need to select sshd: it's already selected for you. See page 453 for further details of ssh and sshd.
  • You don't need to specify any of the remaining configuration options during configuration. See the online handbook for further details.

    Startup preferences

    The next step of interest is the Startup submenu, which allows you to choose settings that take effect whenever you start the machine. See Chapter 29 for details of the startup files.

    (рис 6.7) Startup configuration menu The most important ones are:
  • Select APM if you're running a laptop. It enables you to power the system down in suspend to RAM or suspend to disk mode, preserving the currently running system, and to resume execution at a later date.
  • If you have USB peripherals, select usbd to enable the usbd daemon, which recognizes when USB devices are added or removed.
  • named starts a name daemon. Use this if you're connecting to the Internet at all, even if you don't have a DNS configuration: the default configuration is a caching name server, which makes name resolution faster. Just select the box; you don't need to do anything else. We'll look at named in Chapter 21 .
  • Select lpd, the line printer daemon, if you have a printer connected to the machine. We'll look at lpd in Chapter 15 .
  • Select Linux if you intend to run Linux binaries. This is almost certainly the case, and by default the box is already ticked for you.
  • Select SVR4 and SCO if you intend to run UNIX System V.4 (SVR4) or SCO OpenDesktop or OpenServer (SCO) binaries respectively.
  • Configuring the mouse

    FreeBSD detects PS/2 mice at boot time only, so the mouse must be plugged in when you boot. If not, you will not be able to use it. To configure, select Mouse from the configuration menu. The menu in Figure 6-8 appears.

    (рис 6.8) Mouse menu

    With a modern PS/2 mouse, you don't need to do any configuration at all. You just enable the mouse daemon or moused. Select the menu item Enable: you have the chance to move the mouse and note that the cursor follows. The keys don't work in this menu: select Yes and exit the menu. That's all you need to do.

    If you're running a serial mouse, choose the item Select mouse port and set it to correspond with the port you have; if you have an unusual protocol, you may also need to set it with the Type menu. For even more exotic connections, read the man page for moused and set the appropriate parameters.

    Configuring X

    You should have installed X along with the rest of the system—see page 75. If you haven't, install the package x11/XFree86. In this section, we'll look at what you need to do to get X up and running.

    X configuration has changed a lot in the course of time, and it's still changing. The current method of configuring X uses a program called x/86c/g, which is still under development, and it shows a few strangeness’s. Quite possibly the version you get will not behave identically with the following description. The differences should be relatively clear, however.

    (рис 6.9) xf86cfg main menu

    The configuration is stored in a file called XF86Config, thhough the directory has changed several times in the last few years. It used to be in /etc/X11/XF86Config or

    /etc/XF86Config, but the current preferred place is /usr/X11R6/lib/X11/XF86Config.The server looks for the configuration file in multiple places, so if you're upgrading from an earlier version, make sure you remove any old configuration files. We'll look at the contents of the file in detail in Chapter 28 . In this section, we'll just look at how to generate a usable configuration.

    From the configuration menu, select XFree86 and then xf86cfg. There is a brief delay while xf86cfg creates an initial configuration file, then you see the main menu of Figure 6-9. This application runs without knowing what the hardware is, so the rendering is pretty basic. The window on the left shows the layout of the hardware, and the window on the right is available in case your mouse isn't working. Select the individual components with the mouse or the numeric keypad. For example, to configure the mouse, select the image at top left:

    (рис 6.10) xf86cfg mouse menu

    In all likelihood that won't be necessary. The configuration file that xf86cfg has already created may be sufficient, so you could just exit and save the file. You'll probably want to change some things, though. In the following, we'll go through the more likely changes you may want to make.

    Configuring the keyboard

    You can select a number of options for the keyboard, including alternative key layouts. You probably won't need to change anything here.

    (рис 6.11) xf86cfg keyboard menu

    Describing the monitor

    Probably the most important thing you need to change are the definitions for the monitor and the display card. Some modern monitors and most AGP display cards supply the information, but older devices do not. In this example we'll configure a Hitachi CM813U monitor, which does not identify itself to x/86cfg. Select the monitor image at the top right of the window, then Configure Monitor(s). You see:

    (рис 6.12)

    xf86cfg doesn't know anything about the monitor, so it assumes that it can only display standard VGA resolutions at 640x480. The important parameters to change are the horizontal and vertical frequencies. You can select one of the listed possibilities, but unless you don't know your's monitor specifications, you should set exactly the frequencies it can do. In this case, the monitor supports horizontal frequencies from 31 kHz to 115 kHz and vertical frequencies from 50 Hz to 160 Hz, so that's what we enter. At the same time, we change the identifier to indicate the name of the monitor:

    (рис 6.13) xf86cfg monitor menu

    Select OK to return to the previous menu.

    Configuring the display card

    xf86cfg recognizes most modern display cards, including probably all AGP cards, so you probably don't need to do anything additional to configure the display card. If you find that the resultant configuration file doesn't know about your card, you'll have to select the card symbol at the top of the screen. Even if the card has been recognized, you get this display:

    (рис 6.14)

    The only indication you have that xf86cfg has recognized the card (here a Matrox G200) is that it has selected mga for the driver name. If you need to change it, scroll down the list until you find the card:

    (рис 6.15) xf86cfg card select menu

    Selecting display resolution

    The display resolution is defined by Mode Lines, which we'll look at in detail on page 513. The names relate to the resolution they offer. By default, xf86cfg only gives you 640x480, so you'll certainly want to add more. First, select the field at the top left of the screen:

    (рис 6.16) xf86cfg configuration selection

    From this menu, select Configure ModeLine. You see:

    (рис 6.17) xf86cfg mode line menu

    If you pass the cursor over the image of the screen, you'll see this warning:

    (рис 6.18) xf86cfg mode line warning

    Take it seriously. We’ll look at this issue again in Chapter 28 on page 510. For an initial setup, you shouldn't use this interface. Instead, select Add standard VESA mode at the top. We get another menu:

    (рис 6.19) xf86cfg VESA mode lines

    Select the resolutions you want with the highest frequency that your hardware can handle. In this case, you might select 1024x768 @ 85 Hz, because it's still well within the range of the monitor. Answer yes to the question of whether you want to add it. You can select as many resolutions as you want, but the ModeLine window does not show them.

    You can also use the ModeLine window to tune the display, but it's easier with another program, xvidtune.We'll look at those details in Chapter 28 .

    Finally, select Quit at the bottom right of the display. You get this window:

    (рис 6.20) xf86cfg quit

    When you answer Yes, you get a similar question asking whether you want to save the keyboard definition. Once you've done that, you're finished.

    Desktop configuration

    Next, select Desktop from the Configuration menu. You get this menu:

    (рис 6.21) Desktop select menu

    Which one do you install? You have the choice. If you know what you want, use it. There are many more window managers than shown here, so if you don't see what you're looking for, check the category x11-wm in the Ports Collection. The select menu gives you the most popular ones: Gnome, Afterstep, Enlightenment, KDE, Window maker and fwm2. In this book, we'll consider the KDE desktop and the fvwm2 window manager. KDE is comfortable, but it requires a lot of resources. Gnome is similar in size to KDE. By contrast, fvwm2 is much faster, but it requires a fair amount of configuration. We'll look at KDE and fvwm2 in Chapter 7 .

    Additional X configuration

    At this point, we're nearly done. A few things remain to be done:

  • Decide how you want to start X. You can do it explicitly with the startx command, or you can log in directly to X with the xdm display manager. If you choose start x, you don't need to do any additional configuration.
  • For each user who runs X, create an X configuration file.
  • Configuring xdm

    To enable xdm, edit the file /etc/t/ys. By default it contains the following lines:

    ttyv8  "/usr/X11R6/bin/xdm  -nodaemon"  xterm  off secure
    

    Using an editor, change the text off to on:

    ttyv8  "/usr/X11R6/bin/xdm  -nodaemon"  xterm  on secure
    

    If you do this from a running system, send a HUP signal to init to cause it to re-read the configuration file and start xdm:

    # kill -1 1
    

    This causes an xdm screen to appear on /dev/ttyv8. You can switch to it with Alt-F9.

    User X configuration

    If you're starting X manually with startx, create a file .xinitrc in your home directory. This file contains commands that are executed when X starts. Select the line that corresponds to your window manager or desktop from the following list, and put it in .xinitrc:

     
    Startkde    for kde
    exec gnome-session   for Gnome
    fvwm2        for fvwm2
    

    If you're using xdm, you put the same content in the file .xsession in your home directory.

    Rebooting the new system

    When you get this for, you should have a functional system. If you're still installing from CD-ROM, you reboot by exiting sysinstall. If you have already rebooted, you exit sysinstall and reboot with:

    # shutdown -r now
    

    Don't just press the reset button or turn the power off. That can cause data loss. We'll look at this issue in more detail on page 541.

    Вернуться к учебному плану