




版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、Unix/Linux系統(tǒng)實(shí)驗(yàn)報(bào)告 學(xué) 院: 信息科學(xué)與工程學(xué)院 指導(dǎo)老師: 胡小龍 班 級(jí): 信息安全1401班 學(xué) 號(hào): 姓 名: 孫毅 時(shí) 間: 2016年12月 實(shí)驗(yàn)一 Linux的安裝(課后)11、實(shí)驗(yàn)?zāi)康?2、實(shí)驗(yàn)設(shè)備13、實(shí)驗(yàn)原理14、實(shí)驗(yàn)步逐1Linux安裝過(guò)程:1實(shí)驗(yàn)2 Linux基本操作91、 實(shí)驗(yàn)?zāi)康?2、實(shí)驗(yàn)內(nèi)容93、實(shí)驗(yàn)記錄15實(shí)驗(yàn)3 Linux系統(tǒng)管理191、實(shí)驗(yàn)?zāi)康?92、實(shí)驗(yàn)內(nèi)容193、實(shí)驗(yàn)記錄20實(shí)驗(yàn)4 Linux Shell程序設(shè)計(jì)221、實(shí)驗(yàn)?zāi)康?22、實(shí)驗(yàn)內(nèi)容223、實(shí)驗(yàn)結(jié)果23實(shí)驗(yàn)5 Linux 高級(jí)程序設(shè)計(jì)251、實(shí)驗(yàn)?zāi)康?52、 實(shí)驗(yàn)內(nèi)容25實(shí)驗(yàn)6
2、Linux內(nèi)核281、實(shí)驗(yàn)?zāi)康?82、實(shí)驗(yàn)內(nèi)容28心得體會(huì)31實(shí)驗(yàn)一 Linux的安裝(課后)1、實(shí)驗(yàn)?zāi)康模?) 了解硬盤分區(qū)的概念和方法;(2) 掌握硬盤的分區(qū)規(guī)劃;(3) 掌握Linux操作系統(tǒng)的安裝和配置過(guò)程。2、實(shí)驗(yàn)設(shè)備一臺(tái)pc機(jī)、RedHat Linux 7.2以上版本、VMware Workstation v5.53、實(shí)驗(yàn)原理Linux可以以多種方式安裝在PC機(jī)上: (1)獨(dú)立分區(qū)安裝; (2)DOS分區(qū)安裝; (3)虛擬機(jī)VMWare下安裝。鑒于VMware下安裝對(duì)原來(lái)系統(tǒng)影響較小且不影響本實(shí)驗(yàn)?zāi)康?,因此采用VMWare下安裝方式。4、實(shí)驗(yàn)步逐 (1) 在Windows XP下安
3、裝VMware 5.5(2) 配置虛擬機(jī)(3) 啟動(dòng)虛擬機(jī)(4) 啟動(dòng)Linux安裝過(guò)程(5) 安裝過(guò)程配置(6) 安裝后配置(7) 第1次啟動(dòng) VMWare下Linux操作系統(tǒng)Linux安裝過(guò)程:(1)語(yǔ)言選擇:(2)鍵盤配置: (3)鼠標(biāo)配置: (4)選擇安裝還是升級(jí): (5)安裝類型: (6)磁盤分區(qū)設(shè)置: (7)為系統(tǒng)分區(qū): (8)添加分區(qū): (9)引導(dǎo)裝載程序配置: (10)網(wǎng)絡(luò)配置: (11)防火墻配置: (12)語(yǔ)言支持的選擇: (13)時(shí)區(qū)配置: (14)設(shè)置根口令(15)選擇軟件包組: (16)準(zhǔn)備安裝: 應(yīng)該看到一個(gè)安裝 Red Hat Linux 做準(zhǔn)備的屏幕。 當(dāng)你重新
4、引導(dǎo)系統(tǒng)后,一份完整的安裝日志可在 /root/install.log 中找到,以備今后參考。要取消安裝進(jìn)程,按計(jì)算機(jī)的重新啟動(dòng)按鈕,或者使用 Control-Alt-Delete 組合鍵來(lái)重啟計(jì)算機(jī)。 (17)安裝軟件包: (18)創(chuàng)建引導(dǎo)盤: (19)視頻卡配置: (20)配置顯示器: (21)定制配置: (22)安裝完成實(shí)驗(yàn)2 Linux基本操作1、 實(shí)驗(yàn)?zāi)康?(1)復(fù)習(xí)Linux基本命令 (2)掌握常用Linux命令2、實(shí)驗(yàn)內(nèi)容 (1)練習(xí)命令行模式下的常用命令: man:命令幫助ALT-Fx:虛終端切換常用命令:cat、Ls、ps、chmod、kill、ln、cp、mv、rm、cd、
5、pwd、mkdir、chown、who、w、wc、whoami、date、uname等命令實(shí)例:rootsoamazing-desktop:# touch testrootsoamazing-desktop:# cat testaaaaarootsoamazing-desktop:# lstest 公共的 模板 視頻 圖片 文檔 下載 音樂(lè) 桌面rootsoamazing-desktop:# ps man PID TTY STAT TIME COMMAND 753 tty7 - 0:10 /usr/bin/X :0 -nr -verbose -auth /var/run/gdm/auth-fo
6、 - - Ss+ 0:10 - 1081 pts/0 - 0:00 bash - - Ss 0:00 - 1138 pts/0 - 0:00 ps man - - R+ 0:00 -rootsoamazing-desktop:# ls -ltotal 36-rw-r-r- 1 root root 6 2011-04-12 22:20 testdrwxr-xr-x 2 root root 4096 2011-04-12 15:40 公共的drwxr-xr-x 2 root root 4096 2011-04-12 15:40 模板drwxr-xr-x 2 root root 4096 2011-
7、04-12 15:40 視頻drwxr-xr-x 2 root root 4096 2011-04-12 15:40 圖片drwxr-xr-x 2 root root 4096 2011-04-12 15:40 文檔drwxr-xr-x 2 root root 4096 2011-04-12 15:40 下載drwxr-xr-x 2 root root 4096 2011-04-12 15:40 音樂(lè)drwxr-xr-x 2 root root 4096 2011-04-12 15:40 桌面rootsoamazing-desktop:# chmod 888 testchmod: invali
8、d mode: 888Try chmod -help for more information.rootsoamazing-desktop:# chmod -helpUsage: chmod OPTION. MODE,MODE. FILE. or: chmod OPTION. OCTAL-MODE FILE. or: chmod OPTION. -reference=RFILE FILE.Change the mode of each FILE to MODE. -c, -changes like verbose but report only when a change is made -n
9、o-preserve-root do not treat / specially (the default) -preserve-root fail to operate recursively on / -f, -silent, -quiet suppress most error messages -v, -verbose output a diagnostic for every file processed -reference=RFILE use RFILEs mode instead of MODE values -R, -recursive change files and di
10、rectories recursively -help display this help and exit -version output version information and exitEach MODE is of the form ugoa*(-+=(rwxXst*|ugo)+.Report chmod bugs to GNU coreutils home page: General help using GNU software: Report chmod translation bugs to rootsoamazing-deskto
11、p:# ls -ltotal 36-rw-r-r- 1 root root 6 2011-04-12 22:20 testdrwxr-xr-x 2 root root 4096 2011-04-12 15:40 公共的drwxr-xr-x 2 root root 4096 2011-04-12 15:40 模板drwxr-xr-x 2 root root 4096 2011-04-12 15:40 視頻drwxr-xr-x 2 root root 4096 2011-04-12 15:40 圖片drwxr-xr-x 2 root root 4096 2011-04-12 15:40 文檔drw
12、xr-xr-x 2 root root 4096 2011-04-12 15:40 下載drwxr-xr-x 2 root root 4096 2011-04-12 15:40 音樂(lè)drwxr-xr-x 2 root root 4096 2011-04-12 15:40 桌面rootsoamazing-desktop:# chmod u-w,g+w,o+w testrootsoamazing-desktop:# ls -ltotal 36-r-rw-rw- 1 root root 6 2011-04-12 22:20 testdrwxr-xr-x 2 root root 4096 2011-0
13、4-12 15:40 公共的drwxr-xr-x 2 root root 4096 2011-04-12 15:40 模板drwxr-xr-x 2 root root 4096 2011-04-12 15:40 視頻drwxr-xr-x 2 root root 4096 2011-04-12 15:40 圖片drwxr-xr-x 2 root root 4096 2011-04-12 15:40 文檔drwxr-xr-x 2 root root 4096 2011-04-12 15:40 下載drwxr-xr-x 2 root root 4096 2011-04-12 15:40 音樂(lè)drwx
14、r-xr-x 2 root root 4096 2011-04-12 15:40 桌面rootsoamazing-desktop:# chmod u+w,g-w,o-w testrootsoamazing-desktop:# ls -ltotal 36-rw-r-r- 1 root root 6 2011-04-12 22:20 testdrwxr-xr-x 2 root root 4096 2011-04-12 15:40 公共的drwxr-xr-x 2 root root 4096 2011-04-12 15:40 模板drwxr-xr-x 2 root root 4096 2011-04
15、-12 15:40 視頻drwxr-xr-x 2 root root 4096 2011-04-12 15:40 圖片drwxr-xr-x 2 root root 4096 2011-04-12 15:40 文檔drwxr-xr-x 2 root root 4096 2011-04-12 15:40 下載drwxr-xr-x 2 root root 4096 2011-04-12 15:40 音樂(lè)drwxr-xr-x 2 root root 4096 2011-04-12 15:40 桌面rootsoamazing-desktop:# lnln: missing file operandTry
16、 ln -help for more information.rootsoamazing-desktop:# ln -helpUsage: ln OPTION. -T TARGET LINK_NAME (1st form) or: ln OPTION. TARGET (2nd form) or: ln OPTION. TARGET. DIRECTORY (3rd form) or: ln OPTION. -t DIRECTORY TARGET. (4th form)In the 1st form, create a link to TARGET with the name LINK_NAME.
17、In the 2nd form, create a link to TARGET in the current directory.In the 3rd and 4th forms, create links to each TARGET in DIRECTORY.Create hard links by default, symbolic links with -symbolic.When creating hard links, each TARGET must exist. Symbolic linkscan hold arbitrary text; if later resolved,
18、 a relative link isinterpreted in relation to its parent directory.Mandatory arguments to long options are mandatory for short options too. -backup=CONTROL make a backup of each existing destination file -b like -backup but does not accept an argument -d, -F, -directory allow the superuser to attemp
19、t to hard link directories (note: will probably fail due to system restrictions, even for the superuser) -f, -force remove existing destination files -n, -no-dereference treat destination that is a symlink to a directory as if it were a normal file -i, -interactive prompt whether to remove destinati
20、ons -s, -symbolic make symbolic links instead of hard links -S, -suffix=SUFFIX override the usual backup suffix -t, -target-directory=DIRECTORY specify the DIRECTORY in which to create the links -T, -no-target-directory treat LINK_NAME as a normal file -v, -verbose print name of each linked file -he
21、lp display this help and exit -version output version information and exitThe backup suffix is , unless set with -suffix or SIMPLE_BACKUP_SUFFIX.The version control method may be selected via the -backup option or throughthe VERSION_CONTROL environment variable. Here are the values: none, off never
22、make backups (even if -backup is given) numbered, t make numbered backups existing, nil numbered if numbered backups exist, simple otherwise simple, never always make simple backupsReport ln bugs to GNU coreutils home page: General help using GNU software: Report ln translation b
23、ugs to rootsoamazing-desktop:# whoroot tty7 2011-04-12 22:11 (:0)root pts/0 2011-04-12 22:12 (:0.0)rootsoamazing-desktop:# whoamirootrootsoamazing-desktop:# (2) 編輯器vi的使用:使用vi建立并修改一個(gè)文本文件rootsoamazing-desktop:# vi test(3) 檔案管理:rpm、gzip、tar等命令(4) 網(wǎng)絡(luò)命令: telnet、ftp、talk3、實(shí)驗(yàn)記錄在實(shí)驗(yàn)過(guò)程中,記錄到的實(shí)驗(yàn)現(xiàn)象: 系統(tǒng)啟動(dòng)1、 Man l
24、s按q退出2、 w、who、whoami命令 查看當(dāng)前登錄主機(jī)的所有用戶3、 查看自己的bash相關(guān)進(jìn)程:ps l4、 rpm命令Linux是否安裝logrotate軟件,并且列出屬于該軟件所提供的所有目錄和文件5、 將/etc/man.config復(fù)制到/tmp中,并且以gzip壓縮6、使用tar備份/etc/man.config目錄 7、由于本機(jī)網(wǎng)絡(luò)配置及其軟件下載問(wèn)題,導(dǎo)致網(wǎng)絡(luò)設(shè)置命令無(wú)法成功實(shí)現(xiàn)實(shí)驗(yàn)3 Linux系統(tǒng)管理1、實(shí)驗(yàn)?zāi)康?1)掌握Linux基本系統(tǒng)管理命令 (2)掌握基本管理方法(3)初步了解Linux中與系統(tǒng)管理相關(guān)的有關(guān)配置文件2、實(shí)驗(yàn)內(nèi)容 (1) 用戶管理adduse
25、r、useradd、passwd等觀察:/etc/passwd文件 (2) 文件系統(tǒng)管理df、du命令使用mount、umount命令使用:安裝usb盤或者光盤,查看分析/etc/fstab文件 (3) 存儲(chǔ)器free:了解存儲(chǔ)器使用情況 (4) 關(guān)機(jī)halt、shutdown h、init 0reboot、shutdown -r now并比較它們之間的差別 (5) 網(wǎng)絡(luò)配置netconfig的使用 (6)啟動(dòng)配置/etc/inittab:查看、修改并觀察其響應(yīng)3、實(shí)驗(yàn)記錄在實(shí)驗(yàn)過(guò)程中,注意記錄實(shí)驗(yàn)現(xiàn)象A、用戶管理 建立新的用戶:gang,并且設(shè)置密碼B、文件系統(tǒng)管理 分別用df h將容量結(jié)果
26、以易讀的容量格式顯示出來(lái),用du顯示出了/etc/man.config的內(nèi)容。 掛載了用來(lái)安裝linux的原版光盤,用df查看后,解除了掛載C、存儲(chǔ)器 Free命令 實(shí)驗(yàn)4 Linux Shell程序設(shè)計(jì)1、實(shí)驗(yàn)?zāi)康?1)掌握Linux shell程序運(yùn)行方法 (2)掌握Linux Shell程序基本語(yǔ)法(3)了解Linux環(huán)境變量(3)編寫簡(jiǎn)單Linux shell程序 2、實(shí)驗(yàn)內(nèi)容(1) 查看/etc/.profile文件:相當(dāng)于DOS下autoexe.bat(2) 通配符“*”、“?”、“”的使用$ls a-c* 和 $ls a,m,t*命令 (3)重定向和管道的使用ls | more
27、cat test.txt(4) 變量$lookup=/usr/mydir $echo $lookup $export lookup:讓進(jìn)程使用(5) 編輯并運(yùn)行以下程序(shell程序控制結(jié)構(gòu))1 、fortest #!/bin/bash for a in x y zdo echo now a=$adone2 、fortest1 #!/bin/bash for ado echo now a=$adone3、 functest #!/bin/bashsetup()echo setupdo_date()datechgdir()cd $1do_datesetupchgdir4、 paramtest#
28、!/bin/bashecho filename:$0echo arguments:$*echo number arg:$#echo arg2:$2shiftecho number arg:$#echo arg2:$2set hello,everoneecho args:$*echo arg2:$25 、untiltest#!/bin/bashnumber=0until (test $number gt 5)doecho “ $number”number=expr $number + 1done3、實(shí)驗(yàn)結(jié)果程序調(diào)試及運(yùn)行結(jié)果如下:實(shí)驗(yàn)5 Linux 高級(jí)程序設(shè)計(jì)1、實(shí)驗(yàn)?zāi)康?1)了解Linux操
29、作系統(tǒng)下應(yīng)用程序開發(fā)流程(2)掌握gun工具鏈的使用(3)了解Linux高級(jí)編程技巧(例如IPC機(jī)制、系統(tǒng)調(diào)用等)2、 實(shí)驗(yàn)內(nèi)容 (1)編寫一個(gè)簡(jiǎn)單的C語(yǔ)言程序,編寫Makefile文件。了解編譯過(guò)程,并用gdb進(jìn)行調(diào)試。#include int main(void)printf(Hello World!);調(diào)試: gcc helloworld.c a.out (2)以下任選其一:1、編寫一個(gè)多進(jìn)程通信程序,采用Message Queue或shared Memory或者M(jìn)aped File機(jī)制進(jìn)行通信2、編寫一個(gè)多線程程序(pthread),實(shí)現(xiàn)2程同步互斥源代碼:#include #incl
30、ude #define BUFFER_SIZE 16 struct prodcons/ 緩沖區(qū)相關(guān)數(shù)據(jù)結(jié)構(gòu)int bufferBUFFER_SIZE; pthread_mutex_t lock; int readpos, writepos; pthread_cond_t notempty; pthread_cond_t notfull; ;void init(struct prodcons *b)pthread_mutex_init(&b-lock, NULL);pthread_cond_init(&b-notempty, NULL);pthread_cond_init(&b-notfull,
31、 NULL);b-readpos = 0;b-writepos = 0;void put(struct prodcons *b, int data)pthread_mutex_lock(&b-lock);if (b-writepos + 1) % BUFFER_SIZE = b-readpos)pthread_cond_wait(&b-notfull, &b-lock);b-bufferb-writepos = data;b-writepos+;if (b-writepos = BUFFER_SIZE)b-writepos = 0;pthread_cond_signal(&b-notempty
32、);pthread_mutex_unlock(&b-lock);int get(struct prodcons *b)int data;pthread_mutex_lock(&b-lock);if (b-writepos = b-readpos)pthread_cond_wait(&b-notempty, &b-lock);data = b-bufferb-readpos;b-readpos+;if (b-readpos = BUFFER_SIZE)b-readpos = 0;pthread_cond_signal(&b-notfull);pthread_mutex_unlock(&b-loc
33、k);return data;#define OVER ( - 1)struct prodcons buffer;void *producer(void *data)int n;for (n = 0; n n, n);put(&buffer, n); put(&buffer, OVER);return NULL;void *consumer(void *data)int d;while (1)d = get(&buffer);if (d = OVER)break;printf(-%d n, d);return NULL;int main(void)pthread_t th_a, th_b;vo
34、id *retval;init(&buffer);pthread_create(&th_a, NULL, producer, 0);pthread_create(&th_b, NULL, consumer, 0);pthread_join(th_a, &retval);pthread_join(th_b, &retval);return 0;實(shí)驗(yàn)6 Linux內(nèi)核1、實(shí)驗(yàn)?zāi)康?1)了解Linux操作系內(nèi)核(2)掌握內(nèi)核編譯和內(nèi)核升級(jí)方法(3)了解有關(guān)內(nèi)核編程2、實(shí)驗(yàn)內(nèi)容(1) 內(nèi)核配置和編譯(課后完成)(2) 察看/proc內(nèi)存文件系統(tǒng)下的文件,寫出每個(gè)目錄內(nèi)容(3) 編寫一個(gè)簡(jiǎn)單的字符虛擬設(shè)
35、備程序(以模塊方式編譯、加載、使用)struct file_ operations status_ fops = NULL, /* seek */read_ status,write_ status,NULL, /* readdir */NULL, /* poll */NULL, /* ioctl */NULL, /* mmap */open_ status,NULL, /* flush */close_ status,NULL, /* fsync */NULL, /* fasync */NULL, /* check_ media_ change */NULL, /* revalidate *
36、/NULL, /* lock */;創(chuàng)建這個(gè)設(shè)備:mknod /dev/status c 0static int major_ number = 0; /* pass a major of 0 to register_ chrdev* for dynamic allocation*/int init_ module( void)major_ number = register_ chrdev( 0, status, &status_ fops);if (major_ number count) ? count : char_ count;copy_ to_ user( buffer, message, count_ to_ copy); /* write to the user- space buffer */return char_ count; 心得體會(huì) 之前都是用的Windows系統(tǒng),突然用到linux系統(tǒng),最開始是感覺(jué)很別扭很不習(xí)慣,到后來(lái)用了一段時(shí)間之后再去用windows發(fā)現(xiàn)很不習(xí)慣了,這才意識(shí)到原來(lái)linux系統(tǒng)這么好用,這么神奇,感覺(jué)會(huì)一點(diǎn)linux系統(tǒng)的人都是大神;在做此次試驗(yàn)的過(guò)程中,我也學(xué)到了linux的更多的知識(shí): Linux是一套免費(fèi)使用和自由傳播的類Unix操作系統(tǒng),是一個(gè)基于POSIX和UNIX的
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- Polygodial-pyridazine-生命科學(xué)試劑-MCE
- BOC-1S-3R-3-aminocyclopentanecarboxylic-acid-1S-3R-3-tert-Butoxycarbonyl-amino-cyclopentanecarboxylic-acid-生命科學(xué)試劑-MCE
- AE9C90CB-生命科學(xué)試劑-MCE
- 4-Trifluoromethyl-nicotinic-acid-4-Trifluoromethyl-pyridine-3-carboxylic-acid-生命科學(xué)試劑-MCE
- 2025年窯爐、熔爐及電爐合作協(xié)議書
- 2025年智能電網(wǎng)配電設(shè)備合作協(xié)議書
- 土建工程師合同管理與履約措施
- 2025年抽紗刺繡工藝品合作協(xié)議書
- 2024年倉(cāng)庫(kù)主管工作年終總結(jié)
- 二零二五年度房屋抵押貸款合同
- 年產(chǎn)60萬(wàn)噸摻混肥項(xiàng)目可行性研究報(bào)告申請(qǐng)立項(xiàng)
- 2025年2月《公共安全視頻圖像信息系統(tǒng)管理?xiàng)l例》學(xué)習(xí)解讀課件
- 2025年江蘇省中職《英語(yǔ)》學(xué)業(yè)水平考試高頻必練考試題庫(kù)400題(含答案)
- 2025年濟(jì)寧職業(yè)技術(shù)學(xué)院高職單招語(yǔ)文2018-2024歷年參考題庫(kù)頻考點(diǎn)含答案解析
- 高三一?!吧媾c強(qiáng)弱關(guān)系思辨”審題立意及范文
- 2025年湖南工程職業(yè)技術(shù)學(xué)院高職單招職業(yè)適應(yīng)性測(cè)試近5年??及鎱⒖碱}庫(kù)含答案解析
- 小學(xué)數(shù)學(xué)教學(xué)中小組合作學(xué)習(xí)課件
- 2024年晉中職業(yè)技術(shù)學(xué)院?jiǎn)握新殬I(yè)技能測(cè)試題庫(kù)附答案
- 2025年重癥醫(yī)學(xué)科(ICU)護(hù)理工作計(jì)劃
- 四川省名校2025屆高三第二次模擬考試英語(yǔ)試卷含解析
- 2024各科普通高中課程標(biāo)準(zhǔn)
評(píng)論
0/150
提交評(píng)論