期末综合练习2综述_第1页
期末综合练习2综述_第2页
期末综合练习2综述_第3页
期末综合练习2综述_第4页
期末综合练习2综述_第5页
已阅读5页,还剩14页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、期末综合练习 2 (8、7、5)1. 破解密码,进入系统进入linux系统后,按 E进入以下界面中添加:RW INIT=/SYSROOT/BIN/SH1 i nuxlB /vril imiz-30-123 巳17 root =UU ID3cbdc324-de74-4b82-daXtjb=9f fe38e29794 fh in i t /ssroatzb in/shrd - 1 vh 1乏:rhe; Hhjnoioil; crashkeme 1 -onto 、按快捷键CTRL+X进入一下界面输入:chroot /sysroot进入vi模式:VI /SELINUX/CONFIG将selinux的值

2、修改为disabled,如下所示This fIle controls the state of SELinux on the system nt SELINUX= can take one of these three valiie: tt enforcing - SELinux security pul icy Ls enforced . tt permissiue - SELimux prints yarning instead of enforcing. Hd isabled No SELinuK policy is loaded.ELbUX=disab)cd_ tt SELIHUXTV

3、PE= enn take one af these tuo values: n targeted - Targeted processes are protected, itn in i nun Modi f icat ion of targeted policy. Only se Lectedl processes are protected,nls - Hultl Level Security protection.KEL1NUKTVPEtavgEted重启后选择root用户,输入修改密码 登陆成功,如下所示:chen login: rootPassword :Last login* Tu

4、e Nou 1? 05:29:11 on ttyl rootPchen #2. 修改主机名,IP地址等信息登陆 root 用户后输入命令: HOSTNAMECTL SET-HOSTNAME GAOYArootOchenliostnanect 1 set-hostname gaoyarootllchen 1#查看设置成功与否:rooteclien lit hostname gaoyaroot(?clien Jtt重启后显示成功:gaoya login: rootPassword:Last login: Tue Dec 29 03 37:48 on ttyl rootgaoya ltt查看IP地址

5、,显示未安装,这里先配置YUM在安装ip服务:rootPgaoya tt if conf ig-bash: i fconfig: command not foundrooWgaoya Id _将光盘挂载在/mnt 目录下:mount/dev/srO /mntroot(*gaoua Jtt Nount /deu/srO znnt进入vi模式: vi /etc/yum.repos. d/local.repo 输入以下内容:rootgaoya 111 u i /巳tc/yun * repos. d/ loca 1 . repo lucall iiciine= local gpgcheck=l ena

6、ble=l baseurlfIle:/mnt/ gpgkey=f lie :/tnTit/RPM-GPGKEY-redhatrelease建立yum缓存:rcatiUsidDLiayun nakc匚盘亡Loaded plugins; product-id. subscription-inanagerTh is system is not reg istcred to Red iHat Subscr ipt iaim HiinkageraE-nt. You can use subscr i|pt ion-nainager to register. local(1x5): 1 oc D ZgrQi

7、iip_gz(2/5): localzfi)elists_db(3?5): 1 ocn I Zpr i iwry_db(4/5) - 1 oca 1 zp-roductid(5/5): 1 ocai 1 /other_dLftetaddta Cache Created进入光盘挂载的目录中的PACKAGE中:rootgaoya ltt cd /mnt/P读ckages/显示此目录中net-tools的rpm包:rootg-aoya Packages lit Is net-too Is* nettools-Z.O-O * 17.Z0131004g辻.el?.x86_64.rpm rootSgaoy

8、a PackagesK使用YUM进行安装:rootgaoya Packages# yun install net-tools-Z.0-0-l?.Z0131GO4g辻亡1?k8Ej_64.rpm安装成功显示如下:Insta1led:net-too1sx86_64 0:2.0-0.17.Z0131004git.el?Complete *root国gfDua Facknq巳召JM查看IP地址,如下(现在还未设置)LirooCgaLoya Packages Jtt i fconf igens33: f lags = 4163 亡 GO : g : 4e : bh : f3 -txKiuxeve: 1

9、en, 1066RXRXTXTXt xqu 亡*u 1 En packets 827 bytes 79G17 (7?.1 KiB) errors O packets O errors Omu 15GGdropped O ouermuns Ofiamebytes O CO B)dropped O ovcrruriLS O carr icr 0ciol 1 isiemw Ojruotl3goiiDyia Pockagus litflags=73 mtu 6553& fnet 1Z7netiTiask 255.0 .O_Qi netG : : 1 prefix lem 1Z9 scope id Ox

10、IOCJtosO loop txqueue 1 en 0 (Loca l Loopbaclk )RX RX TX TXpackets 8 err*口i-s: Q packeits 8 errors Qbytes 5ZQ (5ZG.G Bidropped 0 ovcrruiis 0frciinc 0bytes: SZ0 (S20.0 B)dropped 0 overriums O cari? ier* 0co 1 1 iianns O进入网络设置文件,并显示其内容:ruulfty irdwni|p i rdwn- $ 卩谕 i.fdfnjn-idnifdlotm-pos t Ifdauim pp

11、p ifdakfUirrcvutes i f dnim-K i tinetwork-scrintsJiI rdouii-Tcm irdouri TcMPort firduMii-lLiiiivelI Tupifup-a liases ifiLp-fcincp Irup-eth ifu.p- ifijipifup-ipu& i Flip lisdn ifup-pi ip a Fup-plushifuip-pos-t Lftiprppp 1 rip-r tinier Lfup-Kii tifup-Teft ifup TcinPort ifup-tuiineinit. ipu6-npIota 1 n

12、etwork functlams iigtwurk- ruiiet i 口 hm查看:使用vi命令进入i fcfg ens33rocrtgoiy& TiEtiiiork-:scjrip1/slt uim现在开始配置ip地址:HUADDR=00:0C:29:6Z:C0:BATYPEEtheimetB DO TPB DTD=iioneDEFROUTE=yesPEERDMS=yesPEERROUTES=yesIPU4,FAILURE_FATAL=noIPUeYNITyes rPU6_AIITOCOMF=yesIPU6_DEFRDUTE=yes lPU6_PEEBDNS=yes rPU6_PEERfi

13、OUTES=yesIPU6,FAILUREFATAL=noNAriE=ens33UUID=7fdzezoz-f5ce-4a6a-b173-481Zalb9?5c?ONBOOT=yesIPADDfi=19Z.16B.5.13?METMASK=255 Z55.Z55.0GATEUAV=19Z.168.5.1DMS119Z.168.5.1(注意:设置如IP地址等, 需要查看HWADDR的值是否跟为设置的ETHER端口的 值是否一样,如不一样将会报错) 上图就是不一样,现在将其修改:HUADDR=OO:OC:Z3:4e:bb:f3将网络服务开启:rooteqeQmsqstemctlNet work再次

14、查看ip,显示设置成功:rootyaoya network-scripts)w irconfinens33f1ags =4153 ntu 150inet 192.16B.5.13? netmask broadcast 55 inct6 rcBO:20c:29fr:fec:bbf3 prefixlen 64 scopeid 0x20 ether 00 :Oc :Z5 :bb : f3 txqtieuelen 1000 (Ethernet)RX packets LB7& bytes 1B3057 t17B.7 KiB)RX errors 0 dro

15、pped 0 ouerruns 0 Prane 0TX packets 25 bytes 3733 (3,6 KiB)TX errors Q dropped 0 ouerrtins Q carr ler 0 col 1 is Ions 0lo: f1agS=?3RUMNING ntu 6S536 inet 1Z7.0,0.1 nctnask Z55.0.0.lnetft : : 1 pref ixlen 128 scope L1 OxlOloop txqueuelen 0 (Laca1 Loopback)RXRXTXTXpackets B errors 0 pncKetw B errors O

16、bijtes S20 C520.0 B) dropped 0 ouerruns 0 franc Gbytes 520 (5ZQ,0 E )dropped 0 ouerruns carrier 0cal 1 isions O3. 在虚拟机中添加一块 SCS磁盘二薪便蓋矗虽巧150 GB登陆系统后查看添加成功与否:Fdisk -iDisk zdeu/sdb: 161.1 GB, 161061273600 bytes, 314572000 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512

17、bytes / 512 bytes1/0 size (mininum/optimal): 51Z bytes / 51Z bytes4. 划分2个主分区,25GB、60GB,剩余空间作为扩展分区 划分一个主分区起大小为 25GBrootdaaoua Jtt fdisk /deu/sdbCommand (r for help): nPartition type:p primary (0 primaryj 0 extended, 4 free)e extendedSelect (default pl: pFart 11ion number (1-4, default U: 1First secto

18、r (2048-314572799, default Z048):Using default ualue 2048Last sector* +sectors or +size(KPH,G) (Z049-3K572799, default 311572733): +256Fartition 1 of type Linux and of size Z5 GiB is set查看:Conmand (m for help): pDisk /deu/sdh: 161.1 GB, 1G1061273600 bytesf 3H57Z890 sectors Units = sectors of 1 * 512

19、 = 512 bytesSector size (Jayical/physical): 51Z bytes / 51Z bytes 1/0 size (mininun/optiMal): 51Z bytes / 51Z bytes Disk label typE: dosDisk identifier: 0x2Ole0384Deuice 恥毗StartEndBlocksIdSystemzdeu/sdbl20485Z430847Z62144Q083LinuxComm叔n浪(m fof help):在此划分一个主分区 其大小为:60GBCummand (.n for help: nPartitio

20、n type;p prinary (1 primary7 0 extended, 3 free)e extendedSelect (deTauIt p): pPartition number (Z-4, default 2): ZFirst sector (52130048-311572739, default 52430B4B):Using default value 5230048Last sector, *sectors or 估i船(52430348-314572799, default 314572799): +60G Fartition 2 of tupe Linux and of

21、 size 60 GIB Is setConwand (ht for help): pDisk /deu/sdb: 161,1 GBj 1610612736Q0 bytes 3145728Q0 sectors Units - sectors of 1 * 512 = 51Z bytesSector size Cloqical/pfiijsical) : 51Z bytes / 51Z bytesI/O size (mininumzoptimal): 51Z bytes / 512 byteDisk labe1 type: dosDisk identifier: Gx201eO364Deu ic

22、e BootStartEndBlocksIdSystemzdeu/sdbl2048524308472621440083Linux/deu/sdb2524308481782599676Z91456083L i nux剩余空间作为扩展分区Comm nd (m for help】:nPartition type:P primary urinary, 0 extended E rrcc)e extendedSelect (default p: e氏irt辻ion number (4, defau It 3): 3First sector (17SE5S968-31457Z7S9, default 17

23、8Z59968):Using default ualue 170Z5996BLast sector J +sectors or +s i ZLE CK (H! GJ (1782568-3145727! default 314572799);Using default ualue 31457Z799FeurUtion 3 of type Extended and of size 65 GiB is set查看:Cumnand for help): pBisk /deu/sdb: 161.1 GB 161061273600 bytes 314572800 sectors Units = secto

24、rs of 1 * 51Z 二 12 bytesBector size (logical/pfiysical) : 51Z bytes / 51Z bytes1/0 size (m liiinum/optimal): 512 bytes / 512 bytes Bisk label type: dosDisk identifier: 0xZ01e0384Deuice BootStartEndB lodesIdSystem/deu/sdb126485Z430B47Z6Z1440663Linux/deu/sdbZ524308481782593676Z91456083Linuxzdeu/sdb317

25、8Z59966314572799681564165Extended5.在扩展分区中建立 2个逻辑分区,容量分别为 2GB、10GB 建立一个逻辑分区为 2GComnAnd (m for help): nFart it ion type: p primary (Z prinary 1 extended1 free) 】 logica1 (numbered fron 5)Select (default p): 1I4dd I ng logical partition 5First sector (173262016-314572733, default 17aZ&Z016):Using defau

26、lt Udluc 17BZ6Z016Last sector *sectnrs or *sizeMG (170Z6ZG16-314572793 default 314572799): +ZGPartition 5 of type Linux and of size Z. is setComnand (m for help): pDisk zdeu/sdb:161.1 GB, 161061273600bytes, 311572900sectorsUnits - sectorsfl* 512 ;=51Z bytesSector size (loical/physical): 51Z bytes /

27、512 bytesI/O size (mininun/optimal):51Z bytes/ 51Z bytesDiwk labe1 type:dosDisk identifier:0xZOleO384Deuice BootStartEndBlocksIdSystem/deu/sdbl2465Z43034?262144(10B3Linux/deu/sdbZ5Z43084817BZ59%?6Z914560B3LinuxzdEu/sdb317B259968314572799681564165Extendedzdeu/sdbS17B2620161824563192097152的Linux再次建立一个

28、逻辑分区10GConmaiid (n for help) : 11Partition type:p卩rinary (Z prinary L extended L free)1 logical (numbered from 5)Select (default p): 1Adding logical partition 6rirst sector 110Z45B36H-31457Z7S3, default 10256360J :fuming de Fault ualue 18Z4583B8last sector, +sectors or +size (L8245B368-31457Z73S, de

29、fault 3HS72793): +10GPartition 6 of type Linux and of size 10 GiB is set查看:Command (m for help): pDisk zdeu/sdb:161.1 GEi 161061273663bytes, 314572800sectorsUnits 二 sectorsof 1 512 =512 bytesSector size (log-icalzphysical): 51Z bytes / 51Z bytes1/0 size (nininumoptimal?:512 bytes/ 512 bytesDisk labe

30、l type:dosDisk identifier:0x201e0384Deuice BootStdftEndBlocksIdSystemLdeu/sdbl2048524308472621440083L imux/deu/sdb252430848178253%?6231456083Linux/deu/sdba1259968314572299681564165Extended/deu/sdbS17826Z016182456319209715283L inuxzdeuzsdbB1B24583692O34Z3B871048576083L inux保存退出:Command 5 for help): u

31、The partition table has been altered?Calling loct1() to re-read 辻Ion table 357.5367Z21 sd 0:0:l:Q: sdb Assuning driue cache: write tlirouyli Syncing dis;s.rootQgaoya 4t6.将第1个逻辑分区的类型改为swap、主分区1为ext4、主分区2为XFS第1个逻辑分区的类型改为swap:由于swap的id是82,所以这里的 Hex code输入82:rootPgaoya fdisk /deu/sdbHelcome to fdisk Cut

32、illinux 2.23.2).Chamcfes ui 11 remain in men or y onlyj until you decide to write them. Be carefuI before using the write conmand.Comnaiid (n for help): tPartition number (1-3,5,6, default 6): 5Hex code (type L to 11st all codes)I 82Changed type of part ition 1 Linux1 to 1 Linux suap / Solar查看:IConm

33、and (mfor help): pLisk /deu/sdb: 161.1 GB. 161061Z73600 bytes, 31457Z800sectorslUnits = sectors of 1 * 512=512 bytesISector size (logica 1/physical): 51Z bytes / 51Z bytesIl/O size (mininum/optina1):512 bytes /512 bytesiDisk labeltype: dosDisk identifier: OxZ01eO384DeuiceBuoitStartEndBlocksIdSystemz

34、deu/sdbl204B5243004726Z1440003L inuxzdeu/stlbZ5Z430B48178Z599676Z91456083Linuxdeu/sdbJ179Z59S6B314572799601564165Extendedzdeu/sdb5178Z6ZG1618Z456319Z03715Z8ZLinux suap z Solariszdeu/sdb61824583602031290871048576093Linux保存并退出:Command Cm for help): uThe partition table has been altered!GUling ioctlC)

35、to re-read partition table,749 .6603163 sd 6 :0:l:G : CsdbJ Assuming drive cachei ur辻c through Syncing disks +主分区1为ext4rrootgaoya fl mkfs,ext4 /deuzsdblmkeZfs 1.4Z.9 (ZB-Dec-ZG13)Filesysten label -OS type LinuxBlock size=4096 (lag=2)Fragment size=4096 (log=Z)Stride=0 blocks, Stripe width=0 blocks163

36、8100 inodes, 6553600 blocks3Z7&B& blacks (5+WK) reserued far the super user First data block=0Maxinum filesystem blocks= block groups3Z768 blocks per group, 3Z76G fragments per groupB19Z inodes per groupSuperb lack backups stared on b Eachs:32768, 9B304. 163Bi0 229376, 23121 019ZOO*1S05

37、632,4096000Allocating group tables: doneWriting inode tables: doneCreating Journa1 (32768 blocks): doneUritimg superblocks and filesystem accounting lnfornatfan: donerootqraoLia *1主分区2为XFSrootOgaoya 1H nkfs +xfs/deu/sdbZneta-data=/deuZsdbZisize=Z56agcount =4, agsize=393Z16G blkssectsz=S12attr=2, pro

38、jid32bit=l=crc=0data-bsize=4D9Gblocks=157Z8640, imaxpct=Z5=sun it=Gsuidth=0 blksnaming=uersion Zbsize=4096asci ici=Q ftype=Olog=i nterna1 logbsize=40%blocksSBO, uersion=2=sectsz-512sun it=0 blks lazy-count=lrealt ime=noneextsz=4096blocks=0, rtexteints=0rootQgaoya Ju7.确认分区设置情况,保存退出Command Cm for help

39、): uThe partition table has been altered!Calling ioctlC) to re-read partition table,749 .6603163 sd 6 :0:l:G : CsdbJ Assuming drive cachei ur辻c through Syncing disks +8. 将新分区挂载到/home目录下,设置开机自动挂载新分区挂载到/home目录rootgaoya /J4t nount zdeu/sdb2 /hone rootgaoya /# nount zdeu/sdbl /Jione rocrtnaoua /Jtt设置开机自

40、动挂载Vi /etc/fstabn zettzzfstAb” Created by anaconda on Kon Nou 16 Z1:Z3:34 Z01511 Accessible f i, lesL|stEmst by reference UUID=ldaOb9cd-eBd34364-93e9-O10bebde3851 rootaaoua /#显示分区使用情况rootPgaoya /lit freetotalusedfreesharedbufferscachedHen:1B85472Z33356165Z11&8680111&88172-/+ buffers/caclie :14406B17

41、41404Suap:113430004134300CrooWgaoya /#设置开机自动挂载进入vi编辑器修改文件:vi /etc/fstabIrooteiiaoua /# ui /etc/fstabzdev/srlbSswapdefaults/etc/fstab1 15Lj 694C written root(iaoija Zltt查看:4flrnotffgaoya zjli cat /etc/fstab/etc/fstabCreated by dhaconda on Hon Nuu 16 21 :23Z015ftnftcc匚営客iblu filesystensj by rcfcrcnciE

42、, orc maintained under /dcu/disl(J See nan pagcs fstab(5) ? f indfs(B) raoumt (8) and/orblkidCB) for nareinfo4zdeu/raapper/rhe 1 - root/xfsUUID=b?5a473b-edaS-483d-B539-6d403 822145 zboot /deu/napper/rhe -sua psuapsuap/deu/sdbl/honeext4/deu/sdb2/honexfs/dfiu/sdb5suspwapdefaultsdefaults defaults defau

43、lts defaultsxfs1 defaultsruott!阿J /JHrootegaoya F ilesysten deutmpfs root(?yaouacdronZltt dfType deutnpfs cdronZJtt-hT /deu/sdb5Size Used Auai1 Usex nounted on915M0 915M OZ /deu10. 服务器每次开机自动挂载RPM.iso在设置自动挂载 RPM.ISO时,需要查看虚拟机设置时,是否添加那个光盘镜像:* *新匚D/DVD (IDE)正在便用文件E:RPM.iSO进入 vi 编辑器,修改 /etc/fstab : Vi /e

44、tc/fstabIrooWgaoya cdromZl# ui /etc/fstabzdev/srO/nnt/cdronliso660 defaults0 0查看挂载成功与否:rootegaoya FilEsystM /deu/srOrootBgaoiyacdron2t dfType ixo9660 cdronZJtt-hT zdeu/srSize Used Avail Usez nounted on &36M636M0 100z /nmt/cdroml11. 服务器每次开机自动挂载rhel-server-X-X-dvd.iso光盘镜像在设置自动挂载 rhel-server-X-X-dvd.is

45、o时,需要查看虚拟机设置时,是否添加那个光盘镜像:CD/DVD (IDE) 正在使用丈件 E:rhel-server-7.0-X8. .进入 vi 编辑器,修改 /etc/fstab : Vi /etc/fstabl/deusrlznnt/cdromZiso966G dePau ItsG Ol保存并退出:/etc/fstab1 16Lf 84bC ur itten rootPuaoua cdromZltt查看:rootgaoya Fi iesysten zdev/srlcdromZ# df -hl /deu/sr1TypeSize Used Auai1 Usez Mounted oniso?6

46、60 3.5G 3,5G0 100Z zmnt/cdronZrootgaoua cdromZ Jtt12. 公司准备邮件服务器由于用户数量众多,考虑到动态扩容的需要,计划增加两块SCSI硬盘并构建LVM逻辑卷(挂载到 “/mailbox目录下)专门用于存放邮件数据添加两块硬盘:35fi(SCSI)200 GB硬S 2 (SCSI)200 GB查看添加成功与否:rootgaoya lit fdisk -1104.770673 end_reqiiest: f/0 error, deu fdO, sector 0Disk zdeu/sdb: 214.? G叭 bytes,

47、419430400 sectors Units = sectors of 1 w 51Z =512 bytesSector size (logica1/physica1): 51Z bytes / 51Z bytesI/O size (mininun/optiMalJ: 512 bytes / 512 bytesDisk zdeu/sdci Z14*7 GB 214748364800 bytesj 418430400 sectors Llnits - sectors of 1 * 51Z = 51Z bytesSector size (logical/pliysica 1J : 51Z byt

48、es / 51Z bytes1/0 size (.mininun/aptima 1) : 51Z bytes / 51Z bytes将硬盘分区:rootgaoya ft fdisk /deu/sdbCommand (m for help)nPartition type:p primary (0 primaryf 0 extended, 4 freeJ e extendedSelect (default p】:pPartition number (1-4, default 1:First sector (2048-419430399, defaultUsing default ualue 204

49、BLast sector, +sectors or +sizeKPM,G) Ualue out of range.Last sector, +sectoir or +sizeM,l1#G?Partition 1 of tgpe Linux and of sizeZO40):(2049-4130399,208-413430399,20 GIB is setdefault 419430399): EOGdefault 419430339): *Z0GCommand (m for helpl : uThe partition table has been altered!Callinq ioct1CJ to re-read partition table.101.574E531 sd 2:1:0; sdb Assuming driue cache: urite through Syncing diks.rootOqaoua 1#“lit fdiskCannand (h for help): nPartition type:p primary (0 primary, 0 Extended, 4 Free)e extendedSelect (de

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论