1 / 27

Begin to use Linux

Begin to use Linux. Background. Linux is an operating system similar to UNIX. It runs on many different computers and was first released in 1991. The source code is opened, that is, available at no cost to anyone who wants to modify it. There are of different versions of Linux in the market.

zion
Download Presentation

Begin to use Linux

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Begin to use Linux

  2. Background • Linux is an operating system similar to UNIX. It runs on many different computers and was first released in 1991. • The source code is opened, that is, available at no cost to anyone who wants to modify it. • There are of different versions of Linux in the market. • Want to learn more? Go to http://www.vbird.org

  3. Packages inside Linux • Apache, the most popular web server in the world. • vsftp, very secure file transfer protocol server. • Samba, let Linux become a Windows File Server. • SendMail, SMTP server • DHCP Server • Bind, DNS Server • MySQL, PostgresSQL, Database Server • iptables – A powerful firewall

  4. Try Linux with Putty • Putty is a Remote Shell which can let users run his own linux shell in a remote site • Open Putty in your Windows. • Under Host Name type: ictlab.tyict.vtc.edu.hk • Protocol MUST use SSH. • Click ‘Open’ to open a ssh terminal. • Username: your student id • Password: your HKID without bracket and MUST USE UPPER CASE, e.g G123456A

  5. Directories • Linux use ‘/’ as directories parser (Windows use ‘\’), e.g. /home/alan. • Files name and Directories name in Linux is case sensitive. • No Drives (A:, C: or D: ) name in Linux, you need to ‘mount’ a floppy or CD-ROM drives to a directories • All directories are started from ‘root directory /’ • Each user has his/her ‘home directory’. For user ‘alan’, by default, his home directory is ‘/home/alan’. • Home directory for Super User ‘root’ is ‘/root’

  6. Commands to access Directories • All commands in Linux is case sensitive • cd /etc • Change directory to /etc • cd ~ • Change to your home directory • cd .. • Move to the parent directory of the current directory. • cd - • Move back to the previous directory you were in.

  7. Commands to access Directories (2) • ls -al • List all files or directories name in long format under current directory • pwd • Display current directory's absolute path. • mkdir work • Create the directory ‘work’ in the current directory. • mkdir -p work/reports/2001/oct • Create the directory work/reports/2001/oct, creating parent (-p) directories (work, work/reports, work/reports/2001) as required without danger of overwriting existing directories.

  8. Commands to access Files • cp a.txt backup/a_bk.txt • Copy the file a.txt across to the directory backup and rename it a_bk.txt. • cp -r a b • Copy the directory a into the directory b. The -r means recursive (i.e. the files and subdirectories contained in the directory, plus the files and subdirectories contained in the subdirectories, and so on). • mv a.txt work/reports • Move the file a.txt across to the directory work/reports. • mv a.txt b.txt • When you move a file to its current location, you rename it. In this case the file a.txt is renamed b.txt.

  9. Commands to access Files (2) • rm a.txt • Remove the file a.txt. • rm -r work/reports • To remove a directory (even an empty one) you need to add -r. Here the directory work/reports is removed. • touch report.txt • Create an empty file (in this case report.txt), or if it already exists, update its access and modification time. • less dirs.txt • View the dirs.txt file in the less program, allowing you to view large files, line by line. (Press q to quit.)

  10. Linux Installation • Press Enter for the first screen. • In each of the following steps, press ‘OK’ to proceed to the next step. (You can press ‘Tab’ to move your cursor to ‘OK’) • Select ‘English’ for language. • Select ‘US’ for keyboard. • Select ‘HTTP’ for media. • Select ‘DHCP’ for ip address.

  11. Linux Installation (2) • In Server name field, enter ictlab.tyict.vtc.edu.hk • In Directory field, enter /ftp/fedora/linux/core/4/i386/os • A graphical screen will comes up. • For Language Selection, choose ‘Chinese (Traditional) • For Install Type, choose ‘Custom’

  12. Linux Installation (3) • For Disk Partitioning Setup, choose ‘Manually partition with Disk Druid’ • WARNING: YOU CANNOT TOUCH /hdc IN YOUR DISK PARTITION! • Create 3 partitions in Druid: • /, file size 10000 • /home, file size 10000 • Swap, file size 1000 • Do not use /hdc! Do not use LVM! • For the password, type ‘cmuser’.

  13. Linux Installation (4) • For Firewall Configuration, choose: • Enable Firewall • Check Remote Login, Web Server and File Transfer • WARNING: Disable SELinux! • For Package Group Selection, choose: • Web Server • Windows File Server • FTP Server • DNS Server • Network Server

  14. Install Package with RPM • Go to http://ictlab.tyict.vtc.edu.hk/~alanpo and then download the Java Run Time (jre) RPM package to your home directory. • Open a terminal in your desktop • Type following command to install (jre): • rpm -Uvh jre*.rpm • Upgrades jre or installs the package if no previous version was found. U for upgrade, v for verbose (so you know what's going on), and h for hash (to show a progress bar).

  15. More about RPM • rpm -q jre • Query RPM database, to display version of X-Chat installed. Useful for discovering if you have something installed. • rpm -qa | sort | less • To display all (-a) RPMs installed, in alphabetic order, and in the less program. • rpm -e jre • Uninstall (erase) the package webmin.

  16. Users Management in Linux

  17. root • All Linux distributions setup a special account called ‘root’ during installation. • The ‘root’ account gives you access to everything. • If your shell prompt ends with a hash/number-sign (#) you're logged-in as root. Normal user is a dollar-sign ($)

  18. Create a new user • Only ‘root’ can create and remove user accounts. • useradd alan • Add a new user alan • His home directory will be /home/alan • passwd alan • Give this new account a password • finger alan • List the user information of alan

  19. Remove a user • userdel alan • Remove user alan • userdel -r alan • Remove user alan and ALL THE FILES in his home directory

  20. su - substitute user • The su command allows you to temporarily become another user, until you press Ctrl+D to logout. • su • Become root but you need to submit root’s password • su - alan • Become alan.

  21. Group Management (2) • Arrange a GROUP of users can easily to apply some common policies to them. • Every user belongs to at least one group, their login group - given the same name as their user account. • groupadd students • This will create the students group. • usermod -G students john • Add user john to the group students.

  22. Group Management (3) • less /etc/group • Show all groups and their members. • groupmod –n students tn_students • Rename a group • groupdel tn_students • Remove the group tn_students • groups • Display groups you belong to. • groups john • Display groups john belongs to.

  23. Access Rights • Three kinds of Access Rights: • r – read, w – write, x – execute • Three kinds of people to access files: • owner, group, others • To display the owner and group a file belongs to, enter ‘ls -l’ : • -rw-rw-r-- 1 john tyict 1076 Nov 20 16:50 report.txt • First column (-rw-rw-r--) is Access Right • Third column (john) is owner • Fourth column (tyict) is group

  24. Access Right (2) • Here is the break of -rw-rw-r--: • Type: - for normal files, d for directories and l for Symbolic link • For owner rw-, he/she can read, write but cannot execute the file • For group rw-, same as owner • For others r--, he/she can read but cannot write or execute the file

  25. Change Access Right • chown john report.txt • Change owner of file report.txt, to john. • chown -R john . • Change owner of all files and subdirectories (i.e. -R for recursively) in the current (.) directory, to john. • chgrp tn_stundents report.txt • Change group of file report.txt, to tn_stundents. • chgrp -R tn_stundents . • Change group of all files and subdirectories (i.e. -R for recursively) in the current (.) directory, to john.

  26. Change Access Right (2) • chmod a+rw report.txt • Give all users read and write permission. • chmod go-wx report.txt • Remove write and execute permission (-wx) from report.txt for group and others (go).

  27. Change Access Right (3) • Permissions can also be set in octal (base 8), where read permission is a four, write is two, and execute is one. These you add up separately for user, group and other for between 000 (---------) and 777 (rwxrwxrwx), like so:

More Related