Mmene mungathere pulogalamu ya pulogalamu ya ASUS K52F

PostgreSQL ndi dongosolo laulere la kusamalira mauthenga osiyanasiyana, ogwiritsidwa ntchito pa mapepala osiyanasiyana, kuphatikizapo Windows ndi Linux. Chidachi chimapereka mitundu yambiri ya deta, ili ndi chinenero chokwanira ndipo imathandizira ntchito pogwiritsa ntchito zinenero zamakono. Ubuntu, PostgreSQL imayikidwa kudzera "Terminal" pogwiritsa ntchito maofesi apamwamba kapena ogwiritsira ntchito, ndipo pambuyo pa ntchito yokonzekera, kuyesa ndikupanga matebulo akuchitika.

Sakani PostgreSQL mu Ubuntu

Maziko akugwiritsidwa ntchito mmadera osiyanasiyana, koma dongosolo la kayendedwe kabwino limapatsa iwo kukhala omasuka bwino. Ogwiritsa ntchito ambiri amaima pa PostgreSQL, kuliika mu OS awo ndi kuyamba kugwira ntchito ndi matebulo. Chotsatira, tikufuna kupita pang'onopang'ono kufotokozera njira yonse yowonjezera, kuyambitsa koyamba ndi kukhazikitsidwa kwa chida chatchulidwacho.

Khwerero 1: Yesani PostgreSQL

Inde, muyenera kuyamba pakuwonjezera mafayilo onse ndi ma libraries ku Ubuntu kuti muzitha kugwira ntchito ya PostgreSQL. Izi zagwiritsidwa ntchito pogwiritsira ntchito console ndi ogwiritsa ntchito kapena zolembera.

  1. Thamangani "Terminal" mwa njira iliyonse yabwino, mwachitsanzo, kupyolera mu menyu kapena potsindikiza kuphatikiza Ctrl + Alt + T.
  2. Choyamba, timayang'ana zosungiramo, chifukwa matembenuzidwe atsopano amayamba kuwamasulidwa kumeneko. Lowani mu lamulo la kumundasudo sh -c 'echo "deb //apt.postgresql.org/pub/repos/apt/' lsb_release -cs'-pgdg chachikulu" >> /etc/apt/sources.list.d/pgdg.list 'ndiyeno dinani Lowani.
  3. Lowani mawu achinsinsi pa akaunti yanu.
  4. Mutatha kugwiritsa ntchitowget -q //www.postgresql.org/media/keys/ACCC4CF8.asc -O - | yowonjezera-key key add -kuwonjezera phukusi.
  5. Zimangokhala zokonzanso makina osungiramo machitidwe ndi lamulo labwino.sudo apt-get update.
  6. Ngati mukufuna kudziwa PostgreSQL yopezeka posachedwa kuchokera ku malo ovomerezeka, muyenera kulemba mu consolesudo apt-get install postgresql postgresql-contribndi kutsimikizira kuwonjezera mafayilo.

Pambuyo pa kukonza bwino, mungathe kupitiriza kufotokozera akaunti yeniyeni, kuyang'ana momwe ntchitoyi ikuyendera komanso kukonzekera koyamba.

Gawo 2: Yambani PostgreSQL Choyamba

Otsogolera a DBMS omwe anaikidwa amapezeka kudzera "Terminal" kugwiritsa ntchito malamulo oyenerera. Kuitana kwa wosuta wosasintha kumawoneka motere:

  1. Lowani lamulosudo su - postgresndipo dinani Lowani. Kuchita izi kudzakulolani kuti mupite kwa otsogolera m'malo mwa akaunti yomwe imakhala yosasinthika, yomwe ikugwiritsidwa ntchito panopa.
  2. Kulowa pa console yowonongeka pansi pa chithunzi cha mbiri yomwe ikugwiritsidwa ntchito ndi kudzerapsql. Kuchita ndi chilengedwe kudzakuthandizani kuyambitsathandizo- izo ziwonetsa malamulo onse omwe alipo ndi zifukwa.
  3. Kuwona zambiri zokhudza gawo la PostgreSQL likuchitika kudzera malonda.
  4. Kutuluka chilengedwe kudzathandiza timu q.

Tsopano mukudziwa momwe mungalowere mu akaunti ndikupita ku chithunzithunzi cha kasamalidwe, choncho ndi nthawi yopitilirapo kuti mupange watsopano komanso malo ake osungirako zinthu.

Khwerero 3: Pangani Munthu ndi Zomwe Zili Zosintha

Sikoyenera nthawi zonse kugwira ntchito ndi akaunti yomwe ilipo, ndipo sikuti nthawi zonse ndi kofunika. Ndicho chifukwa chake tikukonzekera kulingalira momwe polojekitiyi idzakhazikitsire ndi kulumikizanitsa ndi deta yosiyana.

  1. Kukhala mu chitonthozo pansi pa machitidwe olamulira postgres (gulusudo su - postgres) lembanicreateuser --interactivendiyeno perekani dzina loyenerera mwa kulemba malemba mu chingwe choyenera.
  2. Chotsatira, sankhani ngati mukufuna kupereka ufulu wogwiritsa ntchito ogwiritsira ntchito zipangizo zonse. Sankhani njira yoyenera ndikupitiriza.
  3. Mndandanda wa malowa umatchulidwa dzina lomwelo monga akauntiyi, kotero muyenera kugwiritsa ntchito lamuloadayambitsa zovutakumene malonda - dzina la ntchito.
  4. Kutembenuka kukagwira ntchito ndi deta yolongosoka kumapezekapsql -d lumpicskumene malonda - dzina la database.

Khwerero 4: Kupanga tebulo ndikugwira ntchito ndi mizere

Ndi nthawi yokonza tebulo lanu loyamba m'masitomu omwe asankhidwa. Ndondomekoyi imathandizidwanso kupyolera mu ndondomekoyi, koma sizikhala zovuta kuthana ndi malamulo akulu, chifukwa zonse muyenera kuchita ndi:

  1. Mutasunthira ku databata, lowetsani code zotsatirazi:

    DZIWANI mayeso (
    equip_id yapadera PRIMARY KEY,
    mtundu varchar (50) NOT NULL,
    mtundu varchar (25) NOT NULL,
    Kumwera kumpoto chakumadzulo, 'kum'mwera chakumadzulo', 'kum'mwera chakumadzulo'),
    tsambulani_date date
    );

    Choyamba dzina la tebulo lafotokozedwa. mayesero (mukhoza kusankha dzina lina). Zotsatirazi zikufotokoza ndime iliyonse. Tinasankha mayina mtundu wa varchar ndi mtundu wa varchar Mwachitsanzo, mungathe kupeza chiwonetsero china, koma pogwiritsa ntchito zilembo za Chilatini. Mabanki mu makina ali ndi udindo wa kukula kwa chigawocho, chomwe chikugwirizana kwambiri ndi deta yoyenera pamenepo.

  2. Pambuyo polowamo izo zimangokhala kuti ziwonetse tebulo pulogalamuyo d.
  3. Mukuwona polojekiti yophweka yomwe ilibe chidziwitso chilichonse pano.
  4. Dongosolo latsopano likuwonjezeka kupyolera mu lamuloYAM'MBUYO YOTSATIRA (mtundu, mtundu, malo, kukhazikitsa_date) VALUES ('slide', 'blue', 'kum'mwera', '2018-02-24');Choyamba, dzina la tebulo likuwonetsedwa, mwa ife ndilo mayesero, ndiye ndondomeko zonse zatchulidwa, ndipo malingaliro omwe ali m'mabuku amasonyezedwa, makamaka pamagwero.
  5. Ndiye inu mukhoza kuwonjezera mzere wina, mwachitsanzo,YAM'MBUYO YOTSATIRA (mtundu, mtundu, malo, kukhazikitsa_date) VALUES ('swing', 'yellow', 'kumpoto chakumadzulo', '2018-02-24');
  6. Kuthamanga tebulo kudutsaSANKHA * KUYESA kuyesa;kuyesa zotsatira. Monga mukuonera, zonse zimakonzedwa molondola ndipo deta imalowa bwino.
  7. Ngati mukufuna kuchotsa mtengo uliwonse, chitani kudzera mwa lamuloPUTANI KUYESA KUYENERA mtundu = 'slide';powatchula munda wofunikira muzolemba.

Khwerero 5: Sakani phpPgAdmin

Maofesi azinthu zosavuta nthawi zambiri zimakhala zophweka pogwiritsa ntchito console, choncho ndibwino kuti muzisinthe ndi kukhazikitsa wapadera phpPgAdmin GUI.

  1. Choyambirira kudutsa "Terminal" Sungani zosinthidwa zakusachedwa zamakalata kudzerasudo apt-get update.
  2. Ikani Apache Web Serversudo apt-get kukhazikitsa apache2.
  3. Pambuyo pokonza, yesani kayendedwe kake ndi kulingalira bwino kwa mawu akesudo apache2ctl configtest. Ngati chinachake chalakwika, yang'anani zolakwika molingana ndi kufotokozera pa webusaiti ya Apache.
  4. Yambani seva polembachikondi chimayamba apache2.
  5. Tsopano kuti opaleshoni ya seva yatsimikiziridwa, mukhoza kuwonjezera makalata a phpPGAdmin powakopera ku malo ovomerezeka apolisi kudzerasudo apt kukhazikitsa phppgadmin.
  6. Kenaka, muyenera kusintha pang'ono fayilo yosinthika. Tsegulani kudzera mu bukhu laling'ono, kutsimikiziragedit /etc/apache2/conf-available/phppgadmin.conf. Ngati chikalatacho chiwerengedwa -kha, mudzafunika lamuloli gedit onaninsosudo.
  7. Asanafike "Akufunani m'deralo" ikani#, kuti mubwererenso mu ndemanga, ndipo lowetsani pansipaLolani kwa onse. Tsopano kulumikiza ku adiresi kudzakhala kotseguka kwa zipangizo zonse pa intaneti, osati kwa PC yeniyeni.
  8. Bweretsani seva la intanetintchito yachikondi apache2 ikuyambandipo omasuka kutsika kuti mugwire ntchito ndi PostgreSQL.

M'nkhaniyi, sitinangoyang'ana PostgreSQL, komanso kukhazikitsa webusaiti ya Apache, yomwe imagwiritsidwa ntchito pophatikiza LAMP software. Ngati mukufuna kutsimikiza kuti malo anu ndi mapulojekiti ena akugwira ntchito bwino, tikukulangizani kuti mudzidziwe nokha ndi njira yowonjezera zigawo zina powerenga mndandanda wathu wina.

Onaninso: Kuika LAMP suite mu Ubuntu