Salt source installation software and Yum installation software

Source: Internet
Author: User

The above is a simple list of source installation of SLS file writing ideas.

Involves some fixed ideas: for example,

1, copy decompression installation need to rely on tar.gz exist

If it is installed, you do not need to install it again.

2, the startup script to join the CHK time requires a file exists, if added, there is no need to add

3, service Management in addition to the startup script, but also watch configuration files.

?

Wake up in the morning before bed. Basic software installation can be written on your own. The following is the source installation Nginx. Related to basic dependency package installation (Yum installation), as well as Pcre installation (source installation) and Nginx (source installation)

Some of these pits, adjust the long time to do well, is very egg pain, to pay attention to the figure of two points to note.

?

Directory structure

[Email protected] salt]# tree prod/

prod/

├── Init

│ ?? └──install.sls

├── Nginx

│ ?? ├──files

│ ?? │??├──nginx-1.9.1.tar.gz

│ ?? │??├──nginx.conf

│ ?? │??└──nginx-init

│ ?? ├──install.sls

├── Pcre

│ ?? ├──files

│ ?? │??└──pcre-8.37.tar.gz

│ ?? └──install.sls

└── PHP

└──files

├──init.d.php-fpm

├──php-5.6.9.tar.gz

├──php-fpm.conf.default

└──php.ini-production

Business modules:

?

Nginx.install

Include

-Init.install

-Pcre.install

?

Nginx-source-install:

File.managed:

-Name:/usr/local/src/nginx-1.9.1.tar.gz

-Source:salt://nginx/files/nginx-1.9.1.tar.gz

-User:root

-Group:root

-mode:755 # In addition to configuration files 644, the remaining installation packages and startup scripts , are 755

Cmd.run:

-Name:cd/usr/local/src && tar zxf nginx-1.9.1.tar.gz && cd nginx-1.9.1 &&/configure--prefix= /usr/local/nginx--user=www--group=www--with-http_ssl_module--with-http_stub_status_module--with-file-aio-- With-http_dav_module--with-pcre=/usr/local/src/pcre-8.37 && make && make install

-Unless:test-d/usr/local/nginx

-Require:

-File:nginx-source-install

-Pkg:pkg-init

-Cmd:pcre-source-install

Nginx-init:

File.managed:

-Name:/etc/init.d/nginx

-Source:salt://nginx/files/nginx-init

-mode:755 # here to write in User and the Group Front , Otherwise, we can't change the authority. .

-User:root

-Group:root

Cmd.run:

-Name:chkconfig--add Nginx

-Unless:chkconfig--list | grep nginx

-Require:

-File:nginx-init

?

/usr/local/nginx/conf/nginx.conf:

File.managed:

-Source:salt://nginx/files/nginx.conf

-User:root

-Group:root

-mode:644

?

Nginx-service:

File.directory:

-Name:/usr/local/nginx/conf/vhost

-Require:

-Cmd:nginx-source-install

Service.running:

-Name:nginx

-Enable:true

-Reload:true

-Require:

-Cmd:nginx-init

-Watch:

-File:/usr/local/nginx/conf/nginx.conf

?

Salt source installation software and Yum installation software

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.