41
ECT 250: Survey of e-commerce technology Publishing pages on a Unix system

ECT 250: Survey of e-commerce technology Publishing pages on a Unix system

  • View
    216

  • Download
    2

Embed Size (px)

Citation preview

ECT 250: Survey of e-commerce technology

Publishing pages on a Unix system

2

Publishing the page

Now that we can create some basic Web pages,we need to discuss how to publish these pages,that is, make them available on the WWW.

In this course, all Web pages will be publishedon the students.depaul.edu machine.

Next we learn how to move existing pages ontostudents.depaul.edu.

3

The steps for publishing

1. Create the Web page(s) using FrontPage2. FTP the page(s) over to students.depaul.edu3. Telnet into your account and change the

permissions for all necessary files anddirectories.This will include all files transferred in thesecond step.

4

File transfer protocol

• FTP (file transfer protocol) allows files to be transferred between computers connected using TCP/IP.

• It uses the client/server model.• FTP permits files to be transferred in both

directions, that is, from the client to the serveror from the server to the client.

• It can transfer files one at a time or many filessimultaneously.

5

Files types and FTP

FTP allows the transfer of two types of files:

1. ASCII text: files containing only charactersavailable through the keyboard and containingno formatting information.Example: Files created using Notepad

2. Binary data: files containing word processeddocuments, worksheets, graphics, etc.

6

Other functions of FTP

FTP has other useful functions:• Displaying remote and local computers’ directories• Changing the current client’s or server’s active

directories• Creating and removing local and remote directories.

We will use these functions when transferring HTMLdocuments created on a PC to the students.depaul.edumachine.

7

Accessing with FTP

There are two ways to access remote machines:1. Full privilege FTP access: This requires that you

have an account on the remote computer and thatyou supply your username and password.

2. Anonymous FTP: If you do not have an accounton the remote computer, you can type anonymousas the username and your e-mail address as thepassword and obtain limited access to the remotecomputer.

8

To use a browser as an interface with FTP:1. Type ftp://[email protected]. This will bring up a window that prompts you

for your password.3. Type in your password (being careful to type

it correctly) and hit enter.4. The files in your main directory will appear.

Note: Be sure to check that the browser does notstore your password. In IE look at Tools/InternetOptions/Content/AutoComplete.

FTP with a browser

9

Other versions of FTP

You can also directly use FTP programs if theyare installed on your machine.Examples:

• ws_ftp• cuteftp

Most have GUI interfaces and work in a mannersimilar to the Web browser interface.

10

Once you have logged into your account using FTP you can browse through the files located inyour account.

You do this by double clicking on the folders that appear.

Example: ftp://[email protected]

Browsing through files

11

A Web server typically requires that any Web pagesthat are to be published on the site must be locatedin a particular directory.

On students.depaul.edu (and condor.depaul.edu)that directory is public_html.

If you do not have a public_html directory you must create one. All your web pages must be in that directory or they will not be visible to browsers.

HTML directory

12

All pages you will publish for this course mustbe located in a subdirectory of public_htmlcalled ect250.

You will NOT receive credit for your homeworkif they are not located in public_html/ect250.

You must create the ect250 subdirectory since itwill certainly not exist.

An additional requirement

13

To create a directory on students.depaul.eduusing FTP with the browser interface:1. Select File2. Select New3. Select Folder4. Click on the folder and give it the name

you wish it to have.

Alternatively you can use the new folder icon(or a similar button) in any GUI interface for FTP.

Creating directories with FTP

14

Once you have created a public_html directory, youcan move your HTML files into that directory.In order to do that:1. Open up the directory into which you wish to

move the file.2. Open the folder where the file is located on your

local machine.3. Select Edit/Copy or drag the file directly into the

directory.

Example: Place pages into public_html/ect250.

Moving files with FTP

15

Once you can moved your Web pages into youraccount, you now need to ensure that they arevisible to a Web browser.

This involves using Telnet to log into the studentsmachine and changing the access permissions onthe files and directories.

Note: Some FTP programs allow you to changepermissions using the GUI interface. We will useTelnet (and Unix commands) instead.

The next step: Telnet

16

Some Unix commands

• Move to a child directory: cd directory_name• Move up to a parent directory: cd ..• List files/directories in the current directory: ls• List files/directories with permissions: ls –l• Copy a file: cp old_file new_file• Create a new directory: mkdir directory_name• Remove a file: rm file_name• Remove a directory: rmdir directory_name• Rename (move) a file: mv old_name new_name• Help on a Unix command: man commandname

17

To give directory_name the correct permissionsyou must:1. Move into the parent directory of directory_name

using cd (change directory)2. Type: chmod 755 directory_name

In order to give file_name the correct permissions you must:1. Move into the parent directory of file_name

using cd (change directory)2. Type: chmod 644 file_name

Access permissions

18

1. Create the Web page(s) using FrontPage2. FTP the page(s) over to students.depaul.edu

placing them in public_html/ect2503. Telnet into your account and change the

permissions for all necessary files anddirectories. (To move from directory todirectory use the cd command).

This will include public_html, ect250,and all files transferred in Step 2.

The steps for publishing

19

Warning about homework!

You must make sure that the permissions on yourdirectories and files are set correctly before yousubmit your web assignments.

If your pages are not viewable you will simply receive a zero on the assignment.

Helpful hint: Try to view your pages before yousubmit the assignment to make sure it works!

20

Viewing your pages

Once you have created a public_html and an ect250directory, located your files in it, and changed the permissions to the correct values, you can view your pages. To do so:1. Open a browser2. Type: http://students.depaul.edu/~name/ect250/main.html

3. This will bring up your 250 main page, that is, thepage called main.html in public_html/ect250/

Example: http://condor.depaul.edu/~tsettle/ect250/resume.html

21

Moving through directoriesThe important commands:• Move to a child directory: cd directory_name• Move up to a parent directory: cd ..• List files/directories in the current directory: ls• List files/directories with permissions: ls –l

Examples: Move up and down the directory structure in public_html.

22

Changing permissionsThe important commands:• File access permissions: chmod 644 file_name• Directory access: chmod 755 directory_name

Example: Change the permissions on the files inthe public_html directory.

23

More about access permissions

When deciding who can have access to a file,UNIX recognizes three categories of users:

1. Owner: The owner of the file or directory2. Group: Other users belonging to the owner’s

group3. Public: All other users on the system

24

Types of access

There are three things that can be done to a file:1. Read: Examine (but do not change) the file2. Write: Change the file3. Execute: If the file contains a program, run

the programThere are also three things that can be done to adirectory:1. Read: List the contents of the directory2. Write: Change the directory by adding or

removing existing files3. Execute: “Search” the directory using ls –l

25

A permission listing

Because there are three types of users with threetypes of access permission, each file/directory has associated with it 9 different settings.

(It also has another setting that indicates whetherit is a file or directory. What is that?)

Example: A long listing of the ect250 directory.

26

More about chmod

The chmod (change mode) command can usethe following notation:

u user (owner) of a file/directoryg groupo others (public)+ add a permission- remove a permission

Examples: chmod o+r resume.htmlchmod g-x resume.html

27

Values associated with types

There are also values associated with each typeof access:

r 4 w 2 x 1

The sum of these values gives a combination ofthe permissions.Examples:

4 = r only 6 = r and w but not x 7 = r, w, and x

28

Another way to use chmod

Typing chmod value file_name for certain valueschanges the permission of the file. (It also worksfor directories).

Examples:• chmod 644 main.html• chmod 755 public_html

29

Renaming filesThe important command:• Rename (move) a file: mv old_name new_name

Examples: • Change the name of resume.html to main.html• Make the name of the image file all lowercase

30

Copying files

After submitting Web pages, you should not makechanges to them. Any changes should be made toa copy of the page.

The important commands:• Create a new directory: mkdir directory_name• Copy a file: cp old_name new_name

Example: Copy the main page.

31

Deleting files/directories

Use with caution!

The important commands:• Remove a file: rm file_name• Remove a directory: rmdir directory_name

Note that a directory must be empty to be deleted using the above syntax.

32

Using * with commands

The * may be used to match any string of textwhen using a Unix command.

Examples:• chmod 644 *.html• rm *.*• cp ect250/* ect250bk/• mv old_ect250/* new_ect250/

33

Condensing commands

Several Unix commands can be condensed intoone command.

Examples:• cd public_html/ect250/• cd ../../• cp ctilogo.gif pictures/ctilogo.gif• mv main.html ../index.html

34

You need to be careful that the paths inserted for relative pages are correct once you transfer them to students.depaul.edu.

You have two choices if they are not:1. Change the relative path in the file

(Use a text editor to modify the file)2. Change the directory structure to match the path

(Use Unix commands to shuffle files/directories)

Mistakes in relative paths

35

• Links between the home and resume page.• Files were moved to condor.depaul.edu

When created: • info/home.htm• info/ctilogo.gif

After the transfer: • home.htm• ctilogo.gif

An example

36

• To view a file, use the more command.• Syntax: more file_name• Move down one line: Use Return key.• Move down one page: Press the space bar.• Move up one page: Type Control-B.• Quit by pressing the q key.

View the resume page to check the path names.

Viewing files

37

• To modify a file on students.depaul.edu, you needto use a text editor. One of the simplest is pico.

• A text editor is NOT the same thing as a wordprocessor. It does not allow you to control theappearance of the text.

• pico was developed at the University of Washingtonfor composing messages in the pine mail program.The menu structure is similar to pine.

• Syntax: pico file_name

Text editing

38

Note that (^ is the Control button):• ^G: Get Help• ^X: Exit – Ends the pico session, saving the

text that has been modified or created.• ^O: Write Out – Saves your work to a file

without ending the session.• ^R: Read File – Copy a file into the buffer.• ^Y: Previous Page• ^V: Next Page• Move in the file using the arrow keys

Example: Path name in my home page.

Commands in pico

39

Since we do not develop HTML directly in thiscourse, you only want to use pico when you needto adjust the path name of hyperlinks, images, etc.

Remember that the alternative is to adjust thedirectory structure in your account to match thepath given in the hyperlink, image, etc.

This involves moving files and moving/deleting files and directories.

When to use pico

41

Unix references

• Just Enough Unix, Andersen, McGraw Hill, 2000, ISBN 0-07-230297-6.

• Unix: The Textbook, Sarwar, Koretsky, and Sarwar, Addison-Wesley, 2001, ISBN 0-201-61260-7.