Linux Programming Environment Setup
Introduce Linux Install Linux on Vmware Software commonly used under Windows Practice
Bạn đang xem trước 20 trang tài liệu Linux Programming Environment Setup, để xem tài liệu hoàn chỉnh bạn click vào nút DOWNLOAD ở trên
1Linux Programming
Environment Setup
Outline
Introduce Linux
Install Linux on Vmware
在 Windows 下常用的 Software
Practice
2
INTRODUCE LINUX
3
History
Linus Torvalds make a Minix (Mini Unix) kernel
Just only 10000 row of C codes
Richard Stallman bring up GNU plan
Open source
Free
Unix-like
GNU/Linux Linux
Kernel + many modules
4
Use
Server
MySql + PHP + Apache
Embedded system
STB (Set Top Box)
Super Computer
75% (Top 500 on the world)
Game
Sony PlayStation 3
Microsoft XBOX
5
Linux Kernel
Linux Kernel version format
Linux-a.b.c
a kernel version
b odd : test
even : stable
c number of bug fix
Common, Linux-2.4.x and Linux-2.6.x
6
Linux distribution
Redhat 9 Linux-2.4.x
Fedora 1 Linux-2.4.x
Fedora 2~ Linux-2.6.x
Debian more app. (15940)
Trustix more safe and stable
Knoppix LiveCD
7
Other
There’s nothing impossible on Linux,
because Source code can change
Find Linux distribution or modules
Good Web Site
8
INSTALL LINUX ON VMWARE
9
Vmware
Use software (VMware ESX Server)
to“virtualize”the hardware resources
Including the CPU, RAM, hard disk
and network controller
To create a virtual machine
that can run its own operating
system and applications just
like a “real” computer
10
Install Linux –
Vmware
11
Install Linux –
Virtual Host
12
13
Install Linux –
Typical (Virtual Host)
14
Install Linux –
Virtual Host
15
Install Linux –
Virtual Host
16
Install Linux –
Virtual Host
17
Install Linux –
Virtual Host
18
Install Linux –
Virtual Host
19
Install Linux –
Virtual Host, Linux
20
Install Linux –
image, download
21
Install Linux –
Linux image
22
Install Linux –
Linux
Install Linux –
image
23
Mainly, press the “Next” forever
We’ll point out options that need to
setup below
24
25
Install Linux –
26
Install Linux –
Install Linux –
27
Install Linux –
28
Install Linux –
只選擇以下套件
Development Tools
Editors
29
Install Linux –
30
Install Linux –
image
31
Install Linux –
32
Install Linux –
33
34
Linux –
network sshd
35
36
37
Windows Software – Linux
38
Pietty – Telnet
Use SSH (Secure Shell) protocol
Allows data to be exchanged over a
secure channel between two computers
Why use it?
Convenient for In/Out Vmware console
Good copy way
39
40
41
Winscp – ftp
Support
SFTP (SSH File Transfer Protocol)
SCP (Secure Copy Protocol)
FTP (File Transfer Protocol)
Good way to transmission data
between Windows and Linux
42
43
44
LINUX COMMON
COMMANDS
45
Linux Command Format
Command [–options] [param1] [param2]
Short option use “-”
Long option use “--”
Ex.
dmesg
gcc –v
gcc ––help
cp file1 file2
46
File management
ls list
ls –al
chmod change authority
-rw-r--r-- 1 root root 20 Sep 25 12:12 123.log
47
d : directory
l : soft-link
- : file
c : char device
b : block device
owner
group
other
r w x
222120
Ex. Chmod 755 file
-rwxr-xr-x
rmdir remove directory
mkdir make directory
cp copy
cp from to
mv move or rename
Move from to
cd change directory
cd
cd –
cd ..
48
find -name find file
find –name
grep find string
dmesg | grep CPU
cat print to stdout
file print file info.
touch change file’s timestamp
make a file
49
rm remove
rm –rf
man command manual
tar uncompress or compress
tar zxvf file.tar.gz
tar zcvf backup.tar.gz /root
tar jxvf file.tar.bz2
ln soft-link
ln –s
50
Network
route setup or print route rule
ping
ping -c 4 www.google.com.tw
ifconfig setup or print network
ifconfig eth0 xxx.xxx.xxx.xxx
netstat show the network status
netstat -l
51
System
reboot
shutdown –r
shutdown
shutdown -h now
ps print process
ps aux
kill terminate process
kill
killall
52
uname show system info.
uname –r
uname –a
free memory allocate state
sync store memory buf. to disk
53
Vi Editor
vi filename
54
Visual Mode
yy copy a row
p paste a row
dd delete a row
55
Insert Mode
Input what you want
56
Command Mode
:wq save file and quit
:q! un-save and quit
:100 jump to 100th row
/ find [key] in this file
press “n” to “Next”
57
Tips
Tab
Command complement
File complement
Up/Down
Record command
history
` `
First to do
Ex. ifconfig `cat net.conf`
net.conf eth0 x.x.x.x
58
PRACTICE
59
First program - Hello World ~!
touch test.c
新增一檔案
vi test.c
撰寫 code
gcc test.c –o test
編譯程式
gcc -o
./test
執行程式
60
//test.c
#include
int main (int argc, char *argv[]) {
printf("Hello world~!\n");
return 0;
}
Homework
實現該 Linux 程式設計環境, 並利用已有之
程式碼編譯和執行出一簡單範例
程式碼請至課程網站 download
(helloworld_sock)
Report Format
作業描述
流程圖
執行結果
問題與討論
心得 61
Submission
以一個學號命名之壓縮檔(此報告)於期限內 E-
Mail 寄至助教信箱和繳交紙本給助教
鄭玴吉 : ES711: g9517702@yuntech.edu.tw
林宜鋒 : ES711: g9517733@yuntech.edu.tw
Deadline
2008/03/19 晚上12點前
若有疑問可至ES711詢問助教
62