Transcript Document

ECT 250: Survey of e-commerce technology
Publishing pages on a Unix system
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 published
on the students.depaul.edu machine.
Next we learn how to move existing pages onto
students.depaul.edu.
2
The steps for publishing
1. Create the Web page(s) using FrontPage
2. FTP the page(s) over to students.depaul.edu
3. Telnet into your account and change the
permissions for all necessary files and
directories.
This will include all files transferred in the
second step.
3
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 server
or from the server to the client.
• It can transfer files one at a time or many files
simultaneously.
4
Files types and FTP
FTP allows the transfer of two types of files:
1. ASCII text: files containing only characters
available through the keyboard and containing
no formatting information.
Example: Files created using Notepad
2. Binary data: files containing word processed
documents, worksheets, graphics, etc.
5
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 HTML
documents created on a PC to the students.depaul.edu
machine.
6
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 that
you supply your username and password.
2. Anonymous FTP: If you do not have an account
on the remote computer, you can type anonymous
as the username and your e-mail address as the
password and obtain limited access to the remote
computer.
7
FTP with a browser
To use a browser as an interface with FTP:
1. Type ftp://[email protected]
2. 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 not
store your password. In IE look at Tools/Internet
Options/Content/AutoComplete.
8
Other versions of FTP
You can also directly use FTP programs if they
are installed on your machine.
Examples:
• ws_ftp
• cuteftp
Most have GUI interfaces and work in a manner
similar to the Web browser interface.
9
Browsing through files
Once you have logged into your account using
FTP you can browse through the files located in
your account.
You do this by double clicking on the folders
that appear.
Example: ftp://[email protected]
10
HTML directory
A Web server typically requires that any Web pages
that are to be published on the site must be located
in 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.
11
An additional requirement
All pages you will publish for this course must
be located in a subdirectory of public_html
called ect250.
You will NOT receive credit for your homework
if they are not located in public_html/ect250.
You must create the ect250 subdirectory since it
will certainly not exist.
12
Creating directories with FTP
To create a directory on students.depaul.edu
using FTP with the browser interface:
1. Select File
2. Select New
3. Select Folder
4. 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.
13
Moving files with FTP
Once you have created a public_html directory, you
can 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.
14
The next step: Telnet
Once you can moved your Web pages into your
account, you now need to ensure that they are
visible to a Web browser.
This involves using Telnet to log into the students
machine and changing the access permissions on
the files and directories.
Note: Some FTP programs allow you to change
permissions using the GUI interface. We will use
Telnet (and Unix commands) instead.
15
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
16
Access permissions
To give directory_name the correct permissions
you 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
17
The steps for publishing
1. Create the Web page(s) using FrontPage
2. FTP the page(s) over to students.depaul.edu
placing them in public_html/ect250
3. Telnet into your account and change the
permissions for all necessary files and
directories. (To move from directory to
directory use the cd command).
This will include public_html, ect250,
and all files transferred in Step 2.
18
Warning about homework!
You must make sure that the permissions on your
directories and files are set correctly before you
submit 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 you
submit the assignment to make sure it works!
19
Viewing your pages
Once you have created a public_html and an ect250
directory, located your files in it, and changed the
permissions to the correct values, you can view your
pages. To do so:
1. Open a browser
2. Type: http://students.depaul.edu/~name/ect250/main.html
3. This will bring up your 250 main page, that is, the
page called main.html in public_html/ect250/
Example: http://condor.depaul.edu/~tsettle/ect250/resume.html
20
Moving through directories
The 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.
21
Changing permissions
The important commands:
• File access permissions: chmod 644 file_name
• Directory access: chmod 755 directory_name
Example: Change the permissions on the files in
the public_html directory.
22
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 directory
2. Group: Other users belonging to the owner’s
group
3. Public: All other users on the system
23
Types of access
There are three things that can be done to a file:
1. Read: Examine (but do not change) the file
2. Write: Change the file
3. Execute: If the file contains a program, run
the program
There are also three things that can be done to a
directory:
1. Read: List the contents of the directory
2. Write: Change the directory by adding or
removing existing files
3. Execute: “Search” the directory using ls –l
24
A permission listing
Because there are three types of users with three
types of access permission, each file/directory
has associated with it 9 different settings.
(It also has another setting that indicates whether
it is a file or directory. What is that?)
Example: A long listing of the ect250 directory.
25
More about chmod
The chmod (change mode) command can use
the following notation:
u user (owner) of a file/directory
g group
o others (public)
+ add a permission
- remove a permission
Examples:
chmod o+r resume.html
chmod g-x resume.html
26
Values associated with types
There are also values associated with each type
of access:
r4
w2
x1
The sum of these values gives a combination of
the permissions.
Examples:
4 = r only
6 = r and w but not x
7 = r, w, and x
27
Another way to use chmod
Typing chmod value file_name for certain values
changes the permission of the file. (It also works
for directories).
Examples:
• chmod 644 main.html
• chmod 755 public_html
28
Renaming files
The 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
29
Copying files
After submitting Web pages, you should not make
changes to them. Any changes should be made to
a 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.
30
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.
31
Using * with commands
The * may be used to match any string of text
when using a Unix command.
Examples:
• chmod 644 *.html
• rm *.*
• cp ect250/* ect250bk/
• mv old_ect250/* new_ect250/
32
Condensing commands
Several Unix commands can be condensed into
one command.
Examples:
• cd public_html/ect250/
• cd ../../
• cp ctilogo.gif pictures/ctilogo.gif
• mv main.html ../index.html
33
Mistakes in relative paths
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)
34
An example
• 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
35
Viewing files
• 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.
36
Text editing
• To modify a file on students.depaul.edu, you need
to use a text editor. One of the simplest is pico.
• A text editor is NOT the same thing as a word
processor. It does not allow you to control the
appearance of the text.
• pico was developed at the University of Washington
for composing messages in the pine mail program.
The menu structure is similar to pine.
• Syntax: pico file_name
37
Commands in pico
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.
38
When to use pico
Since we do not develop HTML directly in this
course, you only want to use pico when you need
to adjust the path name of hyperlinks, images, etc.
Remember that the alternative is to adjust the
directory structure in your account to match the
path given in the hyperlink, image, etc.
This involves moving files and moving/deleting
files and directories.
39
Unix help
If you have any questions about Unix commands
while you are doing the assignment, you should:
1. Check the online Unix reference at:
http://service.depaul.edu/dpo/support/unix/intro.html
2. Type man commandname
3. Check the ECT 250 FAQ
4. E-mail me to ask a question
40
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.
41