FreeBSD Server Installation and optimization (i) (1)

Source: Internet
Author: User
Tags file system ftp new features require requires

For many computer users, FreeBSD is still a relatively unfamiliar system. This article will take FreeBSD 4.7 release as an example, step-by-step you install a complete FreeBSD operating system.

Pre-Installation Preparation

FreeBSD is more adaptable to the hardware of the system (it may be slightly worse than the Lin UX, especially for new display cards, but support for the server's common hardware, including SCSI devices, is quite perfect). Most processors on the IA platform, down to 386, up to Pentium-4 and their compatible CPUs, are capable of running FreeBSD. In order to effectively install, run FreeBSD, I personally recommend that the installation of FreeBSD system should have at least 2GB of the remaining hard disk space, as well as at least 64MB of memory. This configuration of the computer is very easy to find today. Given that FreeBSD is generally configured to be used as a server, the configuration requirements above are clearly easy to achieve.

Dual booting is not appropriate for servers (servers tend to require continuous, long time work, while switching the operating system will undoubtedly require a stop service.) In addition, dual-boot system stability is poor, one operating system crash is likely to damage another operating system. FreeBSD support and other operating systems coexist, and in the boot through the menu to choose to use the operating system, but I personally very opposed to the use of FreeBSD in this way.

So let me install a FreeBSD server from beginning to end, and explain the installation of FreeBSD. In order to install FreeBSD, I have prepared such a computer:

Cpu:pentium II-233, Memory 64MB, hard disk (IDE) 6GB, PS/2 keyboard, mouse, 20x optical drive, no floppy drive, RealTek8139 network card (tp-link).

The above configuration is very easy to do today. Of course, as far as the server is concerned, this configuration is really miserable, but FreeBSD run on it, and assume the database, dynamic Web pages and other services are completely without problems.

The first is to prepare the FreeBSD installation disk. FreeBSD there are many ways to install, the easiest way is to use the CD-ROM installation, however, in the absence of the floppy disk drive, the CD-ROM can also be installed through the BOOTP service remote boot method. Given that this is a rare situation (the author has successfully installed FreeBSD on a computer that does not have a floppy drive or CD drive, the method is to hook up the hard disk on another computer, rather than the usual BOOTP), not described here.

In order to install FreeBSD, I prepared an empty CD-R. Installing FreeBSD requires a minimum of 2 1.44MB of blank floppy disks (the rest are available using FTP), and installing FreeBSD only requires the first CD. Unless your computer is slow or unable to connect to the Internet, you will normally only need to download the image of the first CD. Since the FTP on the Network Center provides a mirror image of the FreeBSD 4.6 all four discs, as well as the first two discs of 4.6.2, I directly downloaded and carved the first CD of the latter.

Turn on your computer and enter the BIOS Setup. In which you choose to have the computer boot from the CD (this is a critical step, although FreeBSD can also start the installation process from a DOS environment, there may be problems), disable all devices that are not available, including serial ports, and ports, and floppy drive controllers (this is done primarily to improve performance, Because the perimeter device may send an interrupt request to the host, a device that is not in use sends a request with no other effect than wasting CPU time.

The system on the FreeBSD installation disc uses the generic kernel, which can accommodate the vast majority of systems. Of course, as his name is "GENERIC (General)", it also brings lower performance, for example, the kernel does not have the ability to play dual CPU, and so on. But since the installation process only happens once, we don't have to care too much about it.

installation CD boot (for floppy boot, is prompted to load all two floppy disks into memory), the first occurrence is the configuration kernel.

Configuring the kernel is not usually required because the FreeBSD can automatically identify the hardware. However, if you have a special hardware configuration (for example, two network cards, using a special IRQ, older, etc.), you may need to manually configure the kernel. For the vast majority of cases, as long as the removal of those devices can not be used to complete the installation of FreeBSD, if you are not familiar with your hardware, this process can even skip.

I personally prefer to delete unused devices, so choose visual mode, will not need to remove all the equipment. Finally, press Q to save the configuration and enter the FreeBSD installer Sysinstall (8).

FreeBSD installation of basic system

As a server administrator, regular server software updates are essential. FreeBSD provides a very convenient way to upgrade--cvsup, which can get some or all of the CVSup's source code from the FreeBSD central CVSup server, or a FreeBSD mirror, and it downloads only the modified source code. And you can choose the version that suits you as needed (using-stable can provide better stability and the latest features of the operating system, which most administrators will choose; using-release to get the quality of a mature product, though that's the case, actually, few people choose this branch The user who uses-current is primarily a person involved in FreeBSD development, and this branch contains all the new features that are about to enter the-stable branch, but do not expect this branch to provide the necessary stability guarantees, nor do you expect it to deliver good performance. But all security issues are fixed first in this branch. I'll explain these in more detail later.

Once the initial kernel configuration is complete, it starts immediately and Sysinstall (8) is started according to the configuration file. We'll see a standard text-mode configuration interface, which is somewhat similar to the interface of early visual Basic for MS-DOS applications.

Select Standard to enter the standard FreeBSD installation process. The first is to partition the disk.

FreeBSD is quite different for disk Management and Windows. A partition is usually enough on one disk, and a partition can be divided into several slice and labeled. In fact, FreeBSD's slice is essentially equivalent to the disk partition of Windows, or the concept of a volume.

To ensure that a system that coexists with FreeBSD can be started, FreeBSD retains a portion of disk space (cyl) by default. This is completely unnecessary for a single operating system computer. You can choose not to use this feature when partitioning, but in this case there is no way to boot another operating system from this hard drive except to completely destroy the set of FreeBSD. To fully use disk space, I chose not to reserve space.

The slice is then created on this partition. Similar to Linux, FreeBSD also uses a separate swap area. This design avoids fragmentation and also prevents the file system from being affected by better performance. Typically, the swap partition is 2-2 to 5 times times the memory, which is sufficient to cope with daily contingencies. /var is used to hold files that are not shared in the cluster,/TMP is used to hold temporary files, and/usr is used to hold files that need to be synchronized in the cluster. /Needless to say, it saves the files that are needed to start the system.

The usually given/allocated space is 128mb,/tmp and/var 256MB, and the rest are assigned to/USR. There are exceptions, however, that if you are going to be a large mail system,/var will be larger (usually the mail system relies on/var to save the Mail). Of course, each slice can be mount to a different place (for example, you can turn the once/usr into/var), but the first configuration can reduce a lot of trouble.

Of course, the lazy way is also some. By pressing a without slice, or without fully matching the slice, the system gives a default configuration for a group (or for the remaining label). If you are going to simply provide a service such as a web+ database, you can simply accept this set of configurations.

Starting with the FreeBSD 4.x, UFS supports a technology called softupdates. The main design goal of Softupdates is to improve file system performance. In addition to/in the slice, all ufs slice should be open softupdates, which is good for improving the overall performance of the system. (/Although it is also a ufs slice, opening softupdates can cause system instability--FREEBSD documents are so warning, and I did eat this loss. However, because/content does not need to change frequently, does not turn on the softupdates and turns on the softupdates almost does not have the performance difference. Softupdates can be turned on or off at any time by Tunefs (8). In the label (8) program, the flag that opens the Softupdates is the file system displayed as Ufs+s.

Then select the installation media and the distribution to install. It provides a few common sets of scenarios. Minium installs the smallest system, including some basic UNIX programs. Developer includes development tools, X-developer and Kernel-developer are used by X and kernel developers respectively. There is also an optional ports that can help us to install the application.

I usually use custom (custom install), do not install source code, ports (because these can be updated from the CVSup sync, install a waste of time), only install XFree86 (mainly to run CVSup, because the compiler does not need x CVSup takes a long time, And a lot of other things, such as PHP to use GD and so on, need to XFree86 the library file support, basic system and a part of the library files. Of course, you can also choose to install additional components as needed.

The system starts to install after it is finished. Note that once the installation begins, all the previous partitions, the file system, and so on are firmly written on the hard drive, and there is no chance of turning back. If you have important data on your hard disk, back it up before that.

Depending on the speed of the computer, this process can last between 10 minutes and several hours. In the process, apart from the problem of CD-ROM or hard drive, there is basically no complications. Press ALT+F2 to switch to the console that is used to debug Sysinstall (8), ALT+F4 can switch to a command-line console, either to debug the FreeBSD installation process, or to cope with emergency situations, which are often not used.

After all system files have been installed, Sysinstall (8) will give a congratulatory picture. At the same time, it also tells you how to run Sysinstall (8) for other operations later, such as configuration, and so on. In fact, Sysinstall (8) In FreeBSD basically corresponds to the role of Windows Control Panel.

You can then configure your network, set the time zone, display fonts, Xwindow, and so on, and create a new user (the built-in administrator in FreeBSD is called Root, but because it has all the privileges, it is sometimes inconvenient to rely entirely on it for daily work. The author accidentally removed the modules as root and then trembled to recompile the kernel.

Some packages are also available on the FreeBSD installation disk. These packages are applications that go through a number of times in advance. For a fast enough machine with a good internet connection, there is no need to install packages (with the exception of KDE and X, it takes a day and a night to compile them). The machine is not fast enough, so I installed CVSup, which is in devel.

So far, we have installed the basic system of FreeBSD. Since many of the library files are included in the FreeBSD base system, and these libraries may have been found to be problematic, it is not appropriate to install applications or services (such as Apache, and so on) immediately. We will then explain FreeBSD's online upgrades (cvsup), installation of applications, and optimization.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.