15 Desember 2007

Installasi Linux Debian Secara Teks

While it is possible to set up Debian on a second partition of an existing system and set up a dual-boot configuration, I wouldn't recommend it if this is your first time installing Linux. In order to set up a dual-boot you'll need to over-write the MBR (Master Boot Record) of your hard-drive, and if you mess that up you could lose access to your entire system. Given that Linux has such modest hardware requirements, you should be able to pick up a used Pentium II clone (non-name-brand) desktop system on places like eBay for around $100. Cheap insurance and a good investment in your education. If you've only got one system and money is tight, another alternative would be to get another hard-drive and install it in your current system (in addition to your current hard-drive). The key is to only have one hard-drive connected at a time. You'd have to do some cable swapping (the power and IDE ribbon cable) between hard-drives when you want to switch back and forth between your regular system and Linux. (Note that with this type of configuration both hard-drives would be jumpered as master). But since you'd only need a two to four gigabyte hard-drive for Linux, this would be a very low-cost option. Being that it's getting hard to find a new hard-drive for anything less than 20 gigabytes, you should be able to find a used 2 to 4 gigabyte hard-drive for $10 to $20. If you do plan to run the GUI you'll want at least 64 meg or RAM. Crucial has good prices on RAM on their system selector tool makes it easy to find out exactly what type of memory you need to order. The options we select in this procedure are more appropriate for a server system (external Internet server or internal file server). If you're more interested in simply having a GUI Linux stand-alone PC or network workstation, check out our Desktop Linux. It features Corel Linux which is based on Debian and is GUI all the way. One thing you may want to check before you get started is in the BIOS setup of your system. Some systems have a "PnP OS" option in the BIOS. Make sure this is set to No before you get started. Installing the OS The following procedure was developed installing the Debian "woody" (3.0r0) release on a Pentium II-233 clone with 128 meg of RAM, a 4-gig IDE hard-drive, and an IDE CD-ROM drive connected as the master on the secondary IDE channel. If you are installing Debian (or any Linux distro for that matter) on a name-brand system, which are inherently proprietary, you may run into some problems. In these cases it's best to check the support pages on the hardware vendor's Web site. Using the following routine on hardware with different configurations may also result in different prompts or windows appearing. It's important to READ the information presented on the various screens during the installation. Don't worry about screwing things up. If you do, just hit the reset button on the PC and start over. Even if you don't screw something up, you can just boot off the CD to redo the install just to get more practice at it. I've gone through this install routine at least 80 times trying different options and, because you accept the default selections most of the time, you can literally whip through it in about 15 minutes once you're familier with it. If you're using an older Pentium system with an older BIOS that doesn't allow for booting off of CDs, you'll have to use a Windows system to create two boot floppies. (They even have boot disk images for the old 1.2-meg 5.25-inch floppy drives if that's what's set up as the A: drive on your soon-to-be Debian system.) To create the boot floppies on a Windows system get two formatted diskettes and: Put the Debian CD #1 in the Windows system CD drive and a blank formatted floppy in the floppy drive. Open a DOS window and switch to the CD drive. On most systems this will be the D: drive so type in the letter D followed by a colon and press Enter. Go to the directory containing the disk creation program by typing in the following at the DOS prompt: cd \dists\woody\main\disks-i386\3.0.23-2002-05-21\dosutils (The part of the path in blue may be different on your system. Use Windows Explorer to go down the directory tree on your CD to verify the above path.) If your A: drive is a 1.44-meg 3.5-inch floppy, enter the following two commands to create the two floppies: rawrite2 -f ..\images-1.44\rescue.bin -d a (insert the second floppy) rawrite2 -f ..\images-1.44\root.bin -d a Label the two disks "Boot Disk #1" and "Boot Disk #2" in the order they were created. If your A: drive is a 1.2-meg 5.25-inch floppy drive, replace the blue part of the above commands with images-1.20 Now that you've got everything you need you can go to the system you'll be installing Debian on and begin the installation procedure. Insert CD #1 into the CD-ROM drive and boot the system off of it. In the case of a non-bootable CD-ROM drive you still want to insert CD #1 in the drive but also insert the floppy Boot Disk #1 in the A: drive and boot the system. (You'll be prompted for the floppy Boot Disk #2 during the boot process.) The Welcome screen appears with a boot: prompt at the bottom. At this prompt, type in: vanilla and hit Enter. (If you're booting off a floppy you'll want to enter "linux vanilla" - without the quotes.) You'll see a lot of dependency errors as the kernel loads but you can disregard these. The Release Notes screen is displayed with Continue highlighted so hit Enter and the Installation Menu will appear. The Installation Menu has two parts - upper area has a Next: and Alternate: and possibly an Alternate1: selection - lower part is the steps that you will progress through using the Next: selection. If your hard-disk has existing partitions blow them away now (this includes any existing Linux partitions if you're redoing an install): Arrow down to Alternate1: Partition a Hard Disk and press Enter to run the cfdisk partitioning utility. If you're installing Debian onto the first hard-drive, highlight /dev/hda (for IDE drives) or /dev/sda (for SCSI drives). If you only have one hard-drive it will already be highlighted. Pressing Enter will display a screen about Lilo limitations. If you have an older system (which will have an older BIOS) you should read this. Pressing Enter with Continue highlighted will start cfdisk and the existing partitions will be displayed. (The up and down arrow keys will hightlight partitions in the upper part of of the cfdisk display. The left and right arrow keys highlight the available menu selections in the lower part of the display.) Use the arrow keys to highlight them and select Delete. After all partitions have been deleted, be sure to select the Write selection to update the partition table or nothing will change. After writing the updates to the drive's partition table you'll be back at cfdisk's main screen. Highlight the Quit selection and press Enter to return to the installation menu. When you use cfdisk to remove existing partitions you "jump ahead" in the installation steps so you'll have to take a step back at this point. Back at the installation menu, arrow down to Configure the Keyboard and press Enter. This will put you back at the correct place in the installation routine so go to the next step in this procedure. With the Next: Configure the Keyboard highlighted, press Enter and U.S. English (QWERTY) will be highlighted. Just press Enter if this is your desired selection and you'll be returned to the installation menu with the Next: step highlighted. This next step partitions the hard-drive. With the Next: Partition a Hard Disk selected press Enter. The first screen displays the list of connected hard-drive(s). Usually there's only one drive and it's already highlighted. If you have more than one IDE drive select /dev/hda for IDE drives or /dev/sda for SCSI drives and press Enter. The Lilo warning about 8-gig or larger drives on older systems with an older BIOS is displayed with Continue highlighted so just hit Enter to start cfdisk. Note: The top part of the cfdisk display lists the partitions and free space and you use the up and down arrow keys to select those. The lower part of the display are the available menu options and you use the left and right arrow keys to select those. You should have a single line that says Pri/Log Free Space with the total free space on the disk displayed on the right. Right arrow over to the New selection and press Enter. Note: You need to create a root partition and a swap partition (for virtual memory). You typically want a swap partition with a size that is double the amount of RAM in your system. For example, if you have 64 meg of RAM, you'll want a swap partition that's 128 meg in size. Be sure to set a root partition size which leaves enough free space for the desired-size swap partition. Note also: If you have a large disk, you may want to leave a gig or two free for partitioning as other file types. As you will see, cfdisk can create a huge variety of partitions and you may want to try creating a FAT16 (DOS), Win95 (FAT32), or NTFS partition later to experiment with exchanging files with other platforms. For example, with a 4-gig disk I'll size the primary (Linux) partition to 3 gig. With a 256 meg swap partition, this leaves a little less than 1 gig free for later experimentation. With Primary highlighted press Enter but don't accept the default partition size value. This default is the entire disk and you won't have any room left for a swap partition. Enter a size in megabytes using the considerations mentioned above (3000 MB in my example). Once you've entered a value and press Enter you'll be given options as to where to locate the primary partition. Accept the default Beginning option and press Enter and the new partition will be displayed. Press the down arrow key to highlight the free space and use the right arrow key to highlight the New selection and press Enter and again accept the Primary selection by pressing Enter. The default partition size value is whatever disk space remains. Enter the desired size of your swap partition (I used 256 due to my system having 128 meg of RAM) and press Enter. You will again be presented with the location selection and you can just accept Beginning and press Enter. With this new partition highlighted, arrow over to the menu selection Type and press Enter which will display some of the different partition types cfdisk supports. Note at the bottom of the screen is a prompt that says Press a key to continue and when you do even more partition types will be displayed. At the bottom of this second screen of partition types you'll see the Enter file system type: with the value defaulted to 82. This is the Linux Swap type which is what we want to just hit Enter. You should now have listed the root partition, the swap partition, and any free space remaining. Be sure to arrow over to the Write menu selection and press Enter so that all your changes get written to the disk's partion table. Once the partition table is updated arrow over to the Quit selection and press Enter to exit out of cfdisk and return to the installation menu. The installation menu will automatically highlight the Initialize and Activate a Swap Partition (hda2) so you can just press Enter. If you want to scan for bad blocks (a good idea even with new drives) Tab to Yes and press Enter, and then answer Yes at the Are you sure? prompt. You are then prompted to initialize the Linux Native partition (the first parition you created - hda1). When you select to do this you are asked if you want to scan for bad blocks. If you do, Tab to Yes (this could take quite a long time with a large partition) or you can accept the default No and press Enter. Then answer Yes at the Are you sure? prompt. Then answer Yes to the prompt to mount the root filesystem. The next item in the installation menu is Install Kernel and Driver Modules. The installation routine detects that you are doing a CD-ROM install and asks you if you want to use this drive as the default installation medium. Accept the default Yes to this by pressing Enter. Configure Device Driver Modules is where you are given the chance to load additional drivers. A meesage about loaded drivers appears with Continue already highlighted so just press Enter. You are then presented with a list of module (driver) categories. Each category has a bunch of modules listed and you have to highlight them and press Enter to install them. If you are prompted for any "Command line arguments" just leave it blank and press Enter. Install the listed modules from the following categories. Don't try and install any hardware drivers for hardware that isn't installed and ready. net - select ppp support (useful for more than just modems) and if you're connecting your system to a network select your NIC driver if it's listed. Many times it's easy to figure out which driver you need because the driver name coincides with the name of the NIC. However this is not always the case. The driver is often based on the chipset used by the card, not the card manufacturer or model. In the table below are some common NICs and the driver you need for them. Note: Many drivers will prompt you for command line options. If you have a good hub or switch and a decent card, you should not have to enter any command-line options for the cards to work. They auto-negotiated a 100 mb, full-duplex connection. NIC Driver 3C509-B (ISA) 3c509 3C905 (PCI) 3c59x SMC 1211 SiS 900 Allied Telesyn AT2550 rtl8139 SMC 8432BT SMC EtherPower 10/100 Netgear FX31 Linksys EtherPCI Kingston KNT40T Kingston KNE100TX D-Link DFE500TX D-Link DFE340TX D-Link DE330CT tulip Many other cards use the pcnet32 or lance drivers. If your NIC is not one of the ones listed above you may find it, and its corresponding driver name, in the Ethernet HOWTO list. Note that I've had problems using some SMC cards (9432 in particular) were you get errors saying "too much work at interrupt" and the card does not work properly. Your safest bet is to use a 3Com 3C509-B (ISA) or 3C905 (PCI) card. They're widely supported, I've never had a problem with them, and they're readily available on eBay. ipv4 - The following modules are for a system which would be connected to the Internet for firewall or proxy capability (but not needed if this will be a network file server). For our purposes, select the following: ip_masq_autofw - kernel support for firewall functionality ip_masq_ftp - (same as above) ip_masq_irc - (same as above) ip_masq_mfw - (same as above) ip_masq_portfw - (same as above) ip_masq_raudio - (same as above) fs - The following are modules you'd want if this would be a system which is not going to be directly connected to the Internet such as an internal file, print, or application server. For our purposes, select all of the following: binfmt_aout - for backward compatibility binfmt_misc - (same as above) nfs - for UNIX/Linux network file storage nfsd - (same as above) (Note that lockd is selected automatically with nfs.) Tip: If you didn't see the above ipv4 and fs selections listed it's likely because you didn't enter "vanilla" at the start of this procedure. You'll want to start the installation over at Step 1. Because you selected net modules, the next step in the installation menu is to Configure the Network. Enter a hostname for your system. If this is going to be an Internet server, use a name that describes its function (ex: "www" or "mail"). If it's going to be in an internal domain in your company, use a name that uniquely identifies it. If this is going to be a home Web/e-mail server using dynamic DNS you'll want to pick something that's really unique (something that isn't already being used by anyone else using the same dynamic DNS service). If none of these apply, you can just accept the default "debian" name. Select the No response to the question asking you if you want to use DHCP or BOOTP. Next you have to enter an IP address for your system. If you're installing this machine on an existing network, MAKE SURE IT'S AN AVAILABLE IP ADDRESS!. If you choose an IP address that's used by another system you'll cause all kinds of problems. (You can use a different system to try and ping the address you plan to use to make sure there are no replies to it.) If you don't know what IP address to use don't accept the default since it's commonly assigned in home networks. Note: If you're installing this machine on an existing network, even a home network, try this: Go to a Windows machine that's also on the network Open a DOS window At the DOS prompt type in winipcfg or ipconfig (one of them should work) and see what the IP address of the machine is Think of an address for your Linux system where the first three "octets" are the same. For example, if the Windows machine has an address of 192.168.10.23, the address for you Linux machine should be 192.168.10.xxx (you make up a number for "xxx" from 1 to 254) Try to ping the number you come up with. For example, if the number you come up with for xxx is 45, at the DOS prompt type in ping 192.168.10.45 and make sure there are no responses to the ping. This means the address isn't being used by another system so you can use it for your Linux system. The subnet mask will be automatically calculated for you based on the class of the IP address you entered and it should be OK as long as you're not on a subnetted LAN. Enter a gateway address if you know what it is (the default route off your network). If it's a home network you probably not have a gateway (unless you have a cable/DSL router). Don't just accept the default entry as a system that's not a gateway may already have this address. The procedure above using a Windows system already on the network may display a default gateway address. If not, just back-space out the default value and press Enter leaving the field blank. You will then be prompted for a domain name. Enter your domain name if you already have one. If you're just playing around, use your last name (for example smith.net). You'll see why on the Internet Servers page. If you accepted the default "debian" host name earlier, your system will then be referred to as "debian.smith.net". Don't worry about conflicting with a real domain that may have that name since this machine won't have a DNS record created on any ISP's DNS server. Note: There are up to three types of "domains" to consider when you are asked for a domain name in Linux. If this will be a system in your Internet domain space, naturally you would use that name. Companies can also set up an internal domain space which has the same type of naming hierarchy as the Internet domain naming system. This type of domain name can be anything you want because it is not visible to the outside world nor do you have to "register" the name with any domain naming authority. In other words, a company can have a public (Internet) domain name (registered through someone like Network Solutions) and a private (internal) domain name. They can be the same or they can be different. The third type of domain are familier to those who work with Windows NT networks. These domains only have a single-word domain, not the dotted hierarchy found on the Internet and in internal Linux/UNIX networks. Linux does not support these type of domains. However, starting with Windows 2000, Windows servers also started using the dotted hierarchy domain naming convention. If you have any such Windows servers on your network, your Linux system can be put into this domain space (i.e. be given the same dotted domain name as your Windows 2000 servers). At the prompt for a DNS address, enter the address of one of your ISP's DNS servers. (Most companies don't have heir own DNS servers and will usually use the DNS servers of their ISP or WAN service provider.) Here again you don't want to just accept the default because that address may be used by another machine on the network which isn't a DNS server. If you're not sure of your ISP's DNS server addresses, just backspace out the existing address and leave it blank. Note: If you enter your ISP's DNS server address, some network-related functions (like establishing a telnet session) may operate slowly until your get your system connected to the Internet so it can "see" the ISP's DNS server. However, this is the only viable entry to use on networks that don't have their own DNS server. Back at the installation menu Install the Base System is highlighted so just press Enter and the file copying and extraction will begin. The next three selections refer to setting up the system to boot up. Select Make System Bootable Select the default Install LILO in the MBR and press Enter when the "Securing LILO" message appears You don't need to Make a Boot Floppy so arrow down to Alernate: Reboot the System press Enter and answer Yes to the confirmation. Be sure to remove the CD as the system reboots to force it to boot off hard-drive. This next phase of the OS installation will install some basic software and configure some basic OS operations. You may see some errors messages in all of the text that's displayed during the boot process. Don't worry about those at this point. Once the system reboots you'll have to press Enter at the screen saying that Debian is installed and the configuration process begins. Tab over to the No selection when the prompt appears asking you if your hardware clock is set to Greenwich Mean Time. For the timezone select your geographic area (if you're in the US, choose "US" and not "America") and press Enter. Then select your correct time zone and press Enter. The next series of dialogs will be password and account related. Note that the cursor will not move and nothing will be displayed when you enter passwords. First you'll be asked if you want to use MD5 passwords. Use default No selection. Next you'll be asked if you want to use shadow passwords. Use the default Yes selection. You'll have to press Enter about an informational message about root passwords. Then you'll be prompted to enter, and re-enter, a password for the root (super-user) account. REMEMBER IT. Finally you'll be be asked to to create a non-root user account entering the username, full name, and password. Create one for yourself using your first name. When asked if you want to remove the PCMCIA files accept the default Yes answer. When asked Do you want to use PPP to install the system? use the default No answer. At this point the apt (package installer) configuration begins. Before continuing, place the CD #1 back in the drive. What apt is going to do is scan the CDs and create an inventory of the packages on them and store it in a database for later use. After the CD #1 is scanned it will ask if you have another CD to scan. Pop in CD #2, Tab to the Yes selection and press Enter. Repeat this process until all seven CDs have been scanned. Once CD #7 has been scanned, remove it and and put CD #1 back in the drive. This time, accept the default No to the prompt asking if you have another CD to scan and press Enter. When prompted to add another apt source accept the default No answer and press Enter. Answer No to the prompt about using security updates from security.debian.org. (We'll take care of this later.) The next window to appear is the System Configuration window where you are asked if you want to run the tasksel task selection utility. Accept the default Yes by pressing Enter. The Task Installer appears with a list of task packages you can select using the space bar. Only select following at this time: X window system C and C++ Tab to Finish and press Enter. Accept the default No to running dselect at this time. At this point a list of packages to be installed are presented with a prompt asking "Do you want to continue?" with Yes being the default so just press Enter. You'll be prompted to insert CD#1 but it should already be in the drive so just press Enter. Just press Enter when the informational message about "kernel link failures". Accept the default No answer to configuring less. Accept the default No answer to adding a mime handler. Next you'll have to select a locale for those applications that use this information. If you are in the US, arrow down to the en_US ISO-8859-1 selection and press the Space Bar to select it. Then Tab to OK and press Enter. Accept the default Leave alone for the default locale selection by pressing Enter Press Enter at the informational message about statd using tcpwrappers. When prompted to "Allow SSH protocol 2 only" Tab over to No and press Enter. Press Enter at the informational message about priviledge separation. Accept the default Yes answer to install ssh-keysign SUID root by pressing Enter. Answer No to the prompt to run the sshd server. Accept the default path for the CVS repositories by pressing Enter and then press Enter again when the prompt to Create the repository directory appears. CVS is a version control system that tracks changes to source files which is useful if you are going to use your system for development work - i.e. programming. For this install, press Enter at the CVS informational message and accept the default No answer to the prompt about starting the CVS pserver. Accept the default Yes to the prompt about managing the X server wrapper using debconf. Accept the default Yes to the prompt about managing the XFree86 configuration using debconf. Select your video card's chipset manufacturer from the list presented and press Enter. If you're not sure what it is, use to the vga selection. Accept the default Yes to the prompt about using the kernel's framebuffer interface. Accept the indicated X ruleset by pressing Enter. Press Enter at the informational message about keyboard types. Select the appropriate keyboard type based on what you read in the previous informational message and press Enter. The default pc104 value is for the Windows types of keyboards most often found in the US. Enter the appropriate keyboard layout based on your locale and press Enter. Press Enter at the informational message regarding mice and trackballs. On the mouse port selection screen, select /dev/psaux if you have a PS/2 mouse. For older serial-type mice, use /dev/ttyS0 if it's conneted to COM1 or /dev/ttyS1 if it's connected to COM2. Then Tab to OK and press Enter. On the mouse selection screen, if you have a name-brand select the model which matches it, or simply select the generic model entry. Answer appropriately to the prompt about whether you have an LCD monitor or not. Press Enter at the informational screen about monitors. Then select Simple from the list of selection methods and press Enter. Select your monitor's size and press Enter. If you have a 15" monitor, you'll want only the 640x480 value for the resolution. If you have a 17" monitor have only the 800x600 value selected (i.e. de-select the 640x480 selection) using the Space Bar. Then Tab to OK and press Enter. At the color depth selection, a recommended value based on your earlier selections will be at the top of the list (highlighted) so just press Enter. At this point more packages will be installed. At some point during this installation you may be prompted to select an ispell dictionary from a list presented. Simply select the appropriate dictionary for your locale. If you get a prompt about erasing the .deb files accept the default Yes by pressing Enter and then pressing Enter again to continue. Next you see a message about helping you configure your mail system. Debian installs the Exim e-mail server software by default which is a shame. 99% of the UNIX/Linux world uses Sendmail. On the Internet Servers page we'll remove Exim and install Sendmail but for now: Press Enter at the "Press Return" prompt Select option 5 to not configure Exim THAT'S IT! The installation is complete. And you'll be sitting at a text-based shell prompt. Before we reboot the system there a couple commands we need to enter to compensate for the differences in the insallation routines between woody and potato. This will put on on the "same page" as the potato installation before moving on to the subsequent guide pages. Start out by logging in as the 'root' superuser (i.e. enter root at the login: prompt and then whatever you entered above for a root password. This will place you at a shell prompt. Unfortunately, when you choose to install the X-Windows system in Woody it sets the system up to bring up a GUI login prompt when the system is booted. We don't want that. Recall that back on the Basics page we showed what files are involved in the Linux boot process, including the symbolic links in the rc2.d directory. You can disable the running of the GUI login routine by renaming the symbolic link to the shell script which runs the GUI login routine. Recall also that any symbolic link that starts with an upper-case 'S' causes its associated script to be run at startup. Use the following mv (move) command to rename this link so that it starts with an underscore character so its associated script won't be run when the system is booted: mv /etc/rc2.d/S99xdm /etc/rc2.d/_S99xdm Next, we want to be able to telnet into the system. Potato takes care of this by default but Woody doesn't (defaulting to the more secure SSH instead) so we'll have to install the telnet server daemon. With CD#1 in the drive, enter the following command: apt-get install telnetd You'll find out more about apt-get on the Packages page. For now, we're pretty much at the same point system-wise as the end of the potato installation. So now you can reboot the system by removing the CD from the drive and pressing Ctrl-Alt-Del. We're not actually done with the initial setup of the system yet. The rest will be covered on the Packages page. For now though, try taking your new Debian system out for a spin around the block in the next section. Trying It Out As your system reboots a lot of messages will be displayed. With a faster system you won't be able to read them all. You can use the Shift-PgUp and Shift-PgDn key combos to scroll through this previously-displayed text to look for any error messages, etc. Don't be too concerned about error messages at this point. We still have to install and update the packages. Once your system restarts you'll be presented with a login prompt. Because Linux is a multi-user OS you have to indentify yourself to the OS via a login. Log in using the root username and the root password you entered during the install. Once you log in the shell prompt debian:~# is displayed. The # indicates you're logged in as root. (Non-root users get a $ prompt.) The debian is the hostname you gave to the system during the install. The ~ indicates that you have been placed in root's home directory. Whenever you first log in you will see this prompt because every user defaults to their home directory at login. (User home directories are created automatically when the user accounts are created on the system.) All non-root users have a sub-directory under the /home directory. The names of these home sub-directories for non-root users match the user names (ex: /home/fred). The root user is a little different. root's home directory is off the root of the file system. Instead of /home/root it's at /root. It's important to understand that /root is the root user's home directory. Don't confuse it with the "root" of the file system, which is denoted by a single slash (/). Since you're in the root user's home directory, look at the files the install routine created by typing in ls and pressing Enter. You won't see anything because there's nothing there. Kind of. There are no user files there. However, there are some system files there. Try typing in ls -laF and pressing Enter. You'll see two files that start with a period, the .bashrc and .profile files. They're both kind of the same thing, like a config.sys file on DOS systems. The .bashrc file sets certain environment defaults when you use the bash shell. The .profile does the same thing, regardless of which shell you use. You can look at the contents of the .profile file by typing in cat .profile ('cat' is the equivalent of the DOS TYPE command which just "types out" the contents of a text file on the screen.) As you can see, it's mainly just the setting of the PATH variable and you can see what the value of your path is set to. Notice I said your path. In UNIX/Linux each user gets their own path. Now lets look at the .bashrc file. Type in cat .bashrc There's a little more here but most of it is commented out. In most UNIX/Linux configuration files any line that begins with a pound character (#) are comments (or are commands that have been commented out as in the case of numerous alias commands in the .bashrc file). Note: There is one case where a line starting with a pound character (#) is not a comment. The very first line is shell scripts will look something like this: #!/bin/sh This is known as the "bang" or "shebang" line. It specifies the path to the shell that the script should be run in. (You can run a shell script under a different shell than the one you're currently using.) alias commands let you substitute one command for another, or "create" your own command. Note the line in the .bashrc file: alias rm='rm -i' This just substitutes the standard alias command with itself but using the -i command-line switch. The -i command-line switch is interactive mode, which means it will prompt you for a confirmation whenever you use the rm command to delete a file (a safety measure). You can also "create" your own commands by aliasing existing commands with a different name. For example, you could enter the following line in the .bashrc file: alias zapfilz='rm -i' to "create" a zapfilz command. Linux defaults it's "virtual terminal" sessions (what you use when you are working at a shell prompt) to the "tty" (teletype) specification. However, some text editors don't get along with the tty terminal type very well. They work better with a "VT100" type of terminal. (The term "terminal" refers to the old "green screen" keyboard/screen devices that were commonly used with mainframes.) Since you tend to work with text files quite a bit in Linux, it would be beneficial to set our virtual terminal sessions to use the VT100 terminal type. Lets use the infamous vi text editor to edit the .bashrc file to change our default terminal type to VT100. We'll do this using an export statement. At the shell prompt type in vi .bashrc to open the file in the editor and the contents will be displayed. Note that there already is one export statement in the .bashrc file. This statement is what sets our shell prompt to display the hostname and current working directory. Press the down arrow key until you get to a blank line in a file (the position of the command in the file isn't important). Press the 'a' key (for append). Note: If you screw things up and you want to quit without saving, just press the following keys in the given order: Esc : q ! Enter Type in the following line (don't start the line with a pound sign): export TERM='vt100' Now press the following keys in the given order to save the changes and exit vi: Esc : w q Enter Note that what we just did changes a startup file. It won't have any effect until the next time you log in. However, just enter that same command at the shell prompt and it will take effect immediately. Once your enter it at the shell prompt, you can make sure it took effect by entering this command at the shell prompt: echo $TERM You can also try entering this command the next time you log in to make sure that the statement you entered into the .bashrc file is correct. $TERM is the environment variable which stores the current terminal value. All environment variables are upper-case. You use the $ character in front of them to indicate you want to echo the contents of the variable. If you didn't use the $ in the above command the word TERM would simply be echoed to the screen. The vi editor is legendary in it's difficulty to master. For one, it's a line editor, not a full-screen editor. For another, it has an "edit" mode and a "command" mode. (We went into edit mode above when we pressed the 'a' key above, and went back to command mode when we hit the Esc key.) There are entire books written on vi. It's only fair to mention though, that vi's keystroke combinations were devised in such a manner that once you get really good with vi, you'll rarely have to take your fingers off the "home" positions on the keyboard. The reason you want to at least become familier with vi is because every Linux and UNIX system will have it, no matter how old or eccentric a distro it is. That can't be said about any other editor. Keep in mind that changes made to the .profile only take effect when you're logged in as the same user that you are logged in as when you make the changes. Each user has their own .profile file located in their home directory (but as the root super-user you can edit everyone's .profile file if you want to set up a standard). The same is true of the .bashrc file, except that, in addition to it only being valid for the current login, it is also only valid if you choose to run the bash shell. Likewise, every user that is set up to use the bash shell by default (which is the default shell in Linux) will have a .bashrc file in their home directory. If you type in: echo $SHELL you'll see that you are using the Linux-default bash shel

0 comment: