First, post-installation configuration
The last time we talked about the installation of FreeBSD, this time we said the configuration and simple optimization method of FreeBSD after installation.
The installation of BSD is only the server to provide services the beginning of the Long March road, but also need some basic settings and optimization. But in fact, even if not optimized, FreeBSD can now be very safe to provide services, the decision is yours. 1. Install and update ports tree some contact with FreeBSD must know Portsnap, this is the software update under FreeBSD the weapon. Or that's the only way. Ports, can be understood as a large list of applications maintained by FreeBSD, you need and unwanted software, almost all can be found under this list. And Portsnap, as the name implies, is the snapshot of ports. Running Portsnap will include the current remote ports tree structure and the latest stable version of all software under the tree in the server's ports tree. Ports How to use, we will talk later, do not worry about using PORTSNAP. Complete the following steps first, and you will find that the ports will be faster and the software will be installed faster. #cd/etc #vi portsnap.conf
Find Portsnap. freebsd.org
Change it to portsnap3.hshh.org
Save Exit I am a netcom user, so use 3rd number mirror. The image list is as follows portsnap.hshh.org (Telecom) portsnap2.hshh.org (Telecom) portsnap3.hshh.org (Netcom) portsnap4.hshh.org (Telecom) This is a domestic portsnap mirror, Updates will be faster. I have seen countless Linux installed and never update, resulting in a large number of vulnerabilities, not entirely a system administrator problem, which is related to Yum or APT's package maintenance. FreeBSD does not have to worry about this at all, as long as you automatically set PORTSNAP, automatic upgrade, even if you put in there for a year, your software will be up to date. However, this is not generally recommended. I'll talk about it later. Then, execute the following command #portsnap fetch extract update your ports tree, the domestic mirror speed is fast. The port package for 63-64m is about to be downloaded. Then wait for the decompression to complete. Now, your ports tree is up-to-date, even if you compile and install the software. Need to update, you can run the following command #portsnap fetch UPDATEPORTSNAP in an incremental update, the first time you need to perform a fetch extract, then only need to perform a fetch update, the incremental update volume is very small, fast. 2. Updating FreeBSD system files No one can guarantee that the operating system is flawless, even if the distribution is not, but after the discovery of patches in time, is the most sensible way. At this point FreeBSD has also done quite a lot of human nature. Then, before updating the system files, we also need to change a configuration file that will make you faster. #cd/etc #vi freebsd-update.conf
Locate the servername update. freebsd.org
Change update.freebsd.org to Freebsd-updates.mirrors.163.com
Save exit and then you can run the following command update, you can look at the uname-a before the update, take 8.2 For example, will display the FreeBSD 8.2-release #freebsd-update fetch #freebsd-update Install update after the restart, then hit Uname-a, will display the FreeBSD 8.2-RELEASE-P4, the display system patch has been hit. With these commands, you can join to Crontab to run regularly automatically. 3. Software Installation Source configuration edit a file, this file does not exist in the newly installed FreeBSD system, unless you install the software with ports, this file will not be generated. Therefore, this file needs to be created manually in the newly installed system. #vi/etc/make.conf
Then enter the following content master_site_backup?=http://mirrors.163.com/freebsd/distfiles/${dist_subdir}/MASTER_SITE_OVERRIDE?=${ Master_site_backup} Save the exit so that when you install with ports, you will be connected directly to the 163 mirror and will be faster. However, there is a drawback is that the latest software release package is usually not updated in time, it takes about 3-4 days or longer, 163 mirrors will be synchronized with FreeBSD, but, however, there is a domestic mirror than not strong. It is generally not recommended to install binaries directly using the Pkg_add method, which is not optimized, preferably compiled and installed through the ports tree. Unless there is a special requirement, I will not write the settings of the Packagesite variable first. 4. Software installation This is one of my favorite advantages of FreeBSD, software collection of comprehensive, clear classification, easy installation, compile and install the way adequate to adapt to the system and optimization. Centrally managed configuration files, absolutely save human time, much better than Linux everywhere looking for compiled files. For example, if I need to install nginx, I am here to assume that you have updated the ports tree, when I write this article, the latest Frebbsd Nginx version is 1.0.8,1. Run the following command to install #cd/usr/ports/www/nginx #make the install Clean pop-up option, select as needed, then OK, wait for the compilation to finish, the software is finished. Dependencies are automatically detected during installation, and dependent software compilation is automatically downloaded. This is a lot more than a bad yum, and no matter yum is installing binaries, and often can't find a dependency package, you'll need to find a config file to waste your time after you've finished loading it! FreeBSD configuration files are all centrally managed. No matter what software you install through ports, if he exists the configuration file, please go to the following path to find #cd/usr/local/etcubuntu seems to be this path, but, I use Apt-get installation, basically this path nothing. 4. Run the software you installed there is a little bit of trouble here, but absolutely not, only takes you about less than 30 seconds of time. If you installed the application, such as Nginx, please follow the steps below to complete the #vi/etc/rc.conf
Then start a new line, enter
Nginx_enable= "YES"
Save exit and then run the following command #cd/usr/local/etc/rc.d #./nginx start your nginx is launched, visit your server, and see Welcome to Nginx Bar.
FreeBSD starting from scratch---post-installation configuration (i)