Quickly install Apache Server on Ubuntu Linux

Let's see quick steps to install Apache Server on Ubuntu Linux,


  1. Run Command: sudo update,
  2. Now Run Command: sudo apt install apache2,
  3. Type Y if you are asked to install dependent packages or note disk space usage,
    After this operation, 109 MB of additional disk space will be used.
    Do you want to continue? [Y/n]
  4. You might be asked to select the Geographical region,
    Please select the geographic area in which you live. 
    Subsequent configuration questions will narrow this down by
    presenting a list of cities, representing the time zones 
    in which they are located.
      1. Africa     3. Antarctica  5. Arctic  7. Atlantic   9. Indian     11. SystemV  13. Etc
      2. America  4. Australia   6. Asia    8. Europe    10. Pacific  12. US
    Geographic area: 
  5. You will also be asked to select the timezone,
    Please select the city or region corresponding to your time zone.
      1. Aden      16. Brunei       31. Hong_Kong    46. Kuala_Lumpur  61. Pyongyang      76. Tehran
      2. Almaty    17. Chita        32. Hovd         47. Kuching       62. Qatar          77. Tel_Aviv
      3. Amman     18. Choibalsan   33. Irkutsk      48. Kuwait        63. Qostanay       78. Thimphu
      4. Anadyr    19. Chongqing    34. Istanbul     49. Macau         64. Qyzylorda      79. Tokyo
      14. Beirut   29. Hebron       44. Kolkata      59. Phnom_Penh    74. Tashkent       89. Yekaterinburg
      15. Bishkek  30. Ho_Chi_Minh  45. Krasnoyarsk  60. Pontianak     75. Tbilisi        90. Yerevan
    If you have selected Region as America 
      1. Adak                     33. Cancun         65. Halifax               97. Mexico_City              129. Rio_Branco
      2. Anchorage                34. Caracas        66. Havana                98. Miquelon                 130. Santa_Isabel
      3. Anguilla                 35. Cayenne        67. Hermosillo            99. Moncton                  131. Santarem
      9. Argentina/Jujuy          41. Creston        73. Indiana/Vevay         105. New_York                137. Sitka
      10. Argentina/La_Rioja      42. Cuiaba         74. Indiana/Vincennes     106. Nipigon                 138. St_Barthelemy
      11. Argentina/Mendoza       43. Curacao        75. Indiana/Winamac       107. Nome                    139. St_Johns
  6. Now you should be retured to the prompt.

Testing apache2 server by deploying sample html page

Lets to to /var/www/html location and create a sample html page,

# nano /var/www/html/sample.html

Start apache2 server:
root@c2c:/var/www/html# sudo service apache2 start

 * Starting Apache httpd web server apache2 
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, 
using Set the 'ServerName' directive globally to suppress this message

To test the server is up, lets try doing curl at localhost/sample.html or (in my case, the IP may vary for your case)

root@c2c:/var/www/html# curl
<title>Apache2 Example</title>
<h1>Hello from Apache2 on Ubuntu!</h1>
Quickly install Apache Server on Ubuntu Linux
Quickly install Apache Server on Ubuntu Linux
Try Out Code2care Dev Tools:


Code2care is an initiative to publish and share varied knowledge in programming and technical areas gathered during day-to-day learnings and development activities.

Students and software developers can leverage this portal to find solutions to their various queries without re-inventing the wheel by referring to our easy to understand posts. Technical posts might include learnings, tutorials, trouble-shooting steps, video tutorials, code snippets, how-to, blogs, articles, etc.

🎉 We are celebrating the 10th years of Code2care! Thank you for all your support!

We strongly support Gender Equality & Diversity.