Kamoo u ka jarang Software for laptop ASUS K52F

PostgreSQL ke tsamaiso ea mahala ea tsamaiso ea basebetsi e sebelisoang bakeng sa lipapali tse sa tšoaneng, ho akarelletsa Windows le Linux. Sesebelisoa se tšehetsa mefuta e mengata ea data, e na le puo e kenyelletsoeng le e tšehetsang mosebetsi ka ho sebelisa lipuo tsa khale tsa lenaneo. In Ubuntu, PostgreSQL e kenngoa kahare "Terminal" ho sebelisa litokomane tsa molao kapa tsa mosebetsing, 'me ka mor'a mosebetsi ona oa ho lokisetsa, ho hlahloba le ho theha litafole ho etsoa.

Kenya PostgreSQL ho Ubuntu

Boitsebiso bo sebelisoa libakeng tse fapa-fapaneng, empa tsamaiso e ntle ea tsamaiso e ba fa taolo e ntle. Basebelisi ba bangata ba emisa PostgreSQL, ba e kenye ka OS ea bona 'me ba qale ho sebetsa le litafole. Ka mor'a moo, re ka rata ho tsamaea ka mohato ho hlalosa ts'ebetso eohle ea ho kenya, tlhahiso ea pele le ho seta sa sesebelisoa se boletsoeng.

Mohato oa 1: Kenya PostgreSQL

Ha e le hantle, o lokela ho qala ka ho eketsa lifaele tsohle tse hlokehang le lilaebraring ho Ubuntu ho netefatsa hore mosebetsi o tloaelehileng oa PostgreSQL. Sena se etsoa ho sebelisa console le mosebedisi kapa litokomane tsa molao.

  1. Matha "Terminal" ka tsela leha e le efe e loketseng, ka mohlala, ho ea ka menyetla kapa ka ho hatelanya motsoako oa senotlolo Ctrl + Alt + T.
  2. Ntlha ea pele, re hlokomela mechine e sebelisoang ke mochine, hobane liphetolelo tsa morao-rao hangata li lefshoa moo. Kenya molaong oa tšimosudo sh -c 'echo "deb //apt.postgresql.org/pub/repos/apt/' lsb_release -cs'-pgdg ka sehloohong" >> /etc/apt/sources.list.d/pgdg.list 'ebe o tobetsa Kenya.
  3. Kenya password bakeng sa akhaonto ea hau.
  4. Ka mor'a tšebeliso eowget -q //www.postgresql.org/media/keys/ACCC4CF8.asc -O - | sudo apt-key eketsa -ho eketsa liphutheloana.
  5. E sala feela ho ntlafatsa lilaebraring tsa tsamaiso ka taelo e tloaelehileng.sudo apt-get update.
  6. Haeba u thahasella ho fumana tlhahiso ea morao-rao ea PostgreSQL ho tloha lefapheng la molao, u lokela ho ngola ka consolesudo apt-get install postgresql postgresql-contrible ho tiisa ho eketsa lifaele.

Ha u qetile ho kenya mekhoa e atlehang, u ka tsoela pele ho qaleng akhaonto e tloaelehileng, ho hlahloba ts'ebetso ea tsamaiso le bocha ba pele.

Mohato oa 2: Qala PostgreSQL Pele

Tsamaiso ea DBMS e kentsoeng e boetse e etsahala ka hara "Terminal" ho sebelisa litaelo tse loketseng. Ho letsetsoa ho sebediswa sa mosebedisi ho shebahale tjena:

  1. Kenya taelosudo ka - postgresmme u tobetsa Kenya. Ketso ena e tla u lumella hore u ee ho batsamaisi molemong oa akhaonto e entsoeng ka nako e sa lekanyetsoang, eo hona joale e sebeletsang e le eona e ka sehloohong.
  2. Ho kenya console ea taolo tlas'a mokhoa oa boitsebiso o sebelisitsoeng ke ho fetapsql. Ho sebetsana le tikoloho ho tla u thusa ho sebetsathuso- e tla bontša litaelo tsohle tse fumanehang le liqabang.
  3. Ho sheba tlhahisoleseding e mabapi le lenaneo la hona joale la PostgreSQL le etsoa ka tsela conninfo.
  4. Ho tsoa tikolohong ho tla thusa sehlopha q.

Hona joale o tseba ho kena ka akhaonteng mme o ea khomong ea batsamaisi, kahoo ke nako ea ho fetela pele ho bopa mochine e mocha le database ea hae.

Mohato oa 3: Etsa Mosebetsi le Database

Hase kamehla ho loketseng ho sebetsa le akhaonto e tloaelehileng e teng, mme ha ho hlokahale kamehla. Ke ka lebaka lena re hlahisang ho hlahloba mokhoa oa ho theha boitsebiso bo bocha le ho hokahanya le boitsebiso bo fapaneng.

  1. Ho ba sethaleng tlasa puso ea taolo postgres (sehlophasudo ka - postgres) ngolaho bōpaebe o fana ka lebitso le letle ka ho thapa litlhaku ka mohala o nepahetseng.
  2. E latelang, etsa qeto ea hore na u batla ho fa litokelo tsa moqapi oa ho sebelisa mehloli eohle ea tsamaiso. Khetha feela khetho e nepahetseng 'me u tsoele pele.
  3. Sebaka sa hau sa marang-rang se molemo ho rehoa lebitso le le leng joalokaha akhaonto e ne e bitsoa, ​​kahoo u lokela ho sebelisa taeloli-lumpics tse entsoengmoo lumpics - lebitso la mosebedisi.
  4. Phetoho ea ho sebetsa le database e boletsoeng e hlaha kapsql -d lumpicsmoo lumpics - lebitso la boitsebiso.

Mohato oa 4: Ho theha tafole le ho sebetsa ka mela

Ke nako ea ho theha tafole ea hau ea pele ho database e khethiloeng. Ts'ebetso ena e boetse e etsoa ka console, empa e ke ke ea e-ba thata ho sebetsana le litaelo tse kholo, hobane tsohle tseo u lokelang ho li etsa ke ho:

  1. Ka mor'a hore u fallele database, kenya khoutu e latelang:

    BALA TABLE teko (
    equip_id serial PRIMARY KEY,
    mofuta oa varchar (50) NOT NULL,
    mebala varchar (25) HA HO NULL,
    sebaka sa varchar (25) hlahloba (sebaka sa 'north', 'south', 'west', 'east', 'northeast', 'ka boroa-bochabela', 'ka boroa bophirimela', 'leboea-bophirima')),
    kenya letsatsi le lengolo
    );

    Taba ea pele lebitso la tafole le boletsoeng. teko (o ka khetha lebitso le leng le leng). Lintlha tse latelang li hlalosa moelelo ka mong. Re khethile mabitso mofuta oa varchar le mebala varchar feela bakeng sa mohlala, u ka fumana pontšo leha e le efe, empa feela ka tšebeliso ea litlhaku tsa Selatine. Linomoro tsa li-brackets li ikarabella bakeng sa boholo ba mohala, o amanang ka kotloloho le data e lumellanang le moo.

  2. Ka mor'a hore e kene ka eona e sala feela ho bontša tafole skrineng ka d.
  3. U bona morero o bonolo o se nang tlhahisoleseding leha e le efe e teng.
  4. Ditaba tse ncha di kenyelletsoa ka taeloHLOKA TSA tlhahlobo (mofuta, mebala, sebaka, kenya_date) VALUES ('slide', 'blue', 'south', '2018-02-24');Ntlha ea pele, lebitso la tafole le bonts'itsoe, ho rona le joalo teko, joale meqomo eohle e thathamisitsoe, 'me litekanyetso tsa licheche li bonts'oa, ha e le hantle li qotsitsoeng.
  5. Joale o ka eketsa mola o mong, ka mohlala,HLOKA TSA teko (mofuta, mobala, sebaka, kenya_date) VALUES ('swing', 'yellow', 'leboea-bophirima', '2018-02-24');
  6. Tsamaisa tafolengKhetho * FROM test;ho hlahloba sephetho. Joalokaha u ka bona, ntho e 'ngoe le e' ngoe e lokiselitsoe ka nepo 'me data e kenngoa hantle.
  7. Haeba o hloka ho tlosa boleng leha e le bofe, etsa joalo ka taeloTSOHA Tlhahlobo HA HO mofuta ofe = 'slide';ka ho bonts'a tšimo e hlokahalang likotsong.

Mohato oa 5: Kenya phpPgAdmin

Ha ho bonolo kamehla ho tsamaisa ditshwantsho tsa marang-rang ka mokhoa o ts'oanelang, kahoo ho molemo ho o ntlafatsa ka ho kenya e khethehileng phpPgAdmin GUI.

  1. Ntho ea bohlokoa ka ho fetisisa "Terminal" Fumana lisebelisoa tsa morao-rao tsa lilaebrari ka tselasudo apt-get update.
  2. Kenya Apache Web Serversudo apt-get kenya apache2.
  3. Kamora ho kenya, leka tlhahlobo ea eona le ho nepahala ha syntaxe u sebelisasudo apache2ctl e ikemiselitse. Haeba ho na le ho hong ho sa tsamaeeng hantle, sheba phoso ho ea ka tlhaloso ho websaeteng ea Apache ea molao.
  4. Qala seva ka ho thapasudo systemctl qala apache2.
  5. Hona joale ts'ebetso ea seva e tiisitsoe, o ka eketsa lilaebrari tsa phpPgAdmin ka ho li boloka ho tsoa lefapheng la liofisi ka molaosudo apt install phppgadmin.
  6. E latelang, o lokela ho fetola hanyenyane file ea tlhomamiso. E bule ka buka e tloaelehileng, e hlalosanggedit /etc/apache2/conf-available/phppgadmin.conf. Haeba tokomane e baloa feela, o tla hloka taelo pele gedit hlakisa hapesudo.
  7. Pele ho mohala "Hloka sebaka sa sebakeng seo" beha#, ho e khutlisetsa hape, mme u kene ka tlaseLumella ho bohle. Hona joale ho fihlella atereseng ho tla ba bulehileng bakeng sa lisebelisoa tsohle tse marang-rang, eseng feela bakeng sa PC ea lehae.
  8. Qala hape seva sa websaetetšebeletso ea sudo apache2 e qala hape'me u ikutloe u lokolohile ho theoha ho sebetsa le PostgreSQL.

Sehloohong sena, ha rea ​​sheba feela PostgreSQL, empa hape re sheba sethala sa websaete sa Apache, se sebelisetsoang ho kopanya LAMP software. Haeba u thahasella ho etsa bonnete ba lits'ebeletso tsa hau le merero e meng, re u eletsa hore u itlhalose ka mokhoa oa ho eketsa likarolo tse ling ka ho bala sehlooho se seng sa rona ho likahaneng tse latelang.

Bona hape: Ho kenya LAMP suite ho Ubuntu