Aegir supports multiple 'server' entities. These servers have 'services' such as 'Web' or 'Database', and 'service types' which are implementations of that service, such as 'Apache' or 'MySQL'.
Some previous experience in the configuration of Apache and MySQL will help if you want to use remote servers with Aegir. If you haven't had any experience in setting up and maintaining Apache or MySQL before you might want get familiar with the basic concepts first.
Remote web servers
On the remote server, install these packages
apt-get install rsync apache2 php5 php5-cli php5-mysql postfix mysql-client mysql-server sudo
Any number of remote web servers may be configured. The remote server needs an aegir user created on the system.
adduser --system --group --home /var/aegir aegir
adduser aegir www-data #make aegir a user of group www-data
Web server configuration
You'll also need to prepare the web server in the same way you did for the master Aegir server during installation:
ln -s /var/aegir/config/apache.conf /etc/apache2/conf.d/aegir.conf
Don't restart Apache even when it prompts you. This will be done by the Verify task you'll spawn for the server from the Aegir frontend later.
Add the aegir user to sudoers so it can restart Apache.
aegir ALL=NOPASSWD: /usr/sbin/apache2ctl
The remote aegir user will also need a login shell, which can be modified using the
chsh -s /bin/sh aegir
Aegir connects directly to the remote server's MySQL to create databases and users. Therefore, you need to log into MySQL in the remote server as root and create a user with the following command:
GRANT ALL PRIVILEGES ON *.* TO root@aegir_server_IP IDENTIFIED BY 'some_pass' WITH GRANT OPTION;
When the server is being verified, Aegir will attempt to create a database and grant privileges to a user for that database. If any of these two fails, verify that your MySQL configuration is correct and that there is no firewall blocking your MySQL port.
You can confirm that MySQL is configured correctly on the remote server by manually connecting from the command line on your Aegir machine:
[aegir@aegir_box:~]$ mysql -h <mysql_server_IP> -u root -p
SSH public/private keys should be set up so the main Aegir server's aegir user can access remote web aegir users with no passwords required.
Example: on main Aegir server:
ssh-keygen -t rsa
Do not use a passphrase when you create your key. Simply press Enter to leave the passphrase blank. Otherwise, SSH will insist that you enter the passphrase everytime you try to SSH using the key. We don't want SSH to present any prompts.
Put the public key's contents into
/var/aegir/.ssh/authorized_keys on the remote web server. The easiest way to do this is to use the ssh-copy-id command.
You should manually login for the first time from your Aegir master server to your remote server as the aegir user, so that the remote web server is added to the known_hosts file in /var/aegir/.ssh on your Aegir master server. Verifying the remote webserver will fail until this has been done.
You can confirm that SSH is set up correctly by manually connecting from your aegirmaster server to your remote server as aegir@ user to aegir@ user:
[aegir@aegirmaster:~]$ ssh aegir@<remoteserver>
There are many, many tutorials online for setting up ssh keys, and various mistakes can be made by inexperienced users such as permissions etc. Aegir isn't a 'Linux beginner's practice tool', so setting these up is really out of the scope of this document and users are encouraged to research this on their own. (For Ubuntu, see this article).
If you have followed the instructions above, and your SSH connection gets closed immediately after you try to connect to the remote server as the aegir user, you may not have given the aegir user a shell correctly. Check the /etc/passwd file on the remote server to make sure that the aegir user has a shell.
Verify the server
Now you can add a new server node in Aegir, set the hostname and/or IP and set the service type to be 'Apache' (or Apache_SSL if this site is to handle SSL sites).
A verify task will be spawned and added to the Task queue ready for dispatching. During a server verification task, various configurations will be set on the Aegir master server and also synced to the remote web server, restarting Apache.
Now when you add a new Platform node in Aegir, you have the option of setting which web server to host it on. If you are not using a makefile but are downloading a platform manually, you must still do this on the main Aegir server. The contents will then be synced across to the web server.
You don't choose a web server when installing a new site. Because a site depends on a platform, its web server is implied by which platform has been chosen. In other words, all sites on a platform are hosted on the same server. You cannot host two sites on the same platform on different servers.