Ib pob software hu ua LAMP muaj xws li OS nyob rau ntawm Linux cov ntsiav, ib lub vas sab Apache, ib qhov MySQL database, thiab PHP yam siv rau ntawm qhov chaw cav. Tom ntej no, peb piav qhia txog qhov kev nthuav dav thiab pib txheej txheem ntawm cov add-ons, noj qhov tseeb version ntawm Ubuntu ua piv txwv.
Nruab tus LAMP suite hauv Ubuntu
Vim tias hom ntawv no txhais tau hais tias koj tau nruab Ubuntu hauv koj lub computer, peb yuav hle qhov kauj ruam no thiab mus ncaj qha mus rau lwm cov kev pabcuam, tabsis koj tuaj yeem nrhiav cov lus qhia hauv nqe lus uas nyiam koj los ntawm kev nyeem peb cov khoom ntawm cov kev sib txuas txuas mus ntxiv.
Yog xav paub ntxiv:
Txhim Kho Ubuntu hauv VirtualBox
Linux Kev Qhia Kev Ntsuas nrog Flash Drives
Kauj ruam 1: Nrawm Apache
Pib los ntawm kev nruab ib qho qhib lub web server hu ua Apache. Nws yog ib qhov zoo tshaj plaws kev xaiv, yog li nws ua qhov kev xaiv ntawm ntau cov neeg siv. Hauv Ubuntu nws muab tso rau hauv "Terminal":
- Qhib cov ntawv qhia zaub mov thiab tso lub console los yog nias qhov tseem ceeb ua ke Ctrl + Alt + T.
- Ua ntej, hloov koj qhov chaw kaw suab kom paub meej tias koj muaj tag nrho cov khoom tsim nyog. Ua li no, ntaus nqe lus
sudo apt-tau hloov tshiab
. - Tag nrho cov kev ua los ntawm sudo sau nrog root nkag, yog li nco ntsoov sau koj tus password (nws tsis yog tso tawm kom pom thaum koj nkag mus rau).
- Thaum ua tiav, sau
sudo apt-mus nruab apache2
ntxiv apache rau lub cev. - Kom paub meej ntxiv cov ntaub ntawv los xaiv cov lus teb D.
- Peb yuav kuaj cov neeg siv qhov web server los ntawm kev khiav
sudo apache2ctl configtest
. - Lub syntax yuav tsum muaj dab tsi, tab sis qee zaus tseem ceeb toom txog qhov yuav tsum tau ntxiv Servername.
- Ntxiv no lub ntiaj teb no txawv txav mus rau cov ntaub ntawv kho kom tsis txhob ceeb toom yav tom ntej. Khiav cov ntaub ntawv xwb
sudo nano /etc/apache2/apache2.conf
. - Tam sim no khiav thib ob console, qhov twg khiav qhov hais kom ua
tus IP addr qhia eth0 | grep inet | awk '{sau $ 2; } ' sed 's //.*$//'
kom paub seb koj tus IP chaw nyob los sis tus neeg rau npe. - Nyob hauv thawj "Terminal" mus rau hauv qab ntawm cov ntaub ntawv qhib thiab sau
ServerName + npe lub npe lossis tus IP address
tias koj nyuam qhuav kawm. Tseg cov kev hloov ntawm Ctrl + O thiab kaw cov ntaub ntawv tawm tswv yim. - Ua lwm txoj kev kuaj kom paub tseeb tias tsis muaj qhov yuam kev, thiab rov qab qhib qhov web server rau ntawm
sudo systemctl restart apache2
. - Ntxiv Apache rau startup, yog tias koj xav kom nws pib nrog lub operating system nrog cov lus txib
sudo systemctl ua kom apache2
. - Nws tshua tsuas yog pib lub web server mus xyuas nws cov stability, siv qhov hais kom ua
sudo systemctl pib apache2
. - Tua tawm koj tus browser thiab mus
localhost
. Yog tias koj nyob rau ntawm nplooj ntawv Apache lub ntsiab, ces txhua yam yog ua haujlwm kom raug, npaj mus rau kauj ruam tom ntej.
Theem 2: nruab MySQL
Cov kauj ruam thib ob yog ntxiv MySQL database, uas yog ua los ntawm tus qauv kev siv cov commands uas muaj nyob rau hauv qhov system.
- Qhov muaj feem ua ntej "Terminal" sau ntawv
sudo apt-mus nruab mysql-neeg rau zaub mov
thiab nias rau Sau. - Tshawb xyuas qhov sib ntxiv ntawm cov ntaub ntawv tshiab.
- Nco ntsoov ruaj ntseg rau koj kev siv ntawm MySQL ib puag ncig, yog li xyuas kom muaj kev tiv thaiv nrog ib qho kev sib txuas ntxiv ntawm
sudo mysql_secure_installation
. - Qhov teeb meem plugin rau kev siv lo lus zais tsis muaj ib txoj kev qhia tib yam, vim txhua tus neeg tau muab rov qab los ntawm nws cov kev daws teeb meem raws li kev validation. Yog tias koj xav tau los nruab rau cov kev cai, nkag rau hauv lub console y thaum thov.
- Tom ntej no, koj yuav tsum xaiv qhov kev tiv thaiv. Ua ntej nyeem cov lus piav qhia ntawm txhua qhov parameter, thiab tom qab ntawd ces xaiv qhov zoo tshaj plaws.
- Teem ib lo lus zais tshiab kom nkag tau mus rau hauv paus.
- Tsis tas li ntawd, koj yuav pom ntau yam kev ruaj ntseg nyob ntawm koj xub ntiag, nyeem lawv thiab txais los yog tsis lees paub yog tias koj pom tias tsim nyog.
Peb pom zoo kom nyeem cov lus piav qhia ntawm lwm txoj kev siv kev txhim kho hauv peb cov tshooj cais, uas koj yuav pom ntawm qhov txuas hauv qab no.
Saib kuj: MySQL Installation Guide rau Ubuntu
Kauj ruam 3: nruab PHP
Kauj ruam kawg kom paub tseeb tias qhov kev lag luam ntawm LAMP yog qhov kev txhim kho PHP cov khoom. Muaj tsis muaj dab tsi nyuaj rau qhov kev siv ntawm cov txheej txheem no, koj tsuas yog yuav tsum tau siv ib qho ntawm cov commands muaj, thiab mam li configure cov hauj lwm ntawm lub add-on nws tus kheej.
- Nyob rau hauv "Terminal" sau rau pab neeg
sudo apt-mus nruab php7.0-mysql php7.0-curl php7.0-json php7.0-cgi php7.0 libapache2-mod-php7.0
txhawm rau nruab cov khoom tsim nyog hauv qhov xwm txheej koj xav tau version 7. - Qee lub sij hawm cov lus txib saum toj no tawg, yog li siv
sudo apt nruab php 7.2-cli
los yogsudo apt nruab hhvm
mus nruab rau qhov tseeb muaj version 7.2. - Thaum ua tiav ntawm txoj haujlwm, nco ntsoov tias qhov kev sib dhos muaj tseeb yog ntsia los ntawm kev sau ntawv hauv lub console
php -v
. - Database kev tswj thiab qhov web interface yuav ua tau siv cov cuab yeej pub dawb PHPmyadmin, uas yog qhov tseem ceeb rau nruab rau lub sijhawm LAMP configuration. Yog xav pib, sau qhov kev txib
sudo apt-mus nruab phpmyadmin php-mbstring php-gettext
. - Tshawb xyuas ntxiv cov ntaub ntawv tshiab los ntawm kev xaiv qhov kev tsim nyog.
- Qhia kom meej rau qhov web server "Apache2" thiab nias rau "OK".
- Koj yuav raug muab qhib raws li kev sib txuas lus ntawm txoj kab lus tshwj xeeb, yog tias tsim nyog, xaiv lo lus teb zoo.
- Tsim ib lo lus zais rau npe nrog cov database server, tom qab uas koj yuav tsum tau kom paub meej tias nws los ntawm rov nkag nws.
- Yog vim li cas, koj yuav tsis muaj peev xwm nkag mus rau hauv PHPmyadmin rau ib tug neeg siv nrog hauv paus nkag los los ntawm TPC interfaces, yog li koj yuav tsum tau lov tes taw qhov hluav taws xob thaiv. Qhib cov cai ntawm txoj cai los ntawm kev hais kom ua
sudo -i
. - Siv lub shutdown los ntaus ntawv
ncha "hloov tshiab neeg siv plugin =" qhov twg Neeg = "hauv paus"; flush privileges; "| mysql -u root -p mysql
.
Ntawm cov txheej txheem no, qhov kev txhim kho thiab kev teeb tsa ntawm PHP rau LAMP tuaj yeem suav tias yog ua tiav tiav.
Saib kuj: PHP Installation Guide rau Ubuntu Server
Niaj hnub no peb them qhov kev txhim kho thiab kev txav ntawm LAMP Cheebtsam rau Ubuntu operating system. Tau kawg, qhov no tsis yog tas nrho cov ntaub ntawv uas tuaj yeem tau muab rau hauv nqe lus no, muaj ntau ntau yam kev sib txuas nrog kev siv ntau tus puav los yog cov kev sib txuas lus. Txawm li cas los xij, ua tsaug rau cov lus qhia saum toj no, koj tuaj yeem npaj koj lub cev rau txoj kev ua haujlwm ntawm qhov software pob.