One of our objectives for INFO300 is for students to have hands-on more than one type of server, and these days: if it the server isn't a mainframe or mid-range web server, and it isn't a Windows server, it's likely to be a 'LAMP' server!
'LAMP' is the combination of Linux OS, Apache httpd, MySQL DBMS, and PHP for the programming language. The 'P' can also stand for other Open Source languages: Perl, a powerful, older, aministrative scripting language with strange syntax; Python, an Object Oriented language easy to interface to browser, desktop, and web components; or, Ruby, maybe on Rails, which is a recent, very powerful & easy-to-master language for the 'LAM' environment that doesn't start with a 'P'.
In the recent past, from the '90s thru the turn of the century, this 'LAMP' platform was very limited in scalabilty. Although all the skills are transferable to commercial UNIX able to run a mid-range or larger machine, Linux was usually deployed on PCs or servers with Intel processors and limited amounts of RAM, and used for small application or web servers with little traffic.
Today, in 2013, the Linux OS on 64-bit machines is losing some of its scalability issues. And Linux has been getting professional, enterprise-quality support on mid-range and mainframe computer hardware from IBM, HP, Sun, and other manufacturers. RedHat and Suse/Novell are the favorite 'commercial flavors' of Linux. IBM's Engineers are enthusiastic about the ability to integrate Linux OS and applications with their proprietary i5 and z operating systems.
IBM has encouraged sales of their Mainframe-class zApp CPU and Chassis, _un_bundled from the typical zOS, since about 2008 and provides expert support for them -- one of these mainframe machines can handle the workload of thousands and thousands of workstation/server-class machines. Where Intel-based server/workstations are limited to a few of quad-core CPUs and a TByte or 2 of of RAM, a Mid-range or Mainframe can handle 32, 64, more more 64-bit CPUs and many TeraBytes of RAM.
Sun, recently acquired by Oracle, has for some years supported RedHat Linux engineers who customize RedHat Linux ($20,000 a copy) to run on Sun Mainframes, which can also handle lots of SMP processors, and many TeraBytes of RAM, and huge disks.
Any skills laid on for work at info300.net are pretty-much directly applicable to those needed to administer the 'big iron' that many believe is the best solution for highly scalable eBusiness applications and databases. If you
info300.net, aka info202.info & info465.info, is a small LAMP (Linux, Apache, MySQL, PHP) server available for students in INFO300 & INFO202 for their projects. It is a VPS-Virtual Private Server at RackSpaceCloud.com. It's able to handle a couple labs of students pounding on it via SSH all at the same time, or about three 'remote X sessions'. It's not locked down very tightly so students can view logs or configuration files as they explore unix.
SSH (Secure SHell) is a protocol that provides secure access via The Internet to the 'shell' or 'command line' of a Linux server. PKI-Public Key Infrastructure provides secure authentication & encryption for automated computer-to-computer processes, and accommodates passwords entered on-line for people to securely access the command line. You'll need an 'SSH Client' on your computer to get to it. Mac users already have one built into the unix OSX and only need to open a terminal window to access it. Windows users need to get an SSH Client, and 'putty.exe' is perhaps the most used terminal emulator, is available for free, see below...
There are also insecure ways to connect that might come to your attention if you poke around on-line. 'Telnet' is one, but we don't use these anymore. Without the secure shell, userids and passwords are passed as plain text over The Internet and anybody 'sniffing packets' would be able to glean userid/password/and destination address from the packets.
Mac OSX and Linux already have a 'terminal' window and and have ssh built in as a command. On these you don't need putty.exe and can just open a 'terminal' or 'console' and enter
to log into the server (where fmlast is the userid assigned for you).
A correct password will get you to your 'prompt', where the cursor will sit on the command line, waiting for you to type a command.
For Windows users, 'putty.exe' is recommended. The PCs in the 2nd and 4th floor labs have Putty in the Windows Start menu, under Linux Applications. If you're working on your own PC or notebook, putty.exe is free for download at the developer's website. (Or google on 'download putty' and it will likely be the top line). putty.exe is a couple megabytes that can be put on your desktop, or on your thumbdrive, where you can double-click to start it.
When you double-click putty's icon its configuration screen should pop up for you to enter the Host Name, Port, and Protocol to be used for your session on the server.
These are info300.net, 22, and SSH, respectively, to be entered in place of info465.net shown here:
If you make an error, you'll get an 'Unable to open connection' message from PuTTY. If this happens, just click OK and try again.
If host name, userid and port are filled in correctly you should get a 'black screen' prompting for your login id.
(Note: If putty just 'blips out' without prompting your for a login id it please check for any firewall(s) you may be running to ensure that port 22 is open for outgoing traffic and established connections. Or, it may be that you are trying to access the server from a network that has been 'banned' because of cracker activity in the past. If you're sure your port 22 is open, contact me via email and report your Public IP Address and the approximate time you attempted to log in. Googling on 'what is my ip address' will show you the public IP address your ISP is providing for you at the time.
Enter the login id assigned to you and press the Enter key. If you enter an incorrect id, which _is_ case sensitive, you'll need to 'X out' of putty and try again.
Entering a correct login id will get you a prompt for a password. Enter the password (case sensitive) and hit the enter key. Notice that the password is not 'echoed' back to the screen, to help keep it secure from someone who may be watching.
Make your 'terminal window' larger! Whether it's putty or a linux or OSX terminal, please make it larger! Use at least a full screen or 132 columns X 40 rows! Working with a tiny terminal window severly limits what you can see and delays understanding of everything that follows! This doesn't apply to phablet users, they're stuck with a tiny screen and half of that occluded by a virtual keyboard...
Commands entered on this server are interpreted by 'bash'. For decades, the 'shell' that sat between a user and the Unix 'kernel' was likely to be the 'Bourne Shell'. In Linux, the Bourne shell has been updated to use edit keys and other features on a PC keyboard -- now it's the 'Bourne Again SHell', or bash.
The dollar mark ($) is the traditional bash prompt for an 'ordinary user'. (A 'privileged user', like root, gets a pound sign (#), which is an indication that ordinary system privileges do not apply.)
This version of Linux also provides the userid and name of the current directory as part of the prompt on each command line. This can be very helpful when working with more than one machine, or terminal window at a time.
Please change your password immediately when you log in.
The command to start the password dialog is
After entering, you'll be prompted to enter the old password as a security measure so somebody who finds your command line can't change it. Also, nothing is 'echoed' when typing passwords, another security measure that is normal behavior of the command line.
After entering the current password you'll be prompted to enter the new password, which is checked by the passwd function for adequacy. Use a combination of upper & lower-case letters and numbers, avoiding words in the dictionary.
If you've entered a 'strong enough' password you'll be prompted to repeat it. If both are the same the new password will be assigned.
Always make sure vi is closed if you log off the wicked way, by clicking the X at the top of your terminal window.
Typing 'exit' at the command line is the 'cleanest' way to log off.
When you log into the server, you are 'in' your home directory. The 'full filename and path' is like /home/flname.
For this class, students' 'home directories' are already in place, named the same as the login id provided.
You'll need to make directories named 'Outlines', case-sensitive, and 'web', all lower-case. Your web directory is linked to the web server's 'document root' for info300.net. Files placed in your 'web' directory, /home/flname/web, are available via The Internet using a URL like 'info300.net/flname'.
Files placed in your home or Outlines directory are _not_ available to the web server so this is a good place to keep stuff that shouldn't be accessible via a web browser.
Project #1 asks students to edit some text files and build a website using the vi editor. Do not use Word, DreamWeaver, or other tool that 'generates HTML'.
Info300.net's web server is rigged to serve up a file named _exactly_ index.html, so plan to get this into place.
All the demo scripts use an 'external CSS', as discussed in class, so you'll need to get this in place in your web directory, too, to have a valid web page.
IS Majors should be working with the 'server-side' editor 'vi'.
vi (Visual Editor) provides 'syntax highlighting' that helps avoid bugs in your code. There is a lot of value in learning to use vi. It is a *ix component and is on every *ix server and something like it is used at the command line of routers and other networking equipment. If you're interested in network admin or application development, vi is the best to learn.
vi provides just about zero 'help' and expects you to know what you're doing. Get your eyes on a vi tutorial _before_ you set to using it! Use vi to edit several paragraphs into a file or two so that you internalize how it works. Here are some good tutorials:
From your home directory, use 'mkdir Outlines' to make the directory. Then use 'chmod 700 Outlines' to set its permissions.
For the last part of the HOL exercise, you'll need a directory named 'web' in your home directory so that your web pages are accessible from the link at info300.net.
You're welcome to choose any one of the demos, copy it into your web directory as 'index.html' and edit it to make the 'skeleton' for your web page.
At the command line, in your home directory, enter
mkdir web chmod 701 web
mkdir makes, or creates, your web directory. chmod 701 allows the web directory to be on a path for others to follow, so the apache server (httpd) will be able to serve up the contents.
Use 'cd web' to change to your new web directory. Files placed in this directory will be served up from your link at info300.net.
Your 'home page' must be named _exactly_ index.html. info300.net is rigged to serve up a file named index.html or index.php when no particular resource is identified...
Using vi, you can create index.html by entering 'vi index.html' at the command line while in your web directory. When you use the vi command 'w' to write your changes it will place the changed file in the directory.
Any files that need to be viewable on the web need to have their permissions set to 604 or 644 whether they're html, graphics, or CSS. While in your web directory, type
chmod 604 index.html
This will set the permissions to rw----r--, so you can read & write, and 'the world' can read your files thru the browser, and others in your same group, 'Students' will not be able to read them directly. (Google on 'linux permissions' to find discussions about the *ix permissions scheme.)
You _can_ copy/paste text from Windows into vi. Highlight what needs to be copied from View -> Source or other place on your PC, then use Edit -> Copy or Ctrl-C to put it onto your clipboard. Position the cursor where the copied text needs to be. With vi in Insert mode, use 'Shift-Insert', or a right-click, to paste the text into the file.
Webwork is often a find/copy/paste/tweak exercise. For the HOL project you're welcome to copy and tweak most any example except another student's project.
You're welcome to jump start your Project #1 using examples of mobile-friendly, responsive websites at tutorial sites, or from a site the instructor has put up as a very simple example of responsive html & css applied to semantically marked up pages: info300.net/Resp. This three page site shows pages that 'break three times' to fit smartphones, tablets, and full-sized browsers. You can copy the samples to your home directory at info300.net from the command line using:
wget -r info300.net/RespThis 'wget recursive' function will create a directory named info300.net _in the directory where it is run_ so it will make a little exercise in moving files around a directory with linux commands...
Unix/Linux commands are brief and have a minimum vowels. Some commands take 'options' or 'switches' that are usually specified using a minus sign. Some commands have 'operands' that are usually specified by following any options with a space and typing in the operands separated by spaces.
'exit' is used when you're ready to exit from the server. It has no options or operands.
Two useful commands are 'pwd', print working directory, and 'ls', list. Pwd is Print Working Directory, will show the full path for the directory you're in, has no options or operands. Ls with no options or operands will list the contents of the directory across the line, except for hidden files starting with a period. 'ls -la' lists All directory entries, including the hidden files in Long form, which shows the permissions, ownership, and group.
Lacking the GUI 'directory tree', programmers often use pwd to make sure they're in the 'right place'.
'cd', Change Directory, with no options or operands is used to move back to your 'home directory'. If you are in your home directory, typing 'cd web' will take you to your web directory. To 'move back' to the directory you just came from, type 'cd ..'. 'Dot dot' means go back one directory.
Many/most Unix commands can be used with options that control their behavior. Options usually follow the command and are indicated with a minus sign (-) or two (--). For a full list of the options available for any command, the 'manual' can be displayed quickly by typing 'man' and the command, like 'man ls'.
Here 'ls -las' was entered to show 'long format', 'all files', and 'size' along with the names of the files.
Long format adds the date and time that the file was last modified to the list.
The files' size, in bytes, is shown if the 's' (size) option is used.
Some files' names start with a dot (.). These are often files that are used by OS and application programs to store configurations and other data. For example, the .bash_history file keeps track of all the commands that have been entered at the command line. The 'a' (all) option shows these as well, but don't mess with them or you're likely to break your login id!
'cp', Copy, is used to copy files from one place on the server to another. If there was a file named boo.html in your home directory and it needs to be copied, something like 'cp boo.html boo2.html' would make a copy of boo.html in a new file named boo2.html. Something like 'cp boo.html web' will place a _copy_ of the file in your web folder.
'mv', Move, is used to rename a file or move it to another directory. After a mv, there is no copy of the file, unlike with cp. Something like 'mv boo.html' boo2.thml would rename boo.html as boo2.html -- boo.html would be gone. Something like 'mv boo.html web' would move boo.html to the web directory and it wouldn't be where it used to be.
'rm', Remove, is used to delete a file entirely. If you're in the directory with a file (a good idea for newbies) something like rm boo2.html would delete it. With no options, rm prompts to ask if you're really sure before deleting a file. If you're really sure when you issue the command you can avoid the prompt by using the '-f', Force, option. 'rm -f boo2.html' would delete the file without asking anything.
Go to the progress page for your class at info300.net and click on the link with your name. The projects require that your 'home page' launches from this link.
Validate your page and its CSS with w3schools' XHTML validator, located at the lower-right corner of w3schools.com. From your browser's address bar, copy the complete url to your web page or \ external CSS file and paste it into the XHTML or CSS box in the validator, then click the Validate button just under it.
Don't put lots of work into your file before you validate it! Make sure you're starting with a valid 'skeleton', then validate often as you edit!
If errors are found by the validator, you're 'debugging'! In your editor, get to the line number with the error, correct it, save your file, go back to the page with validation results, and use Ctrl-r or click the browser's refresh button to refresh the validation page.
When looking at the page again in your browser, use Ctrl-r or the broswer's Refresh button to load the latest copy of your file.
You're welcome to add images to your web pages. Use a 'secure file transfer client' to put them there.
Windows users: Windows has no built-in 'sftp client', but there are free options. FileZilla is installed on the lab machines, and is an easy download and install on your own Windows desktop and/or notebook. FileZilla also works fine on Mac and Linux, offers advantages over the native options. Chrome has several 'sftp client' options that work fine on either Windoze or Mac, but some recent free entries are adware financed and should be avoided.
If Windows users want to experience the exhiliration of making secure file transfers from a Windows command line the author of putty.exe provides pscp.exe. Download the executable file and copy it to a system directory on your path. From the windows command line pscp works the same as scp on a Mac.
Mac OSX and Linux users: SFTP is provided natively by scp-Secure Copy Program at the OSX command line. When the OSX terminal opens, it's at the command prompt and in your 'home' directory on the Mac. Typing ls will show directories, and cd Pictures will take you to where most Macs keep pictures. When you're in the directory with the picture to move, keep in mind that 'tab completion' works so you may only need a few characters of the file name after the scp. The scp command's syntax is like
scp SomeImage.png email@example.com:SCP will prompt for the password for yourid at info300.net and copy SomeImage.png to your home directory at info300.net. Do 'man scp' for syntax if you're hardcore command line.
OSX releases since Snow Leopard have a gui secure file transfer client available in the menu bar above your active Terminal window. FileZilla is arguably better, gives more feedback about what's going on while you wait for files to be transferred...
Mac OS9 users, if there are any in 2014?, can download 'fugu' or FileZilla
Linux Gnome/GUI users, may optionally use Places -> Connect To a Server and you'll have a window you can drag/drop to/from. If you're really hardcore, Linux has 'scp' Secure Copy Program built in the same as Mac OSX -- do 'man scp' for the command line syntax.
PCs in the classroom and 2nd floor labs have FileZilla on them. It is the recommended 'secure file transfer client' as at about Spring 2012.
Install it on your own Windows desktop or laptop -- google on 'download filezilla' and choose the download for Windows, Mac, or Linux. Take care to get FileZilla directly from Mozilla's site, at some download sites it is sometimes trojaned to send credentials to the bad guys, or pitches ads. There may be a software offer to decline or uninstall if you're not careful.
FileZilla's 'Quick Connect' works to connect to one ssh/sftp server -- make sure to specify Port 22. If you're managing more than one connection or need another protocol use the little Site Manager icon just under the File menu choice to add an entry to 'My Sites'. Fill in these boxes: Host-info300.net; Protocol-SFTP; Port-Leave empty; Logon Type-Normal; User-yourloginid; Password-don't save it on a lab machine.