-
Notifications
You must be signed in to change notification settings - Fork 1
Home
Just some recipes to get your Linux workstation setup.
You can download an image of any Linux distribution you're familiar with. For this tutorial we'll use Ubuntu, in particular because it's quite user friendly for Linux beginners.
- Go to https://www.ubuntu.com/download/desktop
- Download the free version of Ubuntu 16.04.3 LTS or later.
- Once the download is complete, you should have an .iso file in the folder where you downloaded it
You can use any virtualization software you want, but for this tutorial we'll use Oracle VirtualBox, just because that's the one we're used to work with.
- Go to https://www.virtualbox.org/wiki/Downloads
- Download VirtualBox 5.2.6 platform packages or later, for Windows hosts.
- Install VirtualBox.
Modern CPUs include hardware virtualization features that help accelerate virtual machines created in VirtualBox, VMware, Hyper-V, and other apps. But those features aren’t always enabled by default. You might to enable the Intel VT-x feature in your BIOS.
Start VirtualBox and follow the steps below:
- Click on the New button and provide the following information:
- Machine name, we will name it linux, feel free to name it what you want.
- Machine type: Linux
- Machine version: Ubuntu (64-bit). Click Next
- Provide sufficient memory size (we recommend >3Gb, depending on how much RAM has your Windows host). Click Next.
- Select Create a virtual hard disk now. Click on Create.
- Select hard disk file type VDI (Virtual Disk Image). Click Next.
- Select storage on physical hard disk as Dynamically allocated. Click Next.
- Keep current file location and select file size as 30Gb. Click Create.
- Click on the Start button to start your virtual machine.
- As a start-up disk select the Ubuntu .iso file you downloaded in the previous step. Click Start.
Ubuntu installation process will start automatically from the previous step.
- Select your language and click on Install Ubuntu.
- Select Download updates while installing Ubuntu. Click Continue.
- Select Erase disk and install Ubuntu. Click Install.
- Select your location and click on Continue.
- Select your keyboard layout and click on Continue.
- Create your superuser by filling the form and click on Continue.
- Wait for the installation to complete. Click on Restart now.
- On the screen showing Please remove the installation medium and press Enter, just press Enter.
- Note that Python 3 comes pre-installed with Ubuntu.
This step is optional but highly recommended. It allows you to copy-paste text and files from your Windows host to your Linux VM and vice-versa.
- In your Linux VM in the top menu, click on Devices > Insert Guest Additions CD Image.
- The autorun starts, click on Run.
- Authenticate yourself with your superuser password defined during the installation.
- When prompted to Press Return to close this window, just press Enter.
- Open a terminal window and type the following command:
sudo adduser <your_user> vboxsf
- Shutdown your Linux VM.
In the VirtualBox Manager window, follow the steps below:
- Select your Linux VM, click on Settings button.
- In General > Advanced > Shared Clipboard, select Bidirectional.
- Click on Shared folders button in the bottom left corner
- Click on the small Add new shared folder icon in the top right corner
- Select the folder path you want share. This will allow you to access your Windows host folder from your Linux VM. In particular to copy files from your Window host.
- Select Auto-mount. Click on OK.
- Click on OK to close the Settings window.
- Restart your Linux VM.
- Click on the Ubuntu icon in the top left corner to open the search bar.
- Type Terminal to look for the command line tool. Click on the Terminal icon.
- In the left toolbar, you can right-click on the Terminal icon and click on Lock it to launcher (you'll need it often).
- Type the following commands and follow the installation steps (if any).
$ sudo apt-get update
$ sudo apt-get install git
# Use this command only if you work with self-signed certificates
$ git config --global http.sslVerify false
In most of cases we will use ODBC connections to connect to databases. This requires to install UnixODBC. Type the following command in your terminal window and follow the installation steps.
$ sudo apt-get install unixodbc-dev
Because you'll be producing code, you need a modern IDE (Integrated Development Environment). You can use the one of your choice but we recommend to use Atom which is open source and integrates well with Git. it's also very elegant and has a strong library of plugins.
- Open Firefox and navigate to the following URL: https://github.com/atom/atom/releases
- Download the file atom-amd64.deb from the last stable release.
- In a terminal window, type the following commands:
$ cd Downloads/
$ sudo dpkg -i atom-amd64.deb
Once the installation is complete you can start Atom by searching it from the Ubuntu search bar.
- Click on the Ubuntu icon in the top left corner to open the search bar.
- Type Atom. Click on the Atom icon.
- In the left toolbar, you can right-click on the Atom icon and click on Lock it to launcher (you'll need it often).
A linter is a program that analyzes your code to detect potential errors before you actually run it. In the context of Python it is also following the style guide defined by PEP 8 (Python Enhancement Proposal 8) to ensure consistent formatting according to best practices. In short, it helps you produce better code, faster. If you are using Atom as an IDE, we'll install a linting package called flake8. In your Linux VM, open a terminal window an run the following commands:
$ sudo apt-get install python3-pip
$ sudo pip3 install --upgrade pip
$ sudo pip3 install flake8
Pip is a package manager for Python and helps you install other Python packages from the Python Package Index (PyPI). Flake8 is the Python package used by the linter plugin we will install in Atom.
Open Atom and follow the steps below:
- Navigate to the menu at the top of the Atom window Packages > Settings View > Install Packages/Themes.
- In the Settings tab under the Install Packages section, search for linter-flake8.
- In the search results for the plugin linter-flake8, click on Install.
- When you modify your first Python file in Atom, flake8 will prompt you to install dependencies. Just say Yes.
A virtual environment is an isolated working copy of Python which allows you to work on a specific project without affecting other projects. You can install the venv package, create and activate your virtual environment by typing the following commands in a terminal window. In the example below, the virtual environment is name myenv:
$ sudo apt-get install python3-venv
$ python3 -m venv path_to_your_venv/myenv
$ source path_to_your_venv/myenv/bin/activate
Remark: The last command above is used to activate your virtual environment. You can deactivate it by typing deactivate
in your terminal.
Add the Docker repository to your Linux repository. Execute the following commands in a terminal window:
$ sudo apt-get update
$ sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
Install Docker Community Edition:
$ sudo apt-get update
$ sudo apt-get install docker-ce
Add your user to the docker
group to setup permissions. Make sure to restart your machine after executing this command.:
$ sudo usermod -a -G docker <username>
Test your Docker installation. Executing the following command will automatically download the hello-world
Docker image if it does not exist and run it:
$ docker run hello-world
Remove the hello-world
image once you're done:
$ docker image ls
$ docker rmi -f hello-world