I will assume that you have already installed BashOnWindows. Note: Some AntiVirus prohibits successfull installation, like Avast. Uninstall Avast.
- Run bash.exe in Administrator Mode
# apt-get install lamp-server^
If you have an error like APR_TCP_DEFER_ACCEP.
add this AcceptFilter http none
end of /etc/apache2/apache2.conf
REF: https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-14-04 REF: http://stackoverflow.com/questions/36469527/installing-apache-on-windows-subsystem-for-linux
First, we need to tell MySQL to create its database directory structure where it will store its information. You can do this by typing:
# mysql_install_db
Secure? (optional; we're at development right?)
# mysql_secure_installation
nano /var/www/html/info.php
and type in<?php phpinfo();
and save it.
Open your browser and visit http://localhost/info.php
# apt-get install python-software-properties
# add-apt-repository ppa:ondrej/php
# apt-get update
# apt-get install -y php7.0
to find available php 7 modules apt-cache search php7-*
for this guide, I will install these modules:
# apt-get install libapache2-mod-php7.0 php7.0-mysql php7.0-curl php7.0-json php7.0-mcrypt php7.0-gd php7.0-mbstring php7.0-zip php7.0-common php7.0-xml
# a2dismod php5
# a2enmod php7.0
# service apache2 restart
# hostname <type-your-computer-name>
# nano /etc/apache2/apache2.conf
and addServerName <type-your-computer-name>
# nano /etc/hosts
add127.0.0.1 <Hostname>
Note: Check before continuing.
cat > /usr/sbin/policy-rc.d <<EOF
#!/bin/sh
exit 101
EOF
chmod +x /usr/sbin/policy-rc.d
dpkg-divert --local --rename --add /sbin/initctl
ln -s /bin/true /sbin/initctl
# a2enmod userdir
# mkdir ~/public_html
Note: Do first at PowerShell/Command lxrun /setdefaultuser <username>
Visit: http://localhost/~<username>
Enable PHP in userdir by checking out # /etc/apache2/mods-available/php7.0.conf
You can now use this for virtual hosts like ~/public_html/mysite.local
- Install nodejs
# apt-get install nodejs npm
OR - PPA:
# curl -sL https://deb.nodesource.com/setup_6.x | bash -
this includes npm already. for LTS use setup_4.x # apt-get install nodejs
REF: https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-an-ubuntu-14-04-server
# curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
REF: https://www.digitalocean.com/community/tutorials/how-to-install-and-use-composer-on-ubuntu-14-04
# apt-get install git
PS C:\> LxRun /setdefaultuser <desired-username>
- just add the server name of the virtual host you created at Bash Environment to C:\Windows\System32\drivers\etc\hosts file.
127.0.0.1 <server name>