How To Install Salt on Ubuntu 12.04
This article covers a version of Ubuntu that is no longer supported. If you are currently operate a server running Ubuntu 12.04, we highly recommend upgrading or migrating to a supported version of Ubuntu:
- Upgrade to Ubuntu 14.04.
- Upgrade from Ubuntu 14.04 to Ubuntu 16.04
- Migrate the server data to a supported version
Reason: Ubuntu 12.04 reached end of life (EOL) on April 28, 2017 and no longer receives security patches or updates. This guide is no longer maintained.
This guide might still be useful as a reference, but may not work on other Ubuntu releases. If available, we strongly recommend using a guide written for the version of Ubuntu you are using. You can use the search functionality at the top of the page to find a more recent version.
An Article From SaltStack
Submitted by: Dave Boucha
Salt is an awesome 100% open source configuration management and remote execution tool. Salt is a new approach to infrastructure management. Easy enough to get running in minutes, scalable enough to manage tens of thousands of servers, and fast enough to communicate with them in seconds.
SaltStack is the awesome and open company behind Salt. All Salt code and features are released under the Apache 2.0 license and can be downloaded at https://github.com/saltstack/salt and your preferred OS’s package manager.
In this article we will accomplish the following:
- Install a Salt Master and a Salt Minion on a DigitalOcean droplet running Ubuntu 12.04
- Execute commands
This article assumes the following:
- You’ve already created a DigitalOcean droplet running Ubuntu 12.04
- You’re already logged in as the default root user
- That’s it!
Ok, the first thing we’re going to do is add the SaltStack ppa:
sudo apt-get install python-software-properties sudo add-apt-repository ppa:saltstack/salt
Enter when prompted.
Now update the apt package database:
sudo apt-get update
Once you’ve added the ppa we can now install the Salt Master and the Salt Minion:
sudo apt-get install salt-master sudo apt-get install salt-minion
Now we just need to tell the Salt Minion where to find its Salt Master. Since we’re running the Salt Master and the Salt Minion on the same host we’re, going to set the
master config option to
localhost. Use your preferred editor to modify the Salt Minion’s config file:
master config option to
localhost and remove the
# to uncomment it.
Now save your changes and then restart the Salt Minion service:
service salt-minion restart
List all the Minion keys your Master knows about:
The Minion’s key should now show up under
Unaccepted Keys. Your droplet’s name should appear where
dave03 appears below:
Accepted Keys: Unaccepted Keys: dave03 Rejected Keys:
The last thing we need to do is have the Master accept the Minion’s public key. Use your droplet’s name instead of ‘dave03’:
salt-key -a 'dave03'
You should see output similar to what’s below:
The following keys are going to be accepted: Unaccepted Keys: dave03 Proceed? [n/Y] y Key for minion dave03 accepted.
You now have a working Salt Master and Salt Minion running on your Ubuntu 12.04 server! Let’s try out some of the commands that you can run.
Check that the Minion responds:
salt '*' test.ping
Let’s list the server’s ip addresses:
salt 'dave03' network.ip_addrs
dave03: - 192.xxx.xxx.xxx
Let’s install nginx:
root@dave03:~# salt 'dave03' pkg.install nginx root@dave03:~# salt 'dave03' service.start nginx
We’ve created some basic Salt formulas that make use of Salt’s built in states to configure our server. This is just the very beginning of what you can do with Salt!
The Official SaltStack Walkthrough is a great way to learn more about Salt.
To learn more about all the ways Salt can help you manage your infrastructure read through the extensive documentation for Salt at http://docs.saltstack.com
Please come join the great Salt community! Our mailing list is here and our IRC channel is #salt on freenode.
Development of Salt takes place here: https://github.com/saltstack/salt
Please feel free to stop by and ask for help!