⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ch03.htm

📁 linux-unix130.linux.and.unix.ebooks130 linux and unix ebookslinuxLearning Linux - Collection of 12 E
💻 HTM
📖 第 1 页 / 共 5 页
字号:


<TT>setup</TT> later as root from the <TT>/sbin</TT> directory to install any disk



sets you did not install earlier.</P>



<P>After the software is installed (the process will take a while), you are presented



with the CONFIGURE menu item. The configuration is pretty straightforward. Select



the correct hardware, time, and network address from the menu items.</P>



<P>You also can modify the LILO parameters to allow booting from the hard disk. When



you are running setup, if you choose the LILO option, you can use the existing <TT>lilo.conf</TT>



file by choosing the RECYCLE option. For the moment, you should start with a new



LILO header. Type the appropriate device names of the partitions you want to boot



from, and be sure to select the option to write all the changes to disk.</P>



<P>After the configuration is done, you can quit the setup menu. Now is the time



to reboot the system. Press Ctrl-Alt-Delete to perform the shutdown command. (It's



safe to do so here.) The kernel should reboot. After the machine starts booting,



remove the root floppy disk from drive A.</P>



<P>Linux should now boot straight from the hard drive from the partition you specified



for LILO. After a flurry of messages quite similar to the ones you saw with the boot



disk, you should see a login prompt. Log in as root and change the password with



the <TT>passwd</TT> command. You are asked to enter the password twice to ensure



that any mistyped errors are avoided.</P>



<P>Congratulations. You are now running Linux on your machine.



<CENTER>



<H3><A NAME="Heading31<FONT COLOR="#000077">Creating the File System</FONT></H3>



</CENTER>



<P>Even though the installation program, setup, will create and install a file system



for you, at times you will want to prepare other partitions for use with Linux. For



example, you might want to store important files in a different partition.</P>



<P>You can also create a file system for Linux manually by using the following commands:







<UL>



	<LI><TT>mke2fs -c </TT>partition: Make second extended file system



	<P>



	<LI><TT>mkfs -c </TT>partition: Make Minix file system



	<P>



	<LI><TT>mkefs -c </TT>partition: Make extended file system



	<P>



	<LI><TT>mkxfs -c </TT>partition: Make Xia file system



</UL>







<P>The partition is the name of the partition to make the file system on. The size



of the partition is taken from the fdisk table entries. Be sure to give the size



in Linux blocks (1024 bytes each), not sectors. This might be the problem if Linux



<TT>mke2fs</TT> doesn't accept the size you give the device although when you double-check



the size with fdisk, it shows that the size is correct. Also, make sure that you



have the right partition; partitions are numbered /dev/hda1, /dev/hda2, and so on



(and /dev/hdb1, /dev/hdb2 for the second hard drive). Don't use /dev/hda or /dev/hdb



because they correspond to entire disks rather than single partitions.</P>



<P>These commands will create an unformatted file system for you. The setup program



will let you format this new file system.</P>



<P>In almost all cases, you will want to use the second extended file system because



it's the fastest and most reliable one of the four file systems listed previously



for Linux.</P>



<P>You must do two very important things immediately after installing Linux. One



is to create an account for yourself, and the other is to ensure that your new Linux



machine does not conflict with other machines if you are on a network.



<CENTER>



<H3><A NAME="Heading32<FONT COLOR="#000077">Dont Run As Root</FONT></H3>



</CENTER>



<P>After you boot your shining new Linux system and log in as root, one of the first



things you should do is create an account for yourself. In most cases, you will want



to use Linux while logged in as a normal user and not as root. Use the root login



only for system-related and administrative tasks that require root privilege. You



are less likely to damage your Linux file system if you are not running as root all



the time.</P>



<P>The <TT>adduser</TT> command can be used for this purpose. For example, to add



myself to the system, I used the following commands:</P>



<PRE><FONT COLOR="#0066FF">HostName:~# adduser



Adding a new user.  The username should not exceed 8 characters



in length, or you may run into problems later.



Enter login name for new account (^C to quit): kamran



Editing information for new user [kamran]



Full Name: Kamran Husain



GID [100]: &lt;Enter&gt;



Group `users', GID 100



First unused id is 501



UID [501]: &lt;Enter&gt;



Home Directory [/home/kamran]: &lt;Enter&gt;



Shell [/bin/bash]: &lt;Enter&gt;



Password [kamran]: helpme12   [beg] NOTE: [end]The password doesn't appear on-screen as you type.



Information for new user [kamran]:



Home directory: [/home/kamran] Shell: [/bin/bash]



uid: [502] gid:[100]



Is this correct? [y/N]: y



Adding login [kamran] and making directory [/home/kamran]



Adding the files from the /etc/skel directory:



./.kermrc -&gt; /home/kamran/./.kermrc



./.less -&gt; /home/kamran/./.less



./.lessrc -&gt; /home/kamran/./.lessrc



./.term -&gt; /home/kamran/./.term



./.term/termrc -&gt; /home/kamran/./.term/termrc



</FONT></PRE>



<P>Just use the defaults presented to you by <TT>adduser</TT> when you are answering



the prompts.



<CENTER>



<H3><A NAME="Heading33<FONT COLOR="#000077">Changing Your Hostname If Youre



on a Network</FONT></H3>



</CENTER>



<P>This step is required only if you are connected to a network. Even if you are



on a standalone machine, it's a good idea to change the hostname for the machine.



The default hostname of your machine is set to an obscure name at boot time in the



file <TT>/etc/rc.d/rc.M</TT>. If you are connected to a network, you should edit



this file (as root) to something that does not clash with other machines on this



system. Also, make sure that the entries in the <TT>/etc/hosts</TT> files do not



clash with any other machines on your network. After you edit this file, run the



<TT>hostname</TT> command to have the changes take effect. This is the time to edit



the domain name commands to ensure your machine's presence on a TCP/IP network. See



Chapter 43, &quot;Networking,&quot; for details.</P>



<P>Obviously, you can set up and configure many more things for your network. A good



book on UNIX systems administration should help. (I suggest UNIX Unleashed, from



Sams Publishing, ISBN 0-672-30402-3.) Let's wait, however, until we get to the system



administration chapter.



<CENTER>



<H3><A NAME="Heading34<FONT COLOR="#000077">Multiple Login Sessions with Virtual



Consoles</FONT></H3>



</CENTER>



<P>Linux, like some other versions of UNIX, provides access to virtual consoles (VC)



so that you can have more than one login session from your console at a time. In



X Window, you can use multiple windows to start different sessions. When faced with



text-based screens, you can use virtual consoles.</P>



<P>Linux starts with six or eight virtual consoles (VCs). You boot into the first



virtual console, VC0, when the machine starts. You can select any VC by pressing



the Alt key with a function key from F1 to F6. For example, pressing Alt-F2 presents



the <TT>login:</TT> prompt again. You're looking at the second VC. To switch back



to the first VC, press Alt-F1. On a newly installed Linux system, you can access



the first six VCs by using Alt-F1 through Alt-F6. By using VCs, you can have several



login sessions at one time on the same Linux machine.







<DL>



	<DT></DT>



</DL>











<DL>



	<DD>



<HR>



<A NAME="Heading35<FONT COLOR="#000077"><B>TIP:</B> </FONT>In fact, you can



	use VCs 1 and 2 while you are installing the software! Try it.



<HR>







</DL>







<CENTER>



<H3><A NAME="Heading36<FONT COLOR="#000077">Powering Down</FONT></H3>



</CENTER>



<P>Linux is a multitasking system: it has to process several items &quot;at the same



time.&quot; Some of the processes that are run by the kernel are invisible to you.



These processes are called background processes, or daemons. When you arbitrarily



kill the power to a UNIX machine, you might be killing the computer in the middle



of a daemon's operation.</P>



<P>Obviously, the solution is to ask for a graceful ending to a UNIX session. This



is where the <TT>shutdown</TT> command comes in. After installation, you can find



<TT>shutdown</TT> in the <TT>/sbin</TT> directory. This is the syntax for the <TT>shutdown</TT>



command:<FONT COLOR="#0066FF"></FONT>



<PRE><FONT COLOR="#0066FF"># /sbin/shutdown [-hr]  [time]



</FONT></PRE>



<P>Because you are the only user, you usually will give the command to shut down



the system immediately:<FONT COLOR="#0066FF"></FONT>



<PRE><FONT COLOR="#0066FF"># /sbin/shutdown -h now



</FONT></PRE>



<P>The <TT>-h</TT> option requests that the system be halted. To reboot the system,



use the <TT>-r</TT> option:<FONT COLOR="#0066FF"></FONT>



<PRE><FONT COLOR="#0066FF"># /sbin/shutdown -r now



</FONT></PRE>



<P>The <TT>-r</TT> option requests shutdown to halt the system and then restart it.



You would normally use this option if you made some changes to the UNIX system that



would require a lot of daemons, system parameters, or both to be changed.







<DL>



	<DT></DT>



</DL>











<DL>



	<DD>



<HR>



<A NAME="Heading37<FONT COLOR="#000077"><B>CAUTION:</B> </FONT>The Ctrl-Alt-Delete



	combination also invokes the <TT>shutdown</TT> command. I have received some messages



	from Linux users, however, who say that the three-key combination hung their system



	up instead of calling <TT>shutdown</TT>. In one case, the file system was corrupted.



	Play it safe--use the <TT>shutdown</TT> command directly.



<HR>







</DL>











<DL>



	<DT></DT>



</DL>











<DL>



	<DD>



<HR>



<A NAME="Heading38<FONT COLOR="#000077"><B>CAUTION:</B> </FONT>Never, ever



	shut down a Linux system without using the <TT>shutdown</TT> command. Not using this



	command could place your file system at great risk of being corrupted. You have to



	be logged in as root to use the <TT>shutdown</TT> command.



<HR>







</DL>







<CENTER>



<H3><A NAME="Heading39<FONT COLOR="#000077">A Final Word About Installing Linux</FONT></H3>



</CENTER>



<P>You should now have enough of the basics to get Linux installed on your system.



Unfortunately, it's impossible to cover all the ways you can install Linux. Simply



too many versions of Linux and even more versions of PC hardware exist. It is simpler



and more coherent to cover the specific instructions for a single release of Linux,



such as the one found on the CD-ROM.</P>



<P>The basic concepts in this chapter hold regardless of which Linux you wind up



with. All releases require you to run fdisk, and all of them include some kind of



installation menu similar to the setup program. If you choose to use a release of



Linux other than Slackware, the <TT>README</TT>s and installation instructions that



come with that release should be easy to understand in the context of the material



presented here.</P>



<P>If you want a more complete discussion of Linux installation (rather than the



&quot;quick&quot; examples given here), read the online book Linux Installation &amp;



Getting Started via FTP from the <TT>sunsite.unc.edu</TT> site in the directory <TT>/pub/Linux/docs/LDP</TT>.



The Web site for this discussion can also be found on <TT>http://sunsite.unc.edu/pub/Linux/docs/LDP/INDEX.html</TT>.



<CENTER>



<H3><A NAME="Heading40<FONT COLOR="#000077">Summary</FONT></H3>



</CENTER>



<P>In this chapter, I covered how to install Linux through the following topics:







<UL>



	<LI>What boot and root disks are and how to create them.



	<P>



	<LI>Partitioning your hard drive in preparation for installing Linux.



	<P>



	<LI>How to set up swap spaces for Linux.



	<P>



	<LI>Booting your new system with the boot disks.



	<P>



	<LI>How to use the setup program to install the software.



	<P>



	<LI>How to work with virtual consoles.



</UL>







<P>Keep in mind that no single document can cover all aspects of installing Linux.



You will find several ways to do the same thing in Linux. Also, this is your system--do



with it as you please!



















</td>
</tr>
</table>

<!-- begin footer information -->



</body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -