Kuyika bokosi la LAMP mu Ubuntu

Pulogalamu yamapulogalamu yotchedwa LAMP ikuphatikizapo OS pa kernel ya Linux, seva ya Apache, database ya MySQL, ndi zipangizo za PHP zomwe zimagwiritsidwa ntchito pa injini yanu. Kenako, timalongosola mwatsatanetsatane za kukhazikitsa ndi kuyimitsa koyambirira kwazowonjezera izi, kutenga chitsanzo cha Ubuntu zatsopano.

Ikani LAMP patsogolo mu Ubuntu

Popeza momwe maonekedwewa alili kale akutanthauza kuti mwaika Ubuntu pa kompyuta yanu, tidzasunthira phazi ili ndikupita ku mapulogalamu ena, koma mungapeze malangizo pa mutu womwe umakukondani mwa kuwerenga nkhani zina pazotsatira izi.

Zambiri:
Kuyika Ubuntu pa VirtualBox
Linux Installation Guide ndi Flash Drives

Gawo 1: Sakani Apache

Yambani mwa kukhazikitsa webusaiti yotseguka yotchedwa Apache. Ndi imodzi mwa njira zabwino kwambiri, kotero zimakhala zosankha za ogwiritsa ntchito ambiri. Mu Ubuntu izo zimayikidwa "Terminal":

  1. Tsegulani menyu ndipo yambani kutsegula kapena kusindikiza kuphatikiza Ctrl + Alt + T.
  2. Choyamba, onetsani zosungira zanu kuti muonetsetse kuti muli ndi zigawo zonse zofunika. Kuti muchite izi, lembani lamulolisudo apt-get update.
  3. Zochitika zonse kudutsa sudo Kuthamanga ndi mizu yofikira, kotero onetsetsani kuti mulowetsa mawu anu achinsinsi (sichiwonetsedwe mukalowa).
  4. Mukamaliza, lowanisudo apt-get kukhazikitsa apache2kuwonjezera apache ku dongosolo.
  5. Onetsetsani kuwonjezera mafayilo mwa kusankha yankho D.
  6. Tidzayesa seva la intaneti pogwiritsa ntchitosudo apache2ctl configtest.
  7. Mawu omasulira ayenera kukhala achilendo, koma nthawi zina pali chenjezo lofunika kuwonjezera Servername.
  8. Onjezerani zosinthika zapadziko lonse pa fayilo yosinthira kuti mupewe machenjezo mtsogolomu. Kuthamangitsani fayiloyo kudutsasudo nano /etc/apache2/apache2.conf.
  9. Tsopano muthamangitsire kachiwiri, pomwe muthamanga lamuloip addr amasonyeza eth0 | kulola inet | awk '{kusindikiza $ 2; } '| sed 's //.*$//'kuti mudziwe malo anu a IP kapena seva yanu.
  10. Choyamba "Terminal" pitani kumunsi kwa fayilo yotseguka ndi kulowaDzina laSevaName + kapena adilesi ya IPkuti mwangophunzira. Sungani kusintha kudzera Ctrl + O ndi kutseka fayilo yosinthidwa.
  11. Chitani chiyeso china kuti muwone kuti palibe zolakwika, ndiyeno muyambitsenso seva la intaneti kudzeraChikondi choyamba cha apache2.
  12. Onjezani Apache kuti ayambe, ngati mukufuna kuti ayambe ndi dongosolo loyendetsa ndi lamulosudo sitingathe kuthandiza apache2.
  13. Amangokhala kuti ayambe seva la intaneti kuti ayang'ane kukhazikika kwake, gwiritsani ntchito lamulochikondi chimayamba apache2.
  14. Yambani msakatuli wanu ndikupitalocalhost. Ngati muli patsamba lapamwamba la Apache, ndiye kuti zonse zikugwira ntchito molondola, pita ku sitepe yotsatira.

Gawo 2: Yesani MySQL

Khwerero yachiwiri ndi kuwonjezera deta ya MySQL, yomwe imagwiritsidwanso kupyolera muyezo wothandizira pogwiritsa ntchito malamulo omwe alipo mu dongosolo.

  1. Choyambirira "Terminal" lembasudo apt-get kukhazikitsa mysql-serverndipo dinani Lowani.
  2. Onetsetsani Kuwonjezera kwa mafayilo atsopano.
  3. Onetsetsani kuti muteteze kugwiritsa ntchito malo anga a MySQL, motero chitetezani chitetezo ndi zosiyana zowonjezeredwa zomwe zaikidwa kudzerasudo mysql_secure_installation.
  4. Kukhazikitsa mapulani a pulogalamu yachinsinsi sikutanthauza malangizo amodzi, chifukwa aliyense wogwiritsira ntchito amatsutsidwa ndi njira zake zowonjezera. Ngati mukufuna kukhazikitsa zofunikira, lowetsani muzondomeko y pa pempho.
  5. Kenaka, muyenera kusankha mlingo wa chitetezo. Choyamba werengani kufotokozera kwa gawo lililonse, ndipo sankhani zoyenera kwambiri.
  6. Ikani mawu achinsinsi kuti mutsimikizire kupeza mizu.
  7. Kuwonjezera pamenepo, mudzawona zochitika zosiyanasiyana zotetezera patsogolo panu, kuziwerenga ndi kuvomereza kapena kukana ngati mukuona kuti ndizofunikira.

Tikukulimbikitsani kuwerenga ndondomeko ya njira yowonjezera mu nkhani yathu yapadera, yomwe mungapeze pazotsatira zotsatirazi.

Onaninso: MySQL Installation Guide ya Ubuntu

Khwerero 3: Sakani PHP

Gawo lomaliza loonetsetsa kuti ntchito ya LAMP ndiyoyendetsedwa bwino ndi kukhazikitsa zigawo za PHP. Palibe chovuta pakukwaniritsa njirayi, mukufunikira kugwiritsa ntchito limodzi la malamulo omwe alipo, ndikukonzekera ntchito yowonjezeretsa.

  1. Mu "Terminal" lembani gululosudo apt-get install php7.0-mysql php7.0-curl php7.0-json php7.0-cgi php7.0 libapache2-mod-php7.0kukhazikitsa zofunika zigawo zikuluzikulu ngati mukufuna 7.
  2. Nthawi zina lamulo ili pamwamba ndi losweka, choncho gwiritsani ntchitosudo apt install php 7.2-clikapenasudo apt kukhazikitsa hhvmkukhazikitsa mawonekedwe atsopano atsopano 7.2.
  3. Pambuyo pomaliza ndondomekoyi, onetsetsani kuti msonkhano woyenera umayikidwa polemba pa consolephp -v.
  4. Kukonzekera kwasanja ndi mawonekedwe a webusaitiyi akugwiritsidwa ntchito pogwiritsira ntchito chipangizo chaulere PHPmyadmin, chomwe chiri chofunikanso kukhazikitsa nthawi ya kukonza LAMP. Kuti muyambe, lowetsani lamulosudo apt-get install phpmyadmin php-mbstring php-gettext.
  5. Onetsetsani Kuwonjezera kwa mafayilo atsopano mwa kusankha njira yoyenera.
  6. Tchulani seva la intaneti "Apache2" ndipo dinani "Chabwino".
  7. Mudzafunsidwa kuti musungire malowa pogwiritsa ntchito lamulo lapadera, ngati kuli koyenera, sankhani yankho lolondola.
  8. Pangani neno lachinsinsi kuti mulembetse ndi seva ya deta, pambuyo pake muyenera kutsimikizira izi mwa kubwezeretsanso.
  9. Mwachinsinsi, simungathe kulowa kwa PHPmyadmin m'malo mwa wogwiritsa ntchito mizu kapena kudzera muzipangizo za TPC, kotero muyenera kulepheretsa ntchito yothandizira. Gwiritsani ntchito ufulu wa mizu kudzera mwa lamulosudo -i.
  10. Gwiritsani ntchito kutseka kwa kulembalembani "wosintha wosuta atsegula plugin =" kumene User = "muzu"; ufulu; "| mysql -u root -p mysql.

Potsatira njirayi, kukhazikitsa ndi kukonzekera kwa PHP kwa LAMP kungatengedwe bwino.

Onaninso: PHP Installation Guide kwa Ubuntu Server

Lero tinaphimba maimidwe ndi masinthidwe oyambirira a zigawo za LAMP kwa Ubuntu opangira dongosolo. Zoonadi, izi sizinthu zonse zomwe zingaperekedwe pa mutuwu, pali maonekedwe ambiri ogwirizana ndi kugwiritsa ntchito madera angapo kapena mabungwe. Komabe, chifukwa cha malangizo omwe ali pamwambawa, mungathe kukonzekera mosavuta dongosolo lanu kuti mugwiritse ntchito molondola pulogalamuyi.