Demand generation Scenarios: 1, Python virtualenv Virtual environments are very useful.  2, saltstack as an important component of operation and maintenance automation is also very useful. But: 1, SALTSATCK is easiest to install with Yum, combined with the python2.6 version Linux-centos comes with.  2, even with compile and install, also in the Python environment of compiling and installing  SO, the demand produced: I want to use the Saltstack API in the VIRTUALENV environment and find the egg ache. The two cannot be integrated together. In order to solve this pain point, spent half an afternoon, referring to Saltstack's official documentation, organized a solution saltstack Official document Connection: https:// docs.saltstack.com/en/latest/topics/development/hacking.html Nonsense said, directly on the dry: realization Process: 1, Preconditions: operating system: centos6.4 pre-installation saltmaster &NBS P installed Salt-minion server compile python:2.7.8 (PIP and Virtua installed) LENV) for easy operation, default to root user.  PS: If the compiled Python is not done, make the best of the environment first. Not much here, default ok  2, action steps: 2.1: Create a Python virtual environment: &NBsp virtualenv /path/to/your/virtualenv source /path/to/your/virtualenv/bin/activate 2.2: Install salt #编译 Add salt configuration to pip install --global-option= '-- salt-root-dir=/path/to/your/virtualenv/salt/' salt  MKDIR-P /path/to/your/virtualenv/salt/etc/salt #将原有配置文件cp过来  CP/salt/conf/master/salt/conf/minion/path/to/your/virtualenv/salt/etc/ salt/ Modify the Master profile "Publish_port", "Ret_port", and differentiate the ports that are running with the current network.  PUBLISH_PORT:5505&NBSP ret_port:5506  &NBSP ; 2.3: Modify Salt-minion Client port configuration "Master_port:5 506 " 2.4: Additional instructions: If your Salt-mini On is a previously existing client, so in order to avoid conflicts with previous caches, you need to delete the previous cache files:/etc/salt/pki Backup Delete. If the master error is the same strategy, remove the PKI and restart. 2.5: Start-Test:  SALT-KEY-L&NBSP ; salt-key-A &NBS p;salt ' * ' test.ping 2.6:API test demo: import salt.client client = salt.client.LocalClient () ret = client.cmd (' * ', ' test.ping ') & Nbsp; print ret above. PS: Basically look at official documents to get it done. A little bit of trouble is with the previous environment, but with the log can be easily solved.
Python virtualenv installation run Saltstack