virtual domains
TRANSCRIPT
>_ Things Lab
Virtual domains
...the standard installation forThings Lab meetings
Check an installed package
Should be checked if all the packages are installed correctly, if not install the package. As example for unzip:
(should be executed at command prompt/terminal)
dpkg --get-selections | grep unzip
sudo apt-get install unzip
Check and install all packages
Should be installed all the following packages:
php5, php-mysql, phpmyadmin, mysql-client, mysql-server and apache2
(check one by one or... directly install all if not yet installed...)
sudo apt-get install php5 php5-mysql apache2 phpmyadmin mysql-client mysql-server
Play with vi, the easy way
What is it vi? Google it or RTFM (at command prompt, man vi).
Open the terminal and go in your home foldercd (enter)
Open a new file (or existing if was already present, to open as root use sudo before the vi command) and try to use some basic commands of vi
vi aaa.txt (enter)
(esc) allows to enter in the command mode
Play with vi, part 1
(in command mode) i allows to enter in the insert mode
(in command mode) x allows to delete a character
(in command mode) dd (double d) allows to delete a line
(in insert mode, means you are editing) press esc to enter in command mode
Play with vi, part 2
(in command mode) :q exit from the editing of the file, do not save changes
(in command mode) :wq exit from the editing of the file, save all changes
any other command? RTFM :-) http://en.wikipedia.org/wiki/RTFM
If you have any problem, go in command mode and quit without saving the changes
Setup a local domain
At the command prompt go in /etc/ foldercd /etc/
Edit the file hosts with root permissions using visudo vi hosts
In vi move using the arrows and add a new line, the line should be as the following (instead test use your name):127.0.0.1test
Save and quit with the command :wq
Check the local domain
At the command prompt check if the domain is responding to pings (what is it ping? RTFM!):ping test (in your case, your name) (enter)
Create the folder where you will have your virtual domain:sudo mkdir /var/www/test/ (enter)
Setup a virtual host in apache
At the command prompt go in /etc/apache2/sites-enabled foldercd /etc/apache2/sites-enabled/
Add a new file root permissions using visudo vi test (use your name instead)
Start the insert mode and paste the text of the next page, change from test to your name!
Virtualhost configuration
ServerAdmin webmaster@localhostServerName test
DocumentRoot /var/www/testOptions FollowSymLinksAllowOverride NoneOptions Indexes FollowSymLinks MultiViewsAllowOverride NoneOrder allow,denyallow from all
ErrorLog /var/log/apache2/test-error.log
Add files to the virtual domain
In /var/www/test/ create a simple html file and insert some text:sudo vi /var/www/test/index.html (enter)(now you know how to do it! :-) )
In /var/www/test/ create a simple php (test.php) file and the following insert text (is ok in one line!):
Test the from the browser