Here I quote some GAP code for generating F4 Lie algebra as matrices 27 x 27. It is possible to obtain them in dimension 26 but then you need to use Sqrt(2) or Sqrt(3). In dimension 27 it is more nice.

Matrices L1..L7 are 8x8 matrices of left multiplication by imaginary unit octonions e1..e7. R1..R7 are right multiplications by unit octonions. If you have troubles to obtain such please let me know.

I have also obtained Lie algebra of E6 as complex matrices 27x27 and Lie algebra E7 as quaternion matrices 28x28. I tried to obtain some nice way E8 Lie algebra in shape 31*8 dim matrices but no luck. It was in 2008 when I worked on these scripts. I have used Freudenthal, Tits, Vinberg papers when doing this.

Regards,
Marek

v18 := BlockMatrix([[1,1,-R1], [2,2,-L1], [3,3,L1+R1]], 4,4);
v28 := BlockMatrix([[1,1,-R2], [2,2,-L2], [3,3,L2+R2]], 4,4);
v38 := BlockMatrix([[1,1,-R3], [2,2,-L3], [3,3,L3+R3]], 4,4);
v48 := BlockMatrix([[1,1,-R4], [2,2,-L4], [3,3,L4+R4]], 4,4);
v58 := BlockMatrix([[1,1,-R5], [2,2,-L5], [3,3,L5+R5]], 4,4);
v68 := BlockMatrix([[1,1,-R6], [2,2,-L6], [3,3,L6+R6]], 4,4);
v78 := BlockMatrix([[1,1,-R7], [2,2,-L7], [3,3,L7+R7]], 4,4);

S:= DiagonalMat([1,-1,-1,-1,-1,-1,-1,-1]);

Build now elliptic version of F4. The name is from that exp(t*[[0,-1], [2,0]]) is ellipse.
Really exp(t*[[0,-1], [2,0]]/Sqrt(2)) is ellipse.

p1 := [[0, -1, 1]];
p2 := [[-1, 1, 0]];

n := NullMat(8,8);
v:= n+p1;
vt := -2*TransposedMat(v);

This a0 really corresponds to ad([[0,-1,0],[1,0,0],[0,0,0]]) derivation on h3O.
a0 := BlockMatrix([[1,2,S], [2,1,-S], [3,4, v], [4,3, vt]], 4,4);

w := n+p2;
wt := -2*TransposedMat(w);

b0 := BlockMatrix([[2,3,S], [3,2,-S], [1,4, w], [4,1, wt]], 4,4);
mats3 := [ v18, v28, v38, v48, v58,v68,v78, a0, b0];;
ms:=List(mats3, x->x{[1..27]}{[1..27]});
f4_e := LieAlgebra( Rationals, ms);

2016-05-24 I add following matrices more nice for human eye, when I learned how to entered them in MathJax.
There are seven matrices generating $so_8$ (triality on Lie algebra).
$$v_{k,8}=\pmatrix{ -R & & & & &
\\ & -L & & & &
\\ & & L+R & & &
\\ & & & 0 & &
\\ & & & & 0 &
\\ & & & & & 0 } $$
In this notation $L$ and $R$ are matrices of left and right multiplication by imaginary base octonions.
We add two more matrices to obtain $f_4$ Lie algebra. We should understand that vectors 1x8 or 8x1 have element on first position (position of 1 in octonions). Matrix S represent octonions conjugation.
$$a_{0}=\pmatrix{ & S & & & &
\\ -S & & & & &
\\ & & 0 & & -1 & 1
\\ & & & 0 & &
\\ & & 2 & & 0 &
\\ & & -2 & & & 0 } $$

$$b_{0}=\pmatrix{ 0 & & & -1 & 1 &
\\ & & S & & &
\\ & -S & & & &
\\ 2 & & & 0 & &
\\ -2 & & & & 0 &
\\ & & & & & 0 } $$