Вы находитесь на странице: 1из 204

Linux Debian 5

Basic Server Administration

Step By Step Guide (With Illustration)

By

Zulfadli Bin Mohd Saad

Computer Engineering Technology (Networking) Department of Electronic MARA Vocational Institute, Lumut, Perak.

http://zcomby-server2008.blogspot.com/

To my loving wife of more than 11 years, who continues to provide me love

and encouragement even when I don’t deserve it.

http://zcomby-server2008.blogspot.com/

Acknowledgments

No book is written alone. Instead, there is a wealth of people working behind the scenes to help make a book the best possible. I’m grateful for the hard work put in behind the scenes by several people. Ruslan, Kharizan, Hj. Shukri, Fadhlina, Zuraida, Kak Ramlah, Kak Zulaikha, Danial, Zainatul and Azhar Pixma, all provided a significant amount of work that helped produce this book. I’m grateful to each of them.

About the Author

Zulfadli Mohd Saad has been teaching Microsoft networking concepts since the DOS days and has been teaching a myriad of other topics since many years before then. He’s been a Malaysia Skills Competition Coach for trade IT PC/Network Support since 2003 and holds many other certifications, including Certified Ethical Hacker, National Industrial Specialist (IT02-00 Information & Communication Technology), National Industrial Specialist Instructor (IT02-00 Information & Communication Technology), Certificate of Excellent MySkills-ASEAN 2009 (IT PC/Network Support), Diploma of Excellent MySkills 2008 (IT PC/Network Support), Bronze Medal MySkills 2010 (IT PC/Network Support) and Bronze Medal MARA Innovation & Invention Competition 2012 (Windows Server 2008 Training Kit).

Zulfadli has developed several video training courses for People Trust Council (Majlis Amanah Rakyat) and has written and co-authored several other technical books. He has a passion for teaching and enjoys sharing knowledge in the classroom as much as he does through books.

He currently works full-time on a government contract providing a wide array of technical training to government personnel in support of a network operations support center. He moonlights as an adjunct instructor at a local college (MARA Vocational Institute) teaching Network System Administration courses.

Zulfadli lives with his wife and four children in Ipoh, Perak, but on most weekends they can’t be found because they always travel. He’s found that configuring networks is a piece of cake compared to building a good house and happy family, but he hasn’t given up yet.

Table Of Contents

Exercise 1

Exercise 2

Exercise

3

Exercise

4

Exercise

5

Exercise

6

Exercise 7

Exercise 8

Exercise 9

Exercise 10

Exercise 11

Exercise 12

Title

Installing Linux Debian 5

System Configuration (Initial Configuration)

Network Configuration

User Management

Printer Installation and Configuration

Process Management

Domain (BIND) Installation and Configuration

FTP Server Installation and Configuration

Apache Web Server Installation and Configuration

DHCP Installation and Configuration

Installing and Configuring Samba

Disk Quotas

Page

6

39

43

57

83

91

100

115

138

156

167

175

Table Of Contents

Exercise 13

Exercise 14

Title

Squid Installation and Configuration

Routing Server Installation and Configuration

Page

188

199

Exercise 1

Installing Linux Debian 5

By

Zulfadli Bin Mohd Saad

Computer Engineering Technology (Networking) Department of Electronic MARA Vocational Institute, Lumut, Perak.

http://zcomby-server2008.blogspot.com/

Exercise 1 : Installing Linux Debian 5

1. Boot-up your PC using Debian DVD.

2. Select Install from the “Installer boot menu” (Figure 1).

Install from the “Install er boot menu” (Figure 1). Figure 1 : Installer boot menu 3.

Figure 1 : Installer boot menu

3. Press ENTER key to continue.

4. Select English as language to use for the installation process (Figure 2).

as language to use for the installation process (Figure 2). Figure 2 : Language 5. Press

Figure 2 : Language

5. Press ENTER key to continue.

6.

Select other for a country, territory or area(Figure 3).

for a “ country, territory or area ” (Figure 3). Figure 3 : country, territory or

Figure 3 : country, territory or area

7. Press ENTER key to continue.

8. Select Asia as you region (Figure 4).

ENTER key to continue. 8. Select Asia as you region (Figure 4). Figure 4 : Region.

Figure 4 : Region.

9. Press ENTER key to continue.

10.

Select Malaysia as your country (Figure 5).

10. Select Malaysia as your country (Figure 5). Figure 5 : Country. 11. Press ENTER key

Figure 5 : Country.

11. Press ENTER key to continue.

12. Select American English as your keyboard layout (Figure 6).

American English as your keyboard layout (Figure 6). Figure 6 : Keyboard layout. 13. Press ENTER

Figure 6 : Keyboard layout.

13. Press ENTER key to continue.

14.

Wait until the Network Auto-configuration process completed. If the result is fail, just press Enter to continue (Figure 7).

result is fail, just press Enter to continue (Figure 7). Figure 7 : Network auto-configuration process.

Figure 7 : Network auto-configuration process.

15. Select Do not configure the network at this time (Figure 8).

Do not configure the network at this time (Figure 8). Figure 8 : Network configuration method.

Figure 8 : Network configuration method.

16. Press ENTER key to continue.

17.

Hostname for the system.

In this exercise, my station number is 21. So, I used hostname debianserver21 (debianserverSN) as my hostname (Figure 9).

Note : SN = Station number

as my hostname (Figure 9). Note : SN = Station number Figure 9 : Hostname. 18.

Figure 9 : Hostname.

18. Press ENTER key to continue.

19. In this exercise I used myserverSN.com as domain name. Replace SN with your station number (Figure 10).

name. Replace SN with your station number (Figure 10). Figure 10 : Domain name. 20. Press

Figure 10 : Domain name.

20. Press ENTER key to continue.

21.

Wait until the disks and all other hardware detection process complete (Figure 11).

all other hardware detection process complete (Figure 11). Figure 11 : Disks and all other hardware

Figure 11 : Disks and all other hardware detection process

22. Select Manual for the partitioning method (Figure 12).

22. Select Manual for the partitioning method (Figure 12). Figure 12 : Partitioning method. 23. Press

Figure 12 : Partitioning method.

23. Press ENTER key to continue.

24.

Select your hard disk (normally labeled as sda). In this exercise I used SCSI hard disk (Figure 13).

sda ). In this exercise I used SCSI hard disk (Figure 13). Figure 13 : Partition

Figure 13 : Partition disks.

25. Press ENTER key to continue.

26. Select Yes when you are asked to create new empty partition (Figure 14).

you are asked to create new empty partition (Figure 14). Figure 14 : Partition disks -

Figure 14 : Partition disks - Yes.

27. Press ENTER key to continue.

To install Linux, we need to create minimum 2 partitions:

a) Swap This partition use for virtual memory (2 x physical RAM).

b)

/

Where Debian is installed.

= root

Recommended another partition to be created:

c) /boot This partition to store boot loader and must set as Primary partition.

d) /home This partition to store all your files.

Benefits of using separate partitions

Put simply, keeping directories that tend to fill up separate from directories needed by the system to function safeguards the system against a crash. If “/home” and “/boot” were both on the same partition, they would share the same HDD resources. When “/home” fills up, the operating system would not be able to allocate storage to other important system functions that need “/boot”.

Another plus is that you can format one partition and keep the data on another. You can reinstall your operating system without losing data on the “/home” partition. Also, in the case of a partial HDD failure, your chances of saving data is increased.

Other partitions you can create:

/var

 

This partition contains spool directories such as those for mail and printing. In addition, it contains the error log directory. If your machine is a server and develops a chronic error, those messages can fill the partition. Server computers ought to have /var in a different partition than /.

/usr

 

This is where most executable binaries go. In addition, the kernel source tree goes here, and much documentation.

/tmp

Some programs write temporary data files here. Usually, they are quite small. However, if you run computationally intensive jobs, like science or engineering applications, hundreds of megabytes could be required for brief periods of time. In this case, keep /tmp in a different partition than /.

Creating Boot Partition.

28. Select FREE SPACE of your hard disk (Figure 15)

28. Select FREE SPACE of your hard disk (Figure 15) Figure 15 : Partition disks –

Figure 15 : Partition disks Free Space.

29. Press ENTER key to continue.

30. Select Create a new partition (Figure 16)

to continue. 30. Select Create a new partition (Figure 16) Figure 16 : Partition disks –

Figure 16 : Partition disks Create new partition.

31. Press ENTER key to continue.

32.

Enter the size for /boot partition. Normally around 70–150 MB. Let’s put 150 MB (Figure 17)

around 70 –150 MB. Let’s put 150 MB (Figure 17) Figure 17 : Partition disks –

Figure 17 : Partition disks New partition size.

33. Press ENTER key to continue.

34. Select Primary for partition type (Figure 18)

34. Select Primary for partition type (Figure 18) Figure 18 : Partition disks - Primary. 35.

Figure 18 : Partition disks - Primary.

35. Press ENTER key to continue.

36. Select Beginning for location of the new partition (Figure 19)

Beginning for location of the new partition (Figure 19) Figure 19 : Partition disks – Beginning.

Figure 19 : Partition disks Beginning.

37. Press ENTER key to continue.

38.

Select Mount point (Figure 20)

38. Select Mount point (Figure 20) Figure 20 : Partition disks – Mount point. 39. Press

Figure 20 : Partition disks Mount point.

39. Press ENTER key to continue.

40. Select /boot as mount point for the partition (Figure 21)

Select /boot as mount point for the partition (Figure 21) Figure 21 : Partition disks -

Figure 21 : Partition disks - /boot

41. Press ENTER key to continue.

42.

Select Done setting up the partition (Figure 22)

42. Select Done setting up the partition (Figure 22) Figure 22 : Partition disks - Done

Figure 22 : Partition disks - Done

43. Press ENTER key to continue.

44. Now your boot partition are created (Figure 23)

Done 43. Press ENTER key to continue. 44. Now your boot partition are created (Figure 23)

Figure 23 : Partition disks

Creating Swap Partition.

45. Select FREE SPACE of your hard disk (Figure 24)

45. Select FREE SPACE of your hard disk (Figure 24) Figure 24 : Partition disks –

Figure 24 : Partition disks Free space.

46. Press ENTER key to continue.

47. Select Create a new partition (Figure 25)

to continue. 47. Select Create a new partition (Figure 25) Figure 25 : Partition disks –

Figure 25 : Partition disks Create new partition.

48. Press ENTER key to continue.

49.

Enter the size for swap partition. Normally 2 x physical RAM. Now I’m using 1 GB RAM, so my Swap = 2 GB (Figure 26)

Now I’m using 1 GB RAM, so my Swap = 2 GB (Figure 26) Figure 26

Figure 26 : Partition disks New partition size.

50. Press ENTER key to continue.

51. Select Logical for partition type (Figure 27)

51. Select Logical for partition type (Figure 27) Figure 27 : Partition disks – Logical. 52.

Figure 27 : Partition disks Logical.

52. Press ENTER key to continue.

53. Select Beginning for location of the new partition (Figure 28)

Beginning for location of the new partition (Figure 28) Figure 28 : Partition disks – Beginning.

Figure 28 : Partition disks Beginning.

54. Press ENTER key to continue.

55.

Select Use as : (Figure 29)

55. Select Use as : (Figure 29) Figure 29 : Partition disks – Use as. 56.

Figure 29 : Partition disks Use as.

56. Press ENTER key to continue.

57. Select Swap area (Figure 30)

ENTER key to continue. 57. Select Swap area (Figure 30) Figure 30 : Partition disks –

Figure 30 : Partition disks Swap area.

58. Press ENTER key to continue.

59.

Select Done setting up the partition (Figure 31)

59. Select Done setting up the partition (Figure 31) Figure 31 : Partition disks – Done

Figure 31 : Partition disks Done

60. Press ENTER key to continue.

61. Now your swap partition are created (Figure 32)

Done 60. Press ENTER key to continue. 61. Now your swap partition are created (Figure 32)

Figure 32 : Partition disks

Creating Root Partition.

62. Select FREE SPACE of your hard disk (Figure 33)

62. Select FREE SPACE of your hard disk (Figure 33) Figure 33 : Partition disks –

Figure 33 : Partition disks Free space.

63. Press ENTER key to continue.

64. Select Create a new partition (Figure 34)

to continue. 64. Select Create a new partition (Figure 34) Figure 34 : Partition disks –

Figure 34 : Partition disks Create new partition.

65. Press ENTER key to continue.

66.

5 GB is the minimum space required for graphical installation complete with xWindows. But I recommended 10 GB. So, enter 10 GB for the size of root partition. (Figure 35)

enter 10 GB for the size of root partition. (Figure 35) Figure 35 : Partition disks

Figure 35 : Partition disks New partition size.

67. Press ENTER key to continue.

68. Select Primary for partition type (Figure 36)

68. Select Primary for partition type (Figure 36) Figure 36 : Partition disks - Primary. 69.

Figure 36 : Partition disks - Primary.

69. Press ENTER key to continue.

70. Select Beginning for location of the new partition (Figure 37)

Beginning for location of the new partition (Figure 37) Figure 37 : Partition disks – Beginning.

Figure 37 : Partition disks Beginning.

71. Press ENTER key to continue.

72.

Select Mount point (Figure 38)

72. Select Mount point (Figure 38) Figure 38 : Partition disks – Mount point. 73. Press

Figure 38 : Partition disks Mount point.

73. Press ENTER key to continue.

74. Select / as mount point for the partition (Figure 39)

74. Select / as mount point for the partition (Figure 39) Figure 39 : Partition disks

Figure 39 : Partition disks - /

75. Press ENTER key to continue.

76.

Select Done setting up the partition (Figure 40)

76. Select Done setting up the partition (Figure 40) Figure 40 : Partition disks - Done

Figure 40 : Partition disks - Done

77. Press ENTER key to continue.

78. Now your root partition are created (Figure 41)

Done 77. Press ENTER key to continue. 78. Now your root partition are created (Figure 41)

Figure 41 : Partition disks

Creating /home Partition.

79. Select FREE SPACE of your hard disk (Figure 42)

79. Select FREE SPACE of your hard disk (Figure 42) Figure 42 : Partition disks –

Figure 42 : Partition disks Free space.

80. Press ENTER key to continue.

81. Select Create a new partition (Figure 43)

to continue. 81. Select Create a new partition (Figure 43) Figure 43 : Partition disks –

Figure 43 : Partition disks Create new partition.

82. Press ENTER key to continue.

83. This is the last partition we’ll create, so put all the remaining size as home partition (Figure 44).

put all the remaining size as home partition (Figure 44). Figure 44 : Partition disks –

Figure 44 : Partition disks New partition size.

84. Press ENTER key to continue.

85. Select /home as mount point for the partition (Figure 45)

key to continue. 85. Select /home as mount point for the partition (Figure 45) Figure 45

Figure 45 : Partition disks - /home

86.

Select Done setting up the partition (Figure 46)

86. Select Done setting up the partition (Figure 46) Figure 46 : Partition disks - Done

Figure 46 : Partition disks - Done

87. Press ENTER key to continue.

88. Now your root partition are created (Figure 47)

Done 87. Press ENTER key to continue. 88. Now your root partition are created (Figure 47)

Figure 47 : Partition disks

89.

Select Finish partitioning and write changes to disk (Figure 48)

Finish partitioning and write changes to disk (Figure 48) Figure 48 : Partition disks – Finish.

Figure 48 : Partition disks Finish.

90. Press ENTER key to continue.

91. Select Yes to confirm writing the changes to disk (Figure 49)

Yes to confirm writing the changes to disk (Figure 49) Figure 49 : Partition disks –

Figure 49 : Partition disks Confirmation.

92. Press ENTER key to continue.

93. Now the setup wizard start formatting all the partitions you created (Figure 50).

start formatting all the partitions you created (Figure 50). Figure 50 : Formatting Partition. 94. After

Figure 50 : Formatting Partition.

94. After finish formatting partitions, the setup wizard start installing the base system (Figure 51).

setup wizard start installing the base system (Figure 51). Figure 51 : Installing the base system.

Figure 51 : Installing the base system.

95. You need to set a password for ‘root’, the system administrative account. A good password will contain a mixture of letters, numbers and punctuation and should be changed at regular intervals. In this exercise, I will use Pr@ctice as my root password (Figure 52).

I will use Pr@ctice as my root password (Figure 52). Figure 52 : Set root password.

Figure 52 : Set root password.

96. Press ENTER key to continue.

97.

The setup wizard will ask you to re-enter the root password again for verification. Just enter the same password again Pr@ctice (Figure 53).

Just enter the same password again Pr@ctice (Figure 53). Figure 53 : Verify root password 98.

Figure 53 : Verify root password

98. Press ENTER key to continue.

99. Linux setup wizard will ask you to create user account for you to use instead of the root account for non-administrative activities. Here I create new user name as Second Admin. You also can enter your real name as a new user (Figure 54).

You also can enter your real name as a new user (Figure 54). Figure 54 :

Figure 54 : Create new user account.

100. Press ENTER key to continue.

101.

I set the username for Second Admin as admin2. You can enter any name, but remember, the username should start with lower-case letter, and can be followed by any combination of numbers and more lower-case letters (Figure 55).

of numbers and more lower-case letters (Figure 55). Figure 55 : Create new user account -

Figure 55 : Create new user account - username.

102. Press ENTER key to continue.

103. User password. I use 3xerci5e as the password for this user different from the root password (Figure 56).

for this user different from the root password (Figure 56). Figure 56 : Create new user

Figure 56 : Create new user account password.

104. Press ENTER key to continue.

105.

The setup wizard will ask you to re-enter the password again for verification. Just enter the same password again 3xerci5e (Figure 57).

Just enter the same password again 3xerci5e (Figure 57). Figure 57 : Create new user account

Figure 57 : Create new user account password verification.

106. Press ENTER key to continue.

107. After finish creating user account, your installation DVD will be scanned and you have the option to scan additional CDs or DVDs for use by the package manager (apt). Just select NO for the answer because we only use Debian DVD disc 1 only (Figure 58).

because we only use Debian DVD disc 1 only (Figure 58). Figure 58 : Scan DVD

Figure 58 : Scan DVD option.

108. Press ENTER key to continue.

109.

Now the setup wizard ask to use a network mirror for installation process, just select NO for the answer because we only using DVD installation (Figure 59).

answer because we only using DVD installation (Figure 59). Figure 59 : Use network mirror option.

Figure 59 : Use network mirror option.

110. Press ENTER key to continue.

111. Just select NO as the answer for the package usage survey question (Figure 60).

answer for the package usage survey question (Figure 60). Figure 60 : Package usage survey. 112.

Figure 60 : Package usage survey.

112. Press ENTER key to continue.

113.

Software selection. Select all software package except Laptop. Laptop package only used if you installing the Debian on the laptop. Use spacebar key to select or unselect package (Figure 61).

spacebar key to select or unselect package (Figure 61). Figure 61 : Software selection. 114. Press

Figure 61 : Software selection.

114. Press ENTER key to continue.

115. Samba Server.

We will configure the Samba server later. Press ENTER key to continue (Figure 62).

Samba server later. Press ENTER key to continue (Figure 62). Figure 62 : Samba Server –

Figure 62 : Samba Server Workgroup/Domain name.

116.

Select NO as the answer because we will modify the smd.conf file later (Figure 63).

because we will modify the smd.conf file later (Figure 63). Figure 63 : Samba Server –

Figure 63 : Samba Server smd.conf

117. Press ENTER key to continue.

118. Wait until the software installation process complete. This may take 30 60 minute depending on your system performance (Figure 64).

60 minute depending on your system performance (Figure 64). Figure 64 : Software installation process. 119.

Figure 64 : Software installation process.

119. Install the GRUB boot loader to the master boot record? Just select Yes as the answer (Figure 65).

boot record? Just select Yes as the answer (Figure 65). Figure 65 : Install the GRUB

Figure 65 : Install the GRUB boot loader.

120. Press ENTER key to continue.

121.

Installation complete. Remove the installation DVD (Figure 66).

complete. Remove the installation DVD (Figure 66). Figure 66 : Installation complete. 122. Press ENTER key

Figure 66 : Installation complete.

122. Press ENTER key to continue.

Now your system will reboot.

Congratulation! You have finish install the Debian Server.

Exercise 2

System

Configuration

(Initial Configuration)

By

Zulfadli Bin Mohd Saad

Computer Engineering Technology (Networking) Department of Electronic MARA Vocational Institute, Lumut, Perak.

http://zcomby-server2008.blogspot.com/

Exercise 2 : System Configuration (Initial Configuration)

1. Log on to the server as admin2 [user account you create earlier] (Figure 67).

as admin2 [user account you create earlier] (Figure 67). Figure 67 : First time login. 2.

Figure 67 : First time login.

2. Press ENTER button to continue.

3. Enter the password 3xerci5e for admin2 (Figure 68).

3. Enter the password 3xerci5e for admin2 (Figure 68). Figure 68 : User password. 4. Press

Figure 68 : User password.

4. Press ENTER button to continue.

EXERCISE 2.1

Setting Time Zone

In this section, you’ll learn how to setup time zone for your server.

5. Right-click at the right hand top corner of the desktop (on the date and time) and select Adjust Date & Time (Figure 69).

and time) and select Adjust Date & Time (Figure 69). Figure 69 : Adjust Date &

Figure 69 : Adjust Date & Time.

6. If the system asks you for the administrative password, just enter the root password you created earlier - Pr@ctice (Figure 70).

root password you created earlier - Pr@ctice (Figure 70). Figure 70 : Administrative password. 7. Press

Figure 70 : Administrative password.

7. Press ENTER button to continue.

8.

In the “Time and Date Settings” window, you can change your time zone, time and date (Figure 71).

you can change your time zone, time an d date (Figure 71). Figure 71 : Time

Figure 71 : Time and Date Settings.

9. After finish configure your time and date, click the Close button to close the window.

Exercise 3

Network

Configuration

By

Zulfadli Bin Mohd Saad

Computer Engineering Technology (Networking) Department of Electronic MARA Vocational Institute, Lumut, Perak.

http://zcomby-server2008.blogspot.com/

Exercise 3 : Network Configuration

EXERCISE 3.1

Configuring network.

In this section, you’ll learn how to configure network for your server using GUI (Graphical User Interface).

There are four(4) files you have to configure to setup your network, /etc/network/interfaces /etc/resolv.conf /etc/hostname /etc/hosts

But if you configure network using GUI, the system will automatically configure all those files for you.

1. Launch Network Manager. Click System ►Administration ►Network (Figure 72).

Launch Network Manager . Click System ►Administration ►Network (Figure 72). Figure 72 : Launch Network Manager.

Figure 72 : Launch Network Manager.

2.

If the “Granted permissions without asking for password” window appear, tick the Do not display this message again and click the Close button. (Figure 73).

message again and click the Close button. (Figure 73). Figure 73 : Granted permissions without asking

Figure 73 : Granted permissions without asking for password window.

3. Select Wired connection (Figure 74).

password window. 3. Select Wired connection (Figure 74). Figure 74 : Network settings – Connections. 4.

Figure 74 : Network settings Connections.

4. Click Properties button.

Connection Setting

5. Uncheck the Enable roaming mode box (Figure 75).

5. Uncheck the Enable roaming mode box (Figure 75). Figure 75 : eth Properties. 6. Select

Figure 75 : eth Properties.

6. Select Static IP address for “Configuration:” option (Figure 76).

6. Select Static IP address for “Configuration:” option (Figure 76). Figure 76 : eth Properties -

Figure 76 : eth Properties - Configuration.

7.

Now set your server IP address, and ensure that you are using a static IP address. For this exercise, I’m using number 21 as my server station number (Figure 77).

Tips:

Connection Settings.

Configuration

: Static IP address

IP address

: 192.168.2.SN

(server station number)

Subnet mask

: 255.255.255.0

Gateway address

: 192.168.2.ISIP

(internet server IP address)

Note: SN = station number

server IP address) Note: SN = station number Figure 77 : eth Properties – Static IP

Figure 77 : eth Properties Static IP address.

8. Click OK button to continue.

Setting up Host

9. Select the General tab. Make sure the host setting are corrects (Figure 78).

Tips:

Host Settings.

Host name

: debianserver SN

(server name)

Domain name

: myserverSN.com

(DNS server name)

Note: SN = station number

: myserver SN .com (DNS server name) Note: SN = station number Figure 78 : Network

Figure 78 : Network Settings General.

Setting up DNS server

10. Click the DNS tab (Figure 78).

11. Click the Add button (Figure 79).

tab (Figure 78). 11. Click the A dd button (Figure 79). Figure 79 : Network Settings

Figure 79 : Network Settings DNS.

12. Later you will set your server as DNS server, so enter your Server IP address and press ENTER (Figure 80).

server, so enter your Server IP address and press ENTER (Figure 80). Figure 80 : Network

Figure 80 : Network Settings DNS Servers.

Setting up Search Domains

13. Under Search Domains section, click the Add button (Figure 81).

Domains section, click the A dd button (Figure 81). Figure 81 : Network Settings – DNS.

Figure 81 : Network Settings DNS.

14. Enter your Domain name and press ENTER (Figure 82).

– DNS. 14. Enter your Domain name and press ENTER (Figure 82). Figure 82 : Network

Figure 82 : Network Settings Domain name.

Save setting

15. Click the Save button [icon = hard disk with green arrow] (Figure 83).

button [icon = hard disk with green arrow] (Figure 83). Figure 83 : Network Settings –

Figure 83 : Network Settings Save.

16. Enter /etc/network/interfaces in "Location name:" box. This is the network configuration file location (Figure 84).

This is the network configuration file location (Figure 84). 17. Click Save button to save. Figure

17. Click Save button to save.

Figure 84 : Save location.

18. Click Close button to exit Network Manager (Figure 85).

18. Click Close button to exit Network Manager (Figure 85). Restating Network Service Figure 85 :

Restating Network Service

Figure 85 : Network Settings.

19. Launch Root Terminal. Application ►Accessories ►Root Terminal (Figure 86).

19. Launch Root Terminal . Application ►Accessories ►Root Terminal (Figure 86). Figure 86 : Launch Root

Figure 86 : Launch Root Terminal.

20. Restart network service.

Enter the following command and press ENTER:

# /etc/init.d/networking restart

Wait until you get the line said “Reconfiguring network interfaces… done” (Figure 87).

If not, try restarting your network service again. If still error restarting your network service, try rebooting your system by typing the following command:

# reboot

and press ENTER.

After reboot, login back to your Server and open Terminal as root. Try restarting your network service again.

and open Terminal as root. Try restarting your network service again. Figure 87 : Terminal -

Figure 87 : Terminal - Restart network service.

Checking Network Configuration.

21. To check network card IP address, use the following command and press ENTER (Figure 88).

# ifconfig

IP address, use the following command and press ENTER (Figure 88). # ifconfig Figure 88 :

Figure 88 : Terminal ifconfig.

Testing Network.

22. Make sure the network cable is plugged. Try ping to another PC in your network using the following command:

# ping another PC IP address

e.g.:

# ping 192.168.2.22

Enter IP address of the other PC in your network after the ping command and press ENTER (Figure 89).

after the ping command and press ENTER (Figure 89). Figure 89 : Terminal – ping. 23.

Figure 89 : Terminal ping.

23. Press CTRL + C to terminate the ping process.

View network configuration

24. To view a configuration files, we use vim. Vim is a text editor that upwards compatible to vi. It can be used to edit all kinds of plain text. It is especially useful for editing programs.

To view your network configuration, enter the following command in the Terminaland press ENTER (Figure 90).

# vim /etc/network/interfaces

and press ENTER (Figure 90). # vim /etc/network/interfaces Figure 90 : Terminal – interfaces. 25. Vim

Figure 90 : Terminal interfaces.

25. Vim will open the network configuration file (Figure 91).

Vim will open the network configuration file (Figure 91). Figure 91 : Terminal – Network configuration

Figure 91 : Terminal Network configuration file.

All the network settings you created earlier are using GUI. There are two way to configure the network, using GUI and text editor to edit configuration file.

If you want to configure the configuration file, you have to remember all the script in the figure above. I prefer using GUI, it’s easier and faster (Figure 91).

26. Close the Terminal (Figure 91).

Exercise 4

User

Management

By

Zulfadli Bin Mohd Saad

Computer Engineering Technology (Networking) Department of Electronic MARA Vocational Institute, Lumut, Perak.

http://zcomby-server2008.blogspot.com/

Exercise 4 : User Management

EXERCISE 4.1

Changing to Super User.

In this section, you’ll learn how to manage user account in your server.

1. Launch Terminal. Application ►Accessories ► Terminal (Figure 92).

. Application ►Accessories ► Terminal (Figure 92). Figure 92 : Launch Terminal. 2. There are two

Figure 92 : Launch Terminal.

2. There are two type of user, normal user and administrative user root.

When you launch Terminal, you can identify your privilege either normal user or root by looking at the last character near the cursor (Figure 93).

$ = you are normal user. # = you are root. Administrative privilege.

= you are normal user. # = you are root. Administrative privilege. Figure 93 : Terminal
= you are normal user. # = you are root. Administrative privilege. Figure 93 : Terminal

Figure 93 : Terminal normal user and root.

Change from normal user to root.

3. Use su command to change from normal user to root. SU stand for Super User. In Linux root is the Super User.

Enter su command in the Terminal and press ENTER (Figure 94).

#

su

command in the Terminal and press ENTER (Figure 94). # su Figure 94 : Terminal –

Figure 94 : Terminal su.

4. Enter the root password and press ENTER.

Note: the password you enter are invisible (Figure 95).

Note: the password you enter are invisible (Figure 95). Figure 95 : Terminal – su password.

Figure 95 : Terminal su password.

5. After you enter the root password, the Terminal will return with new line ending with character “#(Figure 96).

will return with new line ending with character “ # ” (Figure 96). Figure 96 :

Figure 96 : Terminal su privilege.

EXERCISE 4.2

Creating a Normal User Account.

In this exercise you will create five(5) normal user account; Zul, Ocah, Akmal, Ali and Saad.

adduser is the command you’ll use to create new user account. adduser command add users to the system according to command line options and configuration information in /etc/adduser.conf.

Creating normal user zul

6. To create a normal user, enter the following command and press ENTER (Figure 97):

# adduser zul

command and press ENTER (Figure 97): # adduser zul Figure 97 : Terminal - adduser 7.

Figure 97 : Terminal - adduser

7. Enter the following details for Zul Zcomby (Figure 98).

Logon Name

zul

Password

comby

Full Name

Zul Zcomby

Room Number

207

Work Phone

05-6884401

Home Phone

 

Other

019-6581079

Figure 98 : Terminal – adduser. 8. Press Y when the system ask for confirmation

Figure 98 : Terminal adduser.

8. Press Y when the system ask for confirmation about the information and press ENTER.

9. When new user created, the system automatically create home directory for the user. By default, the home directory for new user are created under the /home directory.

You can check the new user home directory by using the following command:

# cd /home

# ls

directory by using the following command: # cd /home # ls Figure 99 : Terminal -

Figure 99 : Terminal - user /home directory.

You can see there are new directories named zulunder /home directory (Figure 99).

10. Now create the user Ocah Blue, Ahmad Akmal, Aliuddin and MdSaad.

# adduser ocah

Logon Name

ocah

Password

ocah

Full Name

Ocah Blue

Room Number

214

Work Phone

05-6884401

Home Phone

 

Other

019-6681079

Figure 100 : Ocah Blue information.

# adduser akmal

Logon Name

akmal

Password

akmal

Full Name

Ahmad Akmal

Room Number

205

Work Phone

05-6884401

Home Phone

 

Other

050327-02-0077

Figure 101 : Ahmad Akmal information.

# adduser ali

Logon Name

ali

Password

ali

Full Name

Aliuddin

Room Number

208

Work Phone

05-6884401

Home Phone

 

Other

080627-02-0033

Figure 102 : Aliuddin information.

# adduser saad

Logon Name

saad

Password

masuri

Full Name

Md Saad

Room Number

210

Work Phone

05-5272372

Home Phone

 

Other

 

Figure 103 : Md Saad information.

Testing new user.

11. Logout the server. Click System ► Log Out admin2… (Figure 104).

server. Click System ► Log Out admin2… (Figure 104). Figure 104 : Logout 12. Click Log

Figure 104 : Logout

12. Click Log Out button to logout the server. (Figure 105).

Click Log Out button to logout the server. (Figure 105). Figure 105 : Logout system. 13.

Figure 105 : Logout system.

13. Now try login as Md Saad’s. Enter the username as saad (Figure 106).

Logout system. 13. Now try login as Md Saad’s . Enter the username as saad (Figure

Figure 106 : User Login

14. Enter masuri as the password (Figure 107).

14. Enter masuri as the password (Figure 107). Can you login? Figure 107 : User login

Can you login?

Figure 107 : User login password.

Of course you can login. It should be no problem.

EXERCISE 4.3

Changing user password.

15. Launch Terminal. Application ►Accessories ► Terminal (Figure 108).

. Application ►Accessories ► Terminal (Figure 108). Figure 108 : Launch Terminal. Change from normal user

Figure 108 : Launch Terminal.

Change from normal user to root.

16. You must remember, only super user can manage users account. Enter su command in the Terminal and press ENTER to change to super user (Figure 109).

#

su

su command in the Terminal and press ENTER to change to super user (Figure 109). #

Figure 109 : Terminal su.

17.

Enter the root password and press ENTER.

Note: the password you enter are invisible (Figure 110).

Note: the password you enter are invisible (Figure 110). Figure 110 : Terminal – su password.

Figure 110 : Terminal su password.

18. After you enter the root password, the Terminal will return with new line ending with character “#” (Figure 111).

new line ending with character “ # ” (Figure 11 1). Figure 111 : Terminal –

Figure 111 : Terminal su privilege.

19. Use the passwd command to change Md Saad password as following and press ENTER (Figure 112).

# passwd saad

Md Saad password as following and press ENTER (Figure 112). # passwd saad Figure 112 :

Figure 112 : Change Md Saad’s password.

20.

Enter new password for Md Saad’s as 123456 and press ENTER (Figure 113).

for Md Saad’s as 123456 and press ENTER (Figure 113). Figure 113 : Md Saad new

Figure 113 : Md Saad new password.

21. Retype Md Saad’s new password (Figure 114).

21. Retype Md Saad’s new password (Figure 114). Figure 114 : Retype Md Saad’ new password.

Figure 114 : Retype Md Saad’ new password.

22. Now the password for Md Saad’s are successfully updated (Figure 115).

Now the password for Md Saad’s are su ccessfully updated (Figure 115). Figure 115 : Password

Figure 115 : Password successfully updated.

Testing new password.

23. Logout the server. Click System ► Log Out saad… (Figure 116).

the server. Click System ► Log Out saad… (Figure 11 6). Figure 116 : Logout 24.

Figure 116 : Logout

24. Click Log Out button to logout the server. (Figure 117).

Click L og Out button to logout the server. (Figure 117). Figure 117 : Logout system.

Figure 117 : Logout system.

25. Now try login as Md Saad’s. Enter the username as saad (Figure 118).

Logout system. 25. Now try login as Md Saad’s . Enter the username as saad (Figure

Figure 118 : User Login

26.

Enter 123456 as the password (Figure 119).

26. Enter 123456 as the password (Figure 119). Can you login? Figure 119 : User login

Can you login?

Figure 119 : User login password.

Of course you can login. It should be no problem.

27. Logout the server.

EXERCISE 4.4

Deleting user.

28. Login to the server as admin2 and 3xerci5e as password (Figure 120).

server as admin2 and 3xerci5e as password (Figure 120). Figure 120 : User login. 29. Launch

Figure 120 : User login.

29. Launch Terminal. Application ►Accessories ► Terminal (Figure 121).

. Application ►Accessories ► Terminal (Figure 12 1). Figure 121 : Launch Terminal. 30. Change to

Figure 121 : Launch Terminal.

30. Change to Super User su (Figure 122).

1). Figure 121 : Launch Terminal. 30. Change to Super User – su (Figure 122). Figure

Figure 122 : Super User privilege.

31. To remove or delete user account you’ll use deluser command. This command will remove a user from the system.

By default, deluser command will remove the user without removing the home directory, the mail spool or any other files on the system owned by the user.

The --remove-all-files option must be added if you want to remove user including all files and directories on the system owned by the user

Now delete user Md Saad from the system including all files and directories on the system owned by him using the following command (Figure 123):

# deluser

--remove-all-files

saad

the following command (Figure 123): # deluser --remove-all-files saad Figure 123 : Delete user. 32. Logout

Figure 123 : Delete user.

32. Logout the server.

Users delete confirmation.

33. Login as Md Saad’s. Enter the username as saad (Figure 124).

Md Saad’s . Enter the username as saad (Figure 124). Figure 124 : User Login 34.

Figure 124 : User Login

34. Enter 123456 as the password (Figure 125).

User Login 34. Enter 123456 as the password (Figure 125). Can you login? Why? Figure 125

Can you login? Why?

Figure 125 : User login password.

No! You can’t login as saad because Md Saad accounts are deleted.

EXERCISE 4.5

Creating Group.

In this exercise you’ll create three (3) groups, Sem1, Sem2 and Sem3. You also will assign user to those groups.

35. Login to the server as admin2 and 3xerci5e as password (Figure 126).

server as admin2 and 3xerci5e as password (Figure 126). Figure 126 : User login. 36. Launch

Figure 126 : User login.

36. Launch Terminal. Application ►Accessories ► Terminal (Figure 127).

User login. 36. Launch Terminal . Application ►Accessories ► Terminal (Figure 12 7). Figure 127 :

Figure 127 : Launch Terminal.

37. Change to Super User su (Figure 128).

37. Change to Super User – su (Figure 128). Figure 128 : Super User privilege. Create

Figure 128 : Super User privilege.

Create new group

To create new group you’ll use groupadd command. This command creates a new group account using the values specified on the command line plus the default values from the system. The new group will be entered into the system files as needed

38. To create new group Sem1, Sem2 and Sem3; use the following command (Figure 129).

# groupadd Sem1

# groupadd Sem2

# groupadd Sem3

command (Figure 129). # groupadd Sem1 # groupadd Sem2 # groupadd Sem3 Figure 129 : Terminal

Figure 129 : Terminal groupadd.

39. Every time new group created, the system will store the group record in /etc/group file.

Enter the following command to view list of group created in your system (Figure 130):

# cat /etc/group

group created in your system (Figure 130): # cat /etc/group Figure 130 : Terminal - /etc/group

Figure 130 : Terminal - /etc/group

Add user to a group.

40. Now you will assign Zul Zcomby as Sem3 group member. Enter the following command (Figure 131):

# usermod G Sem3 zul

Sem3 group member. Enter the following command (Figure 131): # usermod – G Sem3 zul Figure

Figure 131 : Terminal - usermod

41. To confirm user zul are added as member of Sem3 group, check the /etc/group file.

Enter the following command to view list of group and it members created in your system (Figure 132):

# cat /etc/group

created in your system (Figure 132): # cat /etc/group Figure 132 : Terminal - /etc/group 42.

Figure 132 : Terminal - /etc/group

42. Now set group for Ocah, Akmal and Ali according to table below (Figure 133):

User

Group

ocah

Sem3

akmal

Sem2

ali

Sem1

Figure 133 : Group table.

EXERCISE 4.6

Creating Folder.

In this exercise you’ll create new directory called practice and change the ownership of the directory.

43. To create directory practice, enter the following command (Figure 134):

# mkdir practice

enter the following command (Figure 134): # mkdir practice Figure 134 : Terminal - make directory.

Figure 134 : Terminal - make directory.

View directories/files permission and ownership.

44. Use ls -l command to view directories and files permission and ownership (Figure 135).

# ls -l

and files permission and ownership (Figure 135). # ls -l Figure 135 : Terminal – list

Figure 135 : Terminal list directory contents

You can notify that the practice directory is a member of the root group.

Every files and directories have the groups that have permission to read or open it. It’s also called group ownership.

EXERCISE 4.7

Changing group ownership

45. Enter the following command to change the group ownership of the practice directory from root group to Sem3 group (Figure 136).

# chgrp Sem3 practice

group to Sem3 group (Figure 136). # chgrp Sem3 practice Figure 136 : Terminal – change

Figure 136 : Terminal change directory group owner

46. Use ls -l command to view directories and files permission and ownership (Figure 137).

# ls -l

and files permission and ownership (Figure 137). # ls -l Figure 137 : Terminal – list

Figure 137 : Terminal list directory contents

EXERCISE 4.8

Changing files or directories ownership

47. Use the following command to change directory practice owner from root to zul (Figure

138):

# chown zul practice

from root to zul (Figure 138): # chown zul practice Figure 138 : Terminal – change

Figure 138 : Terminal change directory owner

48. Use ls -l command to view directories and files permission and ownership (Figure 139).

# ls -l

and files permission and ownership (Figure 139). # ls -l Figure 139 : Terminal – list

Figure 139 : Terminal list directory contents

EXERCISE 4.9

Deleting a group.

49. First create new group Sem4, Sem5 and Sem6; use the following command (Figure

140).

# groupadd Sem4

# groupadd Sem5

# groupadd Sem6

140). # groupadd Sem4 # groupadd Sem5 # groupadd Sem6 Figure 140 : Terminal – groupadd.

Figure 140 : Terminal groupadd.

50. To confirm all the groups are successfully created, check the /etc/group file.

Enter the following command to view list of group and it members created in your system (Figure 141):

# cat /etc/group

list of group and it members created in your system (Figure 141): # cat /etc/group Figure

Figure 141 : Terminal - /etc/group

51.

Now you’ll delete Sem6 group. Use the following command to delete Sem6 group (Figure 142):

# groupdel Sem6

command to delete Sem6 gr oup (Figure 142): # groupdel Sem6 Figure 142 : Terminal -

Figure 142 : Terminal - groupdel

52. Check the /etc/group file to confirm the Sem6 group are successfully deleted (Figure

143).

# cat /etc/group

are successfully deleted (Figure 143). # cat /etc/group Figure 143 : Terminal - /etc/group Notice that

Figure 143 : Terminal - /etc/group

Notice that Sem6 group is not listed in the /etc/group file.

53. Now delete group Sem4 and Sem5.

54. Logoff the server.

Exercise 5

Printer

Installation

and

Configuration

By

Zulfadli Bin Mohd Saad

Computer Engineering Technology (Networking) Department of Electronic MARA Vocational Institute, Lumut, Perak.

http://zcomby-server2008.blogspot.com/

Exercise 5 : Printer Installation and Configuration

EXERCISE 5.1

Installing network printer.

In this section, you’ll learn how to network printer in your server.

1. Login to the server as admin2 and 3xerci5e as password (Figure 144).

server as admin2 and 3xerci5e as password (Figure 144). Figure 144 : User login. 2. Launch

Figure 144 : User login.

2. Launch Terminal. Application ►Accessories ► Terminal (Figure 145).

User login. 2. Launch Terminal . Application ►Accessories ► Terminal (Figure 1 45). Figure 145 :

Figure 145 : Launch Terminal.

3.

Change to Super User su (Figure 146).

3. Change to Super User – su (Figure 146). Figure 146 : Super User privilege. 4.

Figure 146 : Super User privilege.

4. Launch Printer Manager. System ►Administration ►Printing (Figure 147).

4. Launch Printer Manager . System ►Administration ►Printing (Figure 147). Figure 147 : Launch Printer Manager

Figure 147 : Launch Printer Manager

5.

Click New button (Figure 148).

5. Click New button (Figure 148). Figure 148 : Printer Manager 6. Select AppSocket/HP JetDirect (Figure

Figure 148 : Printer Manager

6. Select AppSocket/HP JetDirect (Figure 149).

148 : Printer Manager 6. Select AppSocket/HP JetDirect (Figure 149). Figure 149 : Printer Manager –

Figure 149 : Printer Manager New Printer

Setting up printer.

7. In this exercise the printer IP address is set to 192.168.2.24, enter the printer IP address in the Host: box (Figure 150).

the printer IP address in the Host: box (Figure 150). Figure 150 : Printer Manager –

Figure 150 : Printer Manager Location of the network printer

8. Make sure Port number: is set to 9100 (Figure 150).

9. Click Forward button to continue (Figure 150).

10. Select printer brand [example: if you are using HP Color Laserjet CP1510n, select “HPfrom the list] (Figure 151).

CP1510n , select “ HP ” from the list] (Figure 151). Figure 151 : Printer Manager

Figure 151 : Printer Manager printer brand

11. Click Forward button to continue (Figure 151).

12. Select your printer model. In this exercise, I’m using HP Color Laserjet CP1510n printer.

If your printer models are not listed, select the nearest model. So, I select Color Laserjet cp1515n because this is the nearest model (Figure 152).

cp1515n because this is the nearest model (Figure 152). Figure 152 : Printer Manager – Printer

Figure 152 : Printer Manager Printer model

13. Click Forward button to continue (Figure 152).

14. Enter Printer Name (use short name, e.g.: HPColor1510n). Description and Location section are optional (Figure 153).

Description and Location section are optional (Figure 153). Figure 153 : Printer Manager – Printer name

Figure 153 : Printer Manager Printer name

15. Click Apply button to continue (Figure 153).

Test the Printer.

16. Open Text Editor. Click Applications ►Accessories ►Text Editor (Figure 154).

Applications ►Accessories ►Text Editor (Figure 154). Figure 154 : Launch Text Editor 17. Enter some text.

Figure 154 : Launch Text Editor

17. Enter some text. Type whatever you want (Figure 155).

Figure 154 : Launch Text Editor 17. Enter some text. Type whatever you want (Figure 155).

Figure 155 : Text Editor

18.

Print the document. Click File Print… (Figure 156).

the document. Click File ► Print… (Figure 156). Figure 156 : Launch Print Manager 19. Select

Figure 156 : Launch Print Manager

19. Select your network printer (Figure 157).

Print Manager 19. Select your network printer (Figure 157). Figure 157 : Print Manager 20. Click

Figure 157 : Print Manager

20. Click Print button to start printing (Figure 157).

21. Close all program and logout server.

Exercise 6

Process

Management

By

Zulfadli Bin Mohd Saad

Computer Engineering Technology (Networking) Department of Electronic MARA Vocational Institute, Lumut, Perak.

http://zcomby-server2008.blogspot.com/

Exercise 6 : Process Management

EXERCISE 6.1

Understand the process.

In this section, you’ll learn how to analyze process in your server. This knowledge can help you to troubleshoot your server problem.

1. Login to the server as admin2 and 3xerci5e as password (Figure 158).

server as admin2 and 3xerci5e as password (Figure 158). Figure 158 : User login. 2. Launch

Figure 158 : User login.

2. Launch Terminal. Application ►Accessories ► Terminal (Figure 159).

User login. 2. Launch Terminal . Application ►Accessories ► Terminal (Figure 1 59). Figure 159 :

Figure 159 : Launch Terminal.

3.

Change to Super User su (Figure 160).

3. Change to Super User – su (Figure 160). Figure 160 : Super User privilege. 4.

Figure 160 : Super User privilege.

4. Display and monitor all the active processes running on your server is the easiest way to understand the process.

ps command are used to displays information about a selection of the active processes.

Use the following command to display information of the current process running on your server (Figure 161):

#

ps -aux

| more

running on your server (Figure 161): # ps -aux | more Figure 161 : Terminal -

Figure 161 : Terminal - process

Table below explain the definition of every column for the process above:

Column

Explanations

USER

Users start the process.

PID

Process ID

%CPU

Percentage of CPU usage by the process.

%MEM

Percentage of memory usage by the process.

VSZ

Virtual memory size use by the process.

RSS

Memory physical size use by the process.

TTY

Terminal use by the process.

STAT

Process status.

START

When the process start.

TIME

CPU time usage by the process.

COMMAND

Commands start the process.

Figure 162 : Process Table

5. Press Ctrl + C key to exit or to go back to command prompt.

EXERCISE 6.2

Using Process command.

6. Use the following command to display process using by the current user (Figure 163):

# ps -u

process using by the current user (Figure 163): # ps -u Figure 163 : Terminal -

Figure 163 : Terminal - process using by the current user

7. How to display process use by admin2?

Use the following command to display process use by admin2 (Figure 164):

# ps -au | grep admin2

to display process use by admin2 (Figure 164): # ps -au | grep admin2 Figure 164

Figure 164 : Terminal - process use by admin2

8.

To display process use by all users, use the following command (Figure 165):

#

ps -au

by all users, use the following command (Figure 165): # ps -au Figure 165 : Terminal

Figure 165 : Terminal - display process use by all users

EXERCISE 6.3

Stopping a Process.

Sometimes you face with the hang application. You have to terminate the application through manual way. To terminate the process, you have to know the process IDs.

9. Use the following command to display process IDs (Figure 166)

#

ps -aux

9. Use the following command to display process IDs (Figure 166) # ps -aux Figure 166

Figure 166 : Terminal - display process IDs

10. Now try to terminate the bash process start by admin2.

Use one of the following commands to terminate the bash process (Figure 167):

#

kill

5503

or

#

kill -9 5503

or

#

kill -SIGKILL 5503

Signal

Statement

Explanation

1

HUP or SIGHUP

Reload the process. Also called Clean Shut Down and Restart.

2

INT or SIGINT

Terminate the process. Same as Ctrl + C

9

KILL or SIGKILL

Order the operating system to terminate the process without waiting the process terminates itself.

15

TERM or SIGTERM

Order the process to terminate by its application and exit immediately.

Figure 167 : Process Table

11.

You also can display the active process by using Top utility. Top will display the process in real time. You can terminate or close Top utility by pressing q key.

Enter the following command to display process in the real time (Figure 168):

# top

to display process in the real time (Figure 168): # top Figure 168 : Terminal -

Figure 168 : Terminal - top utility

12. Press q key to close top utility.

13. Close all program and logout server.

Exercise 7

Domain

(BIND)

Installation

and

Configuration

By

Zulfadli Bin Mohd Saad

Computer Engineering Technology (Networking) Department of Electronic MARA Vocational Institute, Lumut, Perak.

http://zcomby-server2008.blogspot.com/

Exercise 7 : Domain (BIND) Installation and Configuration

In this section, you’ll learn how to implement a domain name server for your network. Domain Name System (DNS) or Bind (name use in Linux system) provides a standard method for associating names with numeric Internet addresses. This makes it possible for users to refer to network computers by using easy-to-remember names instead of a long series numbers.

The first step is required to ensure that you are using a static IP address and that the DNS settings on the computer have been correctly configured. Make sure you have hook up your PC to the network and you are using a static IP address before you start.

1. Login to the server as admin2 and 3xerci5e as password (Figure 169).

server as admin2 and 3xerci5e as password (Figure 169). Figure 169 : User login. 2. Launch

Figure 169 : User login.

2. Launch Terminal. Application ►Accessories ► Terminal (Figure 170).

User login. 2. Launch Terminal . Application ►Accessories ► Terminal (Figure 1 70). Figure 170 :

Figure 170 : Launch Terminal.

3.

Change to Super User su (Figure 171).

3. Change to Super User – su (Figure 171). Figure 171 : Super User privilege. EXERCISE

Figure 171 : Super User privilege.

EXERCISE 7.1

Check installation package.

4. You can check whether you have the Bind administration utility installed by executing the following command (Figure 172):

# dpkg -l bind9

the following command (Figure 172): # dpkg -l bind9 Figure 172 : Terminal – Package checking

Figure 172 : Terminal Package checking

If the utility is missing you can install it using the following command but make sure your Debian DVD are inserted in the DVD drive:

# apt-get install bind9

Let’s configure Bind. To configure Bind you need to edit 3 files:

/etc/resolv.conf

/etc/bind/named.conf.local

/etc/hosts

create 2 new files:

---> Declare Search Domain and Domain Name Server ---> Declare Forward and Reverse zone file location ---> Declare host

/etc/bind/myserverSN.com.db

/etc/bind/myserverSN.com.arpa

Note: SN Station number.

---> Create Forward zone file ---> Create Reverse zone file

EXERCISE 7.2

Declare Search Domain and Domain Name Server

5. To declare Search Domain and Domain Name Server, you have to edit the resolv.conf file and insert 3 line below:

domain myserver SN.com search myserver SN.com nameserver 192.168.2.SN

Note: SN Station number.

---> Your domain name ---> Your search domain name ---> Your domain IP address

You will use vim to edit resolv.conf file. Vim is a text editor that is upwards compatible to vi. It can be used to edit all kinds of plain text. It is especially useful for editing programs.

Execute the following command to edit resolv.conf (Figure 173):

# vim /etc/resolv.conf

command to edit resolv.conf (Figure 173): # vim /etc/resolv.conf Figure 173 : Terminal – edit resolv.conf

Figure 173 : Terminal edit resolv.conf

Basic vim Commands

Key Strokes

What it Does

/ text

Searches for the text entered. The search starts from the cursor's position.

: file

Opens the file named.

: q

Quits vim without saving.

: w

Saves open file

Esc

Starts command mode.

^r

Redo an action that was undone.

h

Moves the cursor one character to the left.

i

Starts insert mode.

j

Move the cursor down to the next line.

k

Moves the cursor up to the next line.

l

Moves the cursor one character to the right.

p

Pastes to the clipboard.

R

Starts over writing.

u

Undo last action.

x

Deletes the character at the cursor.

yw

Moves the current word to the clipboard.

yy

Moves the current line to the clipboard.

6. Press i to start insert mode and enter the line below (Figure 174):

domain myserver SN.com search myserver SN.com nameserver 192.168.2.SN

Note: SN = Station number.

---> Your domain name ---> Your search domain name ---> Your domain IP address

Your search domain name ---> Your domain IP address Figure 174 : Terminal - Declare Search

Figure 174 : Terminal - Declare Search Domain and Domain Name Server

7.

Press ESC to exit insert mode.

8. Press :wq to save and exit vim (Figure 175)

to exit insert mode. 8. Press :wq to save and exit vim (Figure 175) Figure 175

Figure 175 : Terminal save and exit vim.

EXERCISE 7.3

Declare Forward and Reverse zone file location

9. To declare Forward and Reverse zone file location, you have to edit the named.conf.local file. Execute the following command to edit named.conf.local file (Figure 176):

# vim /etc/bind/named.conf.local

file (Figure 176): # vim /etc/bind/named.conf.local Figure 176 : Terminal – edit named.conf.local file 10.

Figure 176 : Terminal edit named.conf.local file

10. Press i to start insert mode and enter the line below (Figure 177):

zone "myserverSN.com" { type master; file "/etc/bind/myserverSN.com.db"; };

zone "SN.2.168.192.in-addr.arpa" { type master; file "/etc/bind/myserverSN.com.arpa"; };

Note: SN = Station number.

SN .com.arpa"; }; Note: SN = Station number. Figure 177 : Terminal - declare Forward and

Figure 177 : Terminal - declare Forward and Reverse zone file location

11. Press ESC to exit insert mode.

12. Press :wq to save and exit vim (Figure 178)

to exit insert mode. 12. Press :wq to save and exit vim (Figure 178) Figure 178

Figure 178 : Terminal save and exit vim.

EXERCISE 7.4

Declare Hosts

13. To declare hosts, you have to edit the hosts file. Execute the following command to edit hosts file (Figure 179):

# vim /etc/hosts

command to edit hosts file (Figure 179): # vim /etc/hosts Figure 179 : Terminal – edit

Figure 179 : Terminal edit hosts file

14. Press i to start insert mode and enter the line below (Figure 180):

127.0.0.1

localhost

192.168.2.SN

debianserverSN.myserverSN.com

debianserverSN

Note: SN = Station number.

SN .com debianserver SN Note: SN = Station number. Figure 180 : Terminal - declare hosts

Figure 180 : Terminal - declare hosts

15. Press ESC to exit insert mode.

16. Press :wq to save and exit vim (Figure 181)

16. Press :wq to save and exit vim (Figure 181) Figure 181 : Terminal – save

Figure 181 : Terminal save and exit vim.

EXERCISE 7.5

Create Forward zone

17. In previous exercise you have declare myserverSN.com.db as your forward zone file. To create Forward zone file, execute the following command (Figure 182):

# touch /etc/bind/myserverSN.com.db

command (Figure 182): # touch /etc/bind/myserver SN .com.db Figure 182 : Terminal – create Forward zone

Figure 182 : Terminal create Forward zone file

18. Now edit your Forward zone file, execute the following command to edit (Figure 183):

# vim /etc/bind/myserverSN.com.db

to edit (Figure 183): # vim /etc/bind/myserver SN .com.db Figure 183 : Terminal – edit Forward

Figure 183 : Terminal edit Forward zone file

19. Press i to start insert mode and enter the line below (Figure 184):

$TTL 3D myserverSN.com.

IN

SOA

debianserverSN.myserverSN.com.

root.myserverSN.com. (

 

2011030401

--> serial number; base on date

24H

--> refresh time

12H

--> retry

1W

--> expiry

1H )

-->minimum TTL

myserverSN.com.

IN

NS

debianserverSN.myserverSN.com.

myserverSN.com.

IN

A

192.168.2.SN

Note: SN = Station number. Use spacebar for single spacing only. For width spacing between words use Tab.

Figure 184 : Terminal - Forward zone 20. Press ESC to exit insert mode. 21.

Figure 184 : Terminal - Forward zone

20. Press ESC to exit insert mode.

21. Press :wq to save and exit vim (Figure 185)

mode. 21. Press :wq to save and exit vim (Figure 185) Figure 185 : Terminal –

Figure 185 : Terminal save and exit vim.

Zone files definitions.

Record

Definition

SOA

List your administrative configuration for your domain.

NS

List the DNS server for your domain.

A

Domain name for IP address mapping.

MX

Use by mail server in your domain.

EXERCISE 7.6

Create Reverse zone

22. In previous exercise you have declare myserverSN.com.arpa as your reverse zone file. To create Reverse zone file, execute the following command (Figure 186):

# touch /etc/bind/myserverSN.com.arpa

(Figure 186): # touch /etc/bind/myserver SN .com.arpa Figure 186 : Terminal – create Reverse zone file

Figure 186 : Terminal create Reverse zone file

23. Now edit your Reverse zone file, execute the following command to edit (Figure 187):

# vim /etc/bind/myserverSN.com.arpa

to edit (Figure 187): # vim /etc/bind/myserver SN .com.arpa Figure 187 : Terminal – edit Reverse

Figure 187 : Terminal edit Reverse zone file

24. Press i to start insert mode and enter the line below (Figure 188):

$TTL 3D

SN.2.168.192.in-addr.arpa. IN SOA debianserverSN.myserverSN.com. root.myserverSN.com. (

2011030401

--> serial number; base on date

24H

--> refresh time

12H

--> retry

1W

--> expiry

1H )

-->minimum TTL

SN.2.168.192.in-addr.arpa. IN NS debianserverSN.myserverSN.com.

SN.2.168.192.in-addr.arpa. IN PTR myserverSN.com.

Note: SN = Station number. Use spacebar for single spacing only. For width spacing between words use Tab.

Figure 188 : Terminal - Reverse zone 25. Press ESC to exit insert mode. 26.

Figure 188 : Terminal - Reverse zone

25. Press ESC to exit insert mode.

26. Press :wq to save and exit vim (Figure 189)

mode. 26. Press :wq to save and exit vim (Figure 189) Figure 189 : Terminal –

Figure 189 : Terminal save and exit vim.

27. Restart service. Execute the following command to restart Bind service (Figure 190):

# /etc/init.d/bind9 restart

to restart Bind service (Figure 190): # /etc/init.d/bind9 restart Figure 190 : Terminal – Restart Bind

Figure 190 : Terminal Restart Bind service.

EXERCISE 7.7

Test DNS server

28. Testing Forward zone. Execute the following command to test Forward zone (Figure

191):

# nslookup

myserverSN.com

Note: SN = Station Number.

# nslookup myserver SN .com Note: SN = Station Number. Figure 191 : Terminal – Testing

Figure 191 : Terminal Testing Forward zone.

29. Testing Reverse zone. Execute the following command to test Reverse zone (Figure

192):

# nslookup

192.168.2.SN

Note: SN = Station Number.

192): # nslookup 192.168.2. SN Note: SN = Station Number. Figure 192 : Terminal – Testing

Figure 192 : Terminal Testing Reverse zone.

30. Logoff the server.

Exercise 8

FTP Server Installation and Configuration

By

Zulfadli Bin Mohd Saad

Computer Engineering Technology (Networking) Department of Electronic MARA Vocational Institute, Lumut, Perak.

http://zcomby-server2008.blogspot.com/

Exercise 8 : FTP Server Installation and Configuration

File Transfer Protocol (FTP) is a TCP protocol for uploading and downloading files between computers. FTP works on a client/server model. The server component is called an FTP daemon. It continuously listens for FTP requests from remote clients. When a request is received, it manages the login and sets up the connection. For the duration of the session it executes any of commands sent by the FTP client.

Access to an FTP server can be managed in two ways:

Anonymous

Authenticated

In the Anonymous mode, remote clients can access the FTP server by using the default user account called "anonymous" or "ftp" and sending an email address as the password.

In the Authenticated mode a user must have an account and a password. User access to the FTP server directories and files is dependent on the permissions defined for the account used at login. As a general rule, the FTP daemon will hide the root directory of the FTP server and change it to the FTP Home directory. This hides the rest of the file system from remote sessions.

1. Login to the server as admin2 and 3xerci5e as password (Figure 193).

remote sessions. 1. Login to the server as admin2 and 3xerci5e as password (Figure 193). Figure

Figure 193 : User login.

2.

Launch Terminal. Application ►Accessories ► Terminal (Figure 194).

. Application ►Accessories ► Terminal (Figure 194). Figure 194 : Launch Terminal. 3. Change to Super

Figure 194 : Launch Terminal.

3. Change to Super User su (Figure 195).

Terminal. 3. Change to Super User – su (Figure 195). EXERCISE 8.1 Figure 195 : Super

EXERCISE 8.1

Figure 195 : Super User privilege.

vsftpd is an FTP daemon available in Debian. It is easy to install, setup and maintain.

Check installation package.

4. You can check whether you have the vsftpd administration utility installed by executing the following command (Figure 196):

# dpkg -l vsftpd

by executing the following command (Figure 196): # dpkg -l vsftpd Figure 196 : Terminal –

Figure 196 : Terminal Package checking

vsftpd FTP Server Installation (don’t do step 4.1 & 4.2 if your vftpd package already installed)

4.1. If the utility is missing you have to install it. To install vstpd, insert your Debian DVD (disc 1) into your DVD drive and execute the following command (Figure 197):

# apt-get install vsftpd

following command (Figure 197): # apt-get install vsftpd Figure 197 : Terminal – Installing package. 4.2.

Figure 197 : Terminal Installing package.

4.2. Press Y key to continue (Figure 198).

– Installing package. 4.2. Press Y key to continue (Figure 198). Figure 198 : Terminal –

Figure 198 : Terminal Installing package.

By default, your FTP server is now successfully running but only anonymous FTP is allowed to login and download from your FTP server.

5. After finish installing vsftpd package , the system automatically create home directory for the FTP server. By default, the home directory for FTP server are created under the /home directory.

You can check the FTP server home directory by execute the following command:

# cd /home

# ls

by execute the following command: # cd /home # ls Figure 199 : Terminal - user

Figure 199 : Terminal - user /home directory.

You can see there are new directories named “ftp” under /home directory (Figure 199).

EXERCISE 8.2

Creating new file

6. Change to ftp home directory by executing the following command (Figure 200):

# cd

/home/ftp

the following command (Figure 200): # cd /home/ftp Figure 200 : Terminal – ftp home directory.

Figure 200 : Terminal ftp home directory.

7. Create new file named ftptest.txt by using the following command (Figure 201):

# touch /home/ftp/ftptest.txt

command (Figure 201): # touch /home/ftp/ftptest.txt Figure 201 : Terminal – Creating new file. 8. Display

Figure 201 : Terminal Creating new file.

8. Display contents of the ftp home directory by execute the following command (Figure

202):

# ls

by execute the following command (Figure 202): # ls Figure 202 : Terminal – Display directory

Figure 202 : Terminal Display directory contents.

You can see there are new file named “ftptest.txt” under /home/ftp directory (Figure

202).

EXERCISE 8.3

Configuring a Client Computer to test the FTP server.

Please refer to the following table for client configuration.

Name of This Computer

clientxpSN

Name of Organization

IKM

Role of This Computer

Client Workstation

Name of Installer

Administrator

Domain Name

same domain name as you did for the Server

TCP/IP Address

192.168.2.SN

TCP/IP Subnet mask

255.255.255.0

TCP/IP Gateway

192.168.2.ServerNumber

Preferred DNS server

192.168.2.ServerNumber

Note : SN = Station Number

Use the same domain name as you did for the Server.

9.

Launch Network Connections application program. Click Start All Programs ►Accessories ►Communications ►Network Connections (Figure 203)

►Communications ►Network Connections (Figure 203) Figure 203 : Launch Network Connections 10. Right click

Figure 203 : Launch Network Connections

10. Right click Local Area Connection (Figure 204).

10. Right click Local Area Connection (Figure 204). Figure 204 : Local Area Connection 11. Select

Figure 204 : Local Area Connection

11. Select Properties (Figure 204).

12. Double click Internet Protocol (TCP/IP) (Figure 205)

12. Double click Internet Protocol (TCP/IP) (Figure 205) Figure 205 : Local Area Connection Properties 13.

Figure 205 : Local Area Connection Properties

13. Now set your client (Windows XP) IP address, and ensure that you are using a static IP address. For this exercise, I’m using number 61 as my Windows XP client station number (Figure 206)

61 as my Windows XP client statio n number (Figure 206) Use the following IP address:

Use the following IP address:

IP address

:

192.168.2.SN

(client station number)

Subnet mask

:

255.255.255.0

Default gateway

: 192.168.2.ServerNumber

(server IP address)

gateway : 192.168.2. ServerNumber (server IP address) Use the following DNS server address: Preferred DNS server

Use the following DNS server address:

Preferred DNS server Alternate DNS server

: 192 . 168 . 2 . ServerNumber :

(1 st server IP address) (2 nd server IP address)

Figure 206 : Internet Protocol (TCP/IP) Properties 14. Click OK button (Figure 207) Figure 207

Figure 206 : Internet Protocol (TCP/IP) Properties

14. Click OK button (Figure 207)

(TCP/IP) Properties 14. Click OK button (Figure 207) Figure 207 : Local Area Connection Properties 15.

Figure 207 : Local Area Connection Properties

15. Click OK button (Figure 207) and close all remaining windows.