By Andre Aliaman, independent IT consultant.
A LAP stack is an acronym that represents the Linux operating system, with the Apache web server and dynamic content is processed by PHP. Usually, this group of open-source software installed together with Mysql but for this tutorial, I will create something different because I will use Ansible for automating the process.
Prepare all we need in our workstation(I use ubuntu 18.04):
ansible 2.9.4
python version = 2.7.17 (default, Nov 7 2019, 10:07:09) [GCC 7.4.0]
Python 3.6.9
ansible-playbook 2.9.4
ansible-galaxy 2.9.4
Keep in mind, a different version may end to different results when executing the roles. So, make sure everything already set up before doing the next step.
After installing all the prerequisites, We need to add configuration at Ansible hosts. Open it with this command:
nano/vim(depends on your favourite text editor)`/etc/ansible/hosts`
After that, add this value at the host file (adjust server_IP, server_ssh_port, ssh_user accordingly with your server)
<Server_IP> ansible_ssh_port=<Server_SSH_port> ansible_ssh_user=<ssh_user> ansible_host_key_checking=false ansible_python_interpreter=/usr/bin/python3
Right now, we will create a file with the roles we need inside. First, I will create the file with this name requirements.yml
. Make sure to give this file with extension yml
. And copy-paste my script below:
- src: iilness2.ans_common
- src: iilness2.ans_apache
- src: iilness2.ans_php7_2_fpm
- src: iilness2.ans_app
After everything settled, we can start to install our Ansible Roles. you can execute this command ansible-galaxy install -r requirements.yml --force
to start the process. I used --force
here because if accidentally you already use the roles before, the process still can be executed.
In this step, we will create main.yml
as our main YAML file which we will use to run our ansible. Copy-paste this command below:
---
- name: Install Apache and PHP
hosts: all
become: true
roles:
- iilness2.ans_common
- iilness2.ans_apache
- iilness2.ans_php7_2_fpm
- iilness2.ans_app
All Preparation Done!
Now, we can start running our script with this command ansible-playbook main.yml
. You can start to see the process of our script like below:
After all process finish, We can try to access our services with <Server_IP>
we input before to see the result. If everything ok, You can see the result like below:
That's it! Now, we have a server with LAP (Linux, Apache, PHP)Stack ready installed in our ECS.
Installing Elastic Compute Service with Ansible gives us some flexibility in the process without reinvent the wheel. You can use other roles where already available or collaborate with the roles' maker we used in this tutorial. You can also combine this tutorial with other Alibaba Services like ApsaraDB for Databases. Feel free to modify to suit your needs.
Setting up HTTP to HTTPS Redirection with Alibaba Cloud Container Service
Alibaba Clouder - October 12, 2019
Alibaba Clouder - June 3, 2020
Alibaba Clouder - April 12, 2019
Alibaba Clouder - April 2, 2019
Alibaba Clouder - October 12, 2019
Alibaba Clouder - August 31, 2020
Elastic and secure virtual cloud servers to cater all your cloud hosting needs.
Learn MoreAlibaba Cloud Linux is a free-to-use, native operating system that provides a stable, reliable, and high-performance environment for your applications.
Learn MoreHTTPDNS is a domain name resolution service for mobile clients. It features anti-hijacking, high accuracy, and low latency.
Learn MoreEMAS HTTPDNS is a domain name resolution service for mobile clients. It features anti-hijacking, high accuracy, and low latency.
Learn MoreMore Posts by iilness