1. Trang chủ
  2. » Công Nghệ Thông Tin

Professional Information Technology-Programming Book part 127 doc

6 61 0

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 6
Dung lượng 26,17 KB

Nội dung

1. export TERM=pcvt25 2. For the root user, erase or comment out (by putting # symbols before each line) the three-line if statement at the bottom of the /root/.profile file. It should look like this: 3. if [ -x /usr/bin/tset ]: then 4. eval '/usr/bin/tset -sQ \?$TERM' 5. fi Erasing or commenting this if statement keeps OpenBSD from asking you what terminal type you want to use every time you log in. You will have to log out and log back in for these changes to take effect. From this point forward, you should be able to see colors where appropriate (for example, in applications such as Vim, Emacs, Lynx, Mutt, etc.). 5.4.2. Setting the key repeat delay and rate Is the keyboard delay and repeat rate too slow for you? If you're going to be primarily controlling this system through a serial terminal or over OpenSSH, there isn't much sense in changing these settings. If you're going to be working from a keyboard connected directly to the machine, however, there are two settings you can edit to modify the key repeat rate and repeat delay. First let's play with them in real time to see which numbers you prefer, starting with the repeat rate. Run this command: wsconsctl keyboard.repeat.del1=300 If that's too fast or too slow for you, run the same command with a lower or higher number. When you find a rate that you prefer, write it down for right now. We'll make this setting permanent in a moment. Next, let's try changing the key repeat delay. Be warned that if you set this number too low, it can be extremely difficult to type your way out of it: wsconsctl keyboard.repeat.deln=50 Again, adjust the number to your preference, but try not to go so low that you can't type normally. Once you've got your preferred number, write it down. Now let's make these settings permanent. Edit the /etc/wsconsctl.conf file. You'll notice that the first two settings you find are are similar to the commands you've just run. If the lines are commented out (in other words, if there's a # before them), uncomment them and set their numbers to the ones you wrote down. Remember that del1 is the repeat rate and deln is the repeat delay. Save and exit the file when you're finished. Since you've already adjusted the settings for your current session, you won't have to re-log or restart the computer for them to take effect. 5.5. CD/DVD Mounting Made Easy Before you go much further, it might be a good idea to make it easier to mount your optical drive. By default, you have to do it by hand with a command like this: mount -t cd9660 /dev/cd0a /mnt You're going to run out of predefined mount points if you have any other disks or drives to mount, so the default method really isn't meant to be a permanent solution. If this machine is meant to be a server that you'll never need to put CDs into (upgrading aside), there's no need to make any changes; you can leave it as is. Otherwise, follow this procedure: 1. First you'll need a more convenient place to mount the optical drive. I suggest /mnt/cdrom (usually the standard in GNU systems) or /cdrom (usually the standard in FreeBSD). Regardless of what the directory name is, you have to create it. /mnt/cdrom will be the example used throughout this guide, so that's the one we'll use right now, though you're free to change it to your preference. Use the mkdir command to create it: 2. mkdir /mnt/cdrom 3. Next, open /etc/fstab with your preferred text editor and add this line (you may have to change the device node if you have several CD drives): 4. /dev/cd0a /mnt/cdrom cd9660 ro,noauto 0 0 5. Save and exit the editor. Now you can use the mount and umount commands without having to type the device name and mount point each time. 5.6. Installing the Ports Tree and the Base System Source Code Installing the Ports tree and the base system source code is optional. You need Ports only if you need more than a handful of extra programs and you know exactly what they are. You need the OpenBSD source code if you want to be able to switch to the OpenBSD 4.0-STABLE branch, which recompiles the base system if security patches become available. The Ports system downloads the source code of the program you want to install, applies OpenBSD-specific patches, and then compiles and installs it and all of its dependencies. Obviously there are quicker, easier, and more disk-efficient ways to install software, so if you only need a few programs, it might be easier to use the pkg_add command to install them, assuming they have few dependencies. A lot of the time, though, you don't really know what you need until you've had the system up and running for a while, and sometimes you end up needing another program a few months down the line. Whether or not you should install the Ports tree depends on what you're going to do with your OpenBSD machine. If it's just going to be a router or a wireless access point, it might be best to install the few packages you need (if any) and forget about Ports entirely. If this is going to be a web, email, or other network server, Ports will probably make your life easier unless you have the most basic of configurations in mind. If this is to be a desktop machine, you definitely want Ports. If you change your mind later, you can always install or remove the Ports tree. 5.6.1. Installing the Ports tree 1. If you have the official OpenBSD CD set, the Ports source code can be found on disc 3. So insert that disc into your optical drive and mount it (this assumes you followed the earlier tutorial on modifying /etc/fstab to make CD mounting easier): 2. mount /mnt/cdrom 3. Now change to the destination directory: 4. cd /usr/ 5. Finally, unpack the Ports tarball: 6. tar zxvf /mnt/cdrom/ports.tar.gz If you installed over FTP, you'll have to fetch the Ports tarball from your local FTP mirror before you can unpack it. You can connect to it from the command line by using the ftp command. Log in as anonymous and use your email address as the password. Navigate to the / pub/OpenBSD/4.0/ directory, and then use the get command to retrieve ports.tar.gz. This command will do the trick (substitute your local mirror for openbsdmirror below): ftp ftp://openbsdmirror/pub/OpenBSD/4.0/ports.tar.gz Once the file is downloaded, unpack it to the /usr directory. It will unpack its own /usr/ports directory and populate it with the almost 4,000 program entries in the Ports tree. Once the Ports tree is unpacked, you're ready to use it. Instructions for that are in the next section. 5.6.2. Installing the base system source tree This procedure is almost identical to that of the Ports tree. Here's the process: 1. Mount disc 3 of the OpenBSD CD set, or download the src.tar.gz file from your local OpenBSD mirror. If you'd like an example of how to do this, read the preceding subsection on installing the Ports tree. 2. Switch to the /usr/src/ directory: 3. cd /usr/src 4. Unpack the src.tar.gz file: 5. tar zxvf /mnt/cdrom/src.tar.gz When it is done, you will be able to switch to the patch branch and compile your own OpenBSD kernel. Details on what these things are and how to do them are included in later sections of this guide. 5.7. Using the OpenBSD Package Tools The pkg_add command is useful for fetching and installing packages, but it's a real pain to have to type in an exact path to the package, which will be on either disc 1 or 2 of your CD set, or from a remote FTP mirror. Fortunately, a relatively new variable in OpenBSD called PKG_PATH allows you to easily do this. It sets a patheither local or remoteto a directory of OpenBSD packages. If you have PKG_PATH set to an online OpenBSD package repository, it makes it much easier to install packages with pkg_add or through the Ports tree. If you have a lot of installed programs, whether they be from Ports or from the pool of precompiled packages, this is definitely the way to go. Here's how to take advantage of it: 1. Unless you already have one written down, go to this address and find an OpenBSD mirror that is close to you: http://www.openbsd.org/ftp.html#ftp. 2. Edit the /root/.profile configuration file. On a blank line, type in this line, substituting the FTP mirror address you selected in the previous step for openbsdmirror (also substitute amd64 for i386 if you're using the AMD64 edition): 3. export PKG_PATH=ftp://openbsdmirror/pub/OpenBSD/4.0/packages/i386/ 4. And put this line below it: 5. export FETCH_PACKAGES=yes 6. Save and exit the editor, then re-log in so that the changes can take effect. If you are logging in as a regular user and using su to install packages, you will need to make the same changes to your user's ~/.profile configuration as well.

Ngày đăng: 07/07/2014, 03:20