Script to install LEMP stack in Ubuntu 16

by Daniel Pham
Published: Updated:

In this article, I will introduce to you the script to install LEMP stack in Ubuntu 16.

Using this script can save you some time.

My lab environment

I use a virtual machine Ubuntu 16.04 with the following configuration.

  1. OS: Ubuntu 16.04.5 LTS 64bit.
  2. IP: Example i use 192.168.56.30. You can change the information in the script to your server IP. Simply Ctrl + F in the script with my IP and replace it with your IP address.
  3. RAM: 1 GB.
  4. HDD: 10 GB.
  5. CPU: 1 vCPU.
  6. User: root

Packages in the LEMP stack

In this script, I will install the some packages as follows.

  1. Nginx: version 1.14.2.
  2. MariaDB: version 10.3.13.
  3. PHP: version 7.3.2-3+ubuntu16.04.1+deb.sury.org+1.

Recommended Reading: Script to install LAMP (PHP 7) on Ubuntu 16

Use this script to install LEMP stack in Ubuntu 16

Below are the steps you will take to use this script.

install lemp stack in ubuntu 16.04
Install LEMP stack in Ubuntu 16.04.

Step 1: Download the script with the following command.

wget https://gitlab.com/Danny_Pham/WriteBash.com/raw/master/Install/09-Script_install_LEMP_PHP_7.3_on_Ubuntu_16.sh -O install_lemp.sh

Step 2: Give the script permission to execute.

chmod 700 install_lemp.sh

And step 3: Execute the script.

./install_lemp.sh

During the installation process, you will see the following message.

Configuring mariadb-server-10.3
-------------------------------

While not mandatory, it is highly recommended that you set a password for the MariaDB administrative "root" user.

If this field is left blank, the password will not be changed.

New password for the MariaDB "root" user:

This is the message when installing MariaDB, it requires you to set the root password. You can leave it blank and type Enter.

Recommended Reading: Script to install LEMP on Debian 8

WARNING: add-apt-repository is broken with non-UTF-8 locales, see
https://github.com/oerdnj/deb.sury.org/issues/56 for workaround:

# LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
 More info: https://launchpad.net/~ondrej/+archive/ubuntu/php
Press [ENTER] to continue or ctrl-c to cancel adding it

This is the notice when adding PHP 7.3 repository, you just need to press Enter to agree to add the repository to the server.

Configuring tzdata
------------------

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  2. America  3. Antarctica  4. Australia  5. Arctic  6. Asia  7. Atlantic  8. Europe  9. Indian  10. Pacific  11. SystemV  12. US  13. Etc
Geographic area: 6

Please select the city or region corresponding to your time zone.

  1. Aden      8. Atyrau    15. Bishkek     22. Dhaka      29. Hebron       36. Jayapura   43. Khandyga      50. Magadan       57. Omsk        64. Qyzylorda  71. Singapore      78. Thimphu        85. Vientiane
  2. Almaty    9. Baghdad   16. Brunei      23. Dili       30. Ho_Chi_Minh  37. Jerusalem  44. Kolkata       51. Makassar      58. Oral        65. Rangoon    72. Srednekolymsk  79. Tokyo          86. Vladivostok
  3. Amman     10. Bahrain  17. Chita       24. Dubai      31. Hong_Kong    38. Kabul      45. Krasnoyarsk   52. Manila        59. Phnom_Penh  66. Riyadh     73. Taipei         80. Tomsk          87. Yakutsk
  4. Anadyr    11. Baku     18. Choibalsan  25. Dushanbe   32. Hovd         39. Kamchatka  46. Kuala_Lumpur  53. Muscat        60. Pontianak   67. Sakhalin   74. Tashkent       81. Ujung_Pandang  88. Yangon
  5. Aqtau     12. Bangkok  19. Chongqing   26. Famagusta  33. Irkutsk      40. Karachi    47. Kuching       54. Nicosia       61. Pyongyang   68. Samarkand  75. Tbilisi        82. Ulaanbaatar    89. Yekaterinburg
  6. Aqtobe    13. Barnaul  20. Colombo     27. Gaza       34. Istanbul     41. Kashgar    48. Kuwait        55. Novokuznetsk  62. Qatar       69. Seoul      76. Tehran         83. Urumqi         90. Yerevan
  7. Ashgabat  14. Beirut   21. Damascus    28. Harbin     35. Jakarta      42. Kathmandu  49. Macau         56. Novosibirsk   63. Qostanay    70. Shanghai   77. Tel_Aviv       84. Ust-Nera
Time zone: 30

This is the message during the installation of PHP 7.3, it will ask about the time zone to set up for your server.

You just need to select the number corresponding to your geographic area.

Conclusion

Installing LEMP stack will last for about 10 minutes, you just need to wait for a while.

With this script, you don’t need to remember every command, everything is fast and simple.

(This is an article from my old blog that has been inactive for a long time, I don’t want to throw it away so I will keep it and hope it helps someone).

0 0 votes
Article Rating

You may also like

Subscribe
Notify of
guest
1 Comment
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
Victor
Victor
Guest
4 years ago

Hello Danie can you please review about SlickStack tutorial and opinion? I think Vietnam is studying a lot about servers technology, why so many? good luck

DevOps Lite is a personal blog specializing in technology with main topics about DevOps, DevSecOps, SRE and System Administrator. Articles are shared for free and contributed to the community.

SUPPORT US

FOLLOW US

Subscribe my Newsletter for new blog posts. Stay updated from your inbox!

© 2021-2024 DevOpsLite.com – All rights reserved.

Please write sources “DevOpsLite.com” when using articles from this website.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More

2
0
Would love your thoughts, please comment.x
()
x

Adblock Detected

Please support us by disabling your AdBlocker extension from your browsers for our website.