PostgreSQL ke sistimi ea mahala ea database e sebelisitsoeng bakeng sa li-platform tse fapaneng, ho kenyeletsoa Windows le Linux. Sesebelisoa se tšehetsa palo e kholo ea mefuta ea data, e na le puo e ngotsoeng ka har'a eona ebile e ts'ehetsa ts'ebeliso ea lipuo tsa mananeo a khale. Ubuntu, PostgreSQL e kentsoe ka "Mokhatlo oa" terminal " sebelisa li-replication tsa 'muso kapa tsa basebelisi,' me ka mor'a moo, ho etsoa mosebetsi oa ho lokisa, ho etsa liteko le ho theha litafole.
Kenya PostgreSQL ho Ubuntu
Lits'ireletso li sebelisoa libakeng tse fapaneng, empa sistimi ea tsamaiso e fana ka taolo e ntle. Basebelisi ba bangata ba emisa ho PostgreSQL, ba e kenya ho OS ea bona mme ba qale ho sebetsa ka litafole. Kamora moo, re ka thabela ho nyoloha mohato ka mohato ho hlalosa ts'ebetso eohle ea ho kenya, ho qala le ho hlophisa sesebelisoa se boletsoeng.
Mohato oa 1: Kenya PostgreSQL
Ho joalo, o lokela ho qala ka ho eketsa lifaele tsohle tse hlokahalang le lilaebraring ho Ubuntu ho netefatsa ts'ebetso e tloaelehileng ea PostgreSQL. Sena se etsoa ho sebelisoa likhakanyo tsa tšebeliso le basebelisi kapa tsa semmuso.
- Matha "Mokhatlo oa" terminal " ka tsela efe kapa efe e bonolo, ho etsa mohlala, ka menu kapa ka ho tobetsa konopo Ctrl + Alt + T.
- Taba ea mantlha, re ela hloko polokeho ea basebelisi, hobane mefuta ea morao-rao e atisa ho beoa moo pele. Manamisa taelo tšimong
"Sudo sh -c 'echo"
ebe o tobetsa Kena. - Kenya phasewete ea ak'haonte ea hau.
- Kamora ts'ebeliso eo
wget -q //www.postgresql.org/media/keys/ACCC4CF8.asc -O - | senotlolo sa-sudo-eketsa -
ho eketsa lipakete. - E sala feela ho ntlafatsa lilaebrari tsa tsamaiso ka taelo e tloaelehileng
sudo apt-fumana ntjhafatso
. - Haeba u thahasella ho fumana mofuta oa morao-rao o fumanehang oa PostgreSQL ho tsoa setsing sa semmuso, o hloka ho ngola ka har'a komporo
sudo apt-kenya kenya postgresql postgresql-kenya
le ho netefatsa tlatsetso ea lifaele.
Kamora ho kenya ts'ebetso e atlehileng, o ka tsoelapele ho qala akhaonto e tloaelehileng, hlahloba sisteme le tlhophiso ea pele.
Mohato oa Bobeli: Ho qala PostgreSQL Lekhetlo la Pele
Tsamaiso ea DBMS e kentsoeng le eona e etsahala ka "Mokhatlo oa" terminal " o sebelisa litaelo tse nepahetseng. Pitso ho mosebelisi e entsoeng ke default e shebahala tjena:
- Kenya taelo
sudo su - lipapatso
ebe u tobetsa Kena. Ketso e joalo e tla u lumella ho fetohela ho botsamaisi lebitsong la akhaonto e sa pheleng, eo hajoale e sebetsang e le eona e ka sehloohong. - Ho kena ka har'a komporo ea tsamaiso tlas'a tataiso ea profil e sebelisitsoeng
qaloq
. Ts'ebetso e tla u thusa ho sebetsana le tikoloho.thusa
- e tla bontša litaelo tsohle tse teng le likhang. - Ho sheba tlhahisoleseling mabapi le seboka sa ha joale sa PostgreSQL ho etsoa ka
conninfo
. - Tloha tikolohong e tla thusa sehlopha
q
.
Joale o se o tseba ho kena akhaonteng ea hau mme o ee ho khomphutha ea tsamaiso, ka hona ke nako ea ho fetela pele ho theha mosebelisi e mocha le database sa hae.
Mohato oa 3: Theha mosebelisi le database
Ha ho bonolo kamehla ho sebetsa ka akhaonto e tloaelehileng e teng, 'me ha ho hlokahale kamehla. Ke ka lebaka leo re fanang ka maikutlo a ho nka mokhoa oa ho theha profil e ncha le ho hokela database e ka thoko ho eona.
- Ho ba ka har'a khokahano tlas'a taolo ea profil poso (sehlopha
sudo su - lipapatso
) ngolamoqapi - o sebetsa
, ebe o e fa lebitso le nepahetseng ka ho ngola litlhaku moleng o nepahetseng. - E latelang, fumana hore na u batla ho fa basebelisi litokelo tsa sepolesa sa ho fumana lisebelisoa tsohle tsa sistimi. Khetha feela khetho e loketseng ebe u tsoela pele.
- Ho molemo ho bitsa database ka lebitso le tšoanang le ak'haonte eo e reheletsoeng eona, kahoo u lokela ho sebelisa taelo
Lumpics
kae lumpics - mosebelisi. - Phetoho ea ho sebetsa le database e boletsoeng e etsahala ka
psql -d lumpics
kae lumpics - lebitso la database.
Mohato oa 4: Ho theha Tafole le Ho Sebetsa ka Liroto
Ke nako ea ho theha tafole ea hau ea pele lethathamong le khethiloeng. Ts'ebetso ena e boetse e etsoa ka khokahano, leha ho le joalo, ho ke ke ha e-ba thata ho sebetsana le litaelo tsa sehlooho, hobane u hloka tse latelang feela:
- Kamora ho ea database, kenya khoutu e latelang:
QETA TABLE TABLE (
equip_id serial PRIMARY KEY,
mofuta varchar (50) HONA NTLE,
mmala varchar (25) HONA NTLE,
sebaka varchar (25) hlahloba (sebaka ho ('leboea', 'boroa', 'bophirima', 'bochabela', 'lebooa-bochabela', 'ka boroa-bochabela', 'boroa-bophirima', 'leboea-bophirima'),
kenya_lehla la letsatsi
);Lebitso la tafole pele tlhatlhobo (o ka khetha lebitso le leng). Karolo ka 'ngoe e hlalositsoe ka tlase. Re khethile mabitso mofuta varchar le 'mala oa letlalo mohlala feela, o ka fihlella letšoao la efe kapa efe, empa o sebelisa ts'ebeliso ea litlhaku tsa Selatine. Linomoro tse libekeng li ikarabella bakeng sa boholo ba kholomo, e amanang ka kotloloho le data e behiloeng moo.
- Kamora ho kena, e sala feela ho bonts'a tafole e skrineng le
d
. - U bona moralo o bonolo o seng o sena leseli.
- Lintlha tse ncha li eketsoa ka taelo
Teko ea INSERT INTO (mofuta, 'mala, sebaka, kenya_date) LITLHAKU TSE KHOLO (' slide ',' bluu ',' boroa ',' 2018-02-24 ');
Lebitso la tafole le bontšitsoe pele, ho rona e teng tlhatlhobo, ebe likhalamo tsohle li thathamisitsoe, 'me boleng bo bontšoa ho maboko, kamehla ho lintlha tsa khotheishene. - Ebe o ka eketsa mola o mong, ho etsa mohlala.
Teko ea INSERT INTO (mofuta, 'mala, sebaka, kenya_date) LITLHAKISO (' swing ',' mosehla ',' leboea-bophirima ',' 2018-02-24 ');
- Matha tafole
KHETHA * HO TSOA tekong;
ho lekola sephetho. Joalokaha u bona, ntho e ngoe le e ngoe e fumaneha ka nepo mme data e kentsoe ka nepo. - Haeba u hloka ho hlakola boleng, bo etse ka taelo
TLHOBETSOA TOKA HONA mofuta oa = 'slide';
ka ho qotsa tšimo e lakatsehang matšoao a qotsitsoeng.
Mohato oa 5: Kenya phpPgAdmin
Ha ho bonolo kamehla ho tsamaisa database ka khomphutha, ka hona ho molemo ho e ntlafatsa ka ho kenya phpPgAdmin GUI e ikhethang.
- Haholo-holo ka "Mokhatlo oa" terminal " Khoasolla lintlafatso tsa laeborari tsa moraorao ka
sudo apt-fumana ntjhafatso
. - Kenya Apache Web Server
sudo apt-kenya kenya apache2
. - Kamora ho kenya, leka ts'ebetso ea eona le ts'ebeliso ea syntax
sudo apache2ctl haeba
. Haeba ho na le ho sa tsamaeeng hantle, batla phoso ho tlhaloso e fumanehang webosaeteng ea semmuso ea Apache. - Qala seva ka ho thaepa
sudo systemctl qala apache2
. - Kaha seva e sebetsa ka nepo, o ka eketsa lilaebrari tsa phpPgAdmin ka ho li jarolla ho tsoa pokellong ea molao ka
sudo apt kenya phppgadmin
. - E latelang, o hloka ho hokahanya faele ea tlhophiso. E bulele ka bukeng e ngolang lintlha ka ho e hlakisa
gedit /etc/apache2/conf-ava available/phppgadmin.conf
. Haeba tokomane e baloa feela, o tla hloka taelo pele gedit supa hapesudo
. - Pele ho mola "E hloka ea lehae" beha
#
ho e fetola hore e be maikutlo, 'me ho tloha tlase kenellaLumella ho tsoa ho tsohle
. Hona joale ho fumana aterese ho tla buleloa lisebelisoa tsohle tse teng marang-rang, eseng ho PC ea lehae. - Kenya seva ea marang-rang hape
sudo tšebeletso apache2 restart
mme o ka tswela pele ka polokeho ho sebetsa le PostgreSQL.
Sehloohong sena, ha re hlahlobe feela PostgreSQL, empa re kentse le ts'ebetso ea seva sa marang-rang sa Apache, se sebelisoang ho kopanya software ea LAMP. Haeba o thahasella ho netefatsa ts'ebetso e felletseng ea libaka tsa hau tsa marang-rang le merero e meng, re khothaletsa hore u ithute mokhoa oa ho eketsa likarolo tse ling ka ho bala sengoloa sa rona se seng ho sehokela se latelang.
Bona hape: Ho kenya LAMP Software Suite ho Ubuntu