Skip to content

Installation on WSL (Windows Subsystem for Linux)

Elad Avron edited this page Feb 28, 2020 · 4 revisions

What is WSL

WSL (Windows Subsystem for Linux) is a convenient way to run command line Linux apps and services on Windows without having to install and set up complex and big virtual machines. Incidentally, it's also a really convenient way to run development environment intended for use in Linux environments like LAMP (Linux, Apache, MySQL, and PHP) without littering your Windows environment and having to deal with Windows server weirdities.

Prerequisites

A Note on Editing Files

While you can always use a terminal based editor like VIM or nano if you so please, in some cases you'll want the more feature-complete and easier to navigate comfort of a GUI editor.

WSL and VSCode make it really easy to interact with your Linux based files.
At any point, just type code . to open VSCode in whatever directory you're in, or code path/to/file to edit a specific file.

Note that you will not be able to save those files without the WSL Extension, but if you have that installed, everything should be pretty seamless.

Installing

For anything not covered in this part of the guide, consult the Ubuntu Installation Guide.

Step 1: Installing LAMP

LAMP (or Linux, Apacha, MySQL, and PHP) is really easy to setup on WSL.
First, make sure all your existing packages are up to date:

sudo apt-get update && sudo apt-get upgrade

Then, install the LAMP package collection:

sudo apt-get install lamp-server^

That carret (^) is not a typo, it indicates that you're installing a collection of packages and not a single package named "lamp-server".

Step 2: Configuring Apache

Open the file /etc/apache2/apache2.conf in your editor of choice, and add the following two lines at the end:

Servername localhost
AcceptFilter http none

Start Apache:

sudo /etc/init.d/apache2 start

And test your setup by going to http://localhost/ and verifying that you're seeing the Apache2 Ubuntu Default Page.

Step 3: Configuring MySQL

First, start the SQL server by typing

sudo service mysql start

Connect using:

sudo mysql -u root -p

And create the MySQL table and user by:

CREATE DATABASE csb DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
GRANT ALL ON csb.* TO 'csbuser'@'localhost' IDENTIFIED BY 'password';

You can (and should) replace 'csbuser' and 'password' with your preferred username and password.

Step 4: Cloning the CSB7.0 repository

First set up your SSH key. Type:

ssh-keygen

The default settings of which should be fine.
Once you have an SSH public key (usually at ~/.ssh/id_rsa.pub), copy its contents and add it to your GitHub's SSH Key settings.

Then navigate where you want to clone the repository to (/var/www/html/ is the recommended path) and type:

git clone https://github.com/CosmoQuestX/CSB7.0.git

Now edit /etc/apache2/apache2.conf again, and either add:

<Directory /path/to/your/directory>
	AllowOverride All
</Directory>

Or if it already exists - make sure to change AllowOverride to All.

Step 4 Alternative: Cloning a Forked Repositories

If you forked it and intend to work on your own repository, clone your forked repository, and add CosmoQuestX as your upstream remote:

git clone https://github.com/<your_git_username>/CSB7.0.git
cd CSB7.0/
git add remote upstream https://github.com/CosmoQuestX/CSB7.0.git

Then, to sync your repo with the remote, perform:

git pull upstream master --rebase
git push origin

Finally, go to your CSB7.0 directory, and type:

sudo chown -R www-data CSB7.0

Step 5: SASS

Install SASS using

sudo apt install nodejs
sudo apt install npm
sudo npm install -g sass

Then go to the CSB7.0 root directory, and type:

sass csb-themes/default/sass/style.scss csb-themes/default/style.css

Finally: Test CSB7.0!

Open up your browser and navigate to http://localhost/CSB7.0/
If everything went well, you should see the CSB7.0 installer page - and voila - you're ready!