RedHat6.7安装SaltStack、git、sublime

环境

iphostnamerolesaltstack-role
192.168.11.150redhat-pcapcamaster&minion
192.168.11.151redhat-serveroat-serverminion
192.168.11.152redhat-clientoat-clientminion

所以机器都是RedHat6.7

安装saltstack

安装saltstack,pca上装salt-master与salt-minion,其他节点装salt-minion
saltstack需要epel源,在所有节点上执行:

rpm -ivh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6

安装saltstack

[root@redhat-pca ~]# yum install -y salt-master salt-minion
[root@redhat-server ~]# yum install salt-minion -y
[root@redhat-client ~]# yum install salt-minion -y

配置saltstack

# 在pca上执行
[root@redhat-pca ~]# mv /etc/salt/master /etc/salt/master.bak
[root@redhat-pca ~]# vim /etc/salt/master
[root@redhat-pca ~]# cat /etc/salt/master
interface: 0.0.0.0
file_roots:
  base:
    - /srv/salt
pillar_roots:
  base:
    - /srv/pillar
log_file: /var/log/salt/master
key_logfile: /var/log/salt/key
# 在三个节点上执行
[root@redhat-pca ~]# mv /etc/salt/minion /etc/salt/minion.bak
[root@redhat-pca ~]# echo -e "master: 192.168.11.150\nid: $HOSTNAME" | tee -a /etc/salt/minion
master: 192.168.11.150
id: redhat-pca
[root@redhat-pca ~]# cat /etc/salt/minion
master: 192.168.11.150
id: redhat-pca
[root@redhat-pca ~]#

关闭pca的防火墙

chkconfig iptables off

重启服务,pca上重启salt-master与salt-minion,其他节点重启salt-minion

service salt-master restart
service salt-minion restart

接收密钥

[root@redhat-pca log]# salt-key -L
[root@redhat-pca log]# salt-key -A
[root@redhat-pca log]# salt-key -L
Accepted Keys:
redhat-client
redhat-pca
redhat-server
Denied Keys:
Unaccepted Keys:
Rejected Keys:
[root@redhat-pca log]#

验证

[root@redhat-pca ~]# salt "*" test.ping
redhat-pca:
    True
redhat-client:
    True
redhat-server:
    True
[root@redhat-pca ~]#

安装git

直接使用yum安装git的话,git的版本是1.7.1,git clone会报错:

[root@redhat-pca workspace]# git clone https://git.coding.net/lwyeluo/octa-release.git
Initialized empty Git repository in /root/workspace/octa-release/.git/
error: The requested URL returned error: 400 Bad Request while accessing https://git.coding.net/lwyeluo/octa-release.git/info/refs

fatal: HTTP request failed
[root@redhat-pca workspace]# git --version
git version 1.7.1
[root@redhat-pca workspace]#

所以需要使用源码安装git

# 下载git源码
[root@redhat-pca ~]# mkdir software
[root@redhat-pca ~]# cd software/
[root@redhat-pca software]# ls
[root@redhat-pca software]# wget https://github.com/git/git/archive/v2.11.0-rc0.tar.gz

[root@redhat-pca software]# ls
v2.11.0-rc0.tar.gz
[root@redhat-pca software]# tar -xzvf v2.11.0-rc0.tar.gz
# 安装所需依赖
[root@redhat-pca software]# yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel asciidoc xmlto docbook2x perl-ExtUtils-Embed texinfo -y
[root@redhat-pca software]# yum install -y tk zlib-devel openssl-devel perl cpio expat-devel gettext-devel asciidoc xmlto openjade perl-XML-SAX
# 编译安装git
[root@redhat-pca software]# cd git-2.11.0-rc0/
[root@redhat-pca git-2.11.0-rc0]# make configure
GIT_VERSION = 2.11.0-rc0
    GEN configure
[root@redhat-pca git-2.11.0-rc0]# ./configure --prefix=/usr

[root@redhat-pca git-2.11.0-rc0]# make all doc info

[root@redhat-pca git-2.11.0-rc0]# sudo make install install-doc install-html install-info

其中报错:

    DB2TEXI user-manual.texi
/bin/sh: line 1: docbook2x-texi: command not found
make[1]: *** [user-manual.texi] Error 127
make[1]: Leaving directory `/root/software/git-2.11.0-rc0/Documentation'
make: *** [info] Error 2

解决方案:

[root@redhat-pca software]# wget ftp://ftp.is.co.za/mirror/fedora.redhat.com/epel/6/x86_64/docbook2X-0.8.8-1.el6.x86_64.rpm
[root@redhat-pca software]# rpm -ivh docbook2X-0.8.8-1.el6.x86_64.rpm
Preparing...                ########################################### [100%]
   1:docbook2X              ########################################### [100%]
[root@redhat-pca software]# find . -name docbook2x-texi
[root@redhat-pca software]# find / -name db2x_docbook2texi
/usr/bin/db2x_docbook2texi
[root@redhat-pca software]# ln -s /usr/bin/db2x_docbook2texi /usr/bin/docbook2x-texi
[root@redhat-pca software]#

再重新执行make all doc info与sudo make install install-doc install-html install-info
之后就可以正常使用git了

安装sublime

有人提供了脚本来直接安装sublime:

[root@redhat-pca software]# wget https://gist.githubusercontent.com/dkd903/8ba3f51313c1781cc571/raw/f37b1c18547d086cd45e8b484efc518260106ea9/Install_Sublime_Text_3_64.sh -O install-sublime-text.sh
[root@redhat-pca software]# chmod +x install-sublime-text.sh
[root@redhat-pca software]# sh install-sublime-text.sh

可以在applications下打开sublime,但是报错。。。

发现applications对应的文件是存在/usr/local/sublime-text-3/sublime_text_3下,所以….
做一个软连接….

[root@redhat-pca ~]# cd /usr/local/sublime-text-3/
[root@redhat-pca sublime-text-3]# ls sublime_text_3/
changelog.txt         plugin_host           sublime_text
crash_reporter        python3.3.zip         sublime_text.desktop
Icon/                 sublime_plugin.py
Packages/             sublime.py
[root@redhat-pca sublime-text-3]# ln -s sublime_text_3/sublime_text sublime_text
[root@redhat-pca sublime-text-3]#

附:下载下来的脚本:

[root@redhat-pca software]# cat install-sublime-text.sh
#!/bin/sh
SHORTCUT="[Desktop Entry]
Name=Sublime Text 3
Comment=Edit text files
Exec=/usr/local/sublime-text-3/sublime_text
Icon=/usr/local/sublime-text-3/Icon/128x128/sublime_text.png
Terminal=false
Type=Application
Encoding=UTF-8
Categories=Utility;TextEditor;"
SCRIPT="#!/bin/sh
if [ \${1} == \"--help\" ]; then
    /usr/local/sublime-text-3/sublime_text --help
else
    /usr/local/sublime-text-3/sublime_text \$@ > /dev/null 2>&1 &
fi"

curl -L "http://c758482.r82.cf2.rackcdn.com/sublime_text_3_build_3059_x64.tar.bz2" -o "/usr/src/Sublime Text 3.tar.bz2"
cd /usr/src
tar -xvjf "Sublime Text 3.tar.bz2"
cd "Sublime Text 3"
mkdir -pv "/usr/local/sublime-text-3"
mv -fv * "/usr/local/sublime-text-3/"
echo "${SCRIPT}" > "/usr/local/bin/subl"
chmod +x "/usr/local/bin/subl"
echo "${SHORTCUT}" > "/usr/share/applications/sublime-text-3.desktop"

echo "Finish!"[root@redhat-pca software]#

license:

—– BEGIN LICENSE —–
Michael Barnes
Single User License
EA7E-821385
8A353C41 872A0D5C DF9B2950 AFF6F667
C458EA6D 8EA3C286 98D1D650 131A97AB
AA919AEC EF20E143 B361B1E7 4C8B7F04
B085E65E 2F5F5360 8489D422 FB8FC1AA
93F6323C FD7F7544 3F39C318 D95E6480
FCCC7561 8A4A1741 68FA4223 ADCEDE07
200C25BE DBBC4855 C4CFB774 C5EC138C
0FEC1CEF D9DCECEC D3A5DAD1 01316C36
—— END LICENSE ——

安装package control
自动安装:

1、通过快捷键 ctrl+` 或者 View > Show Console 菜单打开控制台

2、粘贴对应版本的代码后回车安装

适用于 Sublime Text 3:

import urllib.request,os;pf='Package Control.sublime-package';ipp=sublime.installed_packages_path();urllib.request.install_opener(urllib.request.build_opener(urllib.request.ProxyHandler()));open(os.path.join(ipp,pf),'wb').write(urllib.request.urlopen('http://sublime.wbond.net/'+pf.replace(' ','%20')).read())

适用于 Sublime Text 2:

import urllib2,os;pf='Package Control.sublime-package';ipp=sublime.installed_packages_path();os.makedirs(ipp)ifnotos.path.exists(ipp)elseNone;urllib2.install_opener(urllib2.build_opener(urllib2.ProxyHandler()));open(os.path.join(ipp,pf),'wb').write(urllib2.urlopen('http://sublime.wbond.net/'+pf.replace(' ','%20')).read());print('Please restart Sublime Text to finish installation')

利用package control安装插件:All Autocomplete、SublimeCodeIntel、CTags、AutoFileName、BracketHighlighter、Color Highlighter、Keymaps、SideBarEnhancements、Alignment

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值