Install the OPS tool using Ansible compilation Tmux

Source: Internet
Author: User

Experimental system: CentOS 6.6_x86_64

Lab Prerequisites: Prepare the build environment in advance, firewall and SELinux are off

Software Introduction: Tmux is a good terminal reuse software, similar to GNU screen, but from the OpenBSD, the use of BSD licensing. The most intuitive benefit of using it is that when you log in to a remote host through a terminal and run Tmux, you can open multiple consoles in it without having to "waste" redundant terminals to connect to the remote host, which is much more than that.

Software Download: Http://pan.baidu.com/s/1c0i9kf2

First, the general installation

1. The dependencies required to install the TMUX:

wget https://sourceforge.net/projects/levent/files/libevent/libevent-2.0/ libevent-2.0.22-stable.tar.gztar XF libevent-2.0. -stable. Tar . GZCD libevent-2.0. -stable. /Configuremake doinstall
Ln-s/usr/local/lib/libevent-2.0.so.5/usr/lib64/libevent-2.0.so.5

2. Install the TMUX package:

wget http://iweb.dl.sourceforge.net/project/tmux/tmux/tmux-2.0/tmux-2.0.tar.gz  Tar XF tmux-2.0. Tar . GZCD Tmux-2.0. /configure--prefix=/usr/local/tmuxmake make andinstall

3. Export the binary file:

Vim/etc/profile.d/tmux. sh---------------------------------------->path= $PATH:/usr/local/tmux/binexport Path <----------------------------------------/etc/profile.d/tmux. SH

4. Export Man Manual:

vim/etc/man. config--------------------------------------------->/usr/local/tmux/ Share/man        // Add a line

5. Edit the configuration file:

Vim ~/. tmux.conf------------------------------------------>Set-G prefix ca // Set prefix command for crtl+aunbind C-b // unbind the ctrl+b  setw-G Mode-keysVI //Copy-mode Set the shortcut key to VI mode  Set-G default-terminal"Screen-256color" //Set terminal color to 256   colorsSet-G status-UTF8 on//Open status bar uft-8 support  set-window-option-g Mode-mouse on//Turn on the scroll screen

6. Common shortcut keys:

    

    

    

At this point, Tmux installation is complete, let's do an expansion experiment, using Ansible installation tmux!

Second, expand the experiment

1. Install ansible and create a Yaml file:

Yum-YInstallansiblemkdir-pv/root/ansible.roles/roles // Create working directory  CD/root/Ansible.rolesvim Tmux.yaml-------------------------------------------->-Name:Installtmux remote_user:root // running user  Hosts:tmux // Shipping The host of this script, followed by a definition  roles:-Tmux// rule name, to be the same as the folder name created later 

2. Put the file:

cd/root/ansible.roles/rolesmkdir -pv tmux/{files,handlers,tasks}                                         // Create a folder with the same name as the rule   cp /root/tmux-2.0. tar. gz/root/libevent-2.0. -stable. tar. GZ tmux/files/      // put the installation package into the cp /root/.tmux.conf tmux/files/                                               // put the configuration file into

3. Write the main yaml file:

Vim/root/ansible.roles/roles/tmux/tasks/main.yaml---------------------------------------------------- -->-name:copy libevent Package
Copy:src=libevent-2.0.22-stable.tar.gz Dest=/root
-Name:copy Tmux Package
Copy:src=tmux-2.0.tar.gz Dest=/root
-Name:copy conf
Copy:src=.tmux.conf Dest=/root
-Name:run Script
script:tmux.sh

4. Write the tmux.sh script:

Vim/root/ansible.roles/roles/tmux/files/tmux.SH---------------------------------------------------------------->#!/bin/bash## Install Libeventcd&&CDTarXF libevent-2.0. A-stable.Tar. GZCD libevent-2.0. A-stable./Configure Make&& Make InstallLN-s/usr/local/lib/libevent-2.0. So.5/usr/lib64/libevent-2.0. So.5# Install Tmuxcd&&CDTarXF tmux-2.0.Tar. GZCD Tmux-2.0./configure--prefix=/usr/local/Tmux Make&& Make Install# Extra OperationTouch/etc/profile.d/tmux.SH Echo 'path= $PATH:/usr/local/tmux/bin'>/etc/profile.d/tmux.SHEcho 'Export PATH'>>/etc/profile.d/tmux.SHEcho 'Manpath/usr/local/tmux/share/man'>>/etc/Mans. config
. /etc/profile.d/tmux.sh
<----------------------------------------------------------------
chmod +x/root/ansible.roles/roles/tmux/files/tmux.sh

5. Join the host you want to install:

vim/etc/ansible/hosts---------------------------------------------->[tmux]                                       //  corresponds to the name 192.168 in the Tmux.yaml file . 19.76 Ansible_ssh_pass=password      // host ip+ login password

6. Try using:

cd/root/ansible.roles/ansible-playbook Tmux.yaml

    

At this point, the experiment is all done. /etc/profile.d/tmux.sh found in use this file cannot be normal source, so you may need to do it manually ./etc/profile.d/tmux. SH . Due to time constraints, so the process is not perfect, the script is not rigorous, there are no conditions to judge, and so on, and the installation host must have a compilation environment. If you need to be able to expand their own changes, I have uploaded the Ansible folder to the share, you can download and use it freely. Finally, thank you for watching, thank you! If you have any questions, please contact qq:82800452.

Install the OPS tool using Ansible compilation Tmux

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.