中南大学Linux系统实验报告.docx
- 文档编号:24475376
- 上传时间:2023-05-27
- 格式:DOCX
- 页数:33
- 大小:1.47MB
中南大学Linux系统实验报告.docx
《中南大学Linux系统实验报告.docx》由会员分享,可在线阅读,更多相关《中南大学Linux系统实验报告.docx(33页珍藏版)》请在冰豆网上搜索。
中南大学Linux系统实验报告
Unix/Linux系统
实验报告
学院:
信息科学与工程学院
指导老师:
胡小龙
班级:
信息安全1401班
学号:
0906140106
姓名:
孙毅
时间:
2016年12月
实验一Linux的安装(课后)
1、实验目的
(1)了解硬盘分区的概念和方法;
(2)掌握硬盘的分区规划;
(3)掌握Linux操作系统的安装和配置过程。
2、实验设备
一台pc机、RedHatLinux7.2以上版本、VMwareWorkstationv5.5
3、实验原理
Linux可以以多种方式安装在PC机上:
(1)独立分区安装;
(2)DOS分区安装;(3)虚拟机VMWare下安装。
鉴于VMware下安装对原来系统影响较小且不影响本实验目的,因此采用VMWare下安装方式。
4、实验步逐
(1)在WindowsXP下安装VMware5.5
(2)配置虚拟机
(3)启动虚拟机
(4)启动Linux安装过程
(5)安装过程配置
(6)安装后配置
(7)第1次启动VMWare下Linux操作系统
Linux安装过程:
(1)语言选择:
(2)键盘配置:
(3)鼠标配置:
(4)选择安装还是升级:
(5)安装类型:
(6)磁盘分区设置:
(7)为系统分区:
(8)添加分区:
(9)引导装载程序配置:
(10)网络配置:
(11)防火墙配置:
(12)语言支持的选择:
(13)时区配置:
(14)设置根口令
(15)选择软件包组:
(16)准备安装:
应该看到一个安装RedHatLinux做准备的屏幕。
当你重新引导系统后,一份完整的安装日志可在/root/install.log中找到,以备今后参考。
要取消安装进程,按计算机的重新启动按钮,或者使用[Control]-[Alt]-[Delete]组合键来重启计算机。
(17)安装软件包:
(18)创建引导盘:
(19)视频卡配置:
(20)配置显示器:
(21)定制配置:
(22)安装完成
实验2Linux基本操作
1、实验目的
(1)复习Linux基本命令
(2)掌握常用Linux命令
2、实验内容
(1)练习命令行模式下的常用命令:
man:
命令帮助
ALT-Fx:
虚终端切换
常用命令:
cat、Ls、ps、chmod、kill、ln、cp、mv、rm、cd、pwd、mkdir、chown、who、w、wc、whoami、date、uname等
命令实例:
root@soamazing-desktop:
~#touchtest
root@soamazing-desktop:
~#cattest
aaaaa
root@soamazing-desktop:
~#ls
test公共的模板视频图片文档下载音乐桌面
root@soamazing-desktop:
~#psman
PIDTTYSTATTIMECOMMAND
753tty7-0:
10/usr/bin/X:
0-nr-verbose-auth/var/run/gdm/auth-fo
--Ss+0:
10-
1081pts/0-0:
00bash
--Ss0:
00-
1138pts/0-0:
00psman
--R+0:
00-
root@soamazing-desktop:
~#ls-l
total36
-rw-r--r--1rootroot62011-04-1222:
20test
drwxr-xr-x2rootroot40962011-04-1215:
40公共的
drwxr-xr-x2rootroot40962011-04-1215:
40模板
drwxr-xr-x2rootroot40962011-04-1215:
40视频
drwxr-xr-x2rootroot40962011-04-1215:
40图片
drwxr-xr-x2rootroot40962011-04-1215:
40文档
drwxr-xr-x2rootroot40962011-04-1215:
40下载
drwxr-xr-x2rootroot40962011-04-1215:
40音乐
drwxr-xr-x2rootroot40962011-04-1215:
40桌面
root@soamazing-desktop:
~#chmod888test
chmod:
invalidmode:
`888'
Try`chmod--help'formoreinformation.
root@soamazing-desktop:
~#chmod--help
Usage:
chmod[OPTION]...MODE[,MODE]...FILE...
or:
chmod[OPTION]...OCTAL-MODEFILE...
or:
chmod[OPTION]...--reference=RFILEFILE...
ChangethemodeofeachFILEtoMODE.
-c,--changeslikeverbosebutreportonlywhenachangeismade
--no-preserve-rootdonottreat`/'specially(thedefault)
--preserve-rootfailtooperaterecursivelyon`/'
-f,--silent,--quietsuppressmosterrormessages
-v,--verboseoutputadiagnosticforeveryfileprocessed
--reference=RFILEuseRFILE'smodeinsteadofMODEvalues
-R,--recursivechangefilesanddirectoriesrecursively
--helpdisplaythishelpandexit
--versionoutputversioninformationandexit
EachMODEisoftheform`[ugoa]*([-+=]([rwxXst]*|[ugo]))+'.
Reportchmodbugstobug-coreutils@gnu.org
GNUcoreutilshomepage:
//www.gnu.org/software/coreutils/> GeneralhelpusingGNUsoftware: //www.gnu.org/gethelp/> Reportchmodtranslationbugsto //translationproject.org/team/> root@soamazing-desktop: ~#ls-l total36 -rw-r--r--1rootroot62011-04-1222: 20test drwxr-xr-x2rootroot40962011-04-1215: 40公共的 drwxr-xr-x2rootroot40962011-04-1215: 40模板 drwxr-xr-x2rootroot40962011-04-1215: 40视频 drwxr-xr-x2rootroot40962011-04-1215: 40图片 drwxr-xr-x2rootroot40962011-04-1215: 40文档 drwxr-xr-x2rootroot40962011-04-1215: 40下载 drwxr-xr-x2rootroot40962011-04-1215: 40音乐 drwxr-xr-x2rootroot40962011-04-1215: 40桌面 root@soamazing-desktop: ~#chmodu-w,g+w,o+wtest root@soamazing-desktop: ~#ls-l total36 -r--rw-rw-1rootroot62011-04-1222: 20test drwxr-xr-x2rootroot40962011-04-1215: 40公共的 drwxr-xr-x2rootroot40962011-04-1215: 40模板 drwxr-xr-x2rootroot40962011-04-1215: 40视频 drwxr-xr-x2rootroot40962011-04-1215: 40图片 drwxr-xr-x2rootroot40962011-04-1215: 40文档 drwxr-xr-x2rootroot40962011-04-1215: 40下载 drwxr-xr-x2rootroot40962011-04-1215: 40音乐 drwxr-xr-x2rootroot40962011-04-1215: 40桌面 root@soamazing-desktop: ~#chmodu+w,g-w,o-wtest root@soamazing-desktop: ~#ls-l total36 -rw-r--r--1rootroot62011-04-1222: 20test drwxr-xr-x2rootroot40962011-04-1215: 40公共的 drwxr-xr-x2rootroot40962011-04-1215: 40模板 drwxr-xr-x2rootroot40962011-04-1215: 40视频 drwxr-xr-x2rootroot40962011-04-1215: 40图片 drwxr-xr-x2rootroot40962011-04-1215: 40文档 drwxr-xr-x2rootroot40962011-04-1215: 40下载 drwxr-xr-x2rootroot40962011-04-1215: 40音乐 drwxr-xr-x2rootroot40962011-04-1215: 40桌面 root@soamazing-desktop: ~#ln ln: missingfileoperand Try`ln--help'formoreinformation. root@soamazing-desktop: ~#ln--help Usage: ln[OPTION]...[-T]TARGETLINK_NAME(1stform) or: ln[OPTION]...TARGET(2ndform) or: ln[OPTION]...TARGET...DIRECTORY(3rdform) or: ln[OPTION]...-tDIRECTORYTARGET...(4thform) Inthe1stform,createalinktoTARGETwiththenameLINK_NAME. Inthe2ndform,createalinktoTARGETinthecurrentdirectory. Inthe3rdand4thforms,createlinkstoeachTARGETinDIRECTORY. Createhardlinksbydefault,symboliclinkswith--symbolic. Whencreatinghardlinks,eachTARGETmustexist.Symboliclinks canholdarbitrarytext;iflaterresolved,arelativelinkis interpretedinrelationtoitsparentdirectory. Mandatoryargumentstolongoptionsaremandatoryforshortoptionstoo. --backup[=CONTROL]makeabackupofeachexistingdestinationfile -blike--backupbutdoesnotacceptanargument -d,-F,--directoryallowthesuperusertoattempttohardlink directories(note: willprobablyfaildueto systemrestrictions,evenforthesuperuser) -f,--forceremoveexistingdestinationfiles -n,--no-dereferencetreatdestinationthatisasymlinktoa directoryasifitwereanormalfile -i,--interactivepromptwhethertoremovedestinations -s,--symbolicmakesymboliclinksinsteadofhardlinks -S,--suffix=SUFFIXoverridetheusualbackupsuffix -t,--target-directory=DIRECTORYspecifytheDIRECTORYinwhichtocreate thelinks -T,--no-target-directorytreatLINK_NAMEasanormalfile -v,--verboseprintnameofeachlinkedfile --helpdisplaythishelpandexit --versionoutputversioninformationandexit Thebackupsuffixis`~',unlesssetwith--suffixorSIMPLE_BACKUP_SUFFIX. Theversioncontrolmethodmaybeselectedviathe--backupoptionorthrough theVERSION_CONTROLenvironmentvariable.Herearethevalues: none,offnevermakebackups(evenif--backupisgiven) numbered,tmakenumberedbackups existing,nilnumberedifnumberedbackupsexist,simpleotherwise simple,neveralwaysmakesimplebackups Reportlnbugstobug-coreutils@gnu.org GNUcoreutilshomepage: //www.gnu.org/software/coreutils/> GeneralhelpusingGNUsoftware: //www.gnu.org/gethelp/> Reportlntranslationbugsto //translationproject.org/team/> root@soamazing-desktop: ~#who roottty72011-04-1222: 11(: 0) rootpts/02011-04-1222: 12(: 0.0) root@soamazing-desktop: ~#whoami root root@soamazing-desktop: ~# (2)编辑器vi的使用: 使用vi建立并修改一个文本文件 root@soamazing-desktop: ~#vitest (3)档案管理: rpm、gzip、tar等命令 (4)网络命令: telnet、ftp、talk 3、实验记录 在实验过程中,记录到的实验现象: 系统启动 1、Manls 按q退出 2、w、who、whoami命令 查看当前登录主机的所有用户 3、查看自己的bash相关进程: ps–l 4、rpm命令Linux是否安装logrotate软件,并且列出属于该软件所提供的所有目录和文件 5、将/etc/man.config复制到/tmp中,并且以gzip压缩 6、使用tar备份/etc/man.config目录 7、由于本机网络配置及其软件下载问题,导致网络设置命令无法成功实现 实验3Linux系统管理 1、实验目的 (1)掌握Linux基本系统管理命令 (2)掌握基本管理方法 (3)初步了解Linux中与系统管理相关的有关配置文件 2、实验内容 (1)用户管理 adduser、useradd、passwd等 观察: /etc/passwd文件 (2)文件系统管理 df、du命令使用 mount、umount命令使用: 安装usb盘或者光盘,查看分析/etc/fstab文件 (3)存储器 free: 了解存储器使用情况 (4)关机 halt、shutdown–h、init0 reboot、shutdown-rnow 并比较它们之间的差别 (5)网络配置 netconfig的使用 (6)启动配置 /etc/inittab: 查看、修改并观察其响应 3、实验记录 在实验过程中,注意记录实验现象 A、用户管理 建立新的用户: gang,并且设置密码 B、文件系统管理 分别用df–h将容量结果以易读的容量格式显示出来,用du显示出了/etc/man.config的内容。 挂载了用来安装linux的原版光盘,用df查看后,解除了挂载 C、存储器 Free命令 实验4LinuxShell程序设计 1、实验目的 (1)掌握Linuxshell程序运行方法 (2)掌握LinuxShell程序基本语法 (3)了解Linux环境变量 (3)编写简单Linuxshell程序 2、实验内容 (1)查看/etc/.profile文件: 相当于DOS下autoexe.bat (2)通配符“*”、“? ”、“[]”的使用 $ls[a-c]*和$ls[a,m,t]*命令 (3)重定向和管道的使用 ls|more cat>test.txt (4)变量 $lookup=/usr/mydir $echo$lookup $exportlookup: 让进程使用 (5)编辑并运行以下程序(shell程序控制结构) 1、fortest #! /bin/bash forainxyz do echonowa=$a done 2、fortest1 #! /bin/bash fora do echonowa=$a done 3、functest #! /bin/bash setup() { echosetup… } do_date() { date } chgdir() { cd$1 } do_date setup chgdir 4、paramtest #! /bin/bash echofilename: $0 echoarguments: $* echonumberarg: $# echoarg2: $2 shift echonumberarg: $# echoarg2: $2 sethello,everone echoargs: $* echoarg2: $2 5、untiltest #! /bin/bash number=0 until(test$number–gt5) do echo“$number” number=`expr$number+1` done 3、实验结果 程序调试及运行结果如下: 实验5Linux高级程序设计 1、实验目的 (1)了解Linux操作系统下应用程序开发流程 (2)掌握gun工具链的使用 (3)了解Linux高级编程技巧(例如IPC机制、系统调用等) 2、实验内容 (1)编写一个简单的C语言程序,编写Makefile文件。 了解编译过程,并用gdb进行调试。 #include intmain(void) { printf("HelloWorld! "); } 调试: gcchelloworld.c a.out (2)以下任选其一: 1、编写一个多进程通信程序,采用MessageQueue或sharedMemory或者MapedFile机制进行通信 2、编写一个多线程程序(pthread),实现2程同步互斥 源代码: #include #include #defineBUFFER_SIZE16 structprodcons { //缓冲区相关数据结构 intbuffer[BUFFER_SIZE]; pthread_mutex_tlock; intreadpos,writepos; pthread_cond_tnotempty; pthread_cond_tnotfull; }; void
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 中南 大学 Linux 系统 实验 报告