Getting Started on This Project - ktopolov/DatabaseSystem GitHub Wiki
- Install WSL (only if working on Windows machine. If on Linux already, no need)
- Install Required Software
- Set up SSH
- Configure Git
- Enabling X11
- Installing Anaconda
If developing on a Windows machine, we can create and run a Linux virtual machine by installing WSL (Windows Subsystem Linux) version 2 with this link: https://docs.microsoft.com/en-us/windows/wsl/install-win10.
Once in a Linux environment, to install the C compiler gcc and c++ compiler g++, simply run:
- Update repo packages:
sudo apt update
- Install GCC:
sudo apt install gcc g++ cmake codelite git-all
This will get the gcc (C) and g++ (C++) compilers, the CMake build system and the CodeLite IDE, and Git version control software.
SSH allows GitHub to ensure secure communication is made to the repository. To use SSH for Git, we must generate a private and public SSH key, add this to our ssh-agent
such that it can send this key whenever communicating via SSH, and thne add this key to our GitHub profile so it can match the key to our profile. See the following link for detailed instructions:
https://docs.github.com/en/github/authenticating-to-github/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent
Using the email linked to your GitHub account, enter:
ssh-keygen -t ed25519 -C "[email protected]"
You do not need to enter a filename to save as; just hit enter and you will get a default filename. You should end up with a <key_name>
private key and a <key_name>.pub
public key. The passphrase can be left blank too if desired.
To addt the key to the SSH agent, start the SSH agent in the background using:
eval "$(ssh-agent -s)"
Add the private key to the agent using:
ssh-add ~/.ssh/<private_key_name>
The two previous commands should be added to your ~/.bashrc
file such that they run every time you open a shell.
To add to GitHub, go to "Settings >> SSH and GPG Keys >> New SSH Key". Give the key an informative title. Then, paste the contents of the public key into the box.
To verify the connection between your SSH agent and GitHub, use:
ssh -T [email protected]
I see:
Hi ktopolov! You've successfully authenticated, but GitHub does not provide shell access.
Assuming you have installed Git and properly connected your SSH key to your local SSH agent and to GitHub, you must configure your local Git to tell it who you are:
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
With only a WSL command line, we cannot use any graphical applications. However, we can use an X11 server (VcXsrv, XMing, Exceed, etc.) to forward the graphical output to our windows machine to view it. We will choose VcXsrv because it has good support and is open-source.
Download VcXsrv installer from https://sourceforge.net/projects/vcxsrv/. Open installer and hit next ... finish until done (use all defaults).
To use X11 forwarding, search XLaunch
in the windows start menu. Select all defaults and continue. Once done, in the bottom right of the screen (where a flash drive would appear if plugged in) you should see an X11 server icon.
- Find Windows machine IP address using
ipconfig
in terminal. Mine is192.168.56.1
. Look for the IPv4 address! - Open WSL Linux terminal
- Type
export DISPLAY=<IP_ADDRESS>:0.0
- For me,
export DISPLAY=192.168.56.1:0.0
- For me,
- Next do
export LIBGL_ALWAYS_INDIRECT=1
Now the WLS window is ready to send things to the server. To test: sudo apt-get install x11-apps
xcalc
If not working, open Windows Firewall
and ensure that VcXsrv is allowed for both private and public.
Automate This: Open your ~/.bashrc
file which runs on every instantiation of a shell and add:
export DISPLAY=<IP_ADDRESS>:0.0
export LIBGL_ALWAYS_INDIRECT=1
It is useful to have Anaconda installed for this project to obtain the required dependencies. See https://gist.github.com/kauffmanes/5e74916617f9993bc3479f401dfec7da for detailed instructions. Assuming you have already installed WSL:
- Go to https://repo.continuum.io/archive to find the list of Anaconda releases
- Select the release you want. I have a 64-bit computer, so I chose the latest release ending in
x86_64.sh
. If I had a 32-bit computer, I'd select thex86.sh
version. If you accidentally try to install the wrong one, you'll get a warning in the terminal. I choseAnaconda3-2021.05-Linux-x86_64.sh
. - From the terminal run wget https://repo.continuum.io/archive/[YOUR VERSION]. Example: $ wget https://repo.continuum.io/archive/Anaconda3-5.2.0-Linux-x86_64.sh
Run the installation script:
$ bash Anaconda[YOUR VERSION].sh
($ bash Anaconda3-5.2.0-Linux-x86_64.sh
) Read the license agreement and follow the prompts to accept. When asks you if you'd like the installer to prepend it to the path, say yes. - Close the terminal and reopen it to reload .bash configs.
To test that it worked, run
$ which python
. It should print a path that has anaconda in it. Mine is/home/ktopolov/anaconda3/bin/python
. - Test by trying to open jupyter, type
$ jupyter notebook --no-browser
. The no browser flag will still run Jupyter on port 8888, but it won't pop it open automatically, which is good if you do not have X11 forwarding setup yet.