Task Overview
One of the Nautilus DevOps team members was working to configure services on a kkloud container that is running on App Server 3 in Stratos Datacenter. Due to some personal work he is on PTO for the rest of the week, but we need to finish his pending work ASAP. Please complete the remaining work as per details given below:
a. Install apache2 in kkloud container using apt that is running on App Server 3 in Stratos Datacenter.
b. Configure Apache to listen on port 8083 instead of default http port. Do not bind it to listen on specific IP or hostname only, i.e it should listen on localhost, 127.0.0.1, container ip, etc.
c. Make sure Apache service is up and running inside the container. Keep the container in running state at the end.
Connect to App Server 3
ssh banner@stapp03
sudo -i
Password for banner: BigGr33n
Verify Container Status
docker ps | grep kkloud
The container kkloud is running using Ubuntu 18.04 image.
Install Apache2
Update package lists and install Apache2:
docker exec kkloud apt update
docker exec kkloud apt install -y apache2
If you need to provide input during installation:
docker exec -it kkloud apt install -y apache2
Alternative using bash -c:
docker exec kkloud bash -c "apt update && apt install -y apache2"
Apache2 and its dependencies were installed successfully (24 new packages, 88.7 MB).
Verify installation:
docker exec kkloud apache2 -v
Apache 2.4.29 is installed.
Configure Apache to Listen on Port 8083
Modify ports.conf and virtual host configuration:
docker exec kkloud sed -i 's/Listen 80/Listen 8083/g' /etc/apache2/ports.conf
docker exec kkloud sed -i 's/:80>/:8083>/g' /etc/apache2/sites-available/000-default.conf
Verify the port change:
docker exec kkloud cat /etc/apache2/ports.conf | grep Listen
Apache is now configured to listen on port 8083.
Start and Verify Apache
Start the service:
docker exec kkloud service apache2 start
Verify it is running:
docker exec kkloud service apache2 status
Test Apache
Test the web server on port 8083:
docker exec kkloud curl -I http://localhost:8083/
A HTTP/1.1 200 OK response confirms Apache is working correctly.
Fix Hostname Warning (Optional)
To suppress "Could not reliably determine the server's fully qualified domain name":
docker exec kkloud bash -c "echo 'ServerName localhost' >> /etc/apache2/apache2.conf"
docker exec kkloud service apache2 restart
Complete Command Sequence
ssh banner@stapp03
sudo -i
docker ps | grep kkloud
docker exec kkloud apt update
docker exec kkloud apt install -y apache2
docker exec kkloud apache2 -v
docker exec kkloud sed -i 's/Listen 80/Listen 8083/g' /etc/apache2/ports.conf
docker exec kkloud sed -i 's/:80>/:8083>/g' /etc/apache2/sites-available/000-default.conf
docker exec kkloud cat /etc/apache2/ports.conf | grep Listen
docker exec kkloud service apache2 start
docker exec kkloud service apache2 status
docker exec kkloud curl -I http://localhost:8083/
Verification Commands
docker ps | grep kkloud
docker exec kkloud apache2 -v
docker exec kkloud ps aux | grep apache
docker exec kkloud curl -I http://localhost:8083/
Task Summary
| Requirement | Status |
|---|---|
| Apache2 installed | Completed |
| Apache configured on port 8083 | Completed |
| Apache service running | Completed |
| Container remains running | Completed |
| Web server responds on port 8083 | Completed |
Key Commands Reference
| Command | Purpose |
|---|---|
docker exec kkloud apt install -y apache2 |
Install Apache2 |
docker exec kkloud sed -i 's/Listen 80/Listen 8083/g' /etc/apache2/ports.conf |
Change HTTP port |
docker exec kkloud service apache2 start |
Start Apache |
docker exec kkloud service apache2 status |
Check Apache status |
docker exec kkloud curl -I http://localhost:8083/ |
Test Apache response |
The kkloud container now has Apache2 running on port 8083 and is ready for use.
Top comments (0)