LAMP is the combination of Linux OS, Apache web server, MySQL/MariaDB DBMS, and PHP for the programming language. It is the most-used server environment in the world today if the P is expanded to include PHP, Python, Perl, and Ruby. Skills in this environment are in high demand and are easy to develop if you've got hands on the server.
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, usually running on a 32-bit server limited to 4GBytes of RAM and relatively small disks. 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, Linux scales across embedded processors, small servers and server farms, mid-range, and mainframes, and clouds based on any of these technologies. RedHat, Suse, Ubuntu and other Linux distros have been getting professional, enterprise-quality support on mid-range and mainframe computer hardware from IBM, HP, Sun, and other manufacturers for a decade or more. IBM's Engineers and customers 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 of workstation/server-class machines. In 2016, IBM announced Ubuntu on their z-Series, and will sell a mainframe that boots and runs Ubuntu or other Linux flavor natively to provide a huge Linux server, or thousands and thousands of virtual servers. Where Intel-based server/workstations are limited to a couple or multi-core CPUs and a TByte or 2 of of RAM, a Mid-range or Mainframe can handle dozens and dozens of 64-bit CPUs and several TeraBytes or more of RAIDed 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.
It turns out that open source, interpreted languages like PHP, Python, or Ruby are easy to scale up massively in mid-range and mainframe environments. IBM will sell a zSeries mainframe loaded with RedHat, Suse, or Ubuntu for something less than $500,000 and it can handle the load of _thousands_ of server-class machines! IBM's mid-range i and mainframe z are easy and inexpensive way to scale up most open source application environments.
Any skills laid on for work at info465.us are pretty-much directly applicable to those needed to administer the 'big iron' that many believe is the best solution for highly available, fault-tolerant, scalable eBusiness applications and databases. And, of course, the skills apply to millions of servers deployed by smaller businesses and organizations.
info465.us is a small LAMP server available for students in info465 for their projects. It is a VPS-Virtual Private Server at DigitalOcean.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 to a linux server that might come to your attention if you poke around on-line. 'Telnet' is one and so is ftp-File Transfer Protocol, but neither is used at info465.us. 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.
Secure replacements for these insecure protocols are ssh-Secure SHell and sftp-Secure FTP. SSH and sftp do a 'security handshake' as they connect, pass encrypted credentials, then encrypt all the traffic after the login.
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 info465.us, 22, and SSH, respectively, to be entered in place of info465.net shown in the graphic here:
Please note, the server for INFO465 in the summer 2020 is info465.us, NOT info465.net as depicted!
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 your terminal window or putty just 'blips out' without prompting your for a login id it may be that 1) you are trying to access the server from a network that has been 'banned' because of cracker activity in the past. Or, 2) a firewall on your computer or border device may be blocking port 22.
If it's not your firewall, or your employer's or some coffee shop, please open a browser and google 'what is my ip' to discover the IP address your ISP is using for your connection. Email me with this IP address and mention the approximate time you attempted to log in. Then, I'll be able to check the logs and we can go from there...
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!
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 Unix 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. A user with 'root privileges' can go anywhere and do anything on the system, so root privileges are doled out carefully. If you want to be root you'll have to set up your own server -- this is the best introduction to networking and network security so it's heartily recommended!.
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.
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.
You can type 'exit' at the command line, which is the 'cleanest' way to log off. Or you can click the red X at the upper right corner of your Putty window.
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. For a student named Joe Schmoe, the full path would be '/home/jschmoe' or '/home/jschmoe2' if he had an account in the past. The tilde at the end of the command line prompt before the dollar sign means 'in your home directory'. Tilde is also a shortcut to a user's home directory so entering 'cd ~/Outlines' or 'cd~/web' would take you directly to either of these directories in your home directory. ('cd' stands for Change Direcory.) Entering 'cd' all by itself will always take you to your home directory.
You'll need to make a directory named 'web', all lower-case. Your web directory is linked to the web server's 'document root' for info465.us. Files placed in your 'web' directory, /home/flname/web, are available via The Internet using a URL like 'info465.us/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 use vi to edit some text files and to build a website using the vi editor. Do not use Word, DreamWeaver, or other tool that 'generates HTML'. And, do not use a Mac or Windows text editor and copy the files to the server.
info465.us'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 is a component of any *ix OS and on many servers it's the only editor available.
On Linux flavors, vi (Visual Editor) actually runs vim (Vi Improved), which provides 'syntax highlighting' that helps avoid bugs in your html, sql, PHP, or Python code. There is a lot of value in learning to use vi. Vi or similar 'command line editor' is used from 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. If you _really_ want to impress a technical interviewer, learn emacs after you master vi
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.
Most Linux flavors are distributed with vim-Vi Improved, which works with a PC keyboard's edit and arrow keys, where the old vi worked with 'dumb terminals' that didn't have edit keys. If your searching for a tutorial, search for 'vim tutorial', not 'vi tutorial' to get the right version. Here are some vim tutorials:
Use vi/vim to edit a file or two in your home directory as you learn it. When you're ready to start the project get along to the next steps...
Vi _is_ a fully featured editor that can do copy/paste, find/replace, record macros, and many other tasks in a unix environment. The only reason vi would be 'slower' than another editor is because the user isn't familiar with vi...
This is a very brief introduction to making directories and setting their permissions. Google 'linux permissions' for more about the -rwxrwxrwx permissions and the 'mod 7' scheme for setting them.
You'll need a directory named 'web' in your home directory so that your web pages are accessible from your link at info465.us.
You only need to make the directory once, and it needs to be in the right place. There is no need to repeat the mkdir or chmod commands each time you log in. There is nothing you need to do to 'save' them. When you log out of the shell the directories should be there next time you log in.
To make the web directory, 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.
To change to your new web directory. Use cd-change directory:
Files placed in this directory will be served up from your link at info465.us.
Your 'home page' must be named _exactly_ index.html if it's plain html, index.shtml if it's html with SSI-Server Side Includes, or index.php if it contains PHP. info465.us is rigged to serve up one of these files by default when no particular resource is identified...
You can usually use vi to create a file, like this:
This command will start editing the empty file 'index.html'. When you use the vi command 'w' to write the file 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. Use the mouse or keyboard to 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.
In vi, 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.
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'. Or, the command 'tree' will show the directory tree in the terminal using the CUI line-drawing set.
'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.
Validate your pages and their CSS with w3C HTML and CSS validator. 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. It's suggested to size them to work with your desktop/tablet and mobile-sized screens. Use GIMP, Paint.net, or other photo editor to resize images.
Use an SFTP-Secure File Transfer Client to copy the images to your web directory at info465.us.
FileZilla is probably the most-used SFTP client for Windows and Mac. It's an easy install on your own Windows desktop and/or notebook.
Chrome also has a choice of SFTP Clients that can be added onto Chrome, one named SFTP Client may be the least obnoxious, some are ad-funded and intrusive.
OSX and Linux provide scp-Secure Copy Program at the command line. Just open a terminal window on your Mac and use ls and cd to navigate to the directory with the images, usually Pictures, then do something like 'scp image.png firstname.lastname@example.org:web/' to copy them to your web directory at info465.us. Do 'man scp' for syntax if you're hardcore command line.
Putty's developer provides pscp.exe for Windows, is a command-line client that can be scripted to move files to/from a Linux server and Windows just like the Mac/unix scp.
OSX releases since Snow Leopard have secure file transfer 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...
Earlier OSX releases, if there are any in 2017?, can download 'fugu' or FileZilla
Linux gnome/GUI users, 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 -- do 'man scp' for the command line syntax.
FileZilla is the recommended 'secure file transfer client' for desktop and notebook computers. Google on 'download filezilla' and choose the download for Windows, Mac, or Linux. Make sure to opt _out_ of the download for security software as you download!
You can use the 'Quick Connect' method to connect to an ssh/sftp server. Host-info465.us; UserId-Your login at info465.us, Password-Yours, Port-22.
To setup Notepad++ as the default editor: Find and start NotePad++ on your machine so that there is a reference to it under the Start or Windows button. Right-click on the NotePad++ icon, choose Properties, then Ctrl-C or Copy the highlighted Target to your clipboard. In FileZilla choose Edit -> Settings -> File Editing and paste the target into the space at the right of the Use Custom Editor button.
Beware: When you use Ctrl-S or File -> Save to save an edited page, revisit the FileZilla window where you'll find a 'File has Changed' dialog waiting for your Yes before the copy...
Noobs, use vi and the command line for these projects, become comfortable navigating and editing as you get your code.
Advanced students may pick another editor: It _must_ do syntax highlighting and it _must not_ be an 'HTML Editor' like DreamWeaver or Seamonkey. vi works fine if you like it, does syntax highlighting and is quickest if you have good bandwidth. It might be time to learn emacs, which is the ultimate geekish server-side editor and is on most *ix servers, will really impress a technical interviewer in the future. Windoze users might like NotePad++ or a higher functioning editor like Atom, Crimson, or Sublime where you edit on the desktop and use FileZilla to transfer files to the server via sftp (NotePad++ will automate this step if you edit its settings). Mac users should check out CodeWrangler, which handles the publishing of files to the server automagically via sftp and also has vertical marks that help align structures in html or scripts.
It's imperative to keep an eye on the error_log to make sure your html
and/or scripts are not producing warnings or errors! Keep a terminal window
open that's 'tailing the log' with:
tail -f /var/log/httpd/error_log | grep yourid
Keep this peeking out from under your browser so you can see it jump when you get an error!
Here is a screenshot showing such an arrangement of putty sessions and browser:
Database programming for the web is an inherently complex task involving multiple skills, data structures, and programming languages. Careful attention to error messages from the server and browser is required. The database needs to be quickly available to test SQL statements used in the scripts, to see the effect SQL in the scripts has on the database, and to delete trashed records or make changes to the schema.
An 'IDE' (Integrated Development Environment) such as the Open Source Eclipse, IBM's WebSphere (which relies heavily on Eclipse), or Microsoft's Visual Studio provides all these 'views' within a single window. They allow drag/drop convenience for combining database objects with progamming objects with minimum scripting involved. The proprietary Zend Studio is a powerful (not-cheap) IDE that provides 4GL power to 3GL PHP and SQL languages.