FastHandle - IT Operations Examples

FastHandle is fast operation tools for infrastructure configurations and tests.

User Tools

Site Tools


preparation:installing.html



Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
preparation:installing.html [2018/02/04 01:00]
kurihara
preparation:installing.html [2020/01/23 01:11] (current)
kurihara
Line 1: Line 1:
 [[:index.html#Preparation|Top#Preparation]] [[:index.html#Preparation|Top#Preparation]]
-====== Installing FastHandle======+====== Installing FastHandle in Manager Server======
  
 \\ \\
Line 10: Line 10:
 == Create fasthandle user== == Create fasthandle user==
 <sxh bash toolbar:false gutter:false> <sxh bash toolbar:false gutter:false>
-# useradd fasthandle +~]# useradd fasthandle 
-# echo 'fasthandle:fastpass' | chpasswd+~]# echo 'fasthandle:fastpass' | chpasswd
 </sxh> </sxh>
  
 == fasthandle user Configuration== == fasthandle user Configuration==
 <sxh bash toolbar:false gutter:false> <sxh bash toolbar:false gutter:false>
-# su - fasthandle+~]# su - fasthandle
 </sxh> </sxh>
  
 <sxh bash toolbar:false gutter:false> <sxh bash toolbar:false gutter:false>
-$ cp -p ~/.bashrc ~/.bashrc.`date -d '1day ago' +%Y%m%d` +~]$ cp -p ~/.bashrc ~/.bashrc.`date -d '1day ago' +%Y%m%d` 
-$ cat << @ >> ~/.bashrc+~]$ cat << @ >> ~/.bashrc
  
 # HastHandle env # HastHandle env
Line 30: Line 30:
 HISTSIZE=10000 HISTSIZE=10000
 HISTFILESIZE=10000 HISTFILESIZE=10000
-HISTTIMEFORMAT='%Y-%m-%dT%T%z ' +HISTTIMEFORMAT='%%T %z ' 
-HISTIGNORE=pwd:history*:man+PROMPT_COMMAND="history -a" 
 + 
 +PS1="[\u@\h \w \t]\$ "
 @ @
 </sxh> </sxh>
  
 <sxh bash toolbar:false gutter:false> <sxh bash toolbar:false gutter:false>
-$ cp -p ~/.ssh/config ~/.ssh/config.`date -d '1day ago' +%Y%m%d` +~]$ cp -p ~/.ssh/config ~/.ssh/config.`date -d '1day ago' +%Y%m%d` 
-$ cat << @ >> ~/.ssh/config+~]$ cat << @ >> ~/.ssh/config
  
 # Don't listen yes/no. # Don't listen yes/no.
Line 46: Line 48:
  
 @ @
-$ chmod 600 ~/.ssh/config+~]$ chmod 600 ~/.ssh/config
 </sxh> </sxh>
  
Line 59: Line 61:
 \\ \\
 ==== Fabric ==== ==== Fabric ====
-=== Check Python Before Installing Fabric=== 
  
-Fabric requires Python version 2.5 - 2.7. +===Fabric Version === 
 +You must use Fabric or fabric3. these days, you should use fabric3. 
 +fabric2 is the different of use. 
 + 
 +|<100% 100px ->| 
 +| Fabric   Python (2.5-2.7)\\ http://www.fabfile.org/                                                                                                                                                                         | 
 +| fabric2  | Python (2.7, 3.4+)\\ http://www.fabfile.org/                                                                                                                                                                       | 
 +| fabric3  | Python (2.7, 3.4+) . \\ Fabric3 is a fork of Fabric to provide compatability with Python 3.4+. The port still works with Python 2.7.\\ https://pypi.org/project/Fabric3/\\ https://github.com/mathiasertl/fabric/ 
 + 
 + 
 +\\ 
 +=== Check Python Before Installing Fabric===
  
 <sxh text toolbar:false gutter:false> <sxh text toolbar:false gutter:false>
-# python -V+~]# python -V
 Python 2.7.5 Python 2.7.5
 </sxh> </sxh>
  
 <sxh text toolbar:false gutter:false> <sxh text toolbar:false gutter:false>
-# python3 -V+~]# python3 -V
 Python 3.5.2 Python 3.5.2
 </sxh> </sxh>
  
 <sxh text toolbar:false gutter:false> <sxh text toolbar:false gutter:false>
-RHEL/CentOS $ rpm -qa |grep python+RHEL/CentOS ~]$ rpm -qa |grep python
  
-Ubuntu $ dpkg -l |grep  python+Ubuntu ~]$ dpkg -l |grep  python
 </sxh> </sxh>
  
Line 83: Line 95:
  
 <sxh text toolbar:false gutter:false> <sxh text toolbar:false gutter:false>
-# export http_proxy=http://xx.xx.xx:port/    <- if you need your proxy server. +~]# export http_proxy=http://xx.xx.xx:port/    <- if you need your proxy server. 
-# export https_proxy=http://xx.xx.xx.xx:port/    <- if you need your proxy server.+~]# export https_proxy=http://xx.xx.xx.xx:port/    <- if you need your proxy server.
  
-# yum install epel-release +~]# yum install epel-release 
-# yum install fabric+~]# yum info fabric 
 +~]# yum install fabric 
 +~]# fab --version 
 +Fabric 1.14.0 
 +Paramiko 1.16.1
 </sxh> </sxh>
  
 \\ \\
 === RHEL/CentOS with pip=== === RHEL/CentOS with pip===
 +==Fabric==
 <sxh text toolbar:false gutter:false> <sxh text toolbar:false gutter:false>
-# yum install gcc python-devel python-setuptools +~]# yum install gcc python-devel python-setuptools 
-# easy_install pip +~]# easy_install pip 
-# pip install fabric+~]# pip search fabric 
 +~]# pip install fabric== 
 +~]# pip install fabric==1.14.0 
 +~]# fab --version 
 +Fabric 1.14.0 
 +Paramiko 1.16.1 
 +</sxh> 
 + 
 +==Fabric3== 
 +<sxh text toolbar:false gutter:false> 
 +~]# yum install gcc python-devel python-setuptools 
 +~]# easy_install pip 
 +~]# pip search fabric3 
 +~]# pip install fabric3 
 +~]# fab --version 
 +Fabric 1.14.0 
 +Paramiko 1.16.1 
 +</sxh> 
 + 
 + 
 +\\ 
 +=== RHEL/CentOS with virtualenv, pip=== 
 +<sxh text toolbar:false gutter:false> 
 +~]# yum install gcc python-devel python-setuptools 
 + 
 +~]# sudo su - fasthandle 
 +~]# pip install virtualenv 
 +~]# cd /home 
 +~]# virtualenv env_fasthandle -p python2.7 
 +~]# source env_fasthandle/bin/activate 
 +~]# pip install fabric==1.14.0 
 + 
 +~]# deactivate 
 + 
 +~]$ cat << END >> ~/.bashrc 
 + 
 +#virtualenv 
 +source env_fasthandle/bin/activate 
 + 
 +END
 </sxh> </sxh>
  
Line 101: Line 157:
 === Debian/Ubuntu  with apt=== === Debian/Ubuntu  with apt===
 <sxh text toolbar:false gutter:false> <sxh text toolbar:false gutter:false>
-# apt install fabric+~]# apt install fabric
 </sxh> </sxh>
  
Line 107: Line 163:
 \\ \\
 === Debian/Ubuntu  with pip=== === Debian/Ubuntu  with pip===
 +==Fabric==
 <sxh text toolbar:false gutter:false> <sxh text toolbar:false gutter:false>
-# apt-get install python-dev python-setuptools gcc +~]# apt-get install python-dev python-setuptools gcc 
-# easy_install pip +~]# easy_install pip 
-# pip install fabric+~]# pip install fabric== 
 +~]# pip install fabric==1.x.x
 </sxh> </sxh>
 +
 +==fabric3==
 +<sxh text toolbar:false gutter:false>
 +~]# apt-get install python-dev python-setuptools gcc
 +~]# easy_install pip
 +~]# pip install fabric3
 +</sxh>
 +
  
 \\ \\
 === Debian/Ubuntu  with pip , python3, virtualenv=== === Debian/Ubuntu  with pip , python3, virtualenv===
 <sxh bash toolbar:false gutter:false> <sxh bash toolbar:false gutter:false>
-$ virtualenv -p python3 env +~]$ virtualenv -p python3 env 
-$ source env/bin/activate +~]$ source env/bin/activate 
-$ pip3 install fabric3+~]$ pip3 install fabric3
 </sxh> </sxh>
  
Line 125: Line 191:
 === RHEL/CentOS === === RHEL/CentOS ===
 <sxh text toolbar:false gutter:false> <sxh text toolbar:false gutter:false>
-# export http_proxy=http://xx.xx.xx:port/    <- if you need your proxy server. +~]# export http_proxy=http://xx.xx.xx:port/    <- if you need your proxy server. 
-# export https_proxy=http://xx.xx.xx.xx:port/    <- if you need your proxy server.+~]# export https_proxy=http://xx.xx.xx.xx:port/    <- if you need your proxy server.
  
-# yum search expect +~]# yum search expect 
-# yum install expect+~]# yum install expect
 </sxh> </sxh>
  
Line 135: Line 201:
 === Debian/Ubuntu === === Debian/Ubuntu ===
 <sxh text toolbar:false gutter:false> <sxh text toolbar:false gutter:false>
-# apt search expect +~]# apt search expect 
-# apt install expect+~]# apt install expect
 </sxh> </sxh>
  
Line 143: Line 209:
 \\ \\
 ===== Installing FastHandle ===== ===== Installing FastHandle =====
 +
 +You can install FastHandle "From GitHub(Method 1 or 2)" or "Make it yourself(Method 3)".
 +
 ==== Method 1 : From GitHub ==== ==== Method 1 : From GitHub ====
  
 +<sxh text toolbar:false gutter:false>
 +~]$ cd /home/fasthandle
 +~]$ test -d fhhome && mv fhhome fhhome.`date +%Y%m%d`
 +
 +~]$ git clone https://github.com/kuritaka/fasthandle.git  fhhome
 +
 +~]$ tree -a -I '.git'  fhhome
 +~]$ chmod 755 fhhome/bin/*
 +</sxh>
 +
 +\\
 +==== Method 2 : From GitHub ====
  
 <sxh text toolbar:false gutter:false> <sxh text toolbar:false gutter:false>
-$ cd /home/fasthandle +~]$ cd /home/fasthandle 
-$ git clone https://github.com/kuritaka/fasthandle.git  fhhome.`date +%Y%m%d` +~]$ git clone https://github.com/kuritaka/fasthandle.git  fhhome.`date +%Y%m%d` 
-$ tree -a -I '.git'  fhhome.`date +%Y%m%d` +~]$ tree -a -I '.git'  fhhome.`date +%Y%m%d` 
-$ mkdir fhhome +~]$ mkdir fhhome 
-$ cp -pr fhhome.`date +%Y%m%d`/ fhhome/ +~]$ cp -pr fhhome.`date +%Y%m%d`/ fhhome/ 
-$ chmod 755 fhhome/fhscripts/*+~]$ chmod 755 fhhome/bin/*
 </sxh> </sxh>
 +
  
 \\ \\
-==== Method : Make it yourself ====+==== Method : Make it yourself ====
  
-You can install "From GitHub(Method 1)" or "Make it yourself(Method 2)". 
  
 Reference **[[preparation:directory-structure.html|]]** Reference **[[preparation:directory-structure.html|]]**
Line 164: Line 245:
 ==1. Make some directory == ==1. Make some directory ==
 <sxh text toolbar:false gutter:false> <sxh text toolbar:false gutter:false>
-# su - fasthandle +~]# su - fasthandle 
-$ cd /home/fasthandle +~]$ cd /home/fasthandle 
-$ mkdir fhhome +~]$ mkdir fhhome 
-$ cd fhhome +~]$ cd fhhome 
-$ mkdir -p fhscripts fabfile hosts key scripts conf/os conf/httpd conf/named  bin src rpm deb log tmp output+~]$ mkdir -p bin fabfile hosts key log target/bin target/deb target/key target/linux  target/rpm  target/scripts  target/src  tmp
 </sxh> </sxh>
  
Line 180: Line 261:
  
 == 3. Copy FastHandle Scripts == == 3. Copy FastHandle Scripts ==
-Please copy the necessary files and change permission like ''chmod 755 xxxx.sh''.+Please copy the necessary files and change permission like ''chmod 755 bin/xxxx.sh''.
   *[[:index.html#FastHandle Scripts|FastHandle Scripts]]   *[[:index.html#FastHandle Scripts|FastHandle Scripts]]
 +
 +== 4. Change mode the bash scripts ==
 +<sxh bash toolbar:false gutter:false>
 +~]# chmod 755 $FHHOME/bin/*.sh
 +</sxh>
 +
  
 \\ \\
 \\ \\
 ===== Test FastHandle ===== ===== Test FastHandle =====
 +==== localhost test ====
 +
 <sxh text toolbar:false gutter:false> <sxh text toolbar:false gutter:false>
-$ fab -l+~]$ fab -l
 Available commands: Available commands:
  
Line 206: Line 295:
  
 <sxh text toolbar:false gutter:false> <sxh text toolbar:false gutter:false>
-$ fab -H x.x.x.x auth.test test.local_hostname +~]$ fab -H localhost test.local_hostname
- +
-$ fab -H x.x.x.x auth.test test.hostname+
 </sxh> </sxh>
  
 \\ \\
 \\ \\
-===== Configuring FastHandle =====+==== remote host test ==== 
 +=== Configuring FastHandle ====
 <sxh text toolbar:false gutter:false> <sxh text toolbar:false gutter:false>
-$ cd $FHHOME +~]$ cd $FHHOME 
-$ vi auth.py+~]$ vi auth.py
  
    # Configureing User and Password    # Configureing User and Password
  
-$ vi __init__.py 
- 
-  # Add/Delete import python files. 
 </sxh> </sxh>
  
 +<sxh text toolbar:false gutter:false>
 +~]$ fab -H 127.0.0.1 auth.test1 -- hostname
 +~]$ fab -H 127.0.0.1 auth.test1 test.hostname
  
 +~]$ fab -H x.x.x.x auth.test1 -- hostname
 +~]$ fab -H x.x.x.x auth.test1 test.hostname
 +</sxh>
  
  


preparation/installing.html.1517673644.txt.gz · Last modified: 2018/02/04 01:00 by kurihara