5. Install MiaRec software on EC2 instance
We will deploy MiaRec to Amazon EC2 instances using Ansible provisioning tool.
You need to follow the step-by-step instructions "Installation on Linux using Ansible" with a few additions described below.
You can run Ansible playbook from:
- Any Linux host with Internet access (Ubuntu, Centos, Redhat). Mac OS X should work as well, but not tested by us.
- Windows 10 with Linux subsystem
- Another EC2 instance.
Copy SSH private key to Ansible Controller machine
You need to use previously created key to access the instance via SSH. Check Connecting to Your Linux Instance Using SSH for details.
Copy the private key to the Ansible Controller machine, for example, to
Use the chmod command to make sure that your private key file isn't publicly viewable:
chmod 400 ~/.ssh/aws-key.pem
Test SSH connection to EC2 instance:
ssh -i ~/.ssh/aws-miarec.pem firstname.lastname@example.org
If everything is ok, you should see the following message the first time you connect to it:
The authenticity of host '126.96.36.199 (188.8.131.52)' can't be established. ECDSA key fingerprint is SHA256:uTU/hyG+7qy1Aq0CxliKekYDWXZI0EEAaPkmXuA9K9M. Are you sure you want to continue connecting (yes/no)?
yes. You should connect to the instance now and see Ubuntu welcome message like:
Welcome to Ubuntu 14.04.5 LTS (GNU/Linux 3.13.0-125-generic x86_64) * Documentation: https://help.ubuntu.com/ System information as of Fri Sep 22 01:32:04 UTC 2017 System load: 0.0 Processes: 103 Usage of /: 0.6% of 125.86GB Users logged in: 0 Memory usage: 2% IP address for eth0: 10.0.1.65 Swap usage: 0%
Create Inventory file (/opt/ansible-miarec/hosts)
In the step [3. Configure deployment] of instructions, you will need to create
hosts file. If you selected Ubuntu as OS for EC2 instance, then create the following file:
miarec1 ansible_ssh_host=184.108.40.206 ansible_ssh_private_key_file=~/.ssh/aws-key.pem ansible_port=22 ansible_user=ubuntu miarec2 ansible_ssh_host=220.127.116.11 ansible_ssh_private_key_file=~/.ssh/aws-key.pem ansible_port=22 ansible_user=ubuntu [miarec] miarec1 miarec2
- Two hosts are defined inside group
miarec. Ansible playbook will be executed against all hosts in group. By default, installation will be done simultaneously.
- Replace 18.104.22.168 and 22.214.171.124 with public ip-addresses of your EC2 instances (these should point to Elastic IP addresses created previously).
- The parameter
ansible_ssh_private_keyspecifies the location of SSH private key for connecting to EC2 instance (in our example, it is
- The parameter
ansible_useris set to
ubuntufor Ubuntu system. For Centos, you need to set it to
Now, test Ansible connection to AWS using the command:
ansible miarec -m shell -a "uname -a"
This command will connect to all hosts in group
miarec in inventory file and print the output of command
You should see something like:
miarec1 | SUCCESS | rc=0 >> Linux ip-10-0-1-65 3.13.0-125-generic #174-Ubuntu SMP Mon Jul 10 18:51:24 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux miarec2 | SUCCESS | rc=0 >> Linux ip-10-0-2-73 3.13.0-125-generic #174-Ubuntu SMP Mon Jul 10 18:51:24 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
Deploy MiaRec to EC2 instances
Follow instructions to deploy MiaRec on EC2 instances using Ansible.
Verify MiaRec web portal and create admin account
Navigate in web browser to the Elastic IP address of each of MiaRec instances, like http://126.96.36.199.
When you access MiaRec web portal the first time, it will ask you to create admin account. You need to create unique accounts for these two servers, like "admin" and "admin2". This is necessary to prevent conflicts during synchronization between servers.