[PYTHON] Install fabric on Ubuntu and try

fabric is a python deployment tool. http://fabric-ja.readthedocs.io/ja/latest/tutorial.html

Arbitrary command execution procedure can be written in python in local environment or remote environment. When setting up the PC, it became troublesome to execute the command every time, so I want to be able to execute it collectively with fabric.

You can write it in a shell script, but python is easier to describe conditional branching and seems to have a convenient API, so I will use this.

environment

$ cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="GalliumOS 2.1"
$ python --version
Python 2.7.12

Introduction of pip

It seems recommended to install fabric via pip. python was included from the beginning, but pip was not included, so I will include it.

$ wget https://bootstrap.pypa.io/get-pip.py
$ sudo python get-pip.py

Libraries needed to build fabric dependent libraries

It seems that these are necessary. For the time being, the minimum.

$ sudo apt install python-dev build-essential libssl-dev

Fabric installation

$ pip install fabric

Try it out

$ cat fabfile_1.py
from fabric.api import local 

def test():
  local("echo hello!")

$ fab -f fabfile_1.py test
[localhost] local: echo hello!
hello!

Done.

reference

Recommended Posts

Install fabric on Ubuntu and try
Install Mecab and mecab-python3 on Ubuntu 14.04
Install and run dropbox on Ubuntu 20.04
Install OpenCV and Chainer on Ubuntu
Install CUDA 8.0 and Chainer on Ubuntu 16.04
Install Puppet Master and Client on Ubuntu 16.04
Install pyenv and Python 3.6.8 on Ubuntu 18.04 LTS
Install TensorFlow on Ubuntu
Install PySide2 on Ubuntu
Install JModelica on Ubuntu
Install Python 3.3 on Ubuntu 12.04
Install Theano on Ubuntu 12.04
Install angr on Ubuntu 18.04
Install pip / pip3 on Ubuntu
Install MongoDB on Ubuntu 16.04 and operate via python
Install GoLand IDE on Ubuntu
Install OpenCV on Ubuntu + python
wsl Install PostgreSQL on Ubuntu 18.04
[ROS] Install ROS (melodic) on Ubuntu (18.04)
Install Caffe on Ubuntu 14.04 (GPU)
Install Docker on WSL Ubuntu 18.04
Install selenium on Mac and try it with python
Install Apache 2.4 on Ubuntu 19.10 Eoan Ermine and run CGI
Install CUDA10.1 + cuDNN7.6.5 + tensorflow-2.3.0 on Ubuntu 18.04
Install Python 3.8 on Ubuntu 18.04 (OS standard)
Install Python 3.8 on Ubuntu 20.04 (OS standard)
Build and install OpenCV on Windows
Install Python 3.9 on Ubuntu 20.04 (OS standard?)
Install confluent-kafka for Python on Ubuntu
Install Python 2.7 on Ubuntu 20.04 (OS standard?)
How to install Go on Ubuntu
ROS study # 1 Install ros-noetic on ubuntu 20.04
Install easy_install and pip on windows
Quickly install OpenCV 2.4 (+ python) on OS X and try the sample
Build Python3 and OpenCV environment on Ubuntu 18.04
Install wsl2 and master linux on windows
Python virtual environment and packages on Ubuntu
Steps to install Python environment on Ubuntu
Install and launch k3s on Manjaro Linux
Mount and format Disk on Ubuntu on GCP.
Install Pleasant on Ubuntu 20.04 (.NetCore3.1 / PostgreSQL version)
How to install php7.4 on Linux (Ubuntu)
How to install fabric and basic usage
Install pyenv and rbenv on CentOS system-wide
Install ROS and ROS module for Roomba on RaspberryPi3 and try to run it
Manage Django images and static assets on Ubuntu
Install matplotlib and display graph on Jupyter Notebook
I can't install Dask with pip on Ubuntu
Install python package in personal environment on Ubuntu
[Procedure memo] Install Python3 + OpenSSL locally on Ubuntu
[Note] Install wxPython 3.x on Linux Mint (Ubuntu)
Install OpenCV 4.0 and Python 3.7 on Windows 10 with Anaconda
Install pip and pandas with Ubuntu or VScode
Install the latest Cuda + CuDNN on Ubuntu 18.04 @ Spring 2020
[Ubuntu] Install Android Studio and create a shortcut
Try importing MLB data on Mac and Python
Install Ubuntu 20.04 LTS (Server) 64bit version on RaspberryPi3B +
Install Python and libraries for Python on MacOS Catalina
Install ZIP version Python and pip on Windows 10
Until you create an Ubuntu boot USB on your Macbook and install Ubuntu on your Thinkpad
Install mecab on Marvericks