Monday, March 7, 2016

Step by Step Setup Ubuntu Server and LAMP Workstation Package

Chapter 1: How to Create Bootable Ubuntu USB Flash Drive 

  1. Prepare a USB Flash Drive at least 2GB free space. 
  2. Download Universal-USB-Installer
  3. Go to http://releases.ubuntu.com/ and download latest version of Ubuntu iso file.
  4. Go to this guide and install image into USB Flash Drive.
  5. Once finished loaded the image, you can use it as bootable drive.
Chapter 2: How to Setup LAMP Workstation Package

1. To install LAMP, run this command at a terminal:
sudo apt-get install apache2 php5 php5-mysql php5-gd mysql-server

2. To install optional extensions, run this command at a terminal:
sudo apt-get install php5-curl php5-imagick phpmyadmin mysql-workbench php5-cli php5-mcrypt php5-ffmpeg

3. Enable apache modules:
sudo a2enmod vhost_alias rewrite

4. To enable openSSH (allowed putty access from other terminal)
sudo apt-get install openssh-server

5. To Share Folder Between Windows and Ubuntu
sudo mkdir /mnt/hgfs
sudo vmhgfs-fuse .host:/ /mnt/ -o allow_other -o uid=1000

---- outdated ---
You will find directory path /mnt/hgfs if successfully mount, otherwise you have to follow below command to resolved the issue.

sudo vmware-config-tools.pl

or 

$ git clone https://github.com/rasa/vmware-tools-patches.git
$ cd vmware-tools-patches
$ ./patched-open-vm-tools.sh
-----------------


Chapter 3: How to Configure Vhost

1. Configure apache webserver access to your workspace and a catch-all vhost by adding the following to /etc/apache2/httpd.conf:
Copy the following snippet into httpd.conf

<Directory "/var/www/vhosts/">
        Options FollowSymLinks
        AllowOverride All

        Order allow,deny
        Allow from all
</Directory>

NameVirtualHost *
ServerName localhost

Add below to allow perl script or cgi script to be executed

<Directory "var/www/your-cgi-bin-path">
    Options ExecCGI
    AddHandler cgi-script .cgi .pl
</Directory>


Create vhosts folder:
sudo mkdir /var/www/vhosts

If you can't save the httpd.conf, you should be editing it as a user with root permissions - i.e. something like

sudo nano /etc/apache2/httpd.conf

Chapter 4: How to Setup Multisite in Vhost

1. Configure a vhost for each sites by creating a file in /etc/apache2/sites-available as shown below and by updating the file /etc/hosts

Save the following as /etc/apache2/sites-available/001-site1.conf:

<VirtualHost *>
        ServerName site1.com
        ServerAlias dev.site1.com
        DocumentRoot /var/www/vhosts/dev.site1.com
</VirtualHost>


Then edit the file /etc/hosts and add this line at the top:
127.0.0.1       site1.com

2. Enable each vhosts site as needed (definitely the first three lines):
sudo a2dissite default
sudo a2ensite sites1.com

*specify full path of config file if sites not found
sudo a2ensite /etc/apache2/sites-available/xxxx.conf

3. Restart Apache:
sudo service apache2 restart

4. Check your ubuntu IP with following comand
ifconfig

4. Go back to window and edit file C:\Windows\System32\drivers\etc\hosts with following line
192.168.122.1 dev.site1.com


References:
https://groups.drupal.org/node/6266
https://help.ubuntu.com/community/SSH/OpenSSH/Configuring
https://xpressubuntu.wordpress.com/2015/05/11/resolving-no-shared-folders-with-vmware-player-7-and-ubuntu-15-04-guest/comment-page-1/#comment-708
https://phpraxis.wordpress.com/2016/05/16/install-php-5-6-or-5-5-in-ubuntu-16-04-lts-xenial-xerus/
https://superuser.com/questions/1072317/vmware-tools-for-ubuntu-16-04-lts-xenial
https://ericsysmin.com/2017/05/24/allow-hgfs-mount-on-open-vm-tools/

No comments:

Post a Comment