Skip to content
Linux development machine setup
Shell Python Makefile JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github/workflows
.vscode
inventory
machine
playbooks
scripts
tests
.ansible-lint
.commitlintrc.js
.editorconfig
.gitattributes
.gitignore
.markdownlint.json
.pre-commit-config.yaml
.travis.yml
.yamllint
CHANGELOG.md
LICENSE
Makefile
README.md
install.sh
machine.travis.yaml
machine.yaml.example
requirements.dev.txt
requirements.txt
requirements.yml
setup

README.md

Development Linux Setup

Branch Status
master Build Status
develop Build Status

This is a collection of Ansible roles and tasks to setup a Linux development machine.

Read my Machine Setup Guide for instructions.

Requirements

  • Ubuntu or another supported operating system
  • Git installed
  • Bash shell
  • Ansible 2.7 or newer (some features require Ansible 2.8)
  • Python 2.7 or 3.7 as required by Ansible

See markosamuli/macos-machine for my macOS setup.

Ubuntu

This setup has been tested on the Ubuntu 16.04 LTS (Xenial Xerus) and 18.04 LTS (Bionic Beaver) releases.

Travis CI builds are running on Ubuntu 16.04.

Ubuntu on WSL

I've also used this playbook to install packages on Ubuntu running on Windows Subsystem for Linux on Windows 10.

Some packages are known not to work so I've added custom fact is_wsl that can be used to check if we're running Linux on Windows and these will be skipped during the set up.

Pengwin on WSL

I've tried installing some of the packages on Pengwin distribution.

Ansible installation should be compatible with pengwin-setup as found in the development branch.

Tested packages:

  • Neovim
  • Terraform
  • Node.js with NVM
  • Python

Known conflicts:

  • Pengwin installs Terraform in /usr/bin/terraform
  • Pengwin installs Node.js with n npm instead of NVM

Install

Install Git and curl:

sudo apt update
sudo apt install curl git

You can run the installer script that will clone the code from GitHub and run the setup script.

curl -s https://raw.githubusercontent.com/markosamuli/linux-machine/master/install.sh | bash -

Getting Started

Clone this project locally and run the ./setup script.

git clone https://github.com/markosamuli/linux-machine
cd linux-machine
./setup

Local options

You can pass custom variables to the Ansible playbook and roles by creating a machine.yaml file to customise your configuration.

cp machine.yaml.example machine.yaml

The setup script will detect if this file exists and passes it to the Ansible Playbook with --extra-vars.

Ansible

The setup script will try to install Ansible

Ansible version

Ansible version 2.8 is installed by default.

You can define MACHINE_ANSIBLE_VERSION environment variable to change the installed version.

Example to use Ansible 2.9 instead of Ansible 2.8:

export MACHINE_ANSIBLE_VERSION=2.9

Force Ansible reinstall

To remove existing Ansible versions and force installation of Ansible, you can use the --reinstall-ansible argument, for example:

./setup --reinstall-ansible

Installing Ansible with APT

The setup script will install Ansible using APT from Ansible PPAs if the ansible command is not found on your system.

Version PPA
2.7 ansible/ansible-2.7
2.8 (default) ansible/ansible-2.8
2.9 ansible/ansible-2.9

Installing Ansible from PyPI into virtualenv

If an acceptable Ansible APT package installation candidate can't be found the setup script will try to install Ansible with pip in a local virtuelenv.

If virtuelenv can't be found the setup script the setup will fail.

You can disable installation from PyPI with --disable-ansible-pypi argument, for example:

./setup --disable-ansible-pypi

Installing Ansible from PyPI into pyenv environment

If the user has set up a local development environment with pyenv and this is defined in a .python-version file in the repository root, the setup script will install Ansible into this environment.

Same as with the local virtualenv, you can disable installation from PyPI with --disable-ansible-pypi argument, for example:

./setup --disable-ansible-pypi

Software installed by the playbooks

Homebrew on Linux (aka Linuxbrew)

Homebrew can be installed on Linux by enabled the following option:

install_linuxbrew: true

Installation will be done using markosamuli.linuxbrew Ansible role.

Desktop applications

Installed on all environments:

To install Slack desktop application via Snap package:

install_slack: true

Command line tools

Run tools playbook:

make tools

Editors

Visual Studio Code will be installed on non-WSL environments via Snap package.

See Developing on WSL for instructions how to install and use Visual Studio Code Remote - WSL extension.

Latest version of Vim will be installed using the package manager.

To install Neovim enable it in machine.yaml:

install_neovim: true

asdf version manager

You can install asdf version manager by adding the following option to your machine.yaml:

install_asdf: true

To configure asdf plugins and package versions to install, add them into your machine.yaml configuration.

asdf_plugins:
  - name: kubectl
  - name: concourse

Python

Use Ubuntu/Debian packages to install Python on the system:

  • Python v2.7 with python package
  • pip with python-pip package
  • [virtualenv] from PyPI

Use pyenv to install and manage Python versions for the current user:

Run Python playbook:

make python

You can disable installation by adding the following option to your machine.yaml:

install_python: false

The markosamuli.pyenv role will modify your .bashrc and .zshrc files during the setup. If you want to disable this, edit machine.yaml file and disable the following configuration option.

pyenv_init_shell: false

Ruby

To install Ruby for development, enable it in your machine.yaml configuration:

install_ruby: true

This will install:

Run Ruby playbook:

make ruby

To change the installed rubies and default version, add the following to your machine.yaml file and customize it to your needs:

rbenv:
  env: user
  version: v1.1.2
  default_ruby: 2.6.3
  rubies:
    - version: 2.6.3

The role doesn't update your .bashrc or .zshrc files but adds a global initialization script in /etc/profile.d/rbenv.sh. If this doesn't work on your environment, add something like below to initialize rbenv in your shell:

if [ -z "${RBENV_ROOT}" ]; then
  if [ -d "$HOME/.rbenv" ]; then
    export PATH=$HOME/.rbenv/bin:$PATH;
    export RBENV_ROOT=$HOME/.rbenv;
    eval "$(rbenv init -)";
  fi
fi

Rust

Install Rust programming language with markosamuli.rust role.

Enable with:

install_rust: true

To avoid modifying path during install:

rust_modify_path: false

Run Rust playbook:

make rust

To uninstall Rust, run:

rustup self uninstall

Node.js

Run Node.js playbook:

make node

You can disable installation by adding the following option to your machine.yaml:

install_nodejs: false

Go

Go programming language installed using markosamuli.golang Ansible role.

Run Go playbook:

make golang

You can disable installation by adding the following option to your machine.yaml:

install_golang: false

Lua

You can install Lua programming language by adding the following option to your machine.yaml file:

install_lua: true

Run Lua playbook:

make lua

This will also install LuaRocks package manager and luacheck rock using the custom luarocks module.

Git

Latest version of Git will be installed.

Vagrant and VirtualBox

Vagrant and VirtualBox are no longer installed by default, but you can enable them by adding:

install_vagrant: true

Docker

Docker will be installed by default.

Run Docker playbook:

make docker

To disable installation, add:

install_docker: false

Packer

To install Packer add:

install_packer: true

Terraform

Run Terraform playbook:

make terraform

Disable Terraform installation with:

install_terraform: false

Amazon Web Services

  • AWS CLI
  • aws-shell - interactive shell for AWS CLI
  • AWS Vault - a vault for securely storing and accessing AWS credentials in development environments
  • cli53 - command line tool for Amazon Route 53

You can disable installation by adding the following option to your machine.yaml:

install_aws: false

Google Cloud Platform

Google Cloud SDK installed from the archive file under user home directory.

Run Google Cloud SDK playbook:

make gcloud

Default install path is in ~/google-cloud-sdk, but you can install it to another location, for example if you prefer ~/opt/google-cloud-sdk add the following option:

gcloud_install_path: ~/opt

To prefer python3 over python2 during Google Cloud SDK install:

gcloud_prefer_python3: true

The markosamuli.gcloud role will modify your .bashrc and .zshrc files. To disable this and manage the configuration yourself, disable the following configuration option in the machine.yaml file:

gcloud_setup_shell: false

You can disable installation by adding the following option to your machine.yaml:

install_gcloud: false

If you prefer to install Google Cloud SDK using package manager, enable it in the machine.yaml configuration file:

gcloud_install_from_package_manager: true

Changes to existing configuration

The installer makes changes to your ~/.bashrc and ~/.zshrc files, so take backup copies of them before running the script.

Ansible Roles

The following external Ansible roles are installed and used. See requirements.yml file for the installed versions.

To install roles:

make install-roles

To update roles to the latest release versions:

make update-roles

To remove any outdated roles:

make clean-roles
Role Build status
markosamuli.asdf Build Status
markosamuli.aws_tools Build Status
markosamuli.gcloud Build Status
markosamuli.golang Build Status
markosamuli.linuxbrew Build Status
markosamuli.nvm Build Status
markosamuli.packer Build Status
markosamuli.pyenv Build Status
markosamuli.terraform Build Status
markosamuli.vagrant Build Status
markosamuli.hyper Build Status

Development

Install pre-commit hooks:

make install-git-hooks

Lint code and configuration:

make lint

References

This is based on my previous setup markosamuli/machine that was forked off from caarlos0/machine to suit my needs.

License

Authors

You can’t perform that action at this time.