Kunshin software ɗin da ake kira LAMP ya haɗa da Linux kernel OS, da sabar yanar gizo na Apache, MySQL database, da abubuwan PHP waɗanda aka yi amfani da injin yanar gizon. Na gaba, zamuyi bayani dalla-dalla yadda kafuwa da tsarin farko na wadannan abubuwan suka kara, muna daukar sabon salo na Ubuntu a matsayin misali.
Shigar da LAMP Software Suite a Ubuntu
Tunda yanayin wannan labarin ya riga ya nuna cewa kun sanya Ubuntu a kwamfutarka, za mu tsallake wannan mataki kuma ku ci gaba zuwa sauran shirye-shirye nan da nan, duk da haka zaku iya samun umarni kan batun abin so a gare ku ta hanyar karanta sauran labaranmu a hanyoyin da ke gaba.
Karin bayanai:
Sanya Ubuntu akan VirtualBox
Linux Gabatarwa daga flash drive
Mataki na 1: Sanya Apache
Bari mu fara da shigar da sabar yanar gizo na bude da ake kira Apache. Yana ɗaya daga cikin zaɓuɓɓuka masu kyau, saboda haka ya zama zaɓin yawancin masu amfani. A cikin Ubuntu, an sanya ta "Terminal":
- Bude menu kuma kaddamar da na'ura wasan bidiyo ko latsa haɗin maɓallin Ctrl + Alt + T.
- Haɓaka kayan ajiya naka na farko don tabbatar cewa kana da duk kayan aikin da ake buƙata. Don yin wannan, rubuta umarnin
sudo dace-samu sabuntawa
. - Dukkanin ayyuka ta hanyar sudo yana aiki tare da tushen tushe, don haka tabbatar da saka kalmar wucewa ta (bai bayyana ba lokacin shigar).
- Lokacin da aka gama, shigar da
sudo dace-samu shigar apache2
don ƙara Apache a cikin tsarin. - Tabbatar da ƙara duk fayiloli ta zaɓi zaɓi D.
- Bari mu gwada aikin uwar garken yanar gizo ta gudana
sudo apache2ctl saitawa
. - Syntax ɗin yakamata ya zama na al'ada, amma wani lokacin gargaɗi yana bayyana game da buƙatar ƙarawa Servername.
- Sanya wannan canjin duniya zuwa fayil din sanyi don gujewa gargadi na gaba. Gudun fayil ɗin da kanta ta hanyar
sudo nano /etc/apache2/apache2.conf
. - Yanzu gudanar da wasan bidiyo na biyu, inda gudanar da umarni
ip addr show eth0 | ingin grep | awk '{buga $ 2; } '| sed 's //.*$//'
don gano adireshin IP ko yankin yanki. - A farkon "Terminal" gangara zuwa kasan ainihin fayil ɗin da aka buɗe da nau'in
ServerName + sunan yankin ko adireshin IP
abin da kawai ka koya. Ajiye canje-canje ta hanyar Ctrl + O kuma rufe fayil ɗin sanyi. - Gwada sake don tabbatar da cewa babu kurakurai, sannan a sake kunna gidan yanar gizo ta hanyar
sudo systemctl sake kunnawa apache2
. - Sanya Apache zuwa kayanda ake buƙata idan ya zama dole domin ya fara da tsarin aiki ta amfani da umarni
sudo systemctl kunna apache2
. - Ya rage kawai don fara sabar yanar gizo don bincika amincin aikinsa, yi amfani da umarnin
sudo systemctl fara apache2
. - Unchaddamar da mai binciken kuma je zuwa
localhost
. Idan kun isa babban shafin Apache, to komai yana tafiya daidai, ci gaba zuwa mataki na gaba.
Mataki na 2: Sanya MySQL
Mataki na biyu shine ƙara bayanan MySQL, wanda kuma ake yi ta hanyar daidaitaccen wasan bidiyo ta amfani da umarnin da ke cikin tsarin.
- Fifikon shiga "Terminal" rubuta
sudo dace-samu shigar da MySQL-sabar
kuma danna kan Shigar. - Tabbatar da ƙarin sababbin fayiloli.
- Tabbatar da amintaccen amfani da yanayin MySQL, don haka samar da kariya tare da ƙari daban, wanda aka sanya ta
sudo mysql_secure_installation
. - Saita tsarin saiti na abubuwan buƙatun kalmar sirri ba shi da jagora guda ɗaya, tunda kowane mai amfani yana jagorantar su ta hanyar yanke shawarar kansu dangane da inganci. Idan kana son shigar da bukatun, shigar da na'ura wasan bidiyo y kan bukatar.
- Na gaba, kuna buƙatar zaɓar matakin kariya. Da farko, karanta bayanin kowane sigogi, sannan ka zaɓi wanda ya fi dacewa.
- Sanya sabon kalmar sirri don samar da tushen tushe.
- Bayan haka, zaku ga saitunan tsaro daban-daban, karanta su kuma karɓa ko ƙi, idan kun ga ya zama tilas.
Muna ba ku shawara ku fahimci kanku tare da bayanin wata hanyar shigarwa a cikin labarinmu daban, wanda zaku samu a mahaɗin da ke biye.
Duba kuma: MySQL Guide Installation Guide akan Ubuntu
Mataki na 3: Sanya PHP
Mataki na ƙarshe don tabbatar da aiki daidai na tsarin LAMP shine shigar da abubuwan PHP. Babu wani abu mai rikitarwa a cikin aiwatar da wannan tsari, kawai kuna buƙatar amfani da ɗayan umarnin da ke akwai, sannan kuma saita ƙara a kanta.
- A "Terminal" rubuta umarnin
sudo dace-samu shigar da php7.0-mysql php7.0-curl php7.0-json php7.0-cgi php7.0 libapache2-mod-php7.0
shigar da kayan aikin da ake buƙata idan kuna buƙatar ẹya 7. - Wasu lokuta umarnin da ke sama ba ya aiki, saboda haka amfani
sudo mai dacewa shigar da php 7.2-cli
kosudo yadda yakamata a kafa hhvm
don shigar da sabon samfurin da ya gabata 7.2. - A ƙarshen tsarin, ka tabbata cewa an sanya taron madaidaiciya ta hanyar rubuta a cikin na'ura wasan bidiyo
php -v
. - Gudanar da bayanai da aiwatar da sigar yanar gizo ana aiwatar da ita ta amfani da kayan aiki kyauta na PHPmyadmin, wanda kuma kyawawa ne don sanyawa yayin tsarin LAMP. Don farawa, shigar da umarni
sudo dace-samu shigar da phpmyadmin php-mbstring php-gettext
. - Tabbatar da ƙari na sabbin fayiloli ta zaɓi zaɓi da ya dace.
- Saka sabar yanar gizo "Apache2" kuma danna kan Yayi kyau.
- Za a zuga ku don saita bayanan ta hanyar umarni na musamman, idan ya cancanta, zaɓi ingantacciyar amsa.
- Irƙiri kalmar sirri don rajista a kan sabar cibiyar bayanai, bayan hakan akwai buƙatar tabbatar da shi ta sake shigar da shi.
- Ta hanyar tsoho, ba za ku iya shigar da PHPmyadmin ba a madadin mai amfani da tushen shiga ko ta hanyar musayar TPC, don haka kuna buƙatar kashe mai amfani mai toshewa. Kunna haƙƙin tushen ta hanyar umarni
sudo -i
. - Cire haɗin ta hanyar bugawa
echo "sabunta mai amfani saita plugin =" inda Mai amfani = "tushe"; saukar da gata; "| mysql -u tushen -p mysql
.
A kan wannan, za a iya la'akari da sakawa da kuma daidaitawa na PHP don LAMP cikin nasara.
Duba kuma: Jagorar Saukewar PHP akan Ubuntu Server
A yau mun taɓa shigarwa da kuma ainihin ƙa'idodin abubuwan LAMP don tsarin aikin Ubuntu. Tabbas, wannan ba duk bayanin da za'a iya bayarwa akan wannan batun ba, akwai lambobi da yawa waɗanda ke da alaƙa da amfani da yawancin yanki ko bayanan bayanai. Koyaya, godiya ga umarnin da ke sama, zaka iya shirya tsarinka don ingantaccen aikin wannan kunshin software.