Ubuntu and OSX‎ > ‎

Ubuntu Command Line Setup

OSX hosting VirtualBox with Ubuntu Server guest installation.

- Ubuntu Server as guest in VirtualBox.
- Apache web server running multiple virtual servers with PHP & MySQL installed.
- Webmin, File Manager on Webmin, FileZilla, phpmyadmin as the administration tools with OpenSSH.
- Dreamweaver on Mac OSX is the development platform.

Install Ubuntu with LAMP
1. -- Download Ubuntu Server at www.ubuntu.com/download
2. -- Download VirtualBox www.virtualbox.org/wiki/Downloads then click "new" to create a new VM.
- Enter "Ubuntu Server", 4GB of RAM (min 1 GB), VDI, 8GB place on desktop, 
- select "Bridged Adapter" on Adapter 1, and check "cable attached" (if you don't, DHCP won't work)
- Run, then select the ISO for Ubuntu Server
- select English, Install Ubuntu Server
- Detect KB Layout - 'yes', now select keys from your KB, OTW select 'No'
- select a hostname
- select "Guided" & use entire disk
- select to do updates automatically.
- select OpenSSH server, LAMP server, Mail Server, hit Tab
- Input password for MySWL "root" user
- Select 'No configuration' for mail server
- Install GRUB boot loader to MBR
- finished, Select 'Continue' - system reboots.
- login
- Test Ub LAMP Server by typing the IP address for Ifconfig - result: the "It works!" page.
- Test SSH (via OpenSSH) using terminal with: "ssh yourname@ip_address"
-- if you forgot to install OpenSSH - go here: http://ubuntuhandbook.org/index.php/2016/04/enable-ssh-ubuntu-16-04-lts/
- A this point the machine is usable - next steps are upgrades / updates & package installation.

- Upgrade or update your installation:
- sudo apt-get update           # fetches the list of available updates
- sudo apt-get upgrade         # strictly upgrades the current packages
- sudo apt-get dist-upgrade  # installs updates (new ones)

4.26.16 --- this is where I stopped while setting up ub1604svr1 on sir machine

3. -- Install Webmin
- wget http://prdownloads.sourceforge.net/webadmin/webmin_1.610_all.deb
- sudo dpkg --install webmin_1.610_all.deb  //Note - there may be errors - fix with next line:
- sudo vi /etc/apt/sources.list  - be sure the "universe" lines are uncommmented
- sudo apt-get install perl libnet-ssleay-perl openssl libauthen-pam-perl libpam-runtime libio-pty-perl           apt-show-versions python
- sudo apt-get -f install
- select File Manager under Others for easy file management - modify index.html at /var/www to test.
4. -- Install phpmyadmin to manage mySQL
- sudo apt-get install phpmyadmin
- select apache2 as the web server, then select "Yes" for advanced options, enter password.
- in a browser enter: ip_address/phpmyadmin to test phpmyadmin
5. -- NB - no need for ProFTPD if you select port 22 on FileZilla (below) --
    -- Install webmin ProFTPD module so FileZilla can be used (skip this if you use SSH for file transfer)
- select the "Un-used Modules" container in webmin
- select ProFTPD server then select install
- set directory paths for FTP under ProFTPD server
6. -- Install FileZilla on the OSX host from the FileZilla website for a very nice file manager.
Create apache virtual hosts
- go to /var/www and create folders /var/www/site1.com and /var/www/site2.com
- place an index.html in both files with a line like "this is sitex" so you can id them at testing
- modify /etc/hosts - enter " site1.com" and " site2.com" b4 the IPv6 #line
- modify /etc/apache2/sites-available by adding a file "site1.com" and paste in the following:
 <VirtualHost *:80>
    DocumentRoot /var/www/site1.com
    ServerName www.site1.com
    ServerAlias site1.com
- of course, you will do this for every virtual host you want to add - an indefinitely large number of vhosts !
- sudo a2ensite site1.com - enable the site within apache - do this for each site
- you may get the message "run /etc/init.d/apache2 reload to activate new configuration" 
- if you receive "Could not reliably ... FQDN, using 127.0.11... blah, then do this: (REF
- sudo /etc/init.d/apache2 reload (you may sometimes receive a different reload instruction as above)
- test it: enter "site1.com" and "site2.com" in 2 separate browser tabs to prove this is working !

Resolve the /var/www permission issue to connect to /var/www/virtual-site and load web files
- type "chown -R yourname /var/www" to allow file transfer via SFTP over SSH (REF)
-> embarrassingly I can't tell you how much time I spent messing with samba vs symlinks
-> if you'd like the entire discussion - I learned tons, then vm me at marc at carestandard.com

Setup Dreamweaver to access Unbuntu server over SFTP and start writing code !
- in the sites setup you will use the vhost directory as your Root
- you will use the vhost name (ex. www.site1.com) as the name of the domain.

Project Complete

Afterthought - I am discarding FileZilla for File Manager in Webmin. FileZilla behaves too much like a windows application, and now there is no need for an additional port open with it gone.

1.11.12 - Project continuation.
Setting a static IP in Ubuntu Server (REF)