xpetit
d7fb96287d
|
4 years ago | |
---|---|---|
.. | ||
README.md | 4 years ago | |
configure.sh | 4 years ago |
README.md
Setup
Table of contents :
Introduction
Our programming exercises require a Unix-like OS (operating system), in particular GNU/Linux.
There are several ways to get a working Linux environment :
- Buy a computer which comes with Linux pre-installed
- Install Linux yourself :
- Natively
- In dual-boot, which allows you to choose between Windows and Linux when your computer starts
- In replacement of any existing OS
- Virtualized
- Using a third-party hypervisor (VirtualBox)
- Using the Windows Subsystem for Linux
- Natively
This document focuses on the latest method : "Windows Subsystem for Linux". If you want to do it differently, ensure you still do the Configure tools part.
Install Windows 10
Skip this part if Windows 10 is up-to-date.
Prepare
- Visit Download Windows 10
- Click on "Download tool now"
- Run the downloaded tool
- Accept the license
- Select "Create installation media (USB flash drive..."
- Select "English (United States)" product language
- Select "Windows 10" edition
- Select "64-bit (x64)" architecture
- Click on "Next"
- Select "USB flash drive"
- Click on "Next"
- If you see the message "We can't find a USB flash drive" make sure you connected a USB flash drive that is formatted
- Click on "Refresh drive list" to see it
- Click on "next"
- Click on "Finish"
Install
- Boot on the flash drive
- If you see "Press any key to boot from CD or DVD..." do it immediately
- This tutorial is using Windows 10 Home
- The system will reboot several times
Wait for Windows 10 to be idle
- Open the Task Manager (right-click in Taskbar or use the shortcut Ctrl+Shift+Esc)
- Click on "More details"
- Select "Performance" tab
- Wait for all the graphs to be completely steady (especially CPU, Wi-Fi, Ethernet)
- Reboot
- Repeat Wait for Windows 10 to be idle until the system is idle shortly after startup
Install updates
- Click on :
- Start
- Settings
- Update & Security
- Check for updates (even if it says "No updates are available")
- Wait until every component Status is "Pending restart"
- Click on "Restart now"
- Repeat Install updates until you see "You're up to date"
Install a web browser
Skip this part if you have a modern & full-featured web browser (e.g. Chrome, Firefox, etc).
We recommend to use Firefox with the extension "uBlock Origin" and the additional filters lists :
- Annoyances
- EasyList Cookie
- uBlock filters - Annoyances
Make sure to apply changes.
Install Linux
Skip this part if you already have Debian (or similar system e.g. Ubuntu).
Install Windows Subsystem for Linux (WSL2)
Follow the guide : Windows Subsystem for Linux Installation Guide for Windows 10
To "Open PowerShell as Administrator", right-click on the Start menu.
Install Debian
- Visit Debian
- Click on "Get" button
- Launch
- Create user as requested (the password doesn't need to be secure and you have to remember it)
- Close (by using the shortcut Ctrl+D, closing the window or typing the
exit
command)
Install VSCode
If you run Linux natively, go to Configure tools.
Download it from the official website. Run the installer, check all "Additional Tasks".
Install remote extension
Launch VSCode, once started it should detect WSL and propose you to install the "Remote - WSL" extension, which is needed for the next steps.
Configure Linux
Connect to remote WSL
Click on the bottom-left green button (overlay says "Open a remote window"), select "Remote-WSL: New Window".
It will open a new VSCode window then install and run a server program in Linux to help VSCode running in its context.
The bottom-left green button (Remote Host) in the VSCode status bar should now indicate "WSL: Debian".
You can close the previous VSCode window.
Configure tools
In the Menu Bar of VSCode, click on "Terminal", then "New Terminal".
A new panel should appear looking like :
user@DESKTOP-XXXXXXX:~$ █
This is a command-line interface, you can type commands and execute them pressing Enter. You can also complete your command using Tab ↹. For instance type "ec
" :
user@DESKTOP-XXXXXXX:~$ ec█
Then press Tab ↹. The command will be completed to "echo
" and a space is added, waiting for arguments to be provided, type "Hello World
" then Enter :
user@DESKTOP-XXXXXXX:~$ echo Hello World
Hello World
user@DESKTOP-XXXXXXX:~$ █
echo
is a program that displays text. Now you will execute commands that will install all the necessary programs you will need, this is the first one :
sudo apt update
Type the password you entered during Linux installation. When it's over (the command prompt appears again) run the 3 next commands (we hide their output):
sudo apt -y upgrade
sudo apt -y install curl
curl https://raw.githubusercontent.com/01-edu/public/master/docs/setup/configure.sh | bash
Configure Gitea
Copy the last line (ssh-ed25519...
) then :
- Connect to Gitea (https://git.DOMAIN where DOMAIN is the 01 platform address)
- Click on top-right menu "Profile and Settings..."
- Click on "Settings"
- Go to "SSH / GPG Keys" tab
- Click on "Add Key" button in "Manage SSH Keys" section
- Paste the public key in the "Content" text area (the "Key Name" will be automatically set)
- Click on "Add Key"
Now you are able to push & pull code to Gitea using git
.
Close the terminal (by using the shortcut Ctrl+D or typing the exit
command)
Configure Go extension
- In the Menu Bar of VSCode, click on "View", then "Extensions"
- In the search field type "go"
- Click on "Install" for the first extension in the list : "Go"
- Click on "Reload Required"
- Open the "Command Palette" (F1 or Ctrl+Shift+P)
- Type "go install"
- Click on "Go: Install/Update Tools"
- Check the first box in order to check all of them
- Click on "OK"