Iphakethe le-software elibizwa nge-LAMP lifaka i-Linux kernel OS, iseva yewebhu ye-Apache, i-database ye-MySQL, nezinto ze-PHP ezisetshenziselwa injini yesiza. Okulandelayo, sizokuchaza ngokuningiliziwe ukufakwa nokucushwa kokuqala kwalawa ongezo, sithathe inguquko yakamuva ye-Ubuntu njengesibonelo.
Ukufaka i-LAMP Software Suite ku-Ubuntu
Njengoba ukwakheka kwale ndatshana sekusho ukuthi une-Ubuntu efakwe ekhompyutheni yakho, sizokweqa lesi sinyathelo bese siqhubeka ngokushesha kwezinye izinhlelo, noma kunjalo ungathola imiyalo ngesihloko esikuthandayo ngokufunda ezinye izindatshana zethu kusixhumanisi esilandelayo.
Imininingwane engaphezulu:
Faka Ubuntu ku-VirtualBox
Ukuhamba nge-Linux kusuka ku-flash drive
Isinyathelo 1: Faka i-Apache
Ake siqale ngokufaka iseva yewebhu evulekile ebizwa nge-Apache. Ngenye yezinketho ezinhle kakhulu, ngakho-ke kuba ukukhetha kwabasebenzisi abaningi. Ku-Ubuntu, kufakwa "Isiginali":
- Vula imenyu bese uqala ikhonsoli noma cindezela inhlanganisela yokhiye I-Ctrl + Alt + T.
- Thuthukisa amakhosombe ohlelo lwakho kuqala ukuze uqiniseke ukuthi unazo zonke izinto ezidingekayo. Ukuze wenze lokhu, bhala umyalo
ukuvuselelwa kwesudo
. - Zonke izenzo nge sudo isebenza ngokufinyelela kwezimpande, ngakho-ke qiniseka ukuthi ucacisa i-password yakho (ayiveli uma ingena).
- Uma usuqedile, ngena
sudo apt-get ukufaka i-apache2
ukufaka i-Apache ohlelweni. - Qinisekisa ukungeza wonke amafayela ngokukhetha inketho yokuphendula D.
- Ake sihlole ukusebenza kweseva yewebhu ngokusebenza
sudo apache2ctl ukucushwa
. - I-syntax kufanele ibe yinto evamile, kepha kwesinye isikhathi kuvela isexwayiso mayelana nesidingo sokungeza I-Servername.
- Faka lokhu kuhluka komhlaba wonke kufayela lokumisa ukuze uvikele izexwayiso ezizayo. Qalisa ifayela uqobo
sudo nano /etc/apache2/apache2.conf
. - Manje sebenzisa ikhonsoli yesibili, lapho ugijimela khona umyalo
ip addr khombisa eth0 | grep inet | awk '{phrinta u- $ 2; } '| sed 's / /
ukuthola ikheli lakho le-IP noma isizinda seseva. - Okokuqala "Isiginali" shona phansi ezansi kwefayela elivuliwe ubhale
ServerName + igama lesizinda noma ikheli le-IP
ukuthi usanda kufunda. Gcina izinguquko I-Ctrl + O bese uvala ifayela lokucushwa. - Hlola futhi ukuze uqiniseke ukuthi awekho amaphutha, bese uqala kabusha iseva yewebhu
sudo systemctl qala kabusha apache2
. - Ngeza i-Apache kusithonjana uma kunesidingo ukuze iqale ngohlelo lokusebenza lisebenzisa umyalo
sudo systemctl inika amandla i-apache2
. - Kuhlala kuphela ukuqala iseva yewebhu ukubheka ukuqina kokusebenza kwayo, sebenzisa umyalo
sudo systemctl qala apache2
. - Qalisa isiphequluli bese uya ku
indawo yasekhaya
. Uma ufike ekhasini eliyinhloko le-Apache, khona-ke yonke into isebenza kahle, qhubekela esigabeni esilandelayo.
Isinyathelo 2: Faka i-MySQL
Isinyathelo sesibili ukufaka i-database ye-MySQL, nayo eyenziwa nge-console ejwayelekile kusetshenziswa imiyalo etholakala ohlelweni.
- Ukubekwa phambili ku "Isiginali" bhala
sudo apt-get ufake mysql-server
bese uqhafaza Ngena. - Qinisekisa ukungezwa kwamafayela amasha.
- Qiniseka ukuthi uvikela ukusetshenziswa kwemvelo ye-MySQL, ngakho-ke hlinzeka ngokuvikela ngesengezo esihlukile, esifakiwe
sudo mysql_secure_installation
. - Ukusetha izilungiselelo ze-plugin zezidingo zephasiwedi akunawo umyalo owodwa, ngoba umsebenzisi ngamunye uqondiswa izinqumo zakhe ngokuya ngokuqinisekiswa. Uma ufuna ukufaka izidingo, faka ikhonsoli y ngesicelo.
- Okulandelayo, udinga ukukhetha izinga lokuvikelwa. Okokuqala, funda incazelo yepharamitha ngalinye, bese ukhetha elifanele kunazo zonke.
- Setha iphasiwedi entsha ukuhlinzeka ukufinyelela kwezimpande.
- Okulandelayo, uzobona izilungiselelo ezahlukahlukene zokuphepha, uzifunde bese wamukela noma wenqaba, uma ubona kunesidingo.
Sikweluleka ukuthi uzijwayeze ngokuchaza enye indlela yokufaka kumbhalo wethu ohlukile, ozowathola kusixhumanisi esilandelayo.
Bheka futhi: Umhlahlandlela wokufakwa kwe-MySQL ku-Ubuntu
Isinyathelo 3: Faka i-PHP
Isinyathelo sokugcina sokuqinisekisa ukusebenza kahle kohlelo lwe-LAMP ukufaka izingxenye ze-PHP. Akukho lutho oluyinkimbinkimbi ekusebenzeni kwale nqubo, udinga nje ukusebenzisa imiyalo etholakalayo, bese ulungiselela isengezo ngokwayo.
- In "Isiginali" bhala umyalo
sudo apt-get ukufaka php7.0-mysql php7.0-curl php7.0-json php7.0-cgi php7.0 libapache2-mod-php7.0
ukufaka izinto ezidingekayo uma kwenzeka ufuna i-version 7. - Kwesinye isikhathi umyalo ongenhla awasebenzi, ngakho-ke sebenzisa
spt ukufaka i-php 7.2-khungu
nomasudo apt ukufaka hhvm
ukufaka inguqulo yakamuva etholakalayo 7.2. - Ekupheleni kwenqubo, qiniseka ukuthi umhlangano ofanele wafakwa ngokubhala kukhonsoli
php -v
. - Ukuphathwa kweDatabase kanye nokuqaliswa kwesixhumi esibonakalayo sewebhu kwenziwa kusetshenziswa ithuluzi lamahhala le-PHPmyadmin, futhi elifiselekayo ukufakwa ngesikhathi sokucushwa kwe-LAMP. Ukuze uqalise, faka umyalo
sudo apt-get ufake phpmyadmin php-mbstring php-uthole
. - Qinisekisa ukungezwa kwamafayela amasha ngokukhetha inketho ezifanele.
- Cacisa iseva yewebhu "Apache2" bese uqhafaza KULUNGILE.
- Uzokwaziswa ukuthi ulungiselele i-database ngomyalo okhethekile, uma kunesidingo, khetha impendulo evumayo.
- Dala iphasiwedi yokubhaliswa kuseva yedatha, ngemuva kwalokho kuzodingeka ukuthi kuqinisekiswe ngokuyifaka kabusha.
- Ngokuzenzakalelayo, ngeke ukwazi ukufaka i-PHPmyadmin egameni lomsebenzisi ngokufinyelela kwezimpande noma ngokusebenzisa i-TPC, ngakho-ke udinga ukuvimbela ukusetshenziswa kokuvinjwa. Yenza kusebenze amalungelo ezimpande ngomyalo
sudo -i
. - Nqamula ngokuthayipha
i-echo "buyekeza i-plugin yomsebenzisi =" lapho uMsebenzisi = "izimpande"; amalungelo agqamile; "| mysql -u izimpande -p mysql
.
Kulokhu, ukufakwa nokulungiswa kwe-PHP ye-LAMP kungabhekwa njengokuqediwe ngempumelelo.
Bheka futhi: Umhlahlandlela wokufakwa kwe-PHP ku-Ubuntu Server
Namuhla sithinte ekufakweni nasekuhlelweni okuyisisekelo kwezinto ze-LAMP zohlelo lobuntu lwe-Ubuntu. Vele, lokhu akuyona yonke imininingwane enganikezwa ngalesi sihloko, kukhona ama-nuances amaningi ahlotshaniswa nokusetshenziswa kwezizinda eziningi noma imininingwane yedatha. Kodwa-ke, ngenxa yemiyalo engenhla, ungalungisa kalula uhlelo lwakho ukuze lisebenze kahle leli phakethe le-software.