极速快三平台搭建搭建环境:
1.服务器列表: 企 娥:217 1793 408
salt-master: 192.168.42.131
salt-minion: 192.168.42.128(minion-192.168.42.128)
192.168.42.130(minion-192.168.42.130)
2.环境:
(1)服务器之间互相可以通信(火墙关闭或者火墙允许通信)
(2)master对minion的主机名和ip做好解析
部署步骤
1.确定整个配置的目录文件结构:
pcre软件安装
[[email protected] prod]# tree ./pcre/
./pcre/
├── files
│ └── pcre-8.38.tar.gz
└── install.sls
1 directory, 2 files
nginx操作用户添加
[[email protected] prod]# tree ./user/
./user/
└── www.sls
0 directories, 1 file
nginx安装
[[email protected] prod]# tree ./nginx/
./nginx/
├── files
│ ├── nginx-1.11.6.tar.gz
│ ├── nginx.conf
│ └── nginx.service
├── install.sls
└── service.sls
1 directory, 5 files
整个思路分为:创建用户、安装基本组件、安装服务、开启服务这几个过程。
1.创建用户
在user目录的www.sls定义了www这个用户:
[[email protected] user]# cat www.sls
www-user-group:
group.present:
- name: www
- gid: 1100
user.present: - name: www
- fullname: www
- shell: /sbin/nologin
- uid: 1100
- gid: 1100
2.安装基本组件
这个根据业务系统中所需nginx的模块决定,本例中以pcre为例,如果需要其他的模块可以按照类似的方式进行安装,pcre目录下的install.sls如下所示:
[[email protected] pcre]# pwd
/srv/salt/prod/pcre
[[email protected] pcre]# cat install.sls
pcre-source-install:
file.managed: - name: /usr/local/src/pcre-8.38.tar.gz
- source: salt://pcre/files/pcre-8.38.tar.gz
- user: root
- group: root
- mode: 755
cmd.run: - name: cd /usr/local/src && tar xvf pcre-8.38.tar.gz && cd pcre-8.38 && ./configure –prefix=/usr/local/pcre && make && make install
- unless: test -d /usr/local/pcre
- require:
- file: pcre-source-install
在/srv/salt/prod/pcre/files目录下包含pcre的源码安装包:
[[email protected] files]# pwd
/srv/salt/prod/pcre/files
[[email protected] files]# ll
total 2008
-rw-r–r– 1 root root 2053336 Dec 6 20:58 pcre-8.38.tar.gz
3.pcre的安装是在nginx之前进行的,我们把pcre的安装包含在nginx的安装过程中,nginx的安装文件为install.sls:
[[email protected] nginx]# cat install.sls
原文地址:http://blog.51cto.com/13852260/2135999