Install PHP 7.1 packages: sudo apt-get install php7.1 libapache2-mod-php7.1 php7.1-mcrypt php7.1-mysql php7.1-mbstring php7.1-gettext php7.1-xml php7.1-json php7.1-curl php7.1-zip Run the following script (this changes some of the less secure default options): mysql_secure_installation Step 4: installing PHPĪdd PPA for the latest PHP: sudo add-apt-repository ppa:ondrej/phpsudo apt-get update Choose a secure password and remember it, because you will need it later. You will be prompted to create a root password during the installation. Install MariaDB: sudo apt-get updatesudo apt-get install mariadb-server For example, you can enable mod_rewrite: sudo a2enmod rewritesudo service apache2 restart Step 3: installing the MariaDB serverĪdd a repo that contains the latest MariaDB packages: sudo apt-get install software-properties-common sudo apt-key adv -recv-keys -keyserver hkp://:80 0xF1656F24C74CD1D8 sudo add-apt-repository 'deb xenial main' Open in your browser and you should see the “It works” title.ĭon’t forget to enable Apache modules that are necessary for you. Start the Apache HTTP server: sudo service apache2 start Open your favorite Windows editor/IDE, and create an “index.html” file in your project folder (C:\Users\ YOUR WINDOWS USERNAME\Documents\server) with the following content: It works! It works!When you are finished, save the file by pressing Ctrl-O, and hit Enter to confirm. Modify the document root to “/var/CustomLog $/access.log combined Open the Apache default virtual host configuration file: sudo nano /etc/apache2/sites-enabled/nf sudo ln -s /mnt/c/Users/YOUR WINDOWS USERNAME/Documents/server /var/www/devroot sudo mkdir /mnt/c/Users/YOUR WINDOWS USERNAME/Documents/serverĬreate a symbolic link to the selected folder. Please replace YOUR WINDOWS USERNAME with your Windows username. The following command will create a server folder inside your Documents directory. I recommend you to use your Documents folder. This folder should be outside of the WSL filesystem. Install Apache: sudo apt-get install apache2Ĭreate a project folder for your web applications. Once the PPA is configured, update the local package index: sudo apt-get update To add the PPA, run the following command in the WSL bash: sudo add-apt-repository ppa:ondrej/apache2 Ondřej Surý’s PPA offers the latest Apache/PHP packages for Ubuntu. A Personal Package Archive (PPA) is a repository that allows third-party developers to build and distribute packages for Ubuntu. We need to add a PPA for Apache packages. We want to install the latest stable version of Apache, but official Ubuntu repositories don’t contain the latest release. If you have successfully installed Bash on Ubuntu on Windows, let’s install and configure a simple LAMP stack for development. Microsoft has a great tutorial on how to install WSL, please follow the instructions of the article. But, in this tutorial, we will set up the LAMP stack on Ubuntu, so you need to select Ubuntu. You can install more Linux distributions from the Microsoft Store (Ubuntu, openSUSE, SUSE Linux Enterprise Server 12).
0 Comments
Leave a Reply. |