2021redhat linux安装教程手册.docx
redhatIinux安装教程手册1 redhatIinux:开源免费IinUX分支:redhat红帽centos红旗opensusedebianubuntu服务器操作系统:重要安全:Iinuxunix(AIXSolarishp-ux)不太重要:windowsserver2003server2008(最常用)server20122 现在:rhel:redhatenterpriseIinux最新7.0早期:redhat8.0redhat9.03安装RedHatEnterpriseLinux664位-VMwar文件(F)辐(E)M(V)左拟机(M)选项卡(T)帮助(三)A9BJBK主页RedHatEnterpriseLinux一1.5jRedHatEnterpriseLinux664位A开启此翻机印第虎拟机设置设备内存800MB口处理器2二硬盘(SCSD30GBCDDVD(SATA)正在使用文件G:.险网络适配器侬模式(且加QUSB控制器由©A卡自动检测品打印机曲粤显示器目S描述在此处健入对该虚拟机的病述.UeIcoreetoRedHatEnterpriseLinux6.2,Qnsta11orupgradeanexistingsystemInsia11SyStemwithbasicuideodriuerRescueinstalledSySte-BootfronlocaldriueMenortestPressETabltoeditoptionsAutomaticbootin41seconds.REDHArENTERPRISELINUXe6CopyrigncP2003-20»RseHaLnc.andMMen.Alfightsrere<LWelcometoRedHatEnterpriseLinuxforx86_64DiscFound To begin testingthe media beforeinsta1Iation press OK.Choose Skip to skip the media test and start the insta1Iation.<Tab><Alt-Tab> between elements I <Space> selects I <F12> next screenStorageDeviceWarningThestoragedevicebelowmaycontaindata.VMwarerVMwareVirtualSJ三30720.0MBpci-0000:00:10.0-scsi-0:0:0:0Wecouldnotdetectpartitionsorfilesystemsonthisdevice.Thiscouldbebecausethedeviceisblank,unpartitioned,orvirtual.Ifnot,theremaybedataonthedevicethatcannotberecoveredifyouuseitinthisinstallation.Wecanremovethedevicefromthisinstallationtoprotectthedata.Areyousurethisdevicedoesnotcontainvaluabledata?gApplymychoicetoalldeviceswithundetectedpartitionsOrfilesystemsYfes,discardanydataINo,keepanydataPleaseselectthenearestcityinyourtimezone:<IHI>SeleCtedcity:Shanghai.ASia(eastChinj-Beijing,Guangdong,Shanghai,etc.)Asia/Shanghai0要将掩人定向到此虚拟机.OBasicServerODatabaseServerOWebServerOIdentityManagementServerOVirtUaliZationHOStDesktopOSoftwareDevelopmentWorkstationOMinimalPleaseselectanyadditionalrepositoriesthatyouwanttouseforsoftwareinstallation.OHighAvailabilityLoadBalancerRedHatEnterPriSeLinuxCI.”一_AsAddadditionalsoftwarerepositories囹ModifyrepositoryYbucanfurthercustomizethesoftwareselectionnow,orafterinstallviathesoftwaremanagementapplication.CustomizelaterOCustomizenow安装完从之后,使用root账号登陆操作系统4常用快捷键:Ctrl+shift+放大字体Ctrl+-缩小字体pwd显示当前所处的目录路径/根表示整个大硬盘类似WindoWS我的电脑(计算机)cd(changedirectory)进入某些文件夹(目录)例如:进入根下面的etc目录I1.,317八3,root0xg/#cd/etc/root(3xgetc#pwd/etcroot(3xgetc#Is(list)列出当前目录里面有哪些文件或者文件夹用户后面总会显示当前光标所在的目录root(3xgDesktop#cdvarIrootxgvar#root(3xgvar#root(3xgIvarll#IsaccountcvsgameslocalmailpreservempcachedbIlockniscrashemptyliblogoptroot(3xgvar#CdlyPlrootxgyp#root(3xgyp#rootxgyp#pwdvaryprootxgyp#root(axgpyp|#runspoolypmkdiraa新建文件夹aatouch11新建文件11root(9xgDesktop#IsrootxgDesktop#mkdiraarootxgDesktop#IsaarootxgDesktop#touch11root(3xgDesktop#Is11aaroot(3xgDesktop#rm33-fr强力删除33文件rm:remove-fr参数强力删除不提示(f:forcer:递归)一般删除会接这两个参数LruungxyuebLUlJJ升root(3xgDesktop#Is11aaroot(3xgDesktop#root(QxgDesktop#root(3xgDesktop#cdaaroot(3xgaa#Isrootxgaa#mkdirbbrootxgaa#root(3xgaa#rootxgaa#Isbbroot(3xgaa#cdbbroot(3xgbb#pwdrootDesktopaabbroot(3xgbb#Isrootxgbb#touch33rootxgbb#Is33root(3xgbb#rm33-frI5复制剪切删除移动重命名编辑文档退出到上一级目录(类似与返回)删除:rmXX-frrm(remove)返回:Cd.返回上一级目录cd(changedirectory)复制:cp11aa将11文件复制到aa文件夹cp(copy)剪切:mv11aa将11剪切至aamv(move)重命名:mv1112将11重命名成12.:表示上一级目录.:表示当前目录编辑12文件:Vi12按i(insert)插入helloword!shift+zz保存并退出查看12文件的内容:cat126查看文件大小查看已经登陆的用户du-h12查看12文件的大小whow查看当前登录的账号7设置ip地址链接网络SSh登陆ifconfig查看当前的iP地址将图形化界面的网络管理去除,并且使其开机不启动1.*yn*-*广,OK rootxgDesktop#etcinit.dNetworkManagerstopStoppingNetworkManagerdaemon:rootxgDesktop#chkconfigNetworkManageroffchkconfigxx×off使某服务开机不启动chkconfigxxxon使某服务开机启动临时设置ip地址:192.168.31.44rootxgDesktop#root0xgDesktop#Ifconfigeth192.168.31.44netmask255.255.255.root(3xgDesktop#*zz+CzCCr*Lz+z>r1”永久设置ip地址信息setupditViewSearchTerminalHelpServerCancelrootxgShuttingShuttingBringingroot(9xgrootta×Desktop#etcnt.dnetworkrestartdowninterfaceeth0:downloopbackinterface:uploopbackinterface:Desktop#Desktool#etheth0192.168.31.44255.255.255.®192.168.31.1192.168.31.18.8.8.8NameDeviceUseDHCPStaticIPNetmask需要重启网络服务器才可以使得配置的ip信息生效NetworkConfigurationDefauLtgatewayIPPrimaryDNSServerSecondaryDNSooo修改配置文件rootxgDesktop#cdetcsysconfignetwork-scripts/rootxgnetwork-scrlpts#Is"ifcfg-eth0ifcfg-loifdownifdown-bnepifdown-ethifdown-ipppifdown-ipv6ifdown-postifdown-pppifdown-routesifdown-sitifdown-tunnelifupifup-aliasesifup-ethifup-ipppifup-ipv6ifup-isdnifup-plipifup-plusbifup-postifup-routesifup-sitifup-tunnelifup-wirelessinit.ipv6-globalnet.hotplugnetwork-functionsifdown-isdnifup-bnep_network-functions-ipv6root<axgnetwork-scripts#vimifcfg-ethEe匚5iew*dcnjern11d11epDEVICE=eth0HWADDR=00:0c:29:81:9c:88NMCONTROLLED=yesONBOOT=yesf-IPADDR=192,168.31.44重启网络服务或者开机时,自动启动该网卡BOOTPROTO=none_NETMASK=255.255.255.0DNS2=8.8.8.8TYPE=EthernetGATEWAY=192,168.31.1DNS1=192,168.31.1IPV6INIT=noUSERCTL=noroot(Qxg/#etcinit.dnetworkrestartShuttingdownLoopbackinterface:BringinqUPIooPbaCkinterface:3ri11dinGUPinterfaceet间OKOKOKrootxgroot(3xgrootxgrootxgeth71#/#/#/#ifconfig1.inkencapFthernt_HWaddr00:0C:29:81:9C:88inetaddr192.168.31.44BCaSt:192.168.31.255Mask:255.255.255.0inet6addr:fe80:20c:29ff:fe81:9c8864ScopeiLinkUPBROADCASTRUNNINGMULTICASTMTU:1500Metric:1RXpackets:3657errors:0dropped:0overruns:0frame:0TXpackets:70errors:0dropped:0overruns:0carrier:0collisions:0txqueuelen:100RXbytes:322943(315.3KiB)TXbytes:9767(9.5KiB)扇192.168.31.44-SecureCRT-口文件(F)编辑(E)查看(V)选项(O)传城CD脚本(三)IB(L)帮助(三)后盅!口热凉|电量Q召福昌囱竺Q|国11192.168.31.44rootxg#aroot(xg#rootxg#rootx#rootxg#Issh2:AES-2565,1424行,80列VT18修改主机名:hostnameRedl临时修改需要退出exit然后在此登陆vimetcsyscofigetworkHOSTNAME=Redl永久修改,需要reboot9临时设置网关:routeadddefaultgw192.168.31.110查看硬盘的使用率和大小rootHDSdf-hFilesystemSizeUsedAvailUse%Mountedondevsdal29G6.6G21G25%/tmfs1.9G260K1.9G1%/devshmdevsr3.4G3.4G0100%mediaRHEL6.2x8664Disc1rootHDS.fI11挂载:将某一个存储硬件(U光盘)映射到某一文件夹里面mountxx(硬件)目录rootxgDesktop#mountdevcdcdromcdrwrootxgDesktop#mountdevcdrom/cisomount: block device devsr is write-protected, mounting read-onlyroot(9xg root(9xg root(3xg root(3xg rootxg EFI EULA GPLDesktop#Desktop#Desktop#DesktoB迷 Cd ciso ciso# ty-光盘里面的文件HighAvailability images isolinux LoadBalancer media.repoRELEASE-NOTES-kn-IN.html RELEASE-NOTES-ko-KR.html RELEASE-NOTES-ml-IN.html RELEASE-NOTES-m r-IN.html RELEASE-NOTES-or-IN.html RELEASE-NOTES-pa-IN.html RELEASE-NOTES-pt-BR.html Release-Notes-TU-RU.html12Iinux安装软件:1rpm安装2yum3脚本rpm-ivhxxx.rpm列如:使用rpm安装dhcp这个软件_root(9xgPackages#rpm-ivhdhcp-common-4.1.1-25.Pl.el6.x8664.rpmwarning:dhcp-common-4.1.1-25.Pl.el6,x8664.rpm:HeaderV3RSASHA256Signature,keyIDfd431d51:NOKEYPreparing.#10%packagedhcp-common-12:4.1.1-25.Pl.el6.×8664isalreadyInstalled13永久挂载临时挂载:mountxxdd将光盘永久挂载到cdrom1vimetcfstab# etcfstab# CreatedbyanacondaonMonMar2318:22:192015ft# Accessiblefilesystems,byreference,aremaintainedunder,devdisk,# Seemanpagesfstab(5),findfs(8),mount(8)and/orblkid(8)formoreinfo#devmappervgxg-lvroot/ext4defaults11UID=900bf526-d35-4899-af4-2ca7bac75b3/bootext4defaults1 2devmappervgXg-IVswapswapswapdefaultstmpfsdevshmtmpfsdefaultsdevptsdevptsdevptsgid=5,mode=620sysfssyssysfsdefaultsErOCproProCL三defaultsQdev/cdromcdromliso9660defaults0mount-a刷新挂载查看结果:df-h1.rootxgcromj#a-nFilesystemSizeUsedAvailUse%Mountedondevmappervgxg-Ivroot28G2.6G24G10%/tmpfs383M264K383M1%devshmdevsdal485M33M428M7%/bootdevsr3.4G3.4G0100%mediaRHEL6.2x8664Disc1devsr03.4G3.4G0100%cisodevsr3.4G3.4G0100%cdromlrool(§xg_cdroml#rcct/axcrrirml1#cdcdromlIs可以看到光盘里面的文件卸载:amountcdroml强制卸载:-Iumount-Icdroml检查:cdcdroml再次查看14压缩与解压缩将光盘里面的压缩包Vm。tar.gz复制到桌面挂载光驱,Vmwaretools如果光挂载不成功,reboot重启mountdevcdromffcd/ffIscdrootDesktop桌面路径cpffVmxx××x.tar.gz.常见压缩包:××××.tar.gzxxx.zip解压:tarxzvfx×xx.tar.gzunzipxxx.zip压缩:tarczvfuu.tar.gz*将当前所有的文件压缩到UU.tat.gz里面,uu.tar.gz就是压缩之后的名称ziptt,zip*将当前的所有文件压缩到ttzip里面tt.zip是新生成的压缩包文件在桌面上创建一个文件夹:abc,进入abc创建三个文件abc然后将abc里面的文件全部压缩到x.zip里面将xzip剪切到桌面,并解压15/下面常见的目录dev(device)硬件设备文件例如:光驱硬盘cpu等文件/root表示根用户的家目录/home其他用户的家目录/etc配置文件脚本执行程序/binsbin存放系统脚本文件mnt用来挂载其他的硬件设备var用来存放网页网站的内容16绝对路径相对路径绝对路径:从根开始,全部路径相对路径:相对当前所在的路径绝对路径:CProotDesktopaadev相对路径:CPaadev17SSH:Iinux之间远程登录的协议使用的端口号tcp22ssh:secure传输数据是经过加密较安全telnet:23远程桌面:3389越接-SecureCRT快速连接Bl文侬F)磔查看M选项(0)传瑜Cn脚本工Q)g¾J(三)刀刃乳哈妇QR品昌修L曾IM协议(P):SSK2V主机名(三):19216831455(0):叵二防火慵G):无用户名(U):root身份期EML一三KE).庠恻显示快速连推(W)0保话囱在一个标筌中打开(DIIL取消文件(F)编辑(E)查看(V)选项(O)_传输(T)脚本(SL工具(匕帮助(三)强通心热泡I电亳QIR铝膏I杳除?I然192.168.31.451.astlogin:MonMar2318:06:282015fromhzs-pcrootxgrootxgrootxgrootxgrootxgrotgroot(½g18SCP:基于SSh的CoPy可以远程传输文件windows向IinUX传输文件前提:ssh22号端口必须打开。一般来说,可以SSh等就可以使用SCP进行传输文件WinSCPSDocuments-root192.168.31.45-WinSCP本地(L)同M)文侬F)命令(O会话(三)S(O)S(R)SW(三)ISffl9 root©l9Zl68.31.45 Wi 务3在£×由国会先还sa i siQ W SttXW(F) %工占 Q Program r D: system i_f E: Software JE Gsco JG:珞 J H: Cco2 Jf 1: workroom t XiaoMi>TDd>U5ET'类2!上级目录 文件夫 文修夫 g央BJK2015/3/23 10:08:31B OgJSAS名字 rm 上.dbus i. bin i. boot j, cdrom1 1. ciso 3 dev大小已3&10:08:352015/2/42015/2/42015/2/42015/2/414:03:2014:03:20home lib Iib64 lost ar found media mc),mnti. netopt ProC root2015/3/23 18:45:33 2015/3/23 11:32:12 2015/3/23 18:38:31 2015/3/23 14:51:31 2015/3/23 13:35:25 2015/3/23 1721:29 2015/3/23 15:40:38 2013/10/18 9:54:33 2015/3/23 12:05:08 2015/3/23 18:31:20 2015/3/23 111:47 2015/3/23 18:21:21 2015/3/23 15:37:42 2015/3/23 18:45:14 2011/28 22:1301 2015/3/23 1M5:15 2011/6/28 22:13012015/3/23 18:44:332015/3/23 14:59:14rwx-rootr-xr-xr-xr-xr-xr-xrwxrxrxrvwxr-xrwxr-xr-xrwxrxrxr-xr-xr-xrwxrxrxr-xr-xr-xrxrxrxrw×rwxr-xr-xrwxrxrxrwxr-xr-xrwxr-xr-xrwxr-xr-xrxrxrxrootrootrootrootrootrootrootrootrootrootrootrootrootrootrootrootrootroot使用SCP在IinUX之间传输文件scpXXXSoot192168.3L75:/root/DeSktoP将本地文件XXX传至对方的桌面1.rooi(gxgUeSKloPJ不rootxgDesktop#scp×groot(3192.168.31.75:/传到对方的相曰录Theauthenticityofhost,192.168.31.75(192.16(!¾TT5)47establishedRSAkeyfingerprintis3b:12:8b:5a:85:bd:la:ef"f:b9:b5:4c:ff:99:58:b3.Areyousureyouwanttocontinueconnecting(yesno)?yesWarning:Permanentlyadded,192.168.31.75'(RSA)tothelistofknownhosts.rootl92.168.31.75'Spassword:Xg对方密码100%G0.0KBS00:00root©XgDesktop#jroot©XgDesktop#rootxgDesktop#rootxgDesktop#19系统关机重启指令poweroff=initO立即关机reboot立即重启shutdown-h1010分钟之后关机shutdown-r1010分钟之后重启终止:Ctrl+cshutdown-c20用户的创建和密码修改root最高权限1.IUULvyAy/什Orooxg/Jlsubbxg$bxq国KhAvri1C修改root密码:LIw/jrrroot(3xg/#IPaSSWdChargirgPaSSWOrdforuserroot.NeWDasWworchIBADPASSWORD:itisWAYtooshortBADPASSWORD:istoosimpleRetypenewpassword:passwd:allauthenticationtokensupdatedsuccesully.rootxg/#rootxg/#LCC+CZK/14useraddbb创建一个新的帐户bbpasswdbb给bb设置密码su-bb切换到bb帐户exit退出当前帐户21cd进入家目录cd-返回刚才所在的目录例如:1.rooLigxgdd开root(Qgbb#cd-devroot(Qgdev#rootxgdev#root(Qgdev#22挂载is。镜像文件将rhel镜像文件挂载到iso456su-rootvimetcfstabEileEditViewSearchTerminal7fesHelpbbxg:/×Ibbxg:/isol23#Accessiblefilesystems,byreference,aremaintainedunder,devdisk#Seemanpagesfstab(5),findfs(8),mount(8)and/orblkid(8)formoreinfo#devmappervgxg-lvroot/UUID=9bf526-d35-4899-af4-2ca7bac75b3/bootext4defaultsext411default12devmappervgxg-lvswapswapswapdefaults0tmpfsdevshmtmpfsdefaults0devptsdevptsdevptsgid=5,mode=6200sysfssyssysfsdefaults0Oproc/procprocdefaults00isol23rhel-server-6.2-x8664-dvd.isoiso456iso9660looplIg三:wq!I:wq!强制写入并退出w : wirte (保存) q:quit!强制FilesystemSi-usedAVdIlu>eMu led devmappervg xg-lvroot28G5.9G2IG23%/tmpfs383M456K383M1%devshmdevsdal485M33M428M7%/bootdevsr60M60M010%ffisol23rhet-server-6.2-×8664-dvd. isof rr 1 /K八 1 "3.4G3.4G010%iso456rootxg: rootxg -#1 mount -arootxg -#| df -7i-於b(xg"t3E23刷新挂载并查看挂载挂载成功检查:I I JJ 17/丫 J TTrootxg *# cd iso456rootxg iso456# IsEFIEULA GPL HighAvailability images isolinux LoadBalancer media.repo Packages READMERELEASE - NOTES-as-IN.htmlRELEASE-NOTES-es-ES.html RELEASE-NOTES-fr-FR.html RELEASE-NOTES-gu-IN.html RELEASE-NOTES-hi-IN.html RELEASE-NOTES-it-IT.html RELEASE - NOTES-ja-JP.html RELEASE-NOTES-kn-IN.html RELEASE - NOTES-ko-KR.html RELEASE-NOTES-ml-IN.html RELEASE-NOTES-mr-IN.html RELEASE-NOTES-or-IN.htmlRELEASE - NOTES-si-LK.html RELEASE-NOTES-ta-IN.html RELEASE-NOTES-te-IN.html RELEASE-NOTES-zh-CN.html RELEASE-NOTES-zh-TW.html repodata ResilientStorage RPM-GPG-KEY-redhat-beta RPM-GPG-KEY-redhat-releaseScalableFileSystem Server23软连接快捷方式Is-I=ll在/目录下面给network-scripts目录创建一个快捷方式,快捷方式的名字为abe1.roo(gxgaocjtfc/rootxg/#In-setcsysconfignetwork-scripts/rootxg /# total 120 Jrw-r-r-. Ilrwx rwx rwx.1 root root1 root root031MarMar232320:10 20:07 匚二I ->etcsldr-xr-xr-x.2rootroot4096Mar 2311:32(bin dr-xr-xr-x.5rootroot1024Mar 2318:38bootdrwxr-xr-x.2rootroot4096Mar 2314:51cdromldrwxr-xr-x.2rootroot4096Mar 2313:35cisodrwxr-xr-x.19rootroot3860Mar 2319:02devI d rt./v r _ v r _ vrnl-LCC十1 OOQPMar X9 1o+r*ysconfig/network-scripts/24权限r : read 4w : write 2x:执行1(针对一些脚本)权限5=4+l=r + x代表读和执行的权限7 =4+2÷l最高权限Chmod 777 aa将文件aa赋予777的权限7 :文件aa的所属用户7: