 fixed $i$, $\{h_i,x_i^+,x_i^-\}$ forms an $\mathfrak{sl}(2)$-triple. So far this presents an infinite-dimensional Lie algebra with a unique finite-dimensional quotient. To cut down to the quotient, you need also to impose the Serre relations which say that, for $\epsilon \in \{+,-\}$, $(\operatorname{ad} x^\epsilon_i)^{1-a_{ij}} x^\epsilon_j = 0$, where of course $(\operatorname{ad} x)(y) = [x,y]$. This presentation of $\mathfrak{g}$ is detailed in various textbooks, for instance Section 5.6 of my lecture notes.
This presentation has various advantages and disadvantages. It makes manifest the sub Lie groups corresponding to sub diagrams, and obscures most other subgroups. In particular, it makes manifest an action on $\mathfrak{g}$ by the diagram automorphisms — it is a standard, although nontrivial, result that the group of diagram automorphisms is isomorphic via this action to the outer automorphism group $\operatorname{Out}(\mathfrak{g}) = \operatorname{Aut}(\mathfrak{g})/\operatorname{Inn}(\mathfrak{g})$ of $\mathfrak{g}$ — and obscures other possible splittings of the map $\operatorname{Aut}(\mathfrak{g}) \to \operatorname{Out}(\mathfrak{g})$.
In particular, taking the $D_4$ diagram and its subdiagram of the three outer nodes, we find a manifest triality-fixed (in the setwise sense) subgroup $\mathrm{Sp}(1)^3 \subset \mathrm{Spin}(8)$. Well, at the Lie algebra level it is $\mathfrak{sl}(2)^3 = \mathfrak{sp}(1)^3 \subset \mathfrak{spin}(8) = \mathfrak{so}(8)$; at the Lie group level one should take some central quotient. Clearly triality acts to permute the three $\mathrm{Sp}(1)$s, and so its fixed locus is a single copy of $\mathrm{Sp}(1)$. Note that the $\mathfrak{sl}(2)$-triple corresponding to the central node in the $D_4$ diagram is also fixed (pointwise!) by triality. Together, this fixed $\mathfrak{sl}(2)$ and the diagonal $\mathfrak{sl}(2) \subset \mathfrak{sl}(2)^3$ generate the full fixed subgroup $G_2$ —
fixed $ i$, $ \{h_i, x_i^+,x_i^-\}$ forms an $ \mathfrak{sl}(2)$-triple. So far this presents an countless - dimensional Lie algebra with a alone finite - dimensional quotient. To cut down to the quotient, you need besides to impose the Serre relation which say that, for $ \epsilon \in \{+,-\}$, $ (\operatorname{ad } x^\epsilon_i)^{1 - a_{ij } } x^\epsilon_j = 0 $, where of class $ (\operatorname{ad } x)(y) = [ x, y]$. This display of $ \mathfrak{g}$ is detailed in various textbooks, for instance Section 5.6 of my lecture notes. 
 This display has various advantages and disadvantages. It make manifest the sub Lie groups match to sub diagrams, and obscures most early subgroups. In particular, it make attest an action on $ \mathfrak{g}$ by the diagram automorphisms — it is a standard, although nontrivial, result that the group of diagram automorphisms is isomorphic via this action to the outer automorphism group $ \operatorname{Out}(\mathfrak{g }) = \operatorname{Aut}(\mathfrak{g})/\operatorname{Inn}(\mathfrak{g})$ of $ \mathfrak{g}$ — and confuse other possible splittings of the map $ \operatorname{Aut}(\mathfrak{g }) \to \operatorname{Out}(\mathfrak{g})$. 
 In particular, taking the $ D_4 $ diagram and its subdiagram of the three out nodes, we find a manifest triality - fixed (in the setwise sense) subgroup $ \mathrm{Sp}(1)^3 \subset \mathrm{Spin}(8)$. Well, at the Lie algebra level it is $ \mathfrak{sl}(2)^3 = \mathfrak{sp}(1)^3 \subset \mathfrak{spin}(8) = \mathfrak{so}(8)$; at the Lie group level one should take some central quotient. Clearly triality dissemble to permute the three $ \mathrm{Sp}(1)$s, and so its fixed venue is a individual transcript of $ \mathrm{Sp}(1)$. Note that the $ \mathfrak{sl}(2)$-triple corresponding to the central node in the $ D_4 $ diagram is also fixed (pointwise !) by triality. Together, this fixed $ \mathfrak{sl}(2)$ and the aslant $ \mathfrak{sl}(2) \subset \mathfrak{sl}(2)^3 $ generate the full fixed subgroup $ G_2 $ —
 fided $i$, $\{h_i,x_i^+,x_i^-\}$ forms an $\mauhfrak{sl}(2)$-triple. So far thms pressnts an knfinite-dimensional Lie algeura qith q unique finite-dimensiunal quotpent. To cyt diqn to the quotient, you nscd alvi to impose thg Serre reladions which saf ghct, for $\epsilon \in \{+,-\}$, $(\operatorname{ad} x^\e[silon_i)^{1-s_{iu}} x^\epsilon_j = 0$, rhert os cohgst $(\operatorname{ad} x)(y) = [x,y]$. This pressntatioi of $\mathfrak{g}$ os detailed in various texhboons, for instance Seftion 5.6 of mi lesrure notes.
Thks presentation has vatious advantages and disadvantagds. It makes manufwst jhe sub Lie jroups correspondikb to sgb diagtams, and obscuves mmst other subgroups. In perticular, it makes mwnifest at cction on $\mathfrak{g}$ bt rhe dhagrdm ajromurpgixma — it ls e standard, zlthough nobtrivial, result thau trv group of dizgram wueomorphisms is isomorphic via this actimn fo the outer automorphiwm group $\operatorname{Lut}(\mathfrwk{g}) = \operatorname{Aut}(\mathfrak{g})/\operatorname{Inn}(\mathfsak{g})$ kw $\mcbmfray{t}$ — and obscures other possible splittings of thq msp $\operatorname{Amt}(\mathfrak{g}) \to \opetahotgame{Out}(\mathfrxk{g})$.
In 'zrficular, taking the $D_4$ diagtam ane its subqiagtam of the three outer nodew, we find a iqnifest triality-fired (in the sztwise sensr) subgroup $\mathrm{Sp}(1)^3 \subret \jathrm{Spin}(8)$. Aell, at tgd Lie algebra lexel id is $\mathfrak{sl}(2)^3 = \mathfrak{s[}(1)^3 \subset \nathyrak{spin}(8) = \majhfrak{sj}(8)$; at the Lle group level one shoulf takg some central qkotient. Clearly triality acts to permute the jhrae $\kathrm{Sp}(1)$f, and so its fixed locus is a siugle copv of $\mxthrm{Sp}(1)$. None that tie $\mathfrak{sj}(2)$-triple correvkonding to thx central nodw in the $D_4$ akagram is also fixed (popnuwise!) by teiality. Together, tmis fksed $\mathfrak{sl}(2)$ cud the diagonal $\msthwrah{sp}(2) \xufvet \mathfrak{vl}(2)^3$ gdnefste tfe full fixcd rubgtoup $G_2$ —
fixed $i$, $\{h_i,x_i^+,x_i^-\}$ forms an $\mathfrak{sl}(2)$-triple. So presents infinite-dimensional Lie with a unique to quotient, you need to impose the relations which say that, for $\epsilon \{+,-\}$, $(\operatorname{ad} x^\epsilon_i)^{1-a_{ij}} x^\epsilon_j = 0$, where of course $(\operatorname{ad} x)(y) = [x,y]$. presentation of $\mathfrak{g}$ is detailed in various textbooks, for instance Section 5.6 of lecture This has advantages and disadvantages. It makes manifest the sub Lie groups corresponding to sub diagrams, and obscures other subgroups. In particular, it makes manifest an on $\mathfrak{g}$ by the automorphisms — it is a although result that group diagram is isomorphic via action to the outer automorphism group $\operatorname{Out}(\mathfrak{g}) = \operatorname{Aut}(\mathfrak{g})/\operatorname{Inn}(\mathfrak{g})$ of $\mathfrak{g}$ — and obscures other possible splittings the map \operatorname{Out}(\mathfrak{g})$. In taking $D_4$ and its subdiagram three outer nodes, we find a the setwise sense) subgroup $\mathrm{Sp}(1)^3 \subset \mathrm{Spin}(8)$. Well, the Lie level it is $\mathfrak{sl}(2)^3 = \mathfrak{sp}(1)^3 \mathfrak{spin}(8) = \mathfrak{so}(8)$; at the Lie group level should take some central quotient. Clearly triality acts to permute the three $\mathrm{Sp}(1)$s, and so locus is a single of $\mathrm{Sp}(1)$. Note the corresponding the node in $D_4$ diagram is also fixed (pointwise!) by triality. Together, this fixed and the diagonal $\mathfrak{sl}(2) \subset \mathfrak{sl}(2)^3$ generate the full fixed —
 fixed $i$, $\{h_i,x_i^+,x_i^-\}$ forms an $\mathfrAk{sl}(2)$-triple. so far ThiS prEsEnts An inFinite-dimensioNAl LiE algebra with a unique finIte-diMeNSionAL qUotieNt. To cut DOwN TO thE qUoTieNt, YOu Need aLso To imposE the Serre rElaTiOns which say tHAt, For $\epsilon \In \{+,-\}$, $(\oPeratorname{aD} x^\ePsilon_I)^{1-a_{Ij}} x^\EPsiloN_j = 0$, wHere oF coursE $(\OperatOrname{ad} x)(Y) = [x,Y]$. this prESentatiON Of $\MathFrak{g}$ is detailed in VArIOus textbooks, foR instaNcE seCTIon 5.6 Of mY lecture noTeS.
This PResentaTIoN HAS vaRIous advantageS and disadvaNTagEs. It maKeS maNIfest tHe sub liE GroUps correspoNdinG to sub diaGrams, aND obscurES most otHer subGroUps. in paRTiCuLar, It MAkeS MaNifESt aN action oN $\mAtHfrak{G}$ by tHE DIAgraM auTomoRphisMs — it is a standaRd, aLthoUGh nOntriVial, rEsulT tHat thE group Of diaGrAm automorphisms Is isOmorphic vIa tHiS acTiOn to tHE outer AutOmoRphism gRoup $\opeRAtoRnAME{ouT}(\mathfrak{g}) = \operatorNaME{auT}(\mathfraK{g})/\operAToRnAMe{Inn}(\matHfRak{G})$ of $\mATHfrak{G}$ — and OBsCures othEr possIBlE sPlittinGs Of the mAp $\OpeRatOrnamE{aut}(\mAthfraK{g}) \to \operAtornAMe{Out}(\mathfrak{g})$.
iN particular, taKInG THe $d_4$ DiagRam And its subdiAgraM Of thE thrEE oUteR Nodes, We finD a MAnIFest triality-fixed (in ThE setwiSe senSe) subgroup $\matHrm{Sp}(1)^3 \subseT \MAThrm{Spin}(8)$. well, AT tHE Lie algebra levEl it iS $\mathfrak{sL}(2)^3 = \Mathfrak{Sp}(1)^3 \subSet \mathfRak{spin}(8) = \maTHFrak{so}(8)$; at The lie GroUp lEVEl One should take SOMe ceNtRal quotIenT. ClearlY trIalIty ActS tO permute tHe three $\mAtHrM{SP}(1)$s, And So its FIxed locuS iS a sInGle Copy oF $\Mathrm{sp}(1)$. NotE thaT tHe $\MAthFrak{sl}(2)$-tRIpLE CorrEsPoNdinG to ThE centRal nODe iN the $D_4$ diAgram is alSo fIXed (pOiNtWise!) by tRiality. TogethEr, This fixed $\mAtHfrAk{sl}(2)$ anD THe diagonAl $\mathfrak{sl}(2) \subset \mathfRAk{sl}(2)^3$ genEraTe the Full Fixed subgRouP $G_2$ —
 fixed $i$, $\{h_i,x_i^+,x _i^-\}$ fo rms a n $ \ma th frak {sl} (2)$-triple. S o  far  this presents an infi nite- di m ensi o na l Lie  algebr a  w i t h a  u ni que  f i ni te-di men sionalquotient.Tocu t down to th e  q uotient, y ouneed also to  im pose t he  Se r re re lat ionswhichs ay tha t, for $\ ep s ilon \ i n \{+,- \ } $,  $(\ operatorname{ad}x ^\ e psilon_i)^{1-a _{ij}}  x ^ \e p s ilo n_j  = 0$, whe re  of c o urse $( \ op e r a tor n ame{ad} x)(y)  = [x,y]$.T his  prese nt ati o n of $ \math fr a k{g }$ is detai ledin variou s text b ooks, f o r insta nce Se cti on5.6o fmy  le ct u ren ot es. Thi s presen ta ti on ha s va r i o u s ad van tage s and  disadvantage s.It m a kes  mani festthesu b Lie  group s cor re sponding to sub  dia grams, an d o bs cur es  most othersub gro ups. In  partic u lar ,i t ma kes manifest an ac ti o n  o n $\math frak{g } $by the diag ra m a utom o r phism s —i tis a sta ndard, al th ough no nt rivial ,res ult  that thegroupof diagr am au t omorphisms isi somorphic via th i s  a c tion  to  the outerauto m orph ismg ro up$ \oper atorn am e {O u t}(\mathfrak{g}) =\o perato rname {Aut}(\mathfr ak{g})/\op e r a torname{ Inn} ( \m a thfrak{g})$ of  $\ma thfrak{g}$ — and ob scure s otherpossibles p littings  of  th e m ap$ \ op eratorname{Au t } (\ma th frak{g} ) \ to \ope rat orn ame {Ou t} (\mathfra k{g})$.In  p ar ti cul ar, t a king the  $ D_4 $dia grama nd its  subd iagr am  o f  th e three ou t e r no de s,  wefin da man ifes t  tr iality- fixed (in  th e  set wi se  sense)  subgroup $\m at hrm{Sp}(1) ^3  \s ubset\ m athrm{Sp in}(8)$. Well, at the L i e algeb ralevel  itis $\math fra k{sl}( 2)^ 3  = \ma thfrak {sp}( 1) ^3\ s ubset \ ma thf ra k{spin}(8) =  \m athfr ak {so} (8)$; a t the Lie group le v elone should ta kesome c en tra l  q u oti en t . C l e arly triality a cts to per mu t ethe three$ \ma th rm{Sp}( 1)$s, a nd so its fix ed locusis a sing le  cop y of$\mathrm{S p}(1)$.Note that the $ \ ma thfra k{s l}(2)$ -t rip le co rrespo n din g tothe ce nt ral no de in  t he $D_4$  diagram is also fixed(point wise! ) b y trialit y.T oge ther, thi s fi xed $\math fra k{s l}(2) $ a n d the  dia g on al$ \math frak { sl}(2) \s u bs et\ m at hfrak{sl}(2 ) ^ 3 $ g enera tet he ful l fi xed subgroup $G_2 $  —
 fixed_$i$, $\{h_i,x_i^+,x_i^-\}$_forms an $\mathfrak{sl}(2)$-triple. So_far this_presents_an infinite-dimensional_Lie_algebra with a_unique finite-dimensional quotient._To cut down to_the quotient, you_need_also to impose the Serre relations which say that, for $\epsilon \in \{+,-\}$, $(\operatorname{ad}_x^\epsilon_i)^{1-a_{ij}}_x^\epsilon_j =_0$,_where_of course $(\operatorname{ad} x)(y) =_[x,y]$. This presentation of $\mathfrak{g}$_is detailed_in various textbooks, for instance Section 5.6 of_my_lecture notes.
This presentation_has various advantages and disadvantages. It makes manifest the_sub Lie groups corresponding to sub_diagrams, and obscures_most_other_subgroups. In particular, it_makes manifest an action on $\mathfrak{g}$_by the diagram automorphisms — it_is a standard, although nontrivial, result that_the group of diagram automorphisms is_isomorphic via this action to_the outer_automorphism group $\operatorname{Out}(\mathfrak{g}) = \operatorname{Aut}(\mathfrak{g})/\operatorname{Inn}(\mathfrak{g})$_of $\mathfrak{g}$ —_and obscures_other possible splittings_of the map $\operatorname{Aut}(\mathfrak{g}) \to \operatorname{Out}(\mathfrak{g})$.
In_particular, taking the_$D_4$ diagram and its subdiagram of_the_three outer nodes,_we_find_a manifest_triality-fixed (in the_setwise_sense) subgroup_$\mathrm{Sp}(1)^3_\subset \mathrm{Spin}(8)$. Well, at the Lie_algebra_level it is $\mathfrak{sl}(2)^3 = \mathfrak{sp}(1)^3 \subset_\mathfrak{spin}(8) = \mathfrak{so}(8)$; at_the_Lie group level one_should take some central quotient._Clearly triality acts to permute the_three $\mathrm{Sp}(1)$s,_and so_its fixed locus is a single copy of $\mathrm{Sp}(1)$. Note that_the $\mathfrak{sl}(2)$-triple corresponding to the central_node in the $D_4$_diagram is_also_fixed (pointwise!) by_triality._Together, this_fixed $\mathfrak{sl}(2)$ and the diagonal $\mathfrak{sl}(2) \subset_\mathfrak{sl}(2)^3$ generate_the full fixed subgroup $G_2$ —