In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
How do I use saltstack to install apache in bulk? I believe that most people have not yet learned this skill, in order to let you learn, to give you a summary of the following content, do not say much, let's move on.
1. Modify the host name
Modify the hostname: [root@localhost ~] # hostnamectl set-hostname master.saltstack.com [root@localhost ~] # hostnamectl set-hostname web01.saltstack.com [root@localhost ~] # hostnamectl set-hostname web02.saltstack.com modify / etc/hosts file (copy remotely with scp All three hosts are the same): vim / etc/hosts192.168.220.131 master.saltstack.com192.168.220.140 web01.saltstack.com192.168.220.136 web02.saltstack.com turn off firewall: systemctl stop firewalld.servicesetenforce 0 add Epel source for three hosts: yum install-y epel-release
2. Install saltstack:
1. Install: yum install-y salt-master2 on master and yum install-y salt-minion on the managed side (minion)
3. Configure the master host:
Vim / etc/salt/master interface: 192.168.220.131 / / modify the listening address (address of master) auto_accept: True / / change it to true to avoid running salt-key to determine the root location of the certificate authentication file_roots: / / open saltstack file This directory needs to be created by base:-/ srv/saltnodegroups: / / open, set group category group1: 'web01.saltstack.com' group2:' web02.saltstack.com'pillar_opts: True / / enable pillar function, synchronize file function pillar_roots: / / open pillar home directory, and create base:-/ srv/pillar by yourself
4. Enable the service:
[root@master ~] # systemctl start salt-master.service [root@master ~] # netstat-napt | egrep '4506 | 4505'tcp 0 0 192.168.220.131 root@master 0192.168.220.131 root@master * LISTEN 68112/python tcp 0 192.168.220.131 Vera 4506 0.0.0.0 * LISTEN 68136/python
(5) configure minino:
Vim / etc/salt/minino first: master: 192.168.220.131 / / Line 16, specify the IP address of the main control terminal id: web01.saltstack.com / / Line 78, specify the hostname of the controlled side second: master: 192.168.220.131 id: web02.saltstack.com systemctl start salt-minion.service / / enable the service
(6) Test the communication status between the main control terminal and the controlled terminal.
[root@master ~] # salt'* 'test.ping / / View communication status web01.saltstack.com: True [root@master ~] # salt' * 'test.pingweb01.saltstack.com: Trueweb02.saltstack.com: Truesalt' * 'cmd.run' df-h' / / View the mount status of all managed segments [root@master ~] # salt-key / / View customers that have been accepted on master Side Accepted Keys:web01.saltstack.comweb02.saltstack.comDenied Keys:Unaccepted Keys:Rejected Keys: view all the values of grains on the monitored host (each time minino gets client information when it starts): salt 'web01.saltstack.com' grains.items (static data) salt' web01.saltstack.com' pillar.items (dynamic data)
(7) start bulk installation of Apache service:
The following is a demonstration of remote installation of Apache via yum:
Mkdir / srv/saltvim / srv/salt/top.slsbase:'*':-apache// Note:'* 'means that the apache module is executed on all clients. Vim / srv/salt/apache.slsapache-service: pkg.installed:-names: / / if there is only one service, you can write-name: httpd without changing the line-httpd- httpd-devel service.running:-name: httpd- enable: True// Note: apache-service is a custom id name. Pkg.installed is the package installation function. Here is the name of the package to be installed. Service.running is also a function to ensure that the specified service is started, and enable means boot.
Systemctl restart salt-master / / restart service salt'* 'state.highstate / / execute refresh state configuration command
Next, go to the two minino to verify that httpd is installed successfully:
The above is the use of saltstack batch installation of apache method introduction, detailed use of their own use to know the specific essentials. If you want to read more related articles, you are welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.