标签:pkg 查看 div pen 依赖 nbsp src ln -s amp
使用saltstack编译安装LNMP环境
一,系统版本查看
二,安装salt-master和salt-minion
安装配置过程参考SaltStack概述及安装
三,修改配置文件
/etc/salt/master设置根的两个目录
四,设置Nginx安装文档
目录结构为
其中files文件夹下面放置的是源码包 install.sls是安装配置文件
install.sls
include: - pkg.make nginx: user.present: - uid: 1001 nginx-install: file.managed: - name: /root/tools/nginx-1.6.3.tar.gz - source: salt://nginx/files/nginx-1.6.3.tar.gz - mode: 755 - user: root - group: root cmd.run: - name: cd /root/tools/ && tar -xf nginx-1.6.3.tar.gz && cd nginx-1.6.3 && ./configure --with-http_ssl_module --with-http_stub_status_module --user=nginx --group=nginx --prefix=/usr/local/nginx-1.6.3 && make && make install && ln -s /usr/local/nginx-1.6.3/ /usr/local/nginx - require: - pkg: make-pkg - file: nginx-install
其中user.present为用户模块,创建一个uid为1001的nginx用户 cmd.run执行安装命令 pkg文件夹下面的make.sls放置本次安装所需要的所有yum包 require依赖这两个
make.sls文件内容为
make-pkg: pkg.installed: - pkgs: - gcc - pcre - pcre-devel - openssl-devel - numactl - libaio - net-tools - freetype-devel - libjpeg-turbo-devel - libpng-devel - gd-devel - libcurl-devel - libxslt-devel
执行安装
salt ‘web1.example.com‘ state.sls nginx.install saltenv=prod
默认没有加saltenv参数执行的是base环境下的配置,本次需要执行prod生产配置所以执行加参数saltenv=prod
五,设置MySQL安装文档
MySQL的install.sls文档内容为
include: - pkg.make mysql-install: file.managed: - name: /root/tools/mysql-5.7.20-1.el7.x86_64.rpm-bundle.tar - source: salt://mysql/files/mysql-5.7.20-1.el7.x86_64.rpm-bundle.tar - mode: 755 - user: root - group: root cmd.run: - name: cd /root/tools/ && yum remove mysql-libs -y && tar -xf mysql-5.7.20-1.el7.x86_64.rpm-bundle.tar && rpm -ivh mysql-community-common-5.7.20-1.el7.x86_64.rpm && rpm -ivh mysql-community-libs-5.7.20-1.el7.x86_64.rpm && rpm -ivh mysql-community-client-5.7.20-1.el7.x86_64.rpm && rpm -ivh mysql-community-server-5.7.20-1.el7.x86_64.rpm - require: - pkg: make-pkg - file: mysql-install
执行安装
salt ‘web1.example.com‘ state.sls mysql.install saltenv=prod
六,设置php安装文档
标签:pkg 查看 div pen 依赖 nbsp src ln -s amp
原文地址:https://www.cnblogs.com/minseo/p/8745708.html